# Does this achieve the same thing?

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

In case the links donâ€™t work properly -
Their solution:

if gpa >= 4.0:

``````grade = "A"
``````

elif gpa >= 3.0:

``````grade = "B"
``````

elif gpa >= 2.0:

``````grade = "C"
``````

elif gpa >= 1.0:

``````grade = "D"
``````

My Solution:

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"
``````

Hello @cloud6257932118, welcome to the forums! If the numbers are not negative, then yes, the two solutions do the same thing. If you had a gpa of `-1`, then yours wouldnâ€™t `return` anything. But for the purposes of the exercise, yes the solutions do the same thing.

To see how to correctly format code in the forums, see this post.

1 Like

Okay that is awesome! Thank you so very much!
I see what you mean now with the -1 problem. I live in a country which doesnâ€™t use a GPA system so I donâ€™t even know if that is possible hahaha. But yeah I see what you mean with the bug

1 Like

I should hope no-one ever does get a GPA below `0`; thatâ€™s worse than failing everything!

hahaha I see!

1 Like