LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Intermediate Python

Kurs anzeigen

Anleitung zur Übung

  • 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?

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Import package


# Build Scatter plot


# Show plot
Code bearbeiten und ausführen