Python Installation and Get Started
We need to install python to get started. You can download the latest version of python from https://www.python.org/downloads/.
You can download for windows, mac, Unix and Linux os
How to check Python Version:
You need to execute the below command to know about the version of python.
>>> python –version
Python has different syntax for version 2.7 and 3.7. In this tutorial, we are using python 3.7 version.
Python First Program
I love the first program in python. Use Print function with curly braces to with quotes text to print hello world.
Code:
# This if First Python Program
print(‘Hello, world!’)
Python Get Started:
In Python, we can write and execute code in two modes. One is Interactive and second one is Script Mode.
Interactive Mode Programming:
You have to open command prompt then type python to log in interpreter
C:/>python
Python version: 3.63
>>> print “Hello, World!”
Output: Hello, World!
Server Side Mode Programming:
When you run a program from the interpreter, It won’t exist for a long time. It will delete code after exit from it. You have to save file with .py file extension to run.
$python first.py
Output: Hello, World!