-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminiproject05.py
More file actions
55 lines (42 loc) · 1.3 KB
/
Copy pathminiproject05.py
File metadata and controls
55 lines (42 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#-----------------------------------------------------------------------------------------------------------------
#miniproject-05:Student Grade Calculator
#-----------------------------------------------------------------------------------------------------------------
print(f"Student Grade Calculator")
#name of the student
name=str(input("Enter name of the Student:"))
#total number of subjects
no_of_subjects= int(input("Enter the number of Subjects:"))
print(f"Marks Scored by {name}: \n")
#marks scored by the student
marks=[]
for i in range(5):
mark=int(input("Enter mark:"))
marks.append(mark)
print(marks)
#total marks scored by the student
def total_marks(marks):
total=sum(marks)
return(total)
result=total_marks(marks)
print(f"Total Marks Scored by {name}:",result)
#calculating average
def average(total):
avg=total//no_of_subjects
return avg
total=total_marks(marks)
avg = average(total)
print("Average = ",avg)
#finding the grade secured
def Calculate_grade(avg):
if avg>85 :
return("Grade:A")
elif avg<=85 and avg>=75:
return("Grade:B")
elif avg<75 and avg>=60:
return("Grade:C")
elif avg<60 and avg>=50:
return("Grade:D")
else:
return("Fail")
grade=Calculate_grade(avg)
print(f"Grade of {name}: \n", grade)