Python is a scripting language that is a powerful dynamically typed language, supports numerous high-level constructs and data structures. Also, learning the basics and writing programs in Python programming is very easy for beginners.
Index
- What is Python?
- Applications of Python Programming.
- Installing Python Programming Language on your device.
- Python
- Loops
- Comparison of Java and Python
- Operator Precedence
- Conclusion
- QnA
What is Python?

What is a Scripting language?
Scripting languages are that programming language that doesn’t need a compiler, instead of the programs directly interpreted.
Do check Our Programming Language Page.
Applications of Python Programming
Python can be used in various applications right from eCommerce website development to email search applications, fraud mail detection, face recognition, and so on.

Python is useful in many computing environments including the following:
- The command line in a monitor or terminal window.
- Graphical User Interface, including the web.
- Mobile devices.
- Embedded Systems.
- The cloud.
- Backend servers.
Installing Python on your device
Go to https://www.python.org/downloads/ to download Python software.
Install the downloaded software.
On your desktop, a console icon is created with the name “python”.
Just run it and start typing your code.
What should you know before moving to Python Programming from any other language?
- You don’t need to declare a variable.
- No need to use data types.
- Neither semicolons
You don’t have to terminate a line, just start with a new line
- To use nesting in if…else you have to use the elif keyword.
- No use of increment( var++ ) or decrement( var– ) keyword.
To increment/decrement, we have to use the standard logic i.e.
var= var+1 or var= var-1
- No need to declare include statements nor the import functions.
- No need to use classes, objects, when there’s no need.
- It is a bit slower for execution.
- But very powerful.
Python Programming in Details
Python Keywords
false | class | finally | is | return |
none | continue | for | lambda | try |
true | def | from | nonlocal | while |
and | def | global | not | with |
as | elif | if | or | yield |
assert | else | import | pass | |
break | except | in | raise |
Comments
If we want to give some information in the code, then we can use the hash character( # ) at the starting of the line.

This ( # ) is a single line comment.
Ex.
#HEY ………
You can also use the multiline comment. Instead of using the hash comment for each line, we can use the triple-double quotes( “”” ).
Ex.
“”” Hey
How are
You??
“””
The comments are ignored.
Writing Your first code in Python Programming Language
Let’s print Hello World.
print(“ Hello World” )
That’s it.
Python doesn’t have Semicolons.
You don’t need to add headers, functions, variables, to print a single word. Just type print and your message.
I told you above, it’s the easiest Programming language.
If you are a beginner then you will not have any problem understanding the programs but if you moved from other programming languages, the logics are simple but some keywords, functions may confuse you because they have a bit different syntax and also you may feel a little hard to resist.
Variables
In python, you don’t have to worry about data types because Python will do it for you automatically.

Ex.
a = 10
b = “Hello”
c = “Hey Google.”
You just have to focus on your logic and program because the syntax is very simple.
Let’s go for the loops.
Loops in Python Programming
Note: Python doesn’t accept braces, So for loops, we are going to use space or tab space.

Let’s suppose, I need to write an if/for multiline statement then after the expression I am going to use a tab space that denotes that the statements which have tab space are going to execute under if/for.
It will look like this.
if /for expression: ——– ——– if/for expression: ——– ——– statements ———— |
- If … else
It is the decision-making loop. There are 3 keywords.
if, else, elif( shorter version of else if )
Syntax:
if expression:
statements
elif expression:
statements
else:
Statements
We don’t use brackets anymore, instead, we use a colon( : ).
Ex.
if n=0:
print(“The number is 0”)
elif n<0:
print(“The number is negative”);
else:
printf(“The number is positive”);
- While loop
As I said above, python doesn’t accept braces, instead, we use a colon( : ).
Syntax:
while expression:
Statements
Ex.
While n>=0:
n=n-1
print(n);
Continue and Break
The continue is a keyword that is used in loops. Whenever the continue keyword is called, it requests the interpreter to skip the below statements and go for the first line of the loop.
if /for expression: ——– ——– if/for expression: continue ——– ——– statements ———— |
Ex.
Run this code and see what the result is.
while n > 0:
n = n -1
if n == 10:
continue
print ‘Current value :’, n
But in the Break keyword, when it’s called, it terminates the loop.
Ex.
if /for expression: ——– ——– if/for expression: continue ——— ——— statements ——- ——- |
Ex.
while n > 0: print 'Current value :', n n = n -1 if n == 5: break
Comparison of Java and Python
Java | Python |
Java programs are compiled and then interpreted into Byte code. | Python programs are interpreted directly like Script languages. |
Use a semicolon(;) for line termination. | No use of the semicolon. |
Uses curly braces to denote the start and the end. | Use space and tab spaces. |
Needs to declare the variable first. | It can be declared a variable at the time of initialization. |
Needs to declare a variable with data types. | No need to use the data types. |
Faster execution than Python. | Slower execution. |
Needs to write longer lines of code compared to Python. | 5 times less code. |
The use of the class is compulsory. | No need to use class until it’s needed. |
Hard to understand, for other people. | Easy to understand. |
Operator Precedence
Operator | Description |
+ | Addition & Multiplication |
/ * % // | Division, Multiplication, Modulo, Floor Division |
** | Exponentiation(raise to the power) |
~ + – | Complement, (+ and – used for the method names ex. [email protected] and [email protected]) |
>> << | Right & Left Bitwise Shift |
& | Bitwise ‘AND’ |
^ | | Bitwise exclusive ‘OR’ and regular ‘OR’ |
<= < > >= | Comparison Operator |
<> == != | Equality Operators |
= %= /= //= -= += *= **= | Assignment Operators |
is is not | Identity Operators |
in not in | Membership Operators |
not or and | Logical Operators |
Input in Python
To get input, Python has an in-built function i.e. input().
Input() functions read input from the console. Read input is always in string format.
Syntax:
input(prompt)
Where the prompt keyword is for a message.
Ex.
//Getting name as input and greeting him/her. myName= input(“ Enter your name”) myName print(‘ Hey! How are you ‘, myName)
Let’s understand
As for the first line, we assign input for the variable myName and print the input prompt message.
The next line variables state that, if the user entered any name then it will store in myName variable.
On the last line, we displayed Hey! How are you with the name that the user entered.
Conclusion
Python is overtaking the C language. Python has been around since 1991 and is considerably and consistently in the top 10 most popular computing languages. Organizations like Google, YouTube, Dropbox, Netflix, and Hulu spend a huge amount on development in Python.
QnA
You have to understand and apply everywhere and solve problems.
Yes.
Yes. But it’s going to take more effort because of the small keyboard.
Guido van Rossum
You can download the Python software or you can run the applications online on the website onlinegdb.com
You completed the basics, now it’s time to go for examples. :- Python Examples and Functions-beginners