博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
模拟成绩数据库
阅读量:4605 次
发布时间:2019-06-09

本文共 954 字,大约阅读时间需要 3 分钟。

1 name_score={} 2 n=0 3 while n==0: 4     a="0" 5     r=input("You are a teacher or a student?if you are a student,please input '1',else,you can input 't'") 6     if r=="1": 7         ask=input("please input your name,and we'll find your score.") 8         if ask in name_score: 9             print("He's score is:",name_score[ask])10         else:11             print("is not a student.")12     else:13         while a=='0':        14             print("please input the student's name and he's score")15             name=input("input he's name.")16             score=input("input he's score.")17             name_score[name]=score18             on=input("Do you have another student?if you have,input'y',else,input'no'.")19             if on=='y':20                 a='0'21             else:22                 a=123                 print("OK")

这是一个模拟管理成绩数据库,模拟教师添加成绩与学生查询成绩的行为。

这次主要利用了字典的键值对来帮助查询

转载于:https://www.cnblogs.com/Exesoft-Mike/p/8414086.html

你可能感兴趣的文章
【leetcode】107-Binary Tree Level Order Traversal II
查看>>
Jquert data方法获取不到数据,显示为undefined。
查看>>
ssm项目中 数据库和资源的备份
查看>>
hdoj5671 BestCoder Round #81 (div.2)
查看>>
HDU5950【矩阵快速幂】
查看>>
在线C++编译器
查看>>
C#中各种serialization的比较
查看>>
P2617 Dynamic Rankings
查看>>
工作学习常识1
查看>>
Linux小知识点
查看>>
VisualVM监控远程主机
查看>>
C#中检查网络是否连通的二种方法
查看>>
节假日设置
查看>>
<五>初探opengl,编写我们的镜头
查看>>
大数据操作:删除和去重
查看>>
2、JDBC-CURD
查看>>
【C语言零碎知识点】变量的存储类型
查看>>
编程时 对 用途这个字段定义时 不要用using 这个英文
查看>>
JQ实现accordion(可折叠)效果
查看>>
servlet的编码原理
查看>>