Syntax
Data Types & Structures
Iteration
Effect/Return
Good Coding Practices
Recursion!
100

Dictionaries are surrounded in what?

{} or Curly Brackets

100

The name of a searching algorithm that can quickly search through a sorted list of values.

Binary Search

100

An iterating procedure that requires a given range to call code upon the elements within it.

For Loop

100

If a function has a return value and hence an output, then was is guaranteed to be written within its code?

A Return Statement

100

What does DRY stand for?

Don't Repeat Yourself

100
How many times should factorial(5) call itself, assuming the base case is:

if (x>2):

    return 1

5 times

200

Lists can store many datatypes within itself. Is this something dictionaries can do for key and value pairs.

No, keys and values must be certain datatypes.

200

If you use a for loop to iterate through a dictionary, what will your element's variable be for every iteration?

The Key
200

A non-recursive iterating procedure that performs operations until a condition is met.

While Loop

200

What is the return of a function that has no return value?

None

(This is considered a "NoneType")

200

What is the name of Python's variable naming convention?

snake_case

200

What is the evaluation of the function pointed to?

24

300

If one iterates a for loop through range(8) what will be the value of the item/element for the last iteration?

7

(Ranges 0-7)

300

A dict named sports_records has key:value pairs of str:int. What would you write to double a value with a key value of "hoolas_hooped"?

sports_records["hoolas_hooped"] *= 2

300

What is the main difference that sets recursion apart from a while loop?

A recursive function calls itself every iteration/recursive_step.
300

What does .pop() return?

The last element of a list

300

A name for a multi-line comment used to describe the fuctionality and attributes of a function/method.

A Docstring

300
How many times does Bowtie(5) make a recursive call?

5 times

...

print("*" * length)

bowtie(length-1)        <--- Recursive Call

print("*" * length)

400

Write the value of the list below

li = [1] * 3

[1, 1, 1]

400
This word describes the way in which datatypes like tuples cannot change after being created.

Immutable

400

What is the value of sum after the end of the loop?

sum = 0

i = 0

while (i<10):

    while (i<10):

        sum += 1

65

400

How many operations does it take binary search to find a value for a list of size n? (What is its runtime in terms of n?)

log(n)

400
We use doctests only if our function is this.

The Main Function

400

def enigma(x):

    if x==1:

        return 1

    return x * enigma(x//2)

What is the value of enigma(9)?

9 * 4 * 2 * 1 = 72

500

What is the syntax we need to code to use a function double() from a file named file2?

file2.double()

500

What function/method returns a list, of tuples containing key:values pairs of a dictionary?

.items()

500

sum = 0

i = 0

while (i<10):

    for number in range(i):

        sum += 1

    i += 1

sum = 45

500

If we use a function change(index, value) that changes the value of an element in a really, really, large list, would we want the function to create an effect or return the list?

An effect

500

Give two reasons for why functions are used in code

-Reusabilty

-Shortens Code

-Abstraction

500

In our fill function, why can we do an empty return for our base cases in which the square cannot be filled?

We otherwise just fill the pixel, not having a return value. The return statement is used to just terminate the recursive call.

M
e
n
u