L = ['Adam', 'Lisa', 'Bart']
L[2], L[0] = L[0], L[2]
print L
L[2], L[0] = L[0], L[2]
print L
2015-12-22
for x in [ 1,2,3,4,5,6,7,8,9 ]:
for y in [ 0,1,2,3,4,5,6,7,8,9 ]:
if x<y:
print x*10+y
for i in range(1,10,1):
for j in range(0,10):
if i<j:
print str(i)+str(j)
for y in [ 0,1,2,3,4,5,6,7,8,9 ]:
if x<y:
print x*10+y
for i in range(1,10,1):
for j in range(0,10):
if i<j:
print str(i)+str(j)
2015-12-21
for x in [ 1,2,3,4,5,6,7,8,9 ]:
for y in [ 0,1,2,3,4,5,6,7,8,9 ]:
if x<y:
print x*10+y
for y in [ 0,1,2,3,4,5,6,7,8,9 ]:
if x<y:
print x*10+y
2015-12-21
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
sum+=x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
sum+=x
print sum
2015-12-21
sum = 0
x = 1
n = 1
while True:
sum+=x
x*=2
n+=1
if n>20:
break
print sum
x = 1
n = 1
while True:
sum+=x
x*=2
n+=1
if n>20:
break
print sum
2015-12-21
L = [75, 92, 59, 68]
sum = 0.0
for score in L:
sum+=score
print sum / 4
sum = 0.0
for score in L:
sum+=score
print sum / 4
2015-12-21
score = 85
if score>=90:
print 'excellent'
elif score>=80:
print 'good'
elif score>=60:
print 'passed'
else:
print 'failed'
if score>=90:
print 'excellent'
elif score>=80:
print 'good'
elif score>=60:
print 'passed'
else:
print 'failed'
2015-12-21
score = 55
if score>=60:
print 'passed'
else:
print 'failed'
if score>=60:
print 'passed'
else:
print 'failed'
2015-12-21