python练习
作者:互联网
#5-3 def h(): alien_color='green' if alien_color=='green': print("you get 5 point.") if alien_color=='yellow': print("you get 5 point.") #5-4 def hh(): alien_color = 'yellow' if alien_color == 'green': print("you get 5 point.") else: print("you get 10 point.") #5-5 def hhh(): alien_color = 'red' if alien_color == 'green': print("you get 5 point.") elif alien_color =='yellow': print('you get 10 point!') else: print("you get 15 point.") #5-6 def hhhh(): age=2 if age<2: print("这是一个婴儿。") elif age<4: print('这个人是幼儿。') elif age<13: print('这个人是儿童。') elif age<20: print('这个人是青少年。') elif age<65: print('这个人是成年人。') else: print('这个人是老年人。') #5-8 def hhhhh(): names=['audi','bmw','subaru','toyota','admin'] for name in names: if name=='admin': print(f'Hello {name},would you like to see a status report?') else: print(f'Hello {name}, thank you for logging in again.') if __name__=='__main__': h() hh() hhh() hhhh() hhhhh()
标签:point,get,python,练习,alien,color,green,print 来源: https://www.cnblogs.com/huangfei666/p/15651783.html