Vipin | Sat, 06 Jun, 2020 | 296
To install latest verison of python you can download and install it for free from python.org for your operating system.
Once the python is installed on your system you can verify it by typing the following on the windows OS :
If it is installed correctly you will get the output similar to the following
This verify that you have successfully installed python in your system.
Python is an interpreted programming language, this means that as a developer you write Python (.py) files in a text editor and then put those files into the python interpreter to be executed.
Let's write our first Python file, called helloworld.py, which can be done in any text editor.
Place print("Helloworld") in the file and save it.
The way to run a python file is like this on the command line:
After successful execution of the file you will get output similar to this.
Congratulations, you have written and executed your first Python program.
To test a short amount of code in python sometimes it is quickest and easiest not to write the code in a file. This is made possible because Python can be run as a command line itself.
Type the following on the Windows, Mac or Linux terminal:
You will get output similar to this
From there you can write any python, including our hello world example from earlier in the tutorial:
Whenever you are done in the python command line, you can simply type the following to quit the python command line interface:
quit or exit()