首页 > 编程语言 >Python6-实战

Python6-实战

时间:2022-12-09 23:55:05浏览次数:40  
标签:实战 23 dollar month print input Python6



实战01(导演为剧本选角色)
1 def act(actor): 2 print(actor+"开始参演这个剧本") 3 A=input("导演选定的角色是:") 4 act(A)

 

 

 

实战02(模拟美团外卖商家的套餐)
1 def taocan(a,b,c,d,e,f): 2 print('米线店套餐如下:1.'+a+'2.'+c+'3.'+e) 3 print(a+b) 4 print(c+d) 5 print(e+f) 6 taocan('考神套餐','13元','单人套餐','9.9元','情侣套餐','20元')

 

 

实战03(根据生日判断星座) 
1 m = ('摩羯座','水瓶座','双鱼座','白羊座','金牛座','双子座', 2 '巨蟹座','狮子座','处女座','天秤座','天蝎座','射手座','摩羯座') 3 d = (20,19,21,20,21,22,23,23,23,24,23,22) 4 def xingzuo(month,day): 5 if day < d[month-1]: 6 return m[month-1] 7 else: 8 return m[month] 9 M = int(input("请输入月份:")) 10 D = int(input("请输入日期:")) 11 print(str(M)+"月"+str(D)+"日星座为:"+xingzuo(M,D))

 

 

实战04(将美元转换成人民币)
1 def change(dollar): 2 RMB=dollar*6.28 3 return RMB 4 dollar=float(input("请输入要转换的美元金额:")) 5 print("转换后的人民币金额是:",change(dollar))

 

标签:实战,23,dollar,month,print,input,Python6
From: https://www.cnblogs.com/ron312/p/16880208.html

相关文章