Rita Sue and Bob too

Cyrille Lavigne dontreply at caramail.com
Thu Aug 19 22:10:34 EDT 2004


If you dont want them in order you should do:
>if "Rita" and "Sue" and "Bob" in list:
>    print "They were found"
>else:
>    print "They are not in the list"
Otherwise:
>c,a=0,0
>while c<len(list):
>    if list[c]=="Rita":
>        if list[c+1]=="Sue":
>            if list[c+2]=="Bob":
>                print "They were found"
>                a=1
>    c=c+1
>if a!=1:
>    print "they are not in the list"
but I'm sure there is a better way of doing this.




More information about the Python-list mailing list