mahdi-zarepour / python-workshop

Python workshop in shahid Bahonar university of Kerman
3 stars 0 forks source link

Exercise 1: To Convert User Score to Letter Grade #2

Open Pourestarabadi opened 1 week ago

Pourestarabadi commented 1 week ago

Convert User Score to Letter Grade in American system

score = float(input("Enter Your Score (A number between 0 to 20): ")) x = score*5 if x>= 97 and x<= 100: print("Your Score = ", score, "->", "Youre Grade: ", "A+") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","4.0", " ", " ", x, " ", " ", "A+") elif x>= 93 and x< 97: print("Your Score = ", score, "->", "Youre Grade: ", "A") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","4.0", " ", " ", x, " ", " ", "A") elif x>= 90 and x< 93: print("Your Score = ", score, "->", "Youre Grade: ", "A-") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","3.7", " ", " ", x, " ", " ", "A-") elif x>= 87 and x< 90: print("Your Score = ", score, "->", "Youre Grade: ", "B+") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","3.3", " ", " ", x, " ", " ", "B+") elif x>= 83 and x< 87: print("Your Score = ", score, "->", "Youre Grade: ", "B") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","3.0", " ", " ", x, " ", " ", "B") elif x>= 80 and x< 83: print("Your Score = ", score, "->", "Youre Grade: ", "B-") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","2.7", " ", " ", x, " ", " ", "B-") elif x>= 77 and x< 80: print("Your Score = ", score, "->", "Youre Grade: ", "C+") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","2.3", " ", " ", x, " ", " ", "C+") elif x>= 73 and x< 77: print("Your Score = ", score, "->", "Youre Grade: ", "C") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","2.0", " ", " ", x, " ", " ", "C") elif x>= 70 and x< 73: print("Your Score = ", score, "->", "Youre Grade: ", "C-") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","1.7", " ", " ", x, " ", " ", "C-") elif x>= 67 and x< 70: print("Your Score = ", score, "->", "Youre Grade: ", "D+") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","1.4", " ", " ", x, " ", " ", "D+") elif x>= 63 and x< 67: print("Your Score = ", score, "->", "Youre Grade: ", "D") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","1.2", " ", " ", x, " ", " ", "D") elif x>= 60 and x< 63: print("Your Score = ", score, "->", "Youre Grade: ", "D-") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","1.0", " ", " ", x, " ", " ", "D-") elif x>= 0 and x< 60: print("Your Score = ", score, "->", "Youre Grade: ", "F") print() print("Your score", ".", "GPA scale", ".", "%Grade", ".", "Letter Grade") print(" ", score, " ", " ","0.0", " ", " ", x, " ", " ", "F") else: print("Wrong Number!")

GPA_out