Search⌘ K

Exercise: Getting Familiar with Python

Explore fundamental Python control flow and data structures such as for loops, dictionaries, and lists. Learn to manipulate and combine these elements to support effective data exploration and cleaning in data science projects. This exercise helps build a foundation for working with Python in practical data tasks.

Python control flow and data structures

In this exercise, you will practice some basic Python control flow and data structures, including a for loop, dict, and list. This will show you how Python syntax and data structures may be a little different from other programming languages you are familiar with. Perform the following steps to complete the exercise:

  1. Type python3 in Terminal to open a command-line Python interpreter. You should obtain an output similar to the following:

    Python 3.8.10 (default, Nov 14 2022, 12:59:47) 
    [GCC 9.4.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    
  2. Write a for loop in the Command Prompt to print values from 0 to 4 using the following code.

    for counter in
...