d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for k,v in d.iteritems():
print "%s:%s"%(k,v)
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for k,v in d.iteritems():
print "%s:%s"%(k,v)
2015-05-07
sum = 0
x = 1
n = 1
while True:
if n<21:
sum+=x
x=x*2
n+=1
else:
break
print sum
x = 1
n = 1
while True:
if n<21:
sum+=x
x=x*2
n+=1
else:
break
print sum
2015-05-07
不能,因为L.pop(2)执行后元素就剩下3个了,而此时Bart的索引就变成了2 所以该段程序不能正确的完成题目要求的任务
2015-05-07
sum = 0
x = 1
n = 1
while True:
sum += x * n
n *= 2
if n == 2 ** 20:
break
print sum
x = 1
n = 1
while True:
sum += x * n
n *= 2
if n == 2 ** 20:
break
print sum
2015-05-07
s = '''Python was started in 1989 by "Guido".\nPython is free and easy to learn.'''
print s
三个'''
print s
三个'''
2015-05-07
t = ('a','b','A','B'),这样改怎么不行啊
2015-05-06
d = {
'Adam':90,
'Lisa':85,
'Bart':90,
}
print len(d)
####显示结果为:3
'Adam':90,
'Lisa':85,
'Bart':90,
}
print len(d)
####显示结果为:3
2015-05-06