Karel in Python
Basic Python and Console Interaction
Conditionals
Looping
Random
100

How many total times will Karel move in this program?

move()

for i in range(5):  

  move()    

  put_ball()

5

100

What is the final result of the expression 4 + 5 * 3?

19

100

What will be the output of this program?

number = 5

 greater_than_zero = number > 0
if greater_than_zero:   

    print(number)

5

100

Which of the following for loops would print the following numbers?


0

1

2

3

4

5

for i in range(6):  

  print(i)

100

What is the name of our class game?

Wizard

200

How can we teach Karel new commands?

Define a new function

200

What kind of data does a float variable contain?

Numbers that can have decimal components

200

What will be the output of this program?

number = 5 

greater_than_zero = number > 0
if greater_than_zero:   

  if number > 5:       

    print(number)

Nothing will print

200

What is the value of num when this loop completes?


num = 0


for i in range(2, 8, 2):

    num = num + i

12

200

Which classmate was responsible for sound effects in the class game?

Reichen

300

Say you want to write a program to have Karel put down 300 tennis balls. Which control structure would you use?

For Loop

300

What does the following code print?

x = 3.4

 y = 1 

  print(int(x))

   print(x + y)

3
4.4

300

What does this program print?

height = 65 

gender = "female"


if height < 62 or (height < 69 and gender == "male"):    print("You are below average height") 

elif height > 69 or (height > 62 and gender == "female"):    print("You are above average height") else:

You are above average height

300

What is the value of sum when this loop completes?


sum = 0


for i in range(3):

    sum = sum + 5

    for j in range(2):

        sum = sum - 1

9

300

Who does the wizard have to defeat on the top of the castle?

The Kings guard then the king

400

What is the purpose of using a for loop in code?


To repeat something a fixed number of times

400

What is the final result of the expression 2**3?

8

400

number_one = 5

number_two = 10


if number_one == 5:

    print(1)

elif number_one > 5:

    print(2)

elif number_two < 5:

    print(3)

elif number_one < number_two: 

    print(4)

elif number_one != number_two:

    print(5)

else:

    print(6)

1

400

If the user enters a number less than 10, I want the loop to exit. Where should the break command be placed in order to end the loop when the user enters this value?


On line 9

400

What is level 2 on the Wizard Game 

Meadow

500

The following code contains an error. What line is it on?


1  def turn_right():

2       turn_left()

3       turn_left()

4       turn_Left()

5

6  move()

7  turn_left()

8  move()

9  turn_right()

10 move()

Line 4

500

On which line of code will Python error?

1. weight = input("How much do you weigh? ")

2. oz_water = weight / 2 

3. print("You should drink " + str(oz_water)) 

4. print("ounces of water every day if you weigh " + weight)

Line 2

500

What will the following program print when run?


above_16 = True

has_permit = True

passed_test = False


if above_16 and has_permit and passed_test:

    print("Issue Driver's License")

elif above_16 or has_permit or passed_test:

    print("Almost eligible for Driver's License")

else:

    print("No requirements met.")

  1. Almost eligible for Driver’s License


500

What will be printed to the screen when this program is run?


num = 100


while num > 0:

    for i in range(100, 0, -25):

        num = num - i

print(num)

-150

500

Who is Mrs Smiths favorite student 

Carlos

M
e
n
u