用Python写一个简单的对话

  • A+
所属分类:Python习题

对话代码

  1. print('----既然来了,就把代码打一遍吧。')
  2. name = input('告诉我,您的名字:')
  3. print('您好',name,'您今年多大了?')
  4. youage = int(input())
  5. if youage < 20:
  6.     print('卧槽,这么嫩。小鲜肉')
  7. elif youage >20 and youage < 30:
  8.     print('中年的',name,'您好,欢迎来李金龙的博客')
  9. else:
  10.     print('这个年纪了,请爱护好您的眼睛')
  11. print('感谢您的尝试,不如添加个QQ好友,来聊聊?')

用Python写一个简单的对话

经验:看得懂,不代表你会打

超出内容:and、if...elif..else

 

资料相关

李金龙

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: