Can't get example code to work in Vscode

Hi all,

I’m working on teh list examples in Data Structures but I can’t get Mosh’s example to work for me.

I tried to put my example and his, but the system won’t let me.

I installed all the plugins he recommends, but it doesn’t work for me. When I save it closes the gap between chara and =

Any help would be appreaciated.

Thanks,

Patrick

The syntax error:
On line 5 you forgot to close the parenthesis for the `list(range(20) … so just add an extra ) and you will be fine.

What I do, is that I open and close all the parenthesis before I write any code. Something like this.

numbers = list(range())

And yes… when you save it delets the extra spaces. It’s a plugin (forgot the name)…however the extra spaces are recommended by PEP8. When I programmed in Python, I deleted the plugin and everything worked as I wanted to. Check the pugins you installed and check what they do, I’m sure one of them provides styling (or something like that)

Hey Nicolas,

Thanks for that, I’m back up and working :smiley:

Cheers,

Patrick

1 Like

Since you are using VS code, there is a fantastic plugin that will save a lot of headaches:

Bracket Pair Colorizer

It will show the parenthesis (and others {} []) in different colors, so you can see if you opened and closed the corresponding parenthesis.

I think there are 2 version… I’d go with the latest version, but either works like a charm.

This is it at work

Captura de Pantalla 2021-01-26 a la(s) 8.49.10 a. m.

1 Like

This is fantastic and will save me many headaches in the future I bet! Thanks!

1 Like