Medior
18 november 2026

Vind de bug: Data Science & ML

Eén stukje code. Vind de bug, of bewijs dat er geen is.

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))
14

Klik op de regels die het probleem veroorzaken.

Jouw oordeel

Eén poging per dag. Het antwoord verschijnt direct daarna.

Behoud je reeks

Maak een account om je reeks te behouden en je voortgang te volgen.

Account aanmaken