Python Forum
Not entirely sure what I did wrong here.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not entirely sure what I did wrong here.
#1
First of all, I am very new so I apologize if this is a stupid question or if it requires a simple fix.

My goal was to create a function that returns and prints the grade associated with a number given to the code. For example, you put in 65, it prints "The grade for 65 is A" (Ik that's not how it works in schools). So I'm not sure what I did wrong here, if someone could point me in the right direction that would be very helpful.

mrk = 3
grade = returnGrade(mrk)
print("The grade is",grade)

def returnGrade(mrk):
“””return grade
“””
if mark >= 65:
grade = "First"
elif dnum <= 64:
grade = "Upper Second"
elif dnum <= 60:
grade = "Second"
elif dnum <= 50:
grade = "Third"
return grade
else:
grade = "ERROR"
Reply


Messages In This Thread
Not entirely sure what I did wrong here. - by BalCalistan - Feb-18-2019, 09:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,642 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  python gives wrong string length and wrong character thienson30 2 3,050 Oct-15-2019, 08:54 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020