fork(1) download
  1. print('我的第一个python程序')
  2. print(25)
  3. # 输入你的名字
  4. name = input('请输入你的姓名:')
  5. #输出名字 问好
  6. print(name+' 欢迎你使用python:')
  7. #输入年龄
  8. age = int(input('输入你的年龄: '))
  9. #输出年龄
  10. print(f'你的年龄是:{age} 名字是{name}') #f format
  11. #条件检查
  12. if age<18:
  13. print('未成年!')
  14. else:
  15. print('成年了')
  16. #多条件检查
  17. if age<18:
  18. print('努力学习文化知识,考个好大学')
  19. elif age>=18 and age<=25:
  20. print('学习专业知识,找个好工作')
  21. elif age>25 and age<60:
  22. print('好好工作,继续养家')
  23. else:
  24. print('退休了。骑摩托车,环游世界')
Success #stdin #stdout 0.07s 7996KB
stdin
李明
26
stdout
我的第一个python程序
25
请输入你的姓名:李明   欢迎你使用python:
输入你的年龄: 你的年龄是:26  名字是李明
成年了
好好工作,继续养家