Why?


#1



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"
    else:
        return "F"

print get_letter_grade(tyler)


#2

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.


#3

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


#4

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:


#5

No! This is not what I am asking!


#6

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