Education Technology

Putt Putt with Python

Activity Overview

In this coding activity, students will create a golf game.  The golf game gives the user two random points, one for the golf ball and one for the golf hole.  The user will enter a value for the slope.


  • Use the input function and a variable to collect and store data from a user
  • Use the randint() function to generate random integers.
  • Use the plot library to plot points
  • Use the plot library to plot a line segment
  • Use the point slope form of a line to plot a line segment

About the Lesson

In this lesson, you will create a golf game using the Python Editor.  Your game code will randomly generate a location for the golf ball and the hole. To take a shot, the user will enter a linear equation in point-slope form that models the path for the shot.  The program will plot the golf ball, hole and shot.

Note: This lesson requires the use of TI-Nspire™ CX II technology with OS 5.2 and above.