Syntax
Loops
Decision Structures
Data Types
Functions
100

Does indentation matter in Python?

Yes

100

Does this loop execute:

x = 5

while x < 5:

   #body

No, x is not < 5

100

What are the three types of decisions structures?

if, elif, and else 

100

What are the three data types?

int, float, and string

100
Where do you write the function definition?

Outside the main function

200

What is the correct way to format input when taking in an integer?

int(input("words"))

200

How many "Hello"'s would be printed in this loop:

x = 1

while x < 10:

    print("Hello")

    x += 1

10

200

Is the following code correct?

name="Hebah"

if name=="Kelly":

    print ("Your name is Kelly")

if name=="Hebah":

    print ("Your name is Hebah")

else :

    print ("Your name is Maanas") 

No. The second statement should be elif. 

200

Write the code to input a number into a variable. 

variable_name= int(input ("Enter in a number"))

200

What will output?

def function():

   print("Hello")

def main():

   print("Hi")

main()

Hi

300

Is this correct:

if x < 3

   #body

No, missing colon

300

What is the correct way to format while True (to make sure it does not go on forever)?

while True:

   #body

   if condition:

       break

300
Is this the correct way to use an else statement?

x=5

if x<10:

    print ("x is less than 10")

else x>=10:

    print ("x is greater than or equal to 10")


No 

300

What is the difference between int and float?

int is whole numbers

float is decimals 

300

What keyword do you use to pass something back to the main function?

return

400

Is this correct:

(int(input("words")))

No, too many parentheses

400

What would be the output of this line of code?

print (list (range (2, 11, 2)))

2

4

6

8

10

400

What is wrong with the following code? 

y=7

if y<8:

   print ("Small")

   else: 

       print ("Big")


The else statement shouldn't be indented. 

400

How do you convert from a string to a float?

float ()

400

What is wrong with the following code:

def function (name, age, grade):

   #body

def main():

   function("Kelly", 16)

main()

different number of parameters in function call

500

Is this function call correct?

def function(parameter):

    #body

def main():

    function()

No, the function call has no parameter, but the definition does

500

What is the correct output for this line of code? 

for x in range in (2):

    print (x)

    for c in "ab":

        print (c)


a

b

1

a

b


500

What is the output of the following code?

x=13

if x>20:

    if x<25:

       if x<=23:

         if x * 3 < 69:

             print(x + 5)

else:

   print(x + 3)

16

500

What is the output:

x = 5.1

product = int(x) * 2

print(product)

10

500

What is the output of the following code:

def function (x):

    x = x + 2

    return x

def main():

   x = 5

   function(x)

   print(x)

main()

5

M
e
n
u