[Tutor] If then else question
Andrew Robert
andrew.arobert at gmail.com
Wed Jun 14 20:53:44 CEST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Excellent.. much better than testing each value independently.
Thank you.
Mike Hansen wrote:
>
>
>> -----Original Message-----
>> From: tutor-bounces at python.org
>> [mailto:tutor-bounces at python.org] On Behalf Of Andrew Robert
>> Sent: Wednesday, June 14, 2006 12:41 PM
>> To: Python Tutor
>> Subject: [Tutor] If then else question
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi Everyone,
>>
>> In the middle of an if then else, I have the following line
>>
>> elif ch_val == '040' or ch_val == '011' or ch_val == '012':
>>
>>
>> The line works but it is a little ungainly.
>>
>> Anyone have a better way of accomplishing the same thing?
>>
>>
>> - --
>> Thank you,
>> Andrew Robert
>>
>
> Maybe...
>
> elif ch_val in ['040', '011', '012']:
>
> Mike
> http://users.adelphia.net/~mahansen/programming/
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: GnuPT 2.7.2
iD8DBQFEkFs3Dvn/4H0LjDwRApi/AJ4lyyJOoHWt1NzMBPF2gF7qQsA9WgCguYcd
MmjCVxL4giSzpdA1pRKgnHc=
=y80v
-----END PGP SIGNATURE-----
More information about the Tutor
mailing list