Example: my_dict = {'a': 1, 'b': 2}; list(my_dict.keys()) results in ['a', 'b']
Day 5: List Comprehensions (Basic)
Introduce the concept of creating a new list concisely.
Example: [x*2 for x in [1, 2, 3]] results in [2, 4, 6]
Day 6: Reading from a File (Basic Lines)
Recall opening a file and reading lines.
Example: with open('data.txt', 'r') as f: lines = f.readlines()
Day 7: Reset/Review/Choose Your Own
Review a concept from the week or pick a new one you're list to data curious about.
Minute 2-4: Quick Practice Exercise
Day 1 (Strings to Lists):
Take a sentence like "This is a sample sentence." and split it into words.
Take a string like "item1;item2;item3" and split it by the semicolon.
Day 2 (Strings to Lists - Whitespace):
Take a string with multiple spaces: " hello world " and split it.
Day 3 (Iterating):
Create a list of numbers. Print each number multiplied by 10.
Day 4 (Dictionaries):
Create a dictionary. Get a list of all its keys. Get a list of all its values.
Day 5 (List Comprehensions):
Create a list of squares from 1 to 5 using a list comprehension.
Create a list of even numbers from a given list [1,2,3,4,5,6].
Day 6 (File Reading):
(Requires a simple data.txt file with a few lines) Create a file named data.txt with some text. Read its lines into a list.
Day 7 (Your Choice):
Revisit a difficult exercise or try a new one based on your chosen concept.
Minute 5: Self-Reflection & Next Steps
Ask yourself:
"Did I understand the concept fully?"
"Where could this be useful?"
"What's one thing I want to remember for tomorrow?"
Jot down notes: A quick note about the concept or a useful trick.
Plan for tomorrow: Briefly think about what the next day's concept will be.
Tips for "Mastery" over time:
Consistency is Key: Even 5 minutes daily is far more effective than 30 minutes once a week.
Don't Rush: Focus on understanding, not just completing.
Real-World Data: As you get comfortable, try applying these techniques to small snippets of real data you encounter (e.g., a few lines from a CSV, a paragraph from a webpage).
Experiment: Try different variations of the methods. What happens if you split by a character that doesn't exist?
Error Analysis: When you encounter an error, try to understand why it happened. This is a crucial learning step.
Resources: If you get stuck, a quick search for "python string split to list" or "python dictionary keys to list" will bring up plenty of documentation and examples.
Build Gradually: This plan starts simple and adds complexity. Don't jump ahead if you're not comfortable with the basics.
By following this routine, you'll build a strong foundation and gain practical experience in turning various forms of data into lists, which is a fundamental skill in data manipulation and programming. Good luck!