May-08-2020, 04:08 AM
Please read, https://python-forum.io/Thread-How-to-Ex...ython-code
In short, you can execute python code in python shell (i.e. python interactive mode, that is when you have >>>) or save the code in .py file (you can use any IDE or text editor) and execute that file from command line. This is how would you normally write and execute code. python shell normally is used only for some ad-hoc experiment or demo.
When you run in python shell, each line is evaluated and result is displayed immediately. That is why you "see" result.
When you write code in .py file, you need to print in order to get visual output
e.g.
In short, you can execute python code in python shell (i.e. python interactive mode, that is when you have >>>) or save the code in .py file (you can use any IDE or text editor) and execute that file from command line. This is how would you normally write and execute code. python shell normally is used only for some ad-hoc experiment or demo.
When you run in python shell, each line is evaluated and result is displayed immediately. That is why you "see" result.
When you write code in .py file, you need to print in order to get visual output
e.g.
names = ["Karen","John",May","Philips") print(len(names)) names_length = len(names) print(names_length) print(15/3)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs