sum = 0
x = 1
while (x<=100):
x+=sum
sum+=x
print sum
x = 1
while (x<=100):
x+=sum
sum+=x
print sum
2017-03-17
最赞回答 / 慕粉213707976
正好我也用的是win7,我来说一下吧建议你使用IDE,而不是cmd下的py,我个人认为cmd下的py不是很方便不能做到随改随试,即使使用了notepad++类的软件,又要同时开两个软件反而得不偿失所以我建议你还是使用IDE,比如JB的pycharm就对初学者很友好,报错纠正都很清晰希望可以帮到你
2017-03-17
def greet(y='world'):
return 'hello %s '%y
print(greet())
print(greet(123))
return 'hello %s '%y
print(greet())
print(greet(123))
2017-03-17
# -*- coding: utf-8 -*-
d = {
95:'Adam',
85:'Lisa',
59:'Bart'
}
s=inpupt()
for i in d
if s==d.key()
print d[i]#i为key
d = {
95:'Adam',
85:'Lisa',
59:'Bart'
}
s=inpupt()
for i in d
if s==d.key()
print d[i]#i为key
2017-03-17
最赞回答 / 慕粉114150193
个人认为是程序设计时测试用的,就是让大家输入做测试用,目的应该是告诉我们以后使用的时候防止此类问题避免溢出,于问题而言并无实际意义。以上仅属个人观点
2017-03-17
print (r'''"to be,or not to be": that is the question.
Whether it's nother is the mind to suffer.''')可以打印正确
Whether it's nother is the mind to suffer.''')可以打印正确
2017-03-17
print ('hello python')
print('hello','python')
print('hello','python')
2017-03-17
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
#print d['Adam']
#print d['Lisa']
#print d['Bart']
#print d.items()
print 'Adam:'+str(d['Adam'])
print 'Lisa:'+str(d['Lisa'])
print 'Bart:'+str(d['Bart'])
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
#print d['Adam']
#print d['Lisa']
#print d['Bart']
#print d.items()
print 'Adam:'+str(d['Adam'])
print 'Lisa:'+str(d['Lisa'])
print 'Bart:'+str(d['Bart'])
2017-03-17