Need help on; Exercise 5

Hi All, looks like I’m stuck here. I don’t see anything wrong on my code but not sure why Python sees an error.

I tried the following but no luck;

  • rewrite the code
  • tried to put a # on line 9, but it sees error on line 10
  • Still looking an answer on google, but in the meantime, can you help check this please.

Hello.

My guess is your problem is at line 8 or above.
Please put up your code if you don’t find the reason on your own.

1 Like

@ntorres you are running the command:

python ex5.py

which will probably be using version 2.6 or something.

Try using the version 3 of python as per Zed’s example:

python3.6 ex5.py

f-strings were introduced in python 3 so if you are using an older version of python, it will not recognise the syntax:

print(f"some string with f at the front and a {variable} too.")
2 Likes

Hey @ntorres, @gpkesley already gave you the best action but you want to do this:

python --version

If it says 2.7 then you need to run python 3.6 or 3.7. You can do that with either:

python3.6
python3.7
python3

Try all of those.

Hi gpkesley, zedshaw, Ulfen69,

Yeah It works when I ran python3 ex5.py. my bad, I was get used to running python ex#.py as it was working on previous exercises. Thanks so much for your help.

Me too. I do that all the time.