微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

编写程序接受;矩阵数

如何解决编写程序接受;矩阵数

编写程序接受;矩阵编号,名字,姓氏,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 举报,一经查实,本站将立刻删除。