Module 5: Making Choices and Repeating Iterations

In this module, you will learn how to write conditionals statements and learn the fundamentals of how to create code that efficiently repeats the same operations by following the DRY principle.

0Module Learning Outcomes

1Making Choices with Conditional Statements

2Quick Questions with Conditionals

3Will it Run with Conditionals

4Creating Conditional Statements

5Creating an Inline if/else Statement

6Repeated Iterations (Loops)

7Repeated Iterations Questions

8Practice Iterating Over a Collection

9Range, Dictionaries and Comprehensions

10 Range Questions

11Practice Iterating using Range

12Applying Range with Dataframes

13Nested Loops

14Nested Loop Questions

15Making a Nested Loop

16Repeated Iterations with Conditions

17Conditional Loop Questions

18Practice Iterating Over a Collection


20Function Questions

21Making a Function from Existing Code

22Making a Function

23What Did We Just Learn?

About this course

Learn the fundamentals of programming in Python, including how to clean, filter, arrange, aggregate and transform data. You will learn the foundations of programming in Python while writing human-readable code that sets a foundation of best practices and coding style. You will gain the skills to clean, filter, manipulate (wrangle) and summarize data using Python libraries for more effective data analysis. An overview of data structures, iteration, flow control and program design relevant to data exploration and analysis will be addressed along with fundamental programming concepts such as loops, conditionals and data structures that create a solid foundation in data science programming.

About the program

The University of British Columbia (UBC) is a comprehensive research-intensive university, consistently ranked among the 40 best universities in the world. The Key Capabilities in Data Science program was launched in September 2020 and is developed and taught by many of the same instructors as the UBC Master of Data Science program.