Python If/Else Quiz

  • Questions: 15
  • Easy
  • Pass mark: 70%

Every program has to make decisions: launch or hold, refuel or carry on. In Python you write them with if, elif and else. This free quiz has 15 short questions that check you can follow a condition to the branch that runs, and spot the mistakes beginners make most often.

What the quiz covers

  • if, else and elif, and which branch runs
  • Comparison operators, including chained comparisons such as 1000 <= altitude <= 2000
  • and, or and not, and values that count as False
  • Nested conditions and indentation
  • Common mistakes, such as = instead of ==

How it works

  • 15 questions: 11 with one correct answer, 4 where you select every correct answer
  • After each question you see the correct answer and a short explanation
  • No time limit and no account needed
  • Score 70% or more (11 of 15) to pass

New to conditions? Read Python If/Else for Beginners first, or run the examples: basic if statement, if-else, if-elif-else and logical operators and, or, not. After this one, try the Python Math Operations Quiz or the Python Strings Quiz.