Operators in Python Programming
In this blog, we will continue to learn operators in Python Programming. We’ve learned about arithmetic, assignment and conditional operators.
Why Python Programming?
Because Python is easy to learn. It’s code structure is very simple while other programming languages have complex code structure(i.e, C++, Java, etc). It is the best programming language for a beginner to start to learn how to code. It is widely using in whole over the world. However, It is very demanding language in industry as It is used in Machine Learning, Artificial Intelligence etc.
Types of Operators in Python Programming
Operators are divided into following types in Python:
- Arithmetic operators
- Assignment operators
- Comparison operators
- Logical operators
- Identity operators
- Membership operators
- Bitwise operators
So, We have learn about Arithmetic, Assignment and Comparison operators. Now continuing with rest operators.
Logical operators
Logical operators are used to combine conditional statements. For example, and, or, not.
- and : It returns True if both statements are true.
- or : It returns True if one of the statements is true.
- not : It reverses the result, returns False if the result is true and vice-versa.
a = 10
b = 15
c = 20
d = 20
print(a<b and c>b)
print(b<c or a==c)
print(not(c==d))
OUTPUT:
True
True
False
Python Identity Operators
It compares the objects, not if they are equal, but if they are actually the same object, with the same memory location.
- is : It returns True if both variables are the same object.
- is not : It returns True if both variables are not the same object.
x =10
b = 20
p = x
print(x is p)
print(x is not p)
OUTPUT:
True
False
Comments in Python Programming:
You can write comments in your python code for making code more understandable. We use “#” for commenting.
print("Hello") # This says Hello!
a = 5
b=6
print(a+b) # This prints sum of two values
In above code, our python compiler will ignore the comments and that’s why, It will not throw any error.
OUTPUT:
Hello
11
So, We have learned about some more operators, We would continue to learn about rest operators. Also, We will learn more about other types of operators too. So, Be updated on our websites, We will try our best to give a bright path to your career.
However, You can join our whatsapp and telegram groups for daily opportunities links are given below.
Also, Have a look on my previous blogs, In my last blog, I discussed about some operators.click here
Recent Job Posts
- Engineering Jobs (BE/Btech/ME/Mtech)
- Motherson (MSSL) Off Campus Drive 2021
- Experienced Jobs (Jobs for experienced professionals)
- Nielsen Off Campus Drive 2021 | Trainee Analyst
- Management Jobs (MBA/BBA etc. jobs)
- Jobs for BA/MA and other graduates
- Prepare for CAT Exam 2021
- Anagha Engineers Digital_Marketing internship
- Mechanical Engineering Internship 2021
- HackerRank Off Campus Drive 2021
- Stellar Infosys Web_Development Internship
- Mechanical Engineering Jobs
[ Important ]
- All Company names, logos, and brands are the Intellectual Property of their respective owners. All company, product, and service names used on this website are for identification purposes only.
- We are not associated with any company/agency/agent whose jobs are posted on mechomotive.com, We are just an information provider for job openings. Read our Disclaimer Policy and Term of Service for more information
For more job offers, CLICK HERE