You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility
So I was working through the control flow lessons for python 3
I did an activity and it said my code was right , out of curiosity I looked at the solution to see of they matched. And to my surprise there was a small difference. I wanted someone to double check I had it right and that maybe the way I did it was just another solution to the same problem
https://gist.github.com/0a0293ade8289244620a7e546bbb0ede (This is their solution)
https://gist.github.com/41aece0f60334e7238af752dc205ad6a (This is my solution)
In case the links don’t work properly -
Their solution:
def grade_converter(gpa):
grade = “F”
if gpa >= 4.0:
grade = "A"
elif gpa >= 3.0:
grade = "B"
elif gpa >= 2.0:
grade = "C"
elif gpa >= 1.0:
grade = "D"
return grade
My Solution:
def grade_converter(gpa):
if gpa >= 4.0:
return "A"
elif gpa >= 3.0:
return "B"
elif gpa >= 2.0:
return "C"
elif gpa >= 1.0:
return "D"
elif gpa >= 0.0:
return "F"
grade = gpa
(Sorry, I am new to this forum, please help haha)