Data Types and Casting AGAIN!
Boolean Expressions
Conditionals (if/elif/else)
Lists
Loops and Errors
100

int1 = input('Give me an integer between 1 and 5 ')


What data type is variable int1?

String

100

A boolean expression is an expression that evaluates to either _____ or _____.

Note: the answer is CaSe SeNsItIvE

True or False

100

What will be printed?

"yes"

100

list=["frog", "fish", "turtle", "dragonfly"]

print(list [2])

What will be printed?

"turtle"

100

What is the error in this line of code?

x = input(What is your name? )

No quotes to show that it is a string.

200

If we wanted to calculate the total cost of the items in someone's online shopping cart and store it to a variable, what type should we use? List, string, integer, float, or boolean?

Float
200

What is outputted to the console after running the following:

1. num1 = 1.0

2. num2 = 2

3. num2 = num2 - 1

4. print(num2 == num1)

False

200

What kind of error will the following produce?

Indentation error

200

list = ["frog", "fish", "turtle", "dragonfly"]

list.remove["frog"]

print(list[1])

What will be printed?

"turtle"

200

What will happen when this code is run?

The code will print "Hello world!" forever.

300

Change the following code to make c equal to "1.1". Only change line 3:

1. a = "2.2"

2. b = 2

3. c = a / b

c = str(float(a) / b)

300

What will be output to the console after running the following code:

1. lie1 = False

2. lie2 = False

3. lies = lie1 == lie2

4. print(lies)

True

300

What is the output of the following code if you typed in 'hamster'?

'Cute!'

300

What will be printed after the following it run?

3
12

300

What is the error in this code?

   

Used "=" for assignment and "==" for comparison.

400

The following is a ______ of ______ variables:

[True, False, False, True, False]

list of boolean
400

What is output to the console after the following is run:

1. fruit = ['berry', 'mango', 'melon']

2. print(not ('mango' in fruit))

False

400

Given the following code, give an example of two inputs you could put in to get "You are thrown off the bridge".

"to seek the Holy Grail"

"lol" (literally anything other than "What do you mean? An African or European swallow?")

400

list = ["frog", "fish", "turtle", "dragonfly"]

list2 = [list[3], "owl", "bat", "dandelion"]

print(list2)

What will be printed?

["dragonfly", "owl", "bat", "dandelion"]

400

How many times will this loop run? What will it print in the console?

-1

11

0

9

1

7

2

5

3

3

Five times

500

DAILY DOUBLE

Add (only add) to lines 3 and 4 to prevent an error. Variable c should be assigned the value 6 and the console should output "2+4=6" when the code is run.
1. a = 2

2. b = "4"

3. c = a + b

4. print(a + "+" + b "=" c)

3. c = a + int(b)

4. print(str(a) + "+" + b + "=" + str(c))

console: 2+4=6

500

The following evaluates to what?

1. a = 100

2. b = 'science'

3. c = True

4. not c and a < 75 or b == 'science'

True

500

What is printed after the following is run?

'Yep'

500

list = ["frog", "fish", "turtle", "dragonfly"]

list2 = ["mesquite", "oak", "palo verde"]

list3 = []

list3.append(list2)

list3.append(list)

print(f"{list3[0]} {list[0]}")

What will be printed?

['mesquite', 'oak', 'palo verde'] frog

500

What is the error in this code?

x = input("What is your favorite number? ")

y = input("What is your friend's favorite number? ")

z = x * y

print(f"Your super secret number is {z}.")

Did not cast x and y into integers, and python can not multiply strings by strings.