cool code

mail@pastecode.io avatar
unknown
python
9 days ago
1.1 kB
1
Indexable
Never
# Program to input name and marks of 5 subjects of student then find total marks with total percentage

name = input("Enter your name: ")
m1 = float(input("Enter your mark of subject 1: "))
m2 = float(input("Enter your mark of subject 2: "))
m3 = float(input("Enter your mark of subject 3: "))
m4 = float(input("Enter your mark of subject 4: "))
m5 = float(input("Enter your mark of subject 5: "))
def grade(mark):
  if mark > 80:
    return 'A'
  if mark < 80 and mark > 70:
    return 'B'
  if mark < 70 and mark > 60:
    return 'C'
  if mark < 60 and mark > 40:
    return 'D'
  else:
    return 'E'
total = m1 + m2 + m3 + m4+ m5
percent = ((total) / 500) * 100
print("----------Marklist----------")
print("Your name:",name)
print("Mark of subject #1: ", m1, "Grade:",grade(m1))
print("Mark of subject #2: ",m2,"Grade:",grade(m2))
print("Mark of subject #3: ", m3,"Grade:",grade(m3))
print("Mark of subject #4: ", m4,"Grade:",grade(m4))
print("Mark of subject #5: ", m5,"Grade:",grade(m5))
print("Total: ",total)
print("Percentage: ", percent)
print("----------------------------")



Leave a Comment