Variables
Conditionals
Functions
Loops
Arrays
100

What keyword is used to assign a value to a variable in Python?

=

100

What keyword starts a conditional block?

if

100

What keyword is used to define a function?

def

100

What keyword starts a loop that runs a fixed number of times?

for

100

What type is used to store multiple items in one variable?

list

200

What is the output of:
x = 5; 

y = x; 

x = 10; 

print(y)

5

200

What will this print?
x = 4; 

if x > 5: 

print("Big") 

else: print("Small")

Small

200

What’s the output?
def greet(): 

    return "Hi"; 

print(greet())

Hi

200

What will this output?
for i in range(3): 

print(i)

0

1

2

200

What is the index of the first element in a list?

0

300

What’s the data type of 3.14?

float

300

How do you combine two conditions using “and”?

if cond1 and cond2:

300

What does a function return if it has no return statement?

None

300

How do you stop a loop early?

break

300

What will this output?
nums = [10, 20, 30]; print(nums[1])

20

400

What happens if you use a variable before defining it?

NameError

400

What’s the difference between == and =?

== compares; = assigns.

400

What’s the difference between parameters and arguments?

Parameters: placeholders in definition; 

Arguments: actual values passed in.

400

How do you skip an iteration of a loop?

continue

400

How do you add an item to a list?

append()

500

What will the following code print, and why?

x = 10

def change(x):

    x += 5

    return x

change(x)

print(x)




10

500

Write a conditional that prints “Even” if a number n is even, otherwise “Odd”.

if n % 2 == 0: 

    print("Even") 

else: 

    print("Odd")

500

Write a function that returns the square of a number.

def square(n): 

return n ** 2

500

What will this code output, and why?

count = 0

for i in range(1, 6):

    if i % 2 == 0:

        continue

    count += i

print(count)




The loop skips even numbers (continue), so it only adds odd numbers (1 + 3 + 5 = 9).

500

What is the result of list(range(3))?

[0,1,2]