Python basics for absolute beginners

in #new6 years ago (edited)

Python is widely used general-purpose, high level programming language. It was initially designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was mainly developed for emphasis on code readability, and its syntax allows programmers to express concepts in fewer lines of code. Python is a programming language that lets you work quickly and integrate systems more efficiently. There are two major Python versions- Python 2 and Python 3. Both are quite different. Beginning with Python programming:

 1) Finding an Interpreter:

Before we start Python programming, we need to have an interpreter to interpret and run our programs. There are certain online interpreters like http://ideone.com/ or http://codepad.org/  that can be used to start Python without installing an interpreter.

 Windows:There are many interpreters available freely to run Python scripts like IDLE ( Integrated Development Environment ) which is installed when you install the python software from http://python.org/

 Linux:For Linux, Python comes bundled with the linux. 

2) Writing first program: Following is first program in Python 

# Script Begins 

print("GeeksQuiz")

 # Scripts Ends 

Output: GeeksQuiz 

Let us analyze the script line by line. 

Line 1 : [# Script Begins]  In Python comments begin with #. So this statement is for readability of code and ignored by Python interpretor. 

Line 2 : [print(“GeeksQuiz”)] In a Python script to print something on the console print() function is used – it simply prints out a line ( and also includes a newline unlike in C ). One difference between Python 2 and Python 3 is the print statement. In Python 2, the “print” statement is not a function, and therefore can be invoked without a parenthesis. However, in Python 3, it is a function, and must be invoked with parentheses.

 Line 3 : [# Script Ends] This is just another comment like Line 1.

 Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. 

Coin Marketplace

STEEM 0.28
TRX 0.13
JST 0.032
BTC 60947.53
ETH 2913.40
USDT 1.00
SBD 3.56