for x in range(1,10):
for y in range(0,10):
if x < y:
print x * 10 + y
for y in range(0,10):
if x < y:
print x * 10 + y
2016-01-28
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for i in L:
if i in s:
s.remove(i)
else:
s.add(i)
print s
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for i in L:
if i in s:
s.remove(i)
else:
s.add(i)
print s
2016-01-28
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]
2016-01-28
sum = 0
x = 1
while x < 100:
if x%2 !=0:
sum = sum + x
x = x + 1
else:
x = x + 1
print sum
x = 1
while x < 100:
if x%2 !=0:
sum = sum + x
x = x + 1
else:
x = x + 1
print sum
2016-01-27
把t = ( 'a', 'b', ['A‘,’B‘])改成t= ('a', 'b', ('A‘,’B‘)),不是把t中原本一个List类型的改成了tuple类型的,难道这不是问题嘛
2016-01-27
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,':',d[key]
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,':',d[key]
2016-01-27
print [ int(m + n + l) for m in '123456789' for n in '0123456789' for l in '0123456789' if m == l]
2016-01-27