Skip to main content

follow us

Python Intro


What is python?

Python is a high-level programming language, created by Guido van Rossum, and released in 1991. Python is created to be easy in use by human beings.

Python is used for web development (server-side), software development, mathematics, system scripting.

As a high-level programming language, Python cannot directly be executed by a computer.

Why Python?

Python community is an incredibly diverse and welcoming community. Having a well-connected and supportive community is critical in helping you solve problems.

Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.

Python Syntax

Python Syntax also builds to make clean code. Your code will be easy to read, debug, extend, and build upon, compared to other languages.

Python Syntax uses English as its basis for human language. Python was designed for readability and has some similarities to the English language with influence from mathematics.

Python uses new lines to complete a command, as opposed to other programming languages that often use semicolons or parentheses.

Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions, and classes. Other programming languages often use curly-brackets for this purpose.

How to execute Python Syntax?
Python Syntax can be executed by writing directly in the Command Line:

>>> print("Hello, World!")
Hello, World
!

Or by creating a Python file on the server, using the .py file extension, and running it in the Command Line:

C:\Users\Your Name>python myfile.py


Python Indentation

Indentation refers to the spaces at the beginning of a code line. Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. Python uses indentation to indicate a block of code. 

Example:
if 5 > 2:
    print("Five is greater than two!")


Python will give you an error if you skip the indentation:

Syntax Error:
if 5 > 2:
print("Five is greater than two!")

You have to use the same number of spaces in the same block of code, otherwise, Python will give you an error:

Syntax Error:
if 5 > 2:
        print("Five is greater than two!")
            print("Five is greater than two!")

Python Print Function

Print Function is mostly used to debugging.

The purpose of this Print Function is to tell you where you are in the script.

By using Print Function, you can print out the changes that are made so you can see what's like happening under the hood.

Parentheses are not needed around the phrase you want to print in Python 2.

Example:
>>> python2.7
>>> print "Hello Python 2.7 world!"

Hello Python 2.7 world!


How does print function work? 
You call the function name and in parentheses you put the functions parameter.

print ('This is an example of print function')
This is an example of print function


References:
https://www.w3schools.com/

You Might Also Like:

Comment Policy: Be polite, and don't Spam, Thanks
open comment