EduFlow
Python for Data Analysis

Checkpoint: Python Essentials for Analysts

Five questions on this section. Answer all of them, then see your score and why each answer is right or wrong.

Question 1 of 5

What does this print?

Python
prices = {"Desk Mat XL": 29, "Laptop Stand": 49}
prices["Desk Mat XL"] = prices.get("Desk Mat XL", 0) + 1
print(len(prices), prices["Desk Mat XL"])
Question 2 of 5

A colleague’s function returns 3.3333333333333335 for average([10, 20, 30]) instead of 20.0. What is the bug?

Python
def average(values):
    total = 0
    for v in values:
        total += v
        return total / len(values)
Question 3 of 5

Which f-string prints Share: 12.5% when share = 0.125?

Question 4 of 5

A loop over rows stops with TypeError: unsupported operand type(s) for +: 'int' and 'str' on the line total = total + row["quantity"]. What is the most likely fix?

Question 5 of 5

totals = [65.0, 18.0, 72.0]. What does [t > 50 for t in totals] produce?

5 questions unanswered