Discuss / Python / 成绩查询

成绩查询

Topic source

<pre><code> #!/usr/bin/env python3 # -- coding: utf-8 -- c ={'t1':1,'t2':2,'t3':3,'t4':4} print('该系统只录入了t1,t2,t3,t4成绩') name = input('输入要查询的姓名:') if c.get(name,0)==0: print('查询的用户不在该系统中') else: print('%s的分数是:%s' % (name,c.get(name))) </code></pre>

古啦啦月

#2 Created at ... [Delete] [Delete and Lock User]

厉害 我看了你的,用了教程说的另一种判断方法: c={'t1':100,'t2':99,'t3':98,'t4':97} name=input('输入姓名') if (name in c) == False: print('不存在此学生成绩') else: print('%s,你的成绩为%s'%(name,c[name]))

原来输入的不需要加单引号


  • 1

Reply