Python Mistake - Number of letters in name

后端 未结 3 572
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-29 10:28

Write a program that checks how long a name is. The program should take a name as input from the user.

If the name has 3 or fewer letters, your program should work like

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-29 11:08

    a = input('Enter your name: ')
    
    if len(a) <= int(3):
      print ('Hi', a+ ',', 'you have a short name.')
    
    elif len(a) <= int(8):
     print ('Hi', a+ ', nice to meet you.') 
    
    elif len(a) > int(8):
      print ('Hi', a+ ', you have a long name.')
    

提交回复
热议问题