7-3:
number=input("Enter a number: ") number=int(number) if number % 10 ==0: print("Yes, this number can be divided by 10.") else: print("No, this number can't be divided by 10.")
count=0 flavors=[] active=True while active: print("Enter "+str(3-count)+" flavor(s) please.") print("Enter 'quit' to exit.") flavor=input() if flavor == "quit": break flavors.append(flavor) print("We have added "+flavor+" in the pizza!") count=count+1 if count==3: active=False print() print("Congratulations!We have added ",end='') for flavor in flavors: print(flavor+" ",end='') print("in the pizza!")
7-8:
sandwich_orders=['chicken','pastrami','tuna','salmon','pastrami','pork','pastrami'] finished_sandwish=[] while sandwich_orders: temp=sandwich_orders.pop() print("I made your "+temp+" sandwish!") finished_sandwish.append(temp) print("Finished sandwish: ") for sandwish in finished_sandwish: print(sandwish.title())
7-9:
sandwich_orders=['chicken','pastrami','tuna','salmon','pastrami','pork','pastrami'] print("Pastrami sandwishes have been sold out.") while 'pastrami' in sandwich_orders: sandwich_orders.remove('pastrami') print() for sandwish in sandwich_orders: print(sandwish.title())