最新回答 / TheHelenShow
如果换成 d['Paul'] = 72,按语法规定,Paul是key, 72是value, 那么 d 变成:d = { 95: 'Adam', 85: 'Lisa', 59: 'Bart' 'Paul': 72}不符合题目要求
2019-01-16
s = 'Python was started in 1989 by "Guido" \nPython is free and easy to learn'
print(s)
这样也可以成功吧
print(s)
这样也可以成功吧
2019-01-16
用while循环实现
a = 0
b = 0
while True:
a += 1
if a >100:
break
b += a*a
print b
a = 0
b = 0
while True:
a += 1
if a >100:
break
b += a*a
print b
2019-01-16
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for k, v in d.iteritems():
sum = sum + v
print k,'-',v
print 'average', ':', sum/len(d)
sum = 0.0
for k, v in d.iteritems():
sum = sum + v
print k,'-',v
print 'average', ':', sum/len(d)
2019-01-16
已采纳回答 / weixin_慕圣5402688
个人观点:59是key,Bart是value,你赋值的时候88是key,,Bart是value,在python里面完全是两个不同的值,建议采用:59,Mark,尝试一下。
2019-01-16
sum = 0
x = 1
while True:
if x%2==0:
continue
x = x + 1
sum=sum+x
x = x + 1
if x > 100:
break
print sum
x = 1
while True:
if x%2==0:
continue
x = x + 1
sum=sum+x
x = x + 1
if x > 100:
break
print sum
2019-01-15
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for x in d.itervalues():
sum=sum+x
print sum/len(d)
sum = 0.0
for x in d.itervalues():
sum=sum+x
print sum/len(d)
2019-01-15
L = ['Adam', 'Lisa', 'Bart', 'Paul']
LL=range(1,5)
for index, name in zip(LL,L):
print index, '-', name
LL=range(1,5)
for index, name in zip(LL,L):
print index, '-', name