Python ignores assignment statement in editor window
I'm completely new to this (this website as well as programming) so it's probably badly worded. I should also point out that I am using python on RPi2, so I cannot insert anything. The problem is that python ignores the assignment operator when I enter it into the editor, but understands it when I enter it into the shell. For example, if I type
x = 5 x
into the shell, the shell will respond
5
If I find the same thing in the editor window and run the module, the shell responds with nothing, only the restart bar and then three arrows.
==========RESTART==========
.>>>
I cannot find any information on this and I have never encountered this problem using python on my desktop.
source to share
When you just type x
in your program, you don't do anything. If you want to print it use print x
to explicitly tell python to print it. Note that having a simple x
in your module would be a valid python statement (although if you used pyflakes
either pylint
or another such tool it would loudly exclaim that you are not doing anything in this statement).
In a shell, this input x
works simply because it supports the shell, it is a shell function.
source to share