You Can Teach an Old Snake New Tricks: Computer Science on the TI-84 Plus CE Python Graphing Calculator
Python is now on the TI-84 Plus CE Python graphing calculator. As a computer science teacher myself, what does this mean for my students? What are your first thoughts? When I first heard this, I wondered, “How is this different from programming Python on other platforms? How could this benefit my computer science students?”
First, keywords can be menu driven or directly typed. The menus can help when introducing and reinforcing new topics. Students don’t have to remember the exact syntax; they only need to recognize which one to select. It also avoids keyword typos. Notice, the templates below have the keywords in black and use blue placeholders to indicate where parameters belong.
Python spacing can be frustrating and problematic — not anymore!
Traditional Python can be tricky because it uses specific indentation for iteration and selection. Instead of squinting to see if the spacing is correct, TI-84 Plus CE Python uses diamonds ◊ to makes it easier to learn and debug Python spacing. I don’t know about you, but I’ve spent countless hours on a computer trying to find student typos, including a missing, or extra, space or tab.
Python just became more portable
If your students use the TI-84 Plus CE Python, Python is now in the palm of their hand, and they don’t need an internet connection and can literally code anywhere! Since the handheld isn’t connected to the internet, there goes the distraction of games, social media, email … and becomes a very focused learning environment for a very distracted age group.
I’m excited about the implications for my AP® Computer Science Principles class. They can practice vocabulary after using their algorithms and programming skills to create a virtual stack of flash cards. Have you ever tried to fit your laptop in your pocket? Well, the TI-84 Plus CE Python fits in your pocket for on-the-go practice. Students can practice in the car, on a bus, in homeroom … all without internet connection. I’ve used this same idea in my math classes to practice concepts such as slope.
The list for computer systems and networks is rather lengthy. Think about all the review students could accomplish if each student in your class created a flash card stack with a different list of vocabulary. After a few days of practice, partner pairs could link calculators and swap vocabulary lists.
Let’s take a look at how the code might look:
(Note that #1, #2 and #3 are shown in the code itself as comments. These have been included for instructional purposes to help clarify the purpose of each section of code. These are not essential code elements to include.)
#1. First, you need the library imports.
#2. Then, question and answer lists.
#3. Add a loop to practice 10 times. Clear the screen.
#4. Pick a random card from the deck.
#5. Print the question. Wait for the student to press [clear].
#6. Display the question and answer. Wait for the student to press [clear].
Students could write questions and answers for problems such as “What is the binary equivalent to the base ten number 147?” Again, students could swap (link) with a partner for more practice. Or better yet, write a project. They could code a project to practice converting binary to decimal, or vice versa.
#1. Import the random library and declare variables.
#2. Loop eight times.
#3. Generate either a 0 or a 1.
#4. Add the number appropriate to either base.
#5. Give the user the binary number; request the decimal.
#6. Determine if the user is correct.
Light it up!
The TI-Innovator™ Hub with TI LaunchPad™ Board isn’t just for TI‑Basic anymore. It also integrates with Python. This opens up a whole new world for students and Python. Any time my students get to play with RGB colors and sound, the inquiry, enthusiasm and engagement increase tenfold. If you also have input devices such as a temperature or moisture sensor, or output devices such as the TI-RGB array or an LED, you can incorporate those into your code as well. TI Codes lessons using the TI-Innovator™ Hub will be coming later this fall. Be sure to check back on the TI Codes page for updates.
This new version is a short quiz. It asks students to enter the vocabulary word for a given definition and keeps track of the number of correct answers. If the answer is correct, play a tone and make the light on the TI-Innovator™ Hub teal. Otherwise, play a tone twice, and display a magenta light.
The code might be as follows:
#1. New project libraries.
#2. Variables to keep track of the score.
#3. Turn the light “off.”
#4. Get and store the user’s answer.
#5. If correct, add a point, change the light teal, sound a tone once for half a second, wait for the user to press [clear] before a new question.
#6. If incorrect, change the light to magenta, sound a tone twice for half a second, wait for the user to press [clear] before a new question.
#7. Print the number correct at the end.
I think the most exciting part about Python on the TI-84 Plus CE Python graphing calculator is the ability to drive the TI-Innovator™ Rover using Python. In the past, I’ve spent the first two weeks of the year teaching my students TI-Basic on the Rover. Day one, students practice sequential programing using only rv.forward, rv.left and rv.right. I set up obstacle courses and let students problem-solve the steps needed to complete the course. This physical setup teaches students that coding is sequential. Day two, I ask students to code various regular polygons. After coding a regular square, triangle and hexagon, students see the need for iteration (loops). Later on, sensor inputs such as color or ranger measurements can be introduced for selection (if) statements.
A great activity for AP® Computer Science Principles students is to physically check multiple-choice items. Make a life-size maze on butcher paper. Give students four different Python coding options to complete the maze. Have students code their solution choice, then verify with the calculator. If they are incorrect, students have a physical/visual model illustrating their error.
Give students a list of 20–30 questions and answers for a test bank. For example: questions about your school, simple math problems, states and capitals … something that makes the questions accessible for all students.
Tell the students they must incorporate four questions into their project:
After everyone has coded (and tested) their projects, move to the hallway for a “race.” Have groups swap calculators. (You don’t want the students to already know the selected questions.) Line up at the starting line. Ready? Set. Go! The race is on! See which team gets the farthest the fastest.
When creating the project, choose “Rover” from the Type menu. This will automatically add the required library imports.
The code could be:
#1. Required library imports.
#2. Store string answer in variable capital. If the answer is correct, drive forward.
#3. Store integer answer in variable answer. If the answer is correct, drive forward. Otherwise, drive backward.
#4. Set the counter to 1. While the answer isn’t 8, and there have been fewer than three guesses, input a guess.
#5. If the answer is correct, move forward. Set counter to 5 so the loop condition will fail.
#6. While the answer is incorrect, request new answer.
#7. After the loop, move forward.
#8. Let the user know the race is complete.
New to Python?
Don’t stress; everything is menu driven. A great place to start learning the basics of programming with Python is TI Codes: Python.
Whether you’re new to Python or have been teaching with Python forever, the TI-84 Plus CE Python opens doors to numerous coding concepts and projects. Why wouldn’t we teach students how to extend the use of technology they are already using in math or science? See the “Using Python to Squeeze the Fun Back Into Math blog for examples on how to export data to the TI-84 Plus CE Python system. With a few adjustments to the code syntax, students could code the Math in Motion activities using Python instead of TI-Basic. Whether you use the TI-84 Plus CE Python graphing calculator alone, with the TI-Innovator™ Hub or with the TI-Innovator™ Rover, Python just became more accessible to students. Here’s to kicking off another great year in computer science!
AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, TI products. Policies subject to change. Visit www.collegeboard.org.
About the author: Becky Byer teaches math and computer science at Kelly Walsh High School in Casper, Wyoming. She is a Regional T³™ instructor, Nationally Board Certified and a reader for the AP® Computer Science Principles exam. She is passionate about integrating technology, such as computer programming, to build and enhance student understanding of mathematics.