Get startedGet started for free

Scatter plot (2)

In the previous exercise, you saw that the higher GDP usually corresponds to a higher life expectancy. In other words, there is a positive correlation.

Do you think there's a relationship between population and life expectancy of a country? The list life_exp from the previous exercise is already available. In addition, now also pop is available, listing the corresponding populations for the countries in 2007. The populations are in millions of people.

This exercise is part of the course

Intermediate Python

View Course

Exercise instructions

  • Start from scratch: import matplotlib.pyplot as plt.
  • Build a scatter plot, where pop is mapped on the horizontal axis, and life_exp is mapped on the vertical axis.
  • Finish the script with plt.show() to actually display the plot. Do you see a correlation?

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import package


# Build Scatter plot


# Show plot
Edit and Run Code