Beyond the Basics Exercises (Modules 10-12)¶
Module 10: Collections and Itertools¶
Exercise 1: Count words¶
Count how many times each word appears in a sentence.
Hint
Split the sentence and feed the list to collections.Counter.
One possible solution
Module 11: Datetime and JSON¶
Exercise 2: JSON round trip¶
Create a dictionary, serialize it to JSON text, and parse it back.
Hint
Use json.dumps and json.loads.
One possible solution
Module 12: Async and Typing¶
Exercise 3: Async await¶
Create an async function that sleeps for half a second and returns "ok".
Hint
Use asyncio.sleep(0.5).