[Tutor] Shorter way for a little program
Joel Goldstick
joel.goldstick at gmail.com
Sat Aug 23 21:49:09 CEST 2014
On Sat, Aug 23, 2014 at 10:16 AM, Mimi Ou Yang <mimiouyang at hotmail.com> 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???
>
age = int(input("K"))
if age in (1,2,3,4):
print "LOL")
else:
print age # or do you really want to print "K" ?
>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
--
Joel Goldstick
http://joelgoldstick.com
More information about the Tutor
mailing list