install python latest version from below link
check (put tick / select) the boxes
add path (, limit characters, etc., )
to check for successful installation: open command prompt and type py
👉 Note:
in older versions of python, to know version, type the following python --version
New versions of python, to know the version, type the following py
Simple Program
STYLE_1a:
open python idle and type the below printing statement.
print('Hello World')
Simple Program
STYLE_1b:
open cmd and type as follows:
py
print('Hello World2')
The above two styles: Style_1a and Style_1b use the Terminal functionality of the Python with instant results (means single line executed every time)
To exceute multiple lines in python, we need to save a file created in notepad as .py file (i.e., with py extension. Example: abcd.py) This needs to be run either in the python IDLE or through command prompt.
Style-2a: using python IDLE
step1: open python IDLE
step2: File --> New File;
step3: Type multiple lines of code in the editor; File --> SAVE at your desired location.
print('Hello World')
print('Mutiple lines of code')
# this is comment line
# without saving, you can not run the code.
step4: Run --> Run Module; Observe the output in the other window IDLE Shell
Style-2a: using command prompt
step1: open note pad and write multiple lines of code.
then File --> SAVE AS abc.py
print('Hello World')
print()
print('This is multiple lines of code writing')
here I have saved my file on Desktop.
So in command prompt, type
cd Desktop
Now it loads as below:
C:\Users\krish\Desktop>
Type as shown below to run the file:
C:\Users\krish\Desktop> py abc.py