Question regarding Python 3.9 unable to read f strings

Hi there - I’m just beginning to code with no previous computer programming experience. I purchased the Python Crash Course book by Eric Matthes, downloaded the most recent Python 3.9.1, and am using Sublime Text v3.2.2 to run my programming. I’m also on MacOS Catalina.

I’ve just started the book today and am a little confused as I realized that I can’t run f strings or use underscores in integers. If I try to print them I’m given a syntax error. For the f string exercise one I just started running the full .format() method instead. But in the book it specifies that the f string and integer features were introduced in Python3.6, so if I downloaded 3.9 I’m not sure why it won’t work.

Thanks for any advice! I have been enjoying my programming learning journey so far.

Even though you’ve downloaded a new version of python, you may still be using an older version installed. How are you running your program? If you run python -V or python3 -V what is the output?

Looks like I have Python 2.7.18 and Python 3.9.1 when I run python -V and Python3 -V in my terminal.

The book did make me configure Sublime Text so that it will use Python3 when running my programs. If there’s still 2 types of Python on my computer, will that mess it up?

Shouldn’t mess anything up. Different programs might need different installations. Don’t try to remove the system python (which is probably the 2.7).

All you have to do is call the correct python when running your programs. Just run them with python3

Thank you! :slight_smile:

Or use, by adding to the top of your program:

#!/usr/bin/env python3

and make your program executable (chmod +x