Answers for "WAP to generate marksheet of a student by taking marks from the user. (individual grade and percentage for each subject, also find overall grade and percentage)"

0

WAP to generate marksheet of a student by taking marks from the user. (individual grade and percentage for each subject, also find overall grade and percentage)

def get_grade(percentage:float):
    if percentage >= 80.0:
        return "O"
    elif percentage >= 70:
        return "A"
    elif percentage >= 60:
        return "B"
    elif percentage >= 50:
        return "C"
    elif percentage >= 40:
        return "D"
    return "F"
def get_percentage(marks:float):
    return (marks * 100.0 / 100.0)
subjects_num = int(input("Enter the number of subjects : "))
subjects = []
marks = []


for count in range(subjects_num):
    print("Subject",count+1,":")
    subject_name = input("")
    mark = float(input("marks scored : "))
    subjects.append(subject_name)
    marks.append(mark)
    print()
print()
print("Subject\tMarks\tGrade\tPercentage")
percentages = []
for i in range(subjects_num):
    prcntg = get_percentage(marks[i])
    percentages.append(prcntg)
    grade = get_grade(prcntg)
    print("{}\t{}\t{}\t{}".format(subjects[i], marks[i], grade, prcntg))
overall_percentage = sum(percentages)/len(percentages)
overall_grade = get_grade(overall_percentage)
print("Overall Performance : ")
print("Percentage : ", overall_percentage)
print("Grade : ", overall_grade)
Posted by: Guest on May-19-2021

Code answers related to "WAP to generate marksheet of a student by taking marks from the user. (individual grade and percentage for each subject, also find overall grade and percentage)"

Browse Popular Code Answers by Language