
Python: Conditions
Quiz by Teran Subasinghe
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Measure skills
from any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
8 questions
Show answers
- Q1Which of the following is a correct way to write an if statement in Python?if (condition) {if: conditionif condition:if condition then:30s
- Q2What will be the output of the following code: if x == 10: print('Equal') else: print('Not Equal') when x is 5?EqualErrorNot Equal1030s
- Q3What is the purpose of the 'elif' statement in Python?To check another condition if the previous if statement is falseTo end the if statementTo create a loopTo define a function30s
- Q4What is the output of the following code if num = 8: if num % 2 == 0: print('Even') else: print('Odd')?NoneOddEvenError30s
- Q5In Python, which of the following will correctly check if a variable x is not equal to 5?if (x != 5)if x =! 5:if x <> 5:if x != 5:30s
- Q6Which of the following statements will evaluate to True if a is greater than b in Python?a >= ba > ba < ba == b30s
- Q7Which of the following constructs is used to define a block of code that executes when a condition is met in Python?Curly bracesIndentationParenthesesSquare brackets30s
- Q8What is the correct way to check multiple conditions in Python using 'and'?if x > 0 & x < 10:if x > 0, x < 10:if x > 0 and x < 10:if (x > 0 and x < 10):30s