Invalid decimal literal

Hi there just started my python tutorial
I keep getting invalid decimal literal
I enter var = 3.142
I understand it mustn’t start with a number before the var
And no letters in the numeric
But I keep getting invalid decimal literal
As an aside I get a red highlight in the code above my program

Kind regards Steve

Please provide a full error traceback, otherwise we have a hard time telling what exactly is going wrong.

This does not make sense. There is no code above your program.

If you tried to copy and paste from an interpreter window into a .py file, that does not work properly.

Hi Karl
Thanks for reply have screen shot of issue
Just started learning

See this from three days ago.

1 Like

You tried to execute exactly what you see in the IDLE editor window, starting with “Python 3.12.2 (tags…”, which is not valid Python code.

1 Like

Hi Terry thanks for help
Went back and read the instructions properly all ok now

Regards Steve