Objective:
By the end of this lesson, learners will master string manipulation, list comprehensions, advanced loops, and file handling in Python, with applications in data science workflows.
Topics Covered:
Splitting strings.
Replacing substrings.
f-strings for formatting.
Activity:
Modify a filename string to remove the trailing -1 using .replace().
Key Concepts:
Mounting Google Drive.
Searching for files.
Skills Practiced:
Convert currencies.
Filter data.
Activity:
Filter a list of property records for entries in “Tlalpan”.
Key Concepts:
while loops with break/continue.
for loops with dictionaries.
Activity:
Print only odd numbers from 0 to 100 using a for loop.
Examples:
Nested loops.
range() function.
Activity:
Create an 8×8 grid of # symbols using nested loops.
Data Science Applications:
Summing numbers.
Filtering countries.
Reversing a list.
Challenge:
Analyze countries_data.py to find:
Total languages.
Top 10 most spoken languages.
Top 10 most populated countries.
Key Takeaways:
Strings: Split, replace, format.
Files: Search/read in Colab.
Loops: while, for, nested loops.
Comprehensions: Transform/filter lists efficiently.
Access the whole lesson here: Access the lesson content here: Python Advanced Concepts.