问题描述
编写程序接受;矩阵编号,名字,姓氏,3scores(1st ca,2nd ca and Exam) 。 它应该计算总分和平均值,并且应该是 能够给出最高分和最低分,最后打印出矩阵数和分数。
这就是我目前所拥有的
def start():
print("")
op = input("""
1. Add score to Data base
2. Read database
e to exit
>""")
if op.lower() == "1":
reg()
elif op.lower() == "2":
check_data()
elif op.lower() == "e":
credits()
else:
start()
def readd():
print("=" *23)
re = input("Do you want another one yes or no \n> ")
if re.lower() == "yes":
reg()
elif re.lower() == "no":
start()
else:
start()
def credits():
print("code by All things Phantasm an iamphantasm project")
def check_data():
input_v = input("what is the name of the file: ")
filename = input_v + ".txt"
if filename:
demac = "=" * 23
print(f"{demac}")
try:
with open(filename,'r') as file:
p = file.read()
print(p)
start()
except:
print('No file with that name')
start()
elif filename.lower() == "e":
start()
def reg():
filename = "score.txt"
try:
print('Enter your name: ')
fname = input('First name: ')
lname = input('Last name: ')
matric_no = input('Matric No: ')
level = input('Level: ')
course_study = input('What is your course of study: ')
print('Enter your scores')
fca = int(input('1st ca: '))
sca = int(input('2st ca: '))
exam = int(input('Exam: '))
total = fca + sca + exam
with open(filename,"a") as f:
student_data = f"{fname} {lname} | {matric_no} | {level}lvl | {course_study} | {fca} | {sca} | {exam} | {total} \n"
f.write(student_data)
readd()
except:
start()
start()
我需要一些关于如何找到 d 平均值的帮助,并能够给出最高和最低的得分者,最后打印出矩阵数和分数。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)