FAQ: Learn Python - Conditionals & Control Flow - The Big If

This community-built FAQ covers the “The Big If” exercise in Codecademy’s lessons on Python.

FAQs for the Codecademy Python exercise The Big If:

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources about Python in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

Hi there! I’m getting an unexpected indent, however I didn’t change the template only the values

1 Like


Can someone explain this to me? I am very confused.

The code doesn’t refresh when I start ‘15. The Big if’. Instead, the correct code from ‘14.I Got 99 Problems, But a Switch Ain’t One’ remains in script.py. In an effort to work around this I manually wrote the correct code. However, this error message keeps appearing… can anyone help?

I see this was posted a little while ago. Just in case you or anyone else has/is run into this issue:
You do not need to put a bool after the else in line 16. Your program is unable to understand your expression after the : . All other statements look correct. So your program will already be able to deduce that anything below 65 will register as a F.

Please let me know if I explained this correctly. It sounds right in my head.

I also felt the need to add the “and grade < 90”, “and grade < 80”, etc., because I thought
a grade of “75” might return a grade of C and D and F. But, it turns out that wasn’t necessary. Can someone explain why? Is Python just reading top-down, so once it assigns a value it doesn’t continue down the line to see what else might apply to it? I hope that makes sense.

If .. elif .. else statements are always top, down and only one branch can ever be followed (the one in which the condition is satisfied). If none of the branches are followed in the absence of an else clause, then nothing is returned from the function, otherwise the else clause is the default branch.

I found it simpler to start with the lowest value and gradually work up to the highest.

Eg.

if   x < 60: y = 'F'
elif x < 70: y = 'D'
elif x < 80: y = 'C'
elif x < 90: y = 'B'
else:        y = 'A'
return y