Day 013 - Project 13 : Grade Generator

  • I changed the inequality check to work
  • casted score to int so that it can be used in arithmetic
  • changed some syntax to work correctly
print("Exam Grade Calculator")
nameOfExam = input("What is the name of your exam?")
print("The maximum possible score for this exam was 50.")
score = int(input("What score did you recieve in your", nameOfExam, "? "))
percentage = (score/50)*100
if percentage >= 90:
   print("Fab, you got an A+!")
else:
   print("Boo sucks to you:(")
2 Likes

Hi, I’ve changed my code to look like yours, but when running it it says

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    score = int(input("What score did you recieve in your", nameOfExam, "? "))
TypeError: input expected at most 1 argument, got 3

I have completed 100 days of code and here it is day 13 I have solved it
https://replit.com/@arhanansari2009/EXAM-GRADE-CALCULATOR?v=1

int(input("What score did you recieve in your " + nameOfExam + "? "))

2 Likes

Hey @anannaislam,
Welcome To The Replit Ask,

In Your 13 Of 100 Days Of Code Challenge You’re Facing Error You Have Error In Your Score Input (Score Input Returning Value As String Not Integer And You Passing Three Argument’s In Input So You Need To Use f-String) And If Statement (In If Statement > Sign Is After = Sign), So Here Is Your Solution :

Score Variable Solution :-
score = int(input(f"What score did you recieve in your {nameOfExam} ?"))

If Statement Solution :-
if percentage >= float("90"):

Solution :-

print("Exam Grade Calculator")
nameOfExam = input("What is the name of your exam?")
print("The maximum possible score for this exam was 50.")
score = int(input(f"What score did you recieve in your {nameOfExam} ?"))
percentage = (score/50)*100
if percentage >= round(float("90"),2):
   print("Fab, you got an A+!")
else:
   print("Boo sucks to you:(")```
2 Likes

Need help getting this to work

print("Grade Generator")
print()
name = input("Name of Test: ")
print()
maxScore = float(input("Maximum Possible Score: "))
print()
score = float(input("Your Score: "))
decimal = float(maxScore / 100)
percentage = float(score / decimal)
final = float(score / decimal)
if final > .40 and final < .50:
  print("Your Grade is F")
elif final > .50 and final < .60:
  print("Your Grade is D")
elif final > .60 and final < .70:
  print("Your Grade is C")
elif final > .70 and final < .80:
  print("Your Grade is B")
elif final > .80 and final < .90:
  print("Your Grade is A-")
elif final > .90 and final < .99:
  print("Your Grade is A")
elif final == .100:
  print("Your Grade is A+, Perfect Score!!")

What exactly isn’t working?

It won’t print the final score.

final is a percent, not a decimal (like you were checking for)

print("Grade Generator")
print()

name = input("Name of Test: ")
print()
maxScore = float(input("Maximum Possible Score: "))
print()
score = float(input("Your Score: "))

decimal = float(maxScore / 100)
percentage = score / decimal

if percentage < 50:
  print("Your Grade is F")
elif percentage < 60:
  print("Your Grade is D")
elif percentage < 70:
  print("Your Grade is C")
elif percentage < 80:
  print("Your Grade is B")
elif percentage < 90:
  print("Your Grade is A-")
elif percentage < 99:
  print("Your Grade is A")
else:
  print("Your Grade is A+, Perfect Score!!")
1 Like