Mid-Level
November 18, 2026Spot the bug: Data Science & ML
One snippet. Find the bug, or prove there isn't one.
python
1import pandas as pd
2
3
4def add_total(df, tax_rate=0.2):
5 totals = []
6 for idx, row in df.iterrows():
7 totals.append(row["price"] * (1 + tax_rate))
8 df["total"] = totals
9 return df
10
11
12sales = pd.DataFrame({"price": [10, 20, 30, 40]})
13print(add_total(sales))
14Click the lines that carry the problem.
Your verdict
One attempt per day. The answer shows up right after.
Keep your streak
Create an account to keep your streak and track your progress.