Count the number of Moon rocks by type using Python

Visual Studio Code

Use Python and Visual Studio Code to make a simple program to count the number of each type of space rock.

Learning objectives

In this module, you'll learn:

  • How to write variables in the context of a program
  • How to use prebuilt functions to read data from a text file
  • How to create a function and call it in the context of a program
  • How to write conditionals and loops in the context of a program


  • Visual Studio Code installed
  • Python extension installed in Visual Studio Code
  • Python and Jupyter Notebooks installed
  • Knowledge about introductory Python topics