练习结果如下:
#Enter a code
print(45678+0x12fd2)
print("Learn Python in imooc")
print(100<99)
print(0xff==255)
#Enter a code
print(45678+0x12fd2)
print("Learn Python in imooc")
print(100<99)
print(0xff==255)
2019-07-19
最新回答 / 慕婉清1479961
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }sum = 0.0for k, v in d.items(): print k, ':', v sum = sum + vprint 'average', ':', sum / 4
2019-07-19
for x in [ 0,1,2,3,4,5,6,7,8,9 ]:
for y in [0,1,2,3,4,5,6,7,8,9 ]:
if x*10+y<10:
continue
if x<y:
print(x*10+y)
for y in [0,1,2,3,4,5,6,7,8,9 ]:
if x*10+y<10:
continue
if x<y:
print(x*10+y)
2019-07-19
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
sum=sum+x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
sum=sum+x
print sum
2019-07-19
sum = 0
x = 1
n = 1
while True:
x=2**(n-1)
n=n+1
sum=sum+x
if n>20:
break
print sum
x = 1
n = 1
while True:
x=2**(n-1)
n=n+1
sum=sum+x
if n>20:
break
print sum
2019-07-19
L = [75, 92, 59, 68]
sum = 0.0
for a in L:
sum=sum+a
print sum / 4
sum = 0.0
for a in L:
sum=sum+a
print sum / 4
2019-07-19
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
Whether it's nobler in the mind to suffer.'''
2019-07-18
最新回答 / 慕码人4117838
第一个错误是 n=20是赋值语句,不能用作条件作为判断。第二是就算n==20时也是错的,因为只加了前19项的和,没加第20项,所以要n>20才可以。
2019-07-18