Got an Error in Exercise 5 and Need to Know What it is

I typed the stuff that Zed said to type in Exercise 5, but I still get an error here and I still can’t see where that error is. Could someone tell me where that is exactly? Please note: The my_'s were dropped as part of the study drills.


Correction: image

Hey @evancruz1, it looks like you aren’t using Python 3.6 or greater. Do this:

python --version

If you don’t get 3.6.x or 3.7.x then you’ll have to upgrade. I think I’ll have to refresh the videos for how to install the latest python on all the platforms, so let me know if you can’t figure it out.

Nope, still not working, even with the upgrade.

I don’t know what type of machine you are using, but I tried to recreate this on a macbook (I don’t have a windows or linux machine).
In the terminal window, when I type “python”, I get your exact same error. That’s because macOS defaults to python 2.
When I type “python3.7”, it works OK.

I hope this helps.

I’m using Windows, not a Mac.

Hey @evancruz1 so you have to make sure you’re running the correct version of python first. When you do:

python --version

What does it print out?

Sometimes the stack trace in Python will return the line of code after where the actual error is taking place. It’s tripped me up a couple times. Maybe try checking the surrounding lines?

Definitely using Python 2 not Python 3. You need to run the command suggested above to see the python default version. And then run using Python3 (or create a virtual environment - see later in the book).

F-Strings didn’t come in until Python 3

It prints this out:

I think Zed means:
type “python --version”. Type everything between the quotes including the word “version”.

Do not type “python --3.7” (nor any other number).


Nope, still not working, even with the upgrade.

So, you have to install python 3.6, and then make sure you run the correct version. You do it like this:

python --version

If that prints out 3.6 or 3.6 you are good. If it prints 2.7 then try this:

python3 --version

Or try:

python3.6 --version

or try

python3.7 --version

If none of those work then you didn’t actually install python 3.6 or 3.7 at all.