Education Technology

Explorations with Coding: Putt Putt with Python

by Texas Instruments


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