不使用flag
tishi=‘\nPlease enter your toppings.\n’
tishi+='You can enter ‘N’to stop.\n’
tishi+=‘Now you can enter:’
me=‘’
while me!=‘N’:
me=input(tishi)
if me!=‘N’:
print(“we will add “+me+” in your pizza.”)
使用flag
tishi=‘\nPlease enter your toppings.\n’
tishi+=‘You can enter ‘N’ to stop.\n’
tishi+=‘Now you can enter:’
active=True
while active:
message=input(tishi)
if message!= ‘N’:
print(“we will add “+message+” in your pizza.”)
else:
break