Python中文
首页
教程
问答
标签
搜索
登录
注册
用python计算学生/班级平均数
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>Python3.3.3</p> <p>我想写一个上课的程序,但我迷路了。这是我需要做的。</p> <p>我需要根据输入的成绩计算每个学生的平均分。 我需要计算一个班级平均数。 如果学生进入-1年级,则停止输入分数。 需要打印每个学生年级的信息。 学生成绩应显示数字成绩和字母成绩。 这封信将以学生的信件成绩为准。</p> <p><em>如何收集和存储学生姓名和考试成绩。 这样我就可以一次输出到显示学生姓名的地方。 一个数字平均数,一个基于该平均数的字母等级, 一份基于他们收到的字母等级的声明?</p> <p><strong>到目前为止,我的代码如下:</strong></p> <pre><code>def main(): another_student = 'y' while another_student == 'y' or another_student == 'Y': student_average() print() another_student = input('do you have another student to enter (y/n) ? ') while another_student == 'n' or another_student == 'N': student_average_list() class_average() break def student_average(): total = 0.0 print() student_name = input('what is the students name? ') print() print() print(student_name) print('-------------------') number_of_tests = int(input('please enter the number of tests : ')) for test_num in range(number_of_tests): print('test number', test_num + 1, end='') score = float(input(': ')) total += score student_average = total / number_of_tests print () print(student_name,"'s average is : ",student_average, sep='') def student_average_list(): print ('kahdjskh') def class_average(): print ('alsjd') main() </code></pre>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>你需要为全班保留一份分数表。<code>student_average</code>函数做的事情太多了。也许做一个函数<code>get_student_marks</code>,它只返回学生的分数列表。你需要一个<code>average</code>函数来计算一个列表的平均值,你可以用它来计算学生平均值和班级平均值。祝你好运!</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何提高Djang的410误差
10 回答
如何提高doc2vec模型中两个文档(句子)的余弦相似度?
1 回答
如何提高Docker的日志限制?|[输出已剪裁,达到日志限制100KiB/s]
7 回答
如何提高DQN的性能?
1 回答
如何提高EasyOCR的准确性/预测?
1 回答
如何提高Euler#39项目解决方案的效率?
6 回答
如何提高F1成绩进行分类
8 回答
如何提高FaceNet的准确性
4 回答
如何提高fft处理的精度?
4 回答
如何提高Fibonacci实现对大n的精度?
4 回答
如何提高Flask与psycopg2的连接时间
4 回答
如何提高FosterCauer变换的scipy.signal.invres()的数值稳定性?
4 回答
如何提高gae查询的性能?
5 回答
如何提高GANs用于时间序列预测/异常检测的结果
3 回答
如何提高gevent和tornado组合的性能?
8 回答
如何提高googleappengin请求日志的吞吐量
2 回答
如何提高googlevision文本识别的准确性
2 回答
如何提高groupby/apply效率
9 回答
如何提高Gunicorn中的请求率
8 回答
如何提高G中的文件编码转换
1 回答