Apr-28-2017, 06:23 PM
I am trying to print the list at the end of my code. But I can't seem to figure out how to return the list when it is called inside another function.
[code]def main(): select() print(list1, list2) def select(): select = 0 select = int(input('Select one of the following: \n' '(1) for list one \n' '(2) for list two')) try: if select == 1: one() elif select == 2: two() except ValueError: print('try again') def one(): list1 = [] list1.append(1) return list1 def two(): list2 = [] list2.append(1) list2.append(2) return list2 def print(list1, list2): print(list1) print(list2) main()[/code]