Education Technology

Explorations with Coding: Gettin' Trig-y 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 triangle side lengths
  • Use the randint function to determine sine, cosine, or tangent prompts
  • Use if..elif..else statements to make decisions
  • Use the Pythagorean Theorem to find missing triangle side lengths
  • Use right triangle trigonometry ratios to solve problems

About the Lesson

For this lesson, students will write a program that generates a random sine, cosine or tangent ratio.  It will ask the user to enter a different trigonometric ratio based on the given triangle information. It will evaluate the user’s input.  If the user’s input is incorrect, it will give the correct ratio.

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