While Loops
If statements
Variables
Operators
For Loops
100

What do we use loops for?

To repeat an indented block of code

100

What is wrong with this syntax? (pretend it is properly indented)

If x<4:
print(x)


"If" should not be capitalized

100

Is my-variable a valid variable name?

No

100

What does % do?

it finds the remainder of two numbers

100

What does the following code print? (pretend it is properly indented)

for x in range(10)

print(x + 1)

1, 2, 3, 4, 5, 6, 7, 8, 9, 10

200

What is wrong with this code? (pretend it is properly indented)

i = 0

while i < 5

print("yes")

i += 1

it is missing a : after i < 5

200

What do if statements do?

It runs a block of code if a condition is true.

200

Is _myvar a valid variable name?

Yes

200

What does != do?

it checks if two numbers are not equal
300

What does writing "break" in your code do?

it exits the loop

300

What does elif do?

It runs an indented block of code if all previous statements were false and and a condition is true.

300

What type of variable is input?

string

300

What is the difference between = and ==?

= assigns a value to a variable

== checks if two values are equal

400

How do we write code to print "hello" 1000 times?

(pretend this is correctly indented)

i = 0

while i < 1000:

print("hello")

i += 1


400

What does the "or" keyword check for?

It combines two conditions, and will run the indented code if either condition is true.

400

How do you change input into an integer?

num = int(input())

400

What does *= do?

it multiplies a variable by another number and stores the result in the variable.

500

Write a program that finds the product of all the numbers from 1 to an inputted number N (this is called factorial, and you can write this as N!).

pretend this is correctly indented

n = int(input("enter a number: ")

i = 1

product = 1

while i <= n:

product *= i

i += 1

500

Will this code print anything? pretend it is indented correctly

if 5>2 and (4<3 or 4>3):

 print("yay")

Yes, it will print "yay"

500

What happens when I run this code?

x = bool("0")

print(x)

it prints True.

500

What is the difference between / and //?

// does integer division

/ does float division