fork download
  1. username =input('请输入姓名:小白')
  2. gender =input('请输入性别:xx')
  3. age =input('请输入年龄:23')
  4. if gender =='男':
  5. if age >='23':
  6. print(f'我是AI小助手,{username}您好,现在可以结婚。')
  7. else:
  8. print(f'我是AI小助手,{username}您好,现在不可以结婚。')
  9. elif gender =='女':
  10. if age >='20':
  11. print(f'我是AI小助手,{username}您好,现在可以结婚。')
  12. else:
  13. print(f'我是AI小助手,{username}您好,现在不可以结婚。')
  14. else:
  15. print(f'我是AI小助手,{username}您好,请输入正确的性别 (男 或者女)。')
Success #stdin #stdout 0.07s 14120KB
stdin
请输入姓名:小白 
请输入性别:XX
请输入年龄:23
stdout
请输入姓名:小白请输入性别:xx请输入年龄:23我是AI小助手,请输入姓名:小白 您好,请输入正确的性别 (男 或者女)。