Master Python with These Key Concepts
fabulous-acorn3
Created 10/14/2025

Test your Python knowledge with this essential quiz covering variables, operators, conditionals, loops, and more!
1. In Python 3.x, what output will be generated by the following code snippet?
def func():
x = 10
print(x)
x = 20
func()
print(x)
2. What will be the output of the following code: print(f'Result: {5 * 3.0 + 2}')?
Result: 53.0
Result: 17.0
Result: 17
Result: 152
3. Which of the following codes correctly implements a while loop to exit on user input 'stop'?
while input('> ') != 'stop':
while input('> ') == 'stop': continue
while True:
if input('> ') == 'stop':
break
while input('> ') not in ['stop']:
4. Which expression correctly checks if 'num' is positive and divisible by 2 in Python?
num % 2 != 1 and num >= 0
not (num <= 0) and num % 2 == 0
num > 0 and num % 2 == 0
num > 0 or not num % 2
5. What will 'print(type([1, 2, 3]))' output in Python?
<class 'array'>
<class 'list'>
<class 'int'>
<class 'tuple'>