How is it printing A?, I mean tyler is neither a string nor a float, it is a dictionary then why would python print anything instead of showing error!

print get_letter_grade(tyler)

def get_letter_grade(score):
    if score >= 90:
        return "A"
    elif score >= 80:
        return "B"
    elif score >=70:
        return "C"
    elif score >= 60:
        return "D"
        return "F"

print get_letter_grade(tyler)


You cannot call that function and get the expected outcome yet because that function is supposed to take a score as a parameter and you have already stored tyler,lloyd, and alice in a list called students.


But if you run this code in different consol where you have not predefined
student yet you will get the same result


What I am saying is that function will be used for a specific task in that module, so just compile all the code and then you'll see where it fits into the whole piece of code. :slight_smile:


No! This is not what I am asking!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.