Data Types & Operators
Loops
Functions
Lists
Tuples
100

What is the data type of None?

None.

100

What is the difference between a while and a for loop?

While Loop: does something for an infinite number of times UNTIL a condition is met.

For Loop: does something for a certain number of times only.

100
How does one function access a variable in another function?

Return statements.

To Anya - show/create an example.

100

How many data types can a list contain?

One.

100

What is the most common phrase used to describe the difference between lists and tuples?

Tuples are immutable

200

What are the five main types of data?

BONUS: list two more data types (double the points).

1. Boolean (True/False)

2. Integers

3. Float

4. Strings

5. None

BONUS: tuples & lists

200

While Loops: what is the difference between using return False or break to exit the while loop?

return False: exits the while loop AND the entire program.

break: exits the while loop only.

200

What function turns a string into an integer?

int()

Ex: int(string)

200

What is the LENGTH the list below?

my_list = ['random', 'bob', 'choo choo', 'sneeze']

BONUS: what is the index number of 'choo choo'?

Length: 4

BONUS: 2

200

What are the 4 patterns to find data in a tuple?

1. Mapping/Transform

2. Accumulator 

3. Filter

4. Selection

300

What is the difference between "=" and "=="?

"=" means "to assign" something to something else. Mostly used with variables and data.


"==" used for comparisons in while & for loops, means "equal to".

300

What does reference?

numbers = [1, 2, 3, 4, 5]

floats = []

for i in numbers:

floats.append(float(i))

The index number.

300

To distinguish a method/function from a variable, what is needed?

The parentheses.

Example:

addition = some_data

addition()

300

Question 10 on midterm practice test, what does the following code print out?

c. 4.0

300

How do you write a tuple?

my_tuple = ('string_var', float_var, int_var,...)

400

What does % do?

Example:

2 % 1 = ?

Returns the remainder.


2 1 = 2 

2 % 1 = 0

400

What is the term we call i?

numbers = [1, 2, 3, 4, 5]

floats = []

for i in numbers:

floats.append(float(i))

i is the iterator.

400

Question 9 on midterm practice test, how many times is the function less() used?

5 times.

400

Question 8 on midterm practice test, what does the following code print out?

c. [10, 8, 7, 2]

400

Volunteer one person from your team to demonstrate the accumulate pattern with a tuple.

- Use numbers & floats!

Depends on my mood.

500

What are the results of:

7 // 2 = ?

7 / 2 = ?

7 % 2 = ?

7 ** 2 = ?

7 // 2 = 3

7 / 2 = 3.5

7 % 2 = 1

7 ** 2 = 49

500

my_list = [("Emma", 80.0), ("Fred", 34.0), ("Quentin", 14.9)]

for name, grade in my_list:

if name == "Fred":

print(grade)

break

1. What data type is grade? 

2. What is the index number? 

3. What is grade?

1. What data type is grade? Float

2. What is the index number? 1

3. What is grade? 34.0

500

Question 14 on the practice midterm, what does the following code print out?

b. South > north, with 3 deliveries.

500

Why can lists hold tuples (that hold multiple kinds of data types) but lists cannot hold more than one data type without a tuple?

A tuple is also a data type.

500

Volunteer one person from your team to demonstrate the select pattern with a tuple.

- Use integers & strings!

Depends on my mood.

M
e
n
u