Loops and conditionals
Functions
Lists
Syntax
Strings
100

What will this print?

var1 = true

var2 = true

if var1 and var2:

    print("Woohoo!")


Woohoo!

100

What is the name of this function?

def eat_pie():

    print("I like pie")




eat_pie

100

What is the name of this list?

trees = ["cherry", "oak", "birch", "redwood", "willow"]

trees

100

What is wrong here?

var1 = "pineapple"

if (var1 = "pineapple"):

    print("Unfortunately, we will never get to this print statement")

Should be ==, not = 

100

What is the problem here?

print("Hi')

Should be two " " instead of '

200

What will print?

x = 3

if (5*x == 10 or 100<x):

    print("go you")

nothing.

200

What is the return type of function func?

def func():

    return "5"    

A string

200

What will this print?

my_list = ["hi", "what's up", "how are you"]

print(my_list[1])

what's up

200

What will happen when we run this code?

def sum(int num):

    print(num)

Error-- we don't declare variable types in Python

200

What does it mean to concatenate two strings? What symbol do we use for it?

Combine strings using +

300

x = 5

if (8*x ==40 and 2*x < 3):

    print("cool")

else:

    print("oh no")

oh no

300

What happens we call this function?

def function3():

print("Hi!")

print("I'm a function that return true when I'm done printing")

return True

An error-- we forgot about indentation

300

What will this print?

my_list = ["hi"]

my_list.append("hey")

my_list.insert(1, "sup")

print(my_list)

["hi", "sup", "hey"]

300

What will happen?

function myfunction(){

    print("This is my function, cool!")

}

An error-- we use the keyword def, not function, and we use : instead of {}

400

What will this print?

my_list = [3,2]

for index in range(0, len(my_list)):

    print(index)

    print(my_list[index])

0

3

1

2

400

What happens when we run this code?

def fun(num):

    return i+7

def main():

    answer = input("Give us a number!")

    print(fun(answer))

if __name__ = "__main__":

    main()

An error-- answer is actually of type string, but function fun thinks it's an int (and tries to add 7)
400

list = [1,5,7,9]

for num in range(len(list)):

    list[num] += 1 

print(list)

What will the new list print?

[2,6,8,10]

500

What will this print?

my_list = ["hi", "how are you", "hey"]

for greeting in my_list:

    print(greeting)

hi

how are you

hey

500

colors = [“blue”, “red”, yellow”]

colors.append(“green”)

colors.insert(“purple”, 1)

colors.append(“black”)

colors[2] = “orange”

for color in colors:

  print(color)

blue

purple

orange

yellow

green

black