# -*- coding: utf-8 -*-
while 1:
print 'Please enter the name: '
i = raw_input()
d = {
'Adam':95,
'Lisa':85,
'Bart':59
}
#print 'His/Her score is :',d.get(i)
if i in d:
print 'His/Her score is :',d[i]
break
else:
print 'Can\'t find any data,Please try again.'
while 1:
print 'Please enter the name: '
i = raw_input()
d = {
'Adam':95,
'Lisa':85,
'Bart':59
}
#print 'His/Her score is :',d.get(i)
if i in d:
print 'His/Her score is :',d[i]
break
else:
print 'Can\'t find any data,Please try again.'
2016-05-08
# -*- coding: utf-8 -*-
while 1:
print 'Please enter the name: '
i = raw_input()
d = {
'Adam':95,
'Lisa':85,
'Bart':59
}
#print 'His/Her score is :',d.get(i)
if i in d:
print 'His/Her score is :',d[i]
break
else:
print 'Can\'t find any data,Please try again.'
while 1:
print 'Please enter the name: '
i = raw_input()
d = {
'Adam':95,
'Lisa':85,
'Bart':59
}
#print 'His/Her score is :',d.get(i)
if i in d:
print 'His/Her score is :',d[i]
break
else:
print 'Can\'t find any data,Please try again.'
2016-05-08
print [int(x+y+z) for x in '123456789' for y in '0123456789' for z in '0123456789' if x == z]
2016-05-07
def average(*args):
if args:
return float(sum(args))/len(args)
else:
return 0.0
if args:
return float(sum(args))/len(args)
else:
return 0.0
2016-05-07
def move(n, a, b, c):
if (n==1):
print a,'-->',c
else:
move(n-1,a, c, b)
print a,'-->',c
move(n-1, b, a, c)
return
move(4, 'A', 'B', 'C')
if (n==1):
print a,'-->',c
else:
move(n-1,a, c, b)
print a,'-->',c
move(n-1, b, a, c)
return
move(4, 'A', 'B', 'C')
2016-05-07
age =20没出来是:“特别注意: 这一系列条件判断会从上到下依次判断,如果某个判断为 True,执行完对应的代码块,后面的条件判断就直接忽略,不再执行了。”
2016-05-07
s = 'python was started in 1989 by \"guido\".python is free and easy to learn.'
print s
print s
2016-05-07
已采纳回答 / 慕粉3302287
<...code...> if x % 2 == 0: continue当X == 2 的时候就陷入死循环了,continue意思是跳过下面内容重新返回循环,X的值始终没有变,当然也就算不出来了。解决方案是:把x= x+1 放到break和if 之间,
2016-05-07
最新回答 / 清波
关于这一节 的问题是最多的, 其实 就是 慕课网的正确性验证做的不好。打印 unicode 字符串时, 可以 既在文档的开头写注释给解释器看,也在字符串前 加上 表明以下是 unicode 字符串的 token u。另外,最后补充, 初学者如果没有选择版本的羁绊: 一定要用Python3.x!!!!!!!!!!!!!!!
2016-05-07
已采纳回答 / 清波
只有一处不对:<...code...>改成<...code...>就好了 , 思路清晰, 估计是敲代码的时候漏掉了, 这种情况, 在本地运行一下就会报错,能看出是什么回事儿了。
2016-05-07