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

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

2 Likes

Hey @anannaislam,

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()
decimal = float(maxScore / 100)
percentage = float(score / decimal)
final = float(score / decimal)
if final > .40 and final < .50:
elif final > .50 and final < .60:
elif final > .60 and final < .70:
elif final > .70 and final < .80:
elif final > .80 and final < .90:
elif final > .90 and final < .99:
elif final == .100:
``````

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()

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

if percentage < 50:
elif percentage < 60:
elif percentage < 70:
elif percentage < 80:
elif percentage < 90:
elif percentage < 99:
else:
``````
1 Like

Question:
Code doesnât calculate the answer and doesnât go beyond to give different replies, I canât see why not

``````print("Grade Generator")
print()
nameTest = input("What is the name of the test? ")
maxScore = int(input("What is the maximum score you can receive? "))
yourScore = int(input("What is your score? "))
answer = (maxScore * (yourScore / 100))
print("You scored a A+, well done \U0001F973")
print("You scored a A, keep up the good work \U0001F929")
print("You scored a B, you're doing okay \U0001F642")
print("You scored a C, you can do better \U0001F928")
print("You scored a D, next time study a little longer \U0001F9D0")
print("You scored a U, if you have any questions, let me know \U0001F974")
``````

You are printing the message if the score is greater than 90 or if itâs less than 90, but not if the score is 90.
This applies to 90, 80, 70, 60, and 50 as well.

You can try adjusting the numbers,
instead of `if answer > 90:`
use if `answer > 89:`

or you could use greater than or equal to, `>=` instead of just greater than `>`

`if answer >= 90:` instead of
`if answer > 90:`

If you also want to show the score you can just put `print(answer)` after the math.

``````answer = (maxScore * (yourScore / 100))