Exercise: Generators

You are analyzing a log file with transaction data. Positive values represent sales, while negative values represent refunds. Your task is to process the data efficiently using generator functions and expressions.

Each line in the log file is formatted as follows:

date, user_id, transaction_amount

For example:

2025-01-20 12:00:00,user_123,50.75
2025-01-20 12:01:00,user_456,20.00
2025-01-20 12:02:00,user_123,-10.50

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

You must own this product to join the conversation.