正确代码如下:
# -*- coding: utf-8 -*-
print "静夜思\n床前明月光,\n疑是地上霜。\n举头望明月,\n低头思故乡。"
# -*- coding: utf-8 -*-
print "静夜思\n床前明月光,\n疑是地上霜。\n举头望明月,\n低头思故乡。"
2019-01-06
我理解错了???
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+y,'(',x,'<',y,')'
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+y,'(',x,'<',y,')'
2019-01-06
print [101*n+10*m for n in range(1,10) for m in range(0,10)]
感觉这个更简便啊
感觉这个更简便啊
2019-01-04
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in ['Adam', 'Lisa', 'Bart']:
print key,':',d[key]
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in ['Adam', 'Lisa', 'Bart']:
print key,':',d[key]
2019-01-04
L = range(1, 101)
print L[0:10]
print L[2::3]
print L[0:50][4::5]
print L[0:10]
print L[2::3]
print L[0:50][4::5]
2019-01-03