已采纳回答 / 慕名而来lj
<...code...>while True: if n > 20: break这里就是取前20项的和,到第21项就退出 sum = sum + x这里就是每一项相加求和了 x = x * 2根据题意1,2,4,8,16.....都是二倍关系,因此赋值x = x * 2 n = n + 1这里就是从第一项到第二十项了
2019-08-04
最新回答 / weixin_慕码人9112255
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'ORs = '''Python was started in 1989 by "Guido".Python is free and easy to learn.'''
2019-08-04
#Enter a code
print (45678+0x12fd2)
print "learn Python in imooc"
print (100<99),(0xff==255)
运行成功
print (45678+0x12fd2)
print "learn Python in imooc"
print (100<99),(0xff==255)
运行成功
2019-08-03
#Enter a code
str="a"
a=45678+0x12fd2
print(a)
print'Learn Python in imooc'
print(100<99)
print(0xff==255)
str="a"
a=45678+0x12fd2
print(a)
print'Learn Python in imooc'
print(100<99)
print(0xff==255)
2019-08-02
最新回答 / lnteresting
你的程序是utf-8编码,cmd是通过gbk进行解析的,gbk解析utf-8当然会出现乱码。解决方法就是将内容由utf-8解码为unicode,cmd会自动把unicode转为gbk(改方法适用于python2.7)
2019-08-02