Hello I'm trying to make a stem and leaf plot. The first function is supposed to call the other two functions and return the final plot. My code works for the first elemnt in the list and then stops. Is there something I have to do within my for loop? Also I realize that I need an if statement to check for if a number previously exists on the left side then to print the number farther on the right side. Should I assign the left column to a variable? And if so what do i then do on the right side? Any help would be great thanks!
def stem_and_leaf(data): def append_num(data): for x in data: append_last=str(x) return ' %s' %(append_last[-1]) def new_stem(data): for x in data: append_first= str(x) return '%s |' % (append_first[:-1]) return new_stem(data)+append_num(data)