+ 1
Larger than n Lab HELP ITS FOR SCHOOL PLZ
I have a lab assignment and have everything done except this last bit of code that is me creating a list of numbers greater than n the list is made by the user n is also a user input for the sake of this I’ll choose number 5. I’m also going to make a list1= [2,4,7,8,9,10,7,5] So far I have list2 = [] for values in list1: if values > 5: list2.append(values) print(list2) But it prints [7] [7,8] [7,8,9] [7,8,9,10] [7,8,9,10,7] How can I fix this so it shows one list?
1 Réponse
0
SpeedyJabba , the reason is indentation of print. Indent print with the for loop.