[Tutor] Shorter way for a little program

Emile van Sebille emile at fenx.com
Sun Aug 24 22:25:17 CEST 2014


On 8/23/2014 7:16 AM, Mimi Ou Yang wrote:
> age = input("K")
>
> age = int(age)
>
> if (age == 1) or (age == 2) or (age  == 3) or (age == 4):
>      print ("LOL")
>
> else:
>          print ("K")
>
>
>
> Is there a shorter way to do this program???

print ('LOL','K')[int(input("k"))>4]




More information about the Tutor mailing list