Advertisement
earlution

Grade calculator - monolithic

Oct 2nd, 2023
1,077
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. # Monolithic program
  2. def main():
  3.     print("Welcome to the Student Grade Calculator!")
  4.  
  5.     while True:
  6.         student_name = input("Enter student name (or type 'exit' to quit): ")
  7.  
  8.         if student_name.lower() == 'exit':
  9.             print("Goodbye!")
  10.             break
  11.  
  12.         student_score = input("Enter student score: ")
  13.         student_score = int(student_score)
  14.  
  15.         if 90 <= student_score <= 100:
  16.             student_grade = "A"
  17.         elif 80 <= student_score < 90:
  18.             student_grade = "B"
  19.         elif 70 <= student_score < 80:
  20.             student_grade = "C"
  21.         elif 60 <= student_score < 70:
  22.             student_grade = "D"
  23.         else:
  24.             student_grade = "F"
  25.  
  26.         print(f"Student {student_name} scored {student_score} and received a grade of {student_grade}.")
  27.  
  28. if __name__ == "__main__":
  29.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement