1
2
3
4
5
100

Which symbol begins a comment in Python?

The hash symbol (#) begins a comment:


 # This is a comment

100

What does the print() function do?  

The print() function displays information on the screen.  

100

Is Python case-sensitive?

Yes, Python is case-sensitive.

100

What is the output?

name = "Ayna"

print("Hello ", name)

 A.  Hello name                          B.  Hello Ayna

 C.  "Hello", "Ayna"                     D. Ayna Hello

B. Hello Ayna

100

What does the operator != mean?

!= means not equal to.

200

What is a loop?

A loop repeats a block of code.

200

What data type is "Hello"?

String

200

What is a while loop used for?

A while loop repeats code while a condition remains True.

200

What is the output?

age = 14

if age >= 13: 

         print("Teenager") 

else: 

         print("Child")

A. Child     B. 14     C. Teenager    D. An error occurs

C. Teenager

200

What is a for loop used for?

A for loop repeats code for each item in a sequence or a specific number of times.

300

What data type is True?

True is a Boolean (bool)

300

What is the result of 2 ** 3?

The result of 2 ** 3 is 8.

300

What is the difference between = and ==?

= assigns a value to a variable, while == compares two values.

300

What is the output?

for number in range(1, 4): 

     print(number)

A. 1 2 3                        B. 1 2 3 4

C. 0 1 2 3                     D. 4

A. 1 2 3

300

What values does range(5) generate?

0, 1, 2, 3, 4

400

Name four common Python data types

Four common data types are:

  • str — text
  • int — whole numbers
  • float — decimal numbers
  • bool — True or False
400

How can you convert "10" into an integer?

Use int() to convert "10" into an integer:

number = int("10")


400

What do elif and else mean?

elif checks another condition if the previous one is false. else runs when none of the conditions are true.

400

What is the output? 

      colors = ["red", "blue", "green"] 

      print(colors[1])

A. red                           B. blue
C. green                        D. An error occurs

 

B. blue

400

What does break do inside a loop?

break immediately stops the loop.

500

What does the % operator calculate?

The % operator finds the remainder after division.

        print(10 % 3)  

Output: 

1

500

What could cause an infinite loop?

An infinite loop can happen when its condition never becomes False

number = 1 

while number <= 5:                                                     print(number)

500

What is the output?

x = 5 

x = x + 2 

print(x * 2)

14