Multiple statements found

Arijjan V writes (excerpted):

When I enter code into the compiler I continue to get multiple statement error messages. *Even if I copy the code from the book.

I use Idle 34 on windows professional 7. This is what I typed into the Idle Shell.

found_coins = 20 magic_coins = 70 stolen_coins = 3 coins = found_coins for week in range(1, 53):     coins = coins + magic_coins - stolen_coins     print(’Week %s = %s’ % (week, coins)) **Click Enter** *SyntaxError: multiple statements found while compiling a single statement

I searched online but it’s not an indent error. I’d appreciate any help.*

To be honest, I’m not quite sure how you managed to get that error when typing the code into IDLE - the only way I can get it to happen, is if I copy-and-paste directly into the Shell:

{.kg-image loading="lazy" width="462" height="205"}

The reason being is that you can only copy-and-paste line-by-line into the Shell window (a quirk of the way it works). What you should actually be entering looks like this:

{.kg-image loading="lazy" width="425" height="175"}

If you want to paste in a large chunk of code, then click File, then New File, then paste the code, and save the file before trying to run it:

{.kg-image loading="lazy" width="540" height="330"}

If you can reproduce the problem when typing in the code, send a screenshot (take it after entering a few lines) – I’d be interested to see if it’s obvious from the screenshot what the cause is…