pythoncalculator

Why does my TI-84 Plus CE calculator say there's a syntax error when it works fine on my computer?


I have a simple program that prints a floating point variable

x = 1.0
print(f"x = {x}")

On VS Code, it works completely fine, but for my TI-84 Plus CE calculator, it says there's an error on line 2.

>>> SyntaxError: invalid syntax

How can I fix this?


Solution

  • TI-Python is a modified version of CircuitPython (itself based on MicroPython), as per the TI docs. It's pretty stripped down and doesn't support f-strings. Both concatenation (+) and str.format will work fine. Here's the format version:

    x = 1.0
    print("x = {}".format(x))