message=input("What kind of car would you like to rent?")print("Let me see if i can find you a "+message)--------------------------------------------------------------------Whatkindofcarwouldyouliketorent?SubaruLetmeseeificanfindyouaSubaru
message=input("How many peopele eat?")ifint(message)>8:print("There is no empty table.")else:print("Have table.")-------------------------------------------------------------Howmanypeopeleeat?10Thereisnoemptytable.
message=input("Please enter a number:")ifint(message)%10==0:print("This number is an integer of 10.")else:print("This number is not an integer of 10.")-----------------------------------------------------------Pleaseenteranumber:20Thisnumberisanintegerof10.
message="\nPlease tell me your age:"message+="\nEnter 'quit' to end the program."active=Truewhileactive:#使用标志age=input(message)ifage=='quit':active==Falseelifint(age)<3:print(age+",免费!")elif3<=int(age)<=12:print(age+",10美元!")elif12<int(age):print(age+",15美元!")-----------------------------------------------------------------Pleasetellmeyourage:Enter'quit'toendtheprogram.22,免费!Pleasetellmeyourage:Enter'quit'toendtheprogram.66,10美元!Pleasetellmeyourage:Enter'quit'toendtheprogram.1818,15美元!Pleasetellmeyourage:Enter'quit'toendtheprogram.quitPleasetellmeyourage:Enter'quit'toendtheprogram.
sandwich_orders=['a','b','c']finished_sandwiches=[]forsandwich_orderinsandwich_orders:print("I made your "+sandwich_order+" sandwich.")whilesandwich_orders:unfinished_sandwiches=sandwich_orders.pop()finished_sandwiches.append(unfinished_sandwiches)print("\n 所有三明治度都做好了:")forfinished_sandwicheinfinished_sandwiches:print(finished_sandwiche.title())-------------------------------------------------------------------------Imadeyourasandwich.Imadeyourbsandwich.Imadeyourcsandwich.所有三明治度都做好了:CBA
sandwich_orders=['pastrami','a','pastrami','b','c','pastrami']finished_sandwiches=[]forsandwich_orderinsandwich_orders:print(sandwich_order+" sandwich.")print("熟食店的五香牛肉买完了!\n")while'pastrami'insandwich_orders:sandwich_orders.remove('pastrami')forsandwich_orderinsandwich_orders:print("We have "+sandwich_order+" sandwich.")whilesandwich_orders:unfinished_sandwiches=sandwich_orders.pop()finished_sandwiches.append(unfinished_sandwiches)print("\n 所有三明治度都做好了:")forfinished_sandwicheinfinished_sandwiches:print(finished_sandwiche.title())----------------------------------------------------------------------pastramisandwich.asandwich.pastramisandwich.bsandwich.csandwich.pastramisandwich.熟食店的五香牛肉买完了!Wehaveasandwich.Wehavebsandwich.Wehavecsandwich.所有三明治度都做好了:CBA