![Python REPL session. csv.DictReader reads a CSV whose data row, Ann,ann@example.com, has no phone value. The row comes back with 'phone': None, and len(row["phone"]) raises TypeError: object of type 'NoneType' has no len(). Reading the same data with csv.DictReader(f, restval="") gives 'phone': '' instead.](https://pbs.twimg.com/media/HX_HpSsWMAAdclk.jpg?name=small&format=webp)
ALT Python REPL session. csv.DictReader reads a CSV whose data row, Ann,[email protected], has no phone value. The row comes back with 'phone': None, and len(row["phone"]) raises TypeError: object of type 'NoneType' has no len(). Reading the same data with csv.DictReader(f, restval="") gives 'phone': '' instead.

ALT Python code an AI agent wrote for a FastAPI cars API. create_car() takes a plain dict, sets the new car's id to len(cars) + 1, and returns a message wrapper. delete_car() loops over the list and, if no car matches, returns {'error': 'Car not found'}. The id line, the message wrapper and the error return are highlighted.

ALT A Python script called airport_comparison.py. It reads the flight CSV, filters it into flights from LAX and flights from ATL, builds a ProfileReport for each with a title, then calls lax_profile.compare(atl_profile) and saves the result to airport_comparison.html. The last two lines are highlighted.

ALT Python code: a function find_humidity_rows(df, target) builds an empty list, loops over the DataFrame with df.iterrows(), appends each row whose Humidity is at least target, and turns the list into a new DataFrame. The iterrows loop, the append and the DataFrame call are highlighted in red. It's called on weather data read from data/weatherHistory.csv with a target of 0.90.



![A Python script with a list of three cars with ids 1, 2 and 3. create_car() sets the id to len(cars) + 1. The script deletes car 2, creates a new car and prints the ids. The output is [1, 3, 3]: two cars now have id 3.](https://pbs.twimg.com/media/HX5962EWEAAb5aI.jpg?name=small&format=webp)


![Python code: the same find_humidity_rows(df, target) function, now one highlighted line that returns df.loc[df["Humidity"] >= target]. It's called on the same weather data with a target of 0.90.](https://pbs.twimg.com/media/HXvqC5fWQAACeSI.jpg?name=small&format=webp)