Variables and Data Types - why does it only show one error line and not two?

Hey there folks :slight_smile: so happy to be here!

I was just curious. I am doing the: Variables and Data Types and correctly naming variables. so I ran the example given for the wrong syntax
(line 2) β€˜β€™β€˜old - income = 34000’’’
(line 3) β€˜β€™β€˜new income = 40000’’’

how come the error message only shows me that there is an error on line 3 and not 2? does this mean that there might be certain errors that we might not easily be able to find?
thanks in advance


Try editing your post and using the ``` put your code in between 6 of them.

```like this```

When a Python program runs, each line is executed in order. When it comes across an error, the program stops and it returns information about the error.

What this means is that if you have more than one error in your code, you’ll get an error message about the first error only. Once you fix that, you’ll get the next error.

This can seem annoying at first, but because Python doesn’t know what the first error means, it’s impossible for it to understand how to proceed so that it can encounter the rest of your code (whether there is or isn’t another error).

I hope my explanation is clear, if not please let me know.

1 Like