RESOURCES: Class slides: https://docs.google.com/presentation/d/1AXVYWIXesdnNct0KtiCi_ZZn6Kz72HKJbh4VH6BRmHY/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-13 HOMEWORK: Create a list to store several inputs. Then, take in input until the word "STOP" is entered. Store each input apart from "STOP" in the list, and then print out the contents of the list backward.
Write your answer as a comment, and we’ll post the solution by the next class. See you then!
Solution:
x=0
list = []
while x != "STOP":
x=input()
if x != "STOP":
list.append(x)
n=len(list)-1
while n > -1:
print(list[n])
n-=1
print("\nPlease add item to your list, type \"STOP\" to stop"); my_list = []; new_item = input(); while ( new_item.lower() != "stop"): my_list.append(new_item); new_item = input(); my_list_len = len(my_list); n = my_list_len -1; print("Here is you list backwards") while n >= 0: print(my_list[n]); n -= 1;