Python: is a widely used general-purpose, high level programming language. It was created by Guido van Rossum in 1991 and further developed by the Python Software Foundation. Python is also known as scripting language.
Python syntax allows programmers to express their concepts in fewer lines of code.
Scripting Language:
A script or scripting language is a computer language that does not need the compilation step and is rather interpreted one by one at runtime. To execute or run python script we need interpreter. As compared to programming languages that are compiled first before running, scripting languages do not compile the file and execute the file without being compiled. For compiling programming languages needs Compiler.
Scripting languages can be used on server as well as client side.
Most popular scripting languages are -> Python ,PHP,javascript,ruby,R etc
Interpreter:In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program.
Compiler: A compiler is a special program that translates a programming language's source code into machine code, bytecode or another programming language.
Beginning with Python programming:
1. Finding an Interpreter: To Execute or run Python script ,we need to have an interpreter to interpret and run our python script. There are certain online interpreters that can be used to run Python programs without installing it.
Different interpreters are available for different platform.
windows: There are many interpreters available freely to run Python scripts for e.g Python IDLE (Integrated Development Environment) that comes bundled with the Python software,can be downloaded from http://python.org/.
Linux: Python comes preinstalled with popular Linux distros such as Ubuntu and Fedora. To check which version of Python you’re running, type “python” in the terminal emulator. The interpreter should start and print the version number.
macOS: Generally, Python 2.7 comes bundled with macOS.
You’ll can manually install Python Moduleshttp://python.org/3/.
2.Python first program:
Start interpreter and type in the following code .
# Beginning of Script
print("Wellcome To Python")
# end of Script
Output:
Wellcome to Python
Let’s understand the script line by line
Line 1: # Beginning of Script => this is comment in python, comments are used for documentation purpose or description about the script.In Python, comments begin with a #. This statement is ignored by the interpreter.
Line 2: print(“Wellome to python”) => To print something on the console, print() function is used. This function also print a newline after the message is printed.
print(“”): is function python used to show message on Console. It is Function in Python 3. Version but in Python 2 it was simply the Keyword not function, so we had to use print without parentheses ().
However, in Python 3, it is a function and must be invoked with parentheses.
Line 3: #end of Script =>This is just another comment. This is used to Documentation purpose like line no 1.