Test a list
timothy crosley
timothy.crosley at gmail.com
Wed Mar 20 14:24:35 EDT 2013
Hi Ana,
if I understand your question correctly, all you have to do to test this is to write:
if i in t:
print "Test1"
else:
print "Test2"
On Wednesday, March 20, 2013 2:15:27 PM UTC-4, Ana DionĂsio wrote:
> t= [3,5,6,7,10,14,17,21]
>
>
>
> Basically I want to print Test 1 when i is equal to an element of the list "t" and print Test 2 when i is not equal:
>
>
>
>
>
> while i<=25:
>
>
>
> if i==t[]:
>
>
>
> print "Test1"
>
>
>
> else:
>
>
>
> print "Test2"
>
>
>
> What is missing here for this script work?
>
>
>
> Thank you all
More information about the Python-list
mailing list