Mini-Tutorial Python

a = 6
b = 7
c = 42
print 1, a == 6
print 2, a == 7
print 3,a == 6 and b == 7
print 4,a == 7 and b == 7
print 5,not a == 7 and b == 7
print 6,a == 7 or b == 7
print 7,a == 7 or b == 6
print 8,not (a == 7 and b == 6)
print 9,not a == 7 and b == 6
      
1 1
2 0
3 1
4 0
5 1
6 1
7 0
8 1
9 0
      
list = ["Life","The Universe","Everything","Jack","Jill","Life","Jill"]

#make a copy of the list
copy = list[:]
#sort the copy
copy.sort()
prev = copy[0]
del copy[0]

count = 0

#go through the list searching for a match
while count < len(copy) and copy[count] != prev:
    prev = copy[count]
    count = count + 1

#If a match was not found than count can't be < len
#since the while loop continues while count is < len
#and no match is found
if count < len(copy):
    print "First Match: ", prev
      
First Match:  Jill
AnteriorInicioSiguiente