Python Basics
Control Flow & Loops
NumPy & Data
Functions
Misc
100

What does this print?

print(type(3.14))

float

100

What does this print?

x = 10

if x > 5:

    print("big")


big

100

What is the common short alias for NumPy?

np

100

What keyword defines a function?

def

100

What does this print?

print(type("hello"))?

'str'

200

What does this print?
int(3.9)

3

200

How many times does this loop run?

python

for i in range(3):

    print(i)

3

200

What is the shape of np.array([1, 2, 3])?

(3,)

200

What does `return` do in a function?

Sends a value back to the caller and exits the function

200

What does this print?

x = 5

if x > 10:

    print("a")

else:

    print("b")

b

300

What is the value of my_list[1] if
my_list = [10, 20, 30] ?

20

300

What does this print?

x = 5

if x > 10:

    print("a")

elif x > 3:

    print("b")

else:

    print("c")

b

300

What does this print?

arr = np.array([1, 5, 3])

print(arr > 2)

array([False, True, True])

300

What does `square(4)` return if:

def square(x):
    return x * x

16

300

What does this print?

print(np.array([1, 2, 3]) * 2)

array([2, 4, 6]

400

How do you get the value in this dictionary?
data = {"weight": 30}

data["weight"]

400

What does this print?

i = 0

while i < 3:

    print(i)

    i += 1

0
1
2

400

What value should you use for "missing value" in NumPy?

np.nan

400

What does this print?

def add(a, b):

    return a + b

print(add(3, 5))

8

400

What does this print?

def greet(name, msg):
    print(msg, name)

greet("Alice", "Hi")

Hi Alice

500

What does this print?

print("5" + "3")

53

500

How do you write a comment in Python?

# 
500

What does this print?

print(np.array([1, 2, 3]) * 10)

array([10, 20, 30])

500

In the following:

def greet(name, greeting="Hello"):

what is "Hello"?

Default value

500

What does this print?

x = [1, 2]

x.append(3)

print(len(x))

[1, 2, 3]