The Fuller Copy
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid
Problem
A scraping pipeline pulls product listings from several sites, and each raw record differs by source: a price may sit under the first entry of `offers` or as a top-level field, and it arrives as a string like `"$1,299.00"`, while the id and title hide behind different key names. Flatten each raw record into a uniform listing, coercing prices to floats and timestamps to a plain date, and leaving any field that is absent as `None`. The same listing can be scraped from more than one page under the same id, so when an id repeats, keep the copy with the fewest missing fields.
Summary
The same listing lands twice, half-filled each time. Keep what is whole.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.