事实上,除了你自己没人有必要考虑你的感受。你喜欢什么事,什么人,有什么想法,去做就好,不用问,答案在你心中。
message=input("what kind of the car do you want ?")
print('Let me see if I can find you a'+ message)
print('how many people do you have?')
ans=input()
ans=int(ans)
if ans>=8:
print('Sorry ,there are nothing for you')
else:
print('welcome,there are enough sets for you')
message=input("Please input your number: ")
message=int(message)
if message%10==0:
print("Your number is multiple of 10.")
else :
print("Your number can not be divisible by 10.")
message=""
while message!='quit':
message=input("Please input your toppings : ")
if message!='quit':
print("Ok,we will add "+message+" in your pizza.")
else:
break
message=""
while True:
message=input("Enter your age please: ")
message=int(message)
if message<=3:
print("price=0")
elif message<12:
print("price=$10")
else:
print("price=$15")
#使用条件测试来结束循环
message=""
while message!=0:
message=input("Enter your age please: ")
message=int(message)
if message!=0:
if message<=3:
print("price=0")
elif message<12:
print("price=$10")
else:
print("price=$15")
message=""
active=True
while active:
message=input("Enter your age please: ")
message=int(message)
if message==0:
active=False
else:
if message<=3:
print("price=0")
elif message<12:
print("price=$10")
else:
print("price=$15")
message=""
while True:
message=input("Enter your age please: ")
if message=='quit':
break
else:
message=int(message)
if message<=3:
print("price=0")
elif message<12:
print("price=$10")
else:
print("price=$15")
sandwich_orders=['orange','banana','apple']
finished_sandwichs=[]
while sandwich_orders:
for order in sandwich_orders:
print(order+" is making .")
finished_sandwichs.append(order)
sandwich_orders.remove(order)
print("your order is finished.")
print(finished_sandwichs)
sandwich_orders=['orange','pastrami','banana','apple','pastrami']
finished_sandwichs=[]
print("The pastrami has been sale off.")
while sandwich_orders:
for order in sandwich_orders:
if order!='pastrami':
print(order+" is making .")
finished_sandwichs.append(order)
sandwich_orders.remove(order)
else:
sandwich_orders.remove(order)
continue
print("your order is finished.")
print(finished_sandwichs)
def display_message():
print("I learn about the function and model")
display_message()
def favorite_book(title):
print("One of my favorite book is "+title.title()+".")
favorite_book("The Call of Wild")
def make_shirt(size,words):
print("\nSize: "+size)
print("words:"+words)
make_shirt("medium","Immortal")
def make_shirt(size,words):
print("\nSize: "+size)
print("words:"+words)
make_shirt(words="Immortal",size="medium")
def make_shirt(size="large",words="I love python"):
print("\nSize: "+size)
print("words:"+words)
make_shirt("medium","Immortal")
make_shirt("samll","haha")
make_shirt()
def discribe_city(city,country="China"):
print("The "+city+" is belong to "+country+". ")
discribe_city("New York","America")
discribe_city("金山屯")
def city_country(city,country):
message=city+','+country
return message
ex1=city_country("金山屯","China")
ex2=city_country("New York","America")
ex3=city_country("Venice","Italy")
print(ex1)
print(ex2)
print(ex3)
def make_album(song,album,amount=""):
if amount:
album={'song':song,'name':album,'amount':amount}
else:
album={'song':song,'name':album}
return album
ex1=make_album('东风破','菊花台')
ex2=make_album('青花瓷','夜莺',30)
ex3=make_album("将军令",'花田',90)
print(ex1)
print(ex2)
print(ex3)
def make_album(song,album,amount=""):
if amount:
album={'song':song,'name':album,'amount':amount}
else:
album={'song':song,'name':album}
return album
while True:
print("\nPlease enter the song ,album: ")
song=input("Enter your song name: ")
album=input("Enter your album name: ")
if song=='quit' and album=='quit':
break
else:
solution=make_album(song,album)
print(solution)
magician_name=["红烧肉",'辣子鸡','水晶凉皮','彩虹拼盘','糖醋里脊']
def show_magicians(magician_name):
for name in magician_name:
print(name)
show_magicians(magician_name)
magician_name=["红烧肉",'辣子鸡','水晶凉皮','彩虹拼盘','糖醋里脊']
def show_magicians(magician_name):
for name in magician_name:
print(name)
show_magicians(magician_name)
print("\n")
def make_great(magician_name):
for index in range(0,len(magician_name)):
magician_name[index]='the Great '+magician_name[index]
make_great(magician_name)
show_magicians(magician_name)
magician_name=["红烧肉",'辣子鸡','水晶凉皮','彩虹拼盘','糖醋里脊']
def show_magicians(magician_name):
for name in magician_name:
print(name)
show_magicians(magician_name)
print("\n")
def make_great(magician_name):
for index in range(0,len(magician_name)):
magician_name[index]='the Great '+magician_name[index]
return magician_name
new_magicians=make_great(magician_name[:])
show_magicians(magician_name)
show_magicians(new_magicians)
def sandwich_topping(*toppings):
print("your toppings include : ")
for top in toppings:
print(top)
print("\n")
sandwich_topping("banana",'apple')
sandwich_topping("elephant",'panda','peacock')
sandwich_topping("mouse",'dragon','horse')
def build_profile(first,last,**user_info):
profile={}
profile['first name']=first
profile['last name']=last
for key,value in user_info.items():
profile[key]=value
return profile
me=build_profile('张','宸宸',身高=1.75,apperance='hot',hometown='Harbin')
print(me)
#注意,在调用写键值对的时候,键是不加引号的,值才加引号
#注意,for循环中给键与值对应的语句是 profile[key]=value
def car_info(manufacturer,model,**other_info):
profile={}
profile['manufacturer']=manufacturer
profile['model']=model
for key,value in other_info.items():
profile[key]=value
return profile
car=car_info('Benz','s450L',颜色='黑色',级别='大型车',发动机='48V轻混')
print(car)
def record_dream(name,age,**others):
dream={}
dream['name']=name
dream['age']=str(age)
for key,value in others.items():
dream[key]=value
for key,value in dream.items():
print(key+" : "+value)
import model
model.record_dream('小明',19,财务="100000$",家庭="three child and a beautiful girl")