x1 = 1
d = 3
n = 100
x100 = x1+(n-1)*d
s = (x1 + x100 )*n/2
print s
d = 3
n = 100
x100 = x1+(n-1)*d
s = (x1 + x100 )*n/2
print s
2019-05-23
print '静夜思\n\n床前明月光,\n疑是地上霜。\n举头望明月,\n低头思故乡。'#这样是正确的
2019-05-23
Py3上应输入
x1=1
d=3
n=100
x100=x1+99*d
print(x100)
s=(x1+x100)*n/2
print(s)
x1=1
d=3
n=100
x100=x1+99*d
print(x100)
s=(x1+x100)*n/2
print(s)
2019-05-22
Py3上应输入
s=('Python was started in 1989 by "Guido".\nPython is free and easy to learn.')
print(s)
s=('Python was started in 1989 by "Guido".\nPython is free and easy to learn.')
print(s)
2019-05-22
Py3上应输入
print(r'''"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.''')
print(r'''"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.''')
2019-05-22
# -*- coding: utf-8 -*-
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。
'''
# -*- coding: utf-8 -*- 添加注视之后,再使用u''' ''' 会报错
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。
'''
# -*- coding: utf-8 -*- 添加注视之后,再使用u''' ''' 会报错
2019-05-22
A=list(range(1,5))
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for index,name in zip(A,L):
print(index,'-',name)
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for index,name in zip(A,L):
print(index,'-',name)
L = ['Adam',95.5,'Lisa',85,'Bart',59]
print L
print L
2019-05-21
最后一题我的方法:
print [100 * n1 + 10 * n2 + n3 for n1 in range(1, 10) for n2 in range(10) for n3 in range(10) if n1==n3]
也可以啊, 就是提交不过
print [100 * n1 + 10 * n2 + n3 for n1 in range(1, 10) for n2 in range(10) for n3 in range(10) if n1==n3]
也可以啊, 就是提交不过
2019-05-21