# Python Mastery - Formatted Strings Syntax Error

**URL:** <https://forum.codewithmosh.com/t/python-mastery-formatted-strings-syntax-error/2432>\
**Category:** Python\
**Created:** [February 3, 2021, 7:13am UTC](https://forum.codewithmosh.com/t/python-mastery-formatted-strings-syntax-error/2432 "2021-02-03T07:13:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nateM](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@nateM](https://forum.codewithmosh.com/u/nateM)\
**Post date:** [February 3, 2021, 7:13am UTC](https://forum.codewithmosh.com/t/python-mastery-formatted-strings-syntax-error/2432/1 "2021-02-03T07:13:14Z")

</div>

![Python Mastery Section 2 - Primitive Types - Video 5 - Formatted Strings](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/1X/7fb11078ffb4aef20cddc82be8b55b89049cf888.png)

Hello All,

Thank you in advance for any help. I am getting a syntax error on line 3. The code matchs Mosh’s and I’ve installed all the correct extensions so far. I’ve even tried running the code in [pythontutor.org](http://pythontutor.org) and it works there. Thank again for any help.

---

<div class="post-metadata">

**Author:** ![NicolasATC](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/nicolasatc/32/714_2.png) [@NicolasATC](https://forum.codewithmosh.com/u/NicolasATC)\
**Post date:** [February 3, 2021, 12:28pm UTC](https://forum.codewithmosh.com/t/python-mastery-formatted-strings-syntax-error/2432/2 "2021-02-03T12:28:23Z")

</div>

Hello, and welcome!

That’s weird. I checked your code and it works perfectly 🧐

I’ve seen similar behaviour when indenting, but I see no indentation in your code 🧐 🧐

Since it works on [www.pythontutor.com](http://www.pythontutor.com) you can be sure that your code works, and that’t the important point here.

Now it would be interesting to figure it out why a perfectly written code doesn’t work in VSCode. For this I would:

1. Open a new file and write the code again. If it still doesn’t work,
2. Open a Python file from another user, where the code DID work. Here [GitHub - NickATC/test\_files: Files to test and share](https://github.com/NickATC/test_files) you will find a test.py file. download it and test it on your computer.
3. Install another code editor (Notepad++, Atom, etc…), open a new file and write the code again.

I’m pretty sure that at this point, that you will make some findings.

Anyway, let me know if step 1 worked.

---

<div class="post-metadata">

**Author:** ![SAM](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/sam/32/167_2.png) [@SAM](https://forum.codewithmosh.com/u/SAM)\
**Post date:** [February 3, 2021, 5:12pm UTC](https://forum.codewithmosh.com/t/python-mastery-formatted-strings-syntax-error/2432/3 "2021-02-03T17:12:16Z")

</div>

It looks like you’re using a rather old (prior to 3.6) version of python. Run `python --version` to be sure.

---

<div class="post-metadata">

**Author:** ![kikik](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kikik](https://forum.codewithmosh.com/u/kikik)\
**Post date:** [January 6, 2022, 12:24pm UTC](https://forum.codewithmosh.com/t/python-mastery-formatted-strings-syntax-error/2432/4 "2022-01-06T12:24:09Z")

</div>

Hi,

I had the same issue on Mac and I have sorted it with the following:

1: settings  
2: in the search bar type: code-runner.executorMap  
3: click Edit in settings.json  
4: after the last code type a comma and press enter  
5: on the next line type as follow “code-runner.executorMap”  
6: lots of new codes will be displayed  
7: amend the the python code (on mine it was on line 14) showing as  
“python”: “python -u”, as follow:  
“python”: “python3”,  
8: save and exit

After this amendment, the formatting string started to work.

For help refer to “Lesson 9” of Getting Started. It is not the same on newer versions but the above should help.

I hope this helps
