s = set([('Adam', 95), ('Lisa', 85), ('Bart', 59)])
for x in s:
print x[0] + ':', x[1]
for x in s:
print x[0] + ':', x[1]
2015-08-14
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for name in d:
print name + ':',d[name]
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for name in d:
print name + ':',d[name]
2015-08-14
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:', d.get('Adam')
print 'Lisa:', d.get('Lisa')
print 'Bart:', d.get('Bart')
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:', d.get('Adam')
print 'Lisa:', d.get('Lisa')
print 'Bart:', d.get('Bart')
2015-08-14
for x in [ '1','2','3','4','5','6','7','8']:
for y in [ '2','3','4','5','6','7','8','9']:
if x < y:
print x + y
for y in [ '2','3','4','5','6','7','8','9']:
if x < y:
print x + y
2015-08-14
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-08-14
sum = 0
x = 1
n = 1
while True:
sum += x
x = x * 2
if n >= 20:
break
n += 1
print sum
x = 1
n = 1
while True:
sum += x
x = x * 2
if n >= 20:
break
n += 1
print sum
2015-08-14
sum = 0
x = 1
while x < 100:
sum += x
x += 2
print sum
x = 1
while x < 100:
sum += x
x += 2
print sum
2015-08-14