Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

Stackorigin – The Community of Question and Answers

Stackorigin – The Community of Question and Answers Logo Stackorigin – The Community of Question and Answers Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question

Python Operator’s

Operator is nothing but perform the operation on operands.

There are several operators are there those are:

  • Arithmetic operator
  • Relational operator
  • Logical operator
  • Assignment operator
  • Special operator
  • Concatenation Operator
  • Replication Operator
  • Ternary Operator
  • Special Operator

Arithmetic operator:

AdditionSubtraction
MultiplicationDivision and Floor Division
Modulo DivisionExponent
  1. Addition Operator: Addition operator denoted by “+”
  2. Subtraction Operator: Subtraction Operator denoted by “-”
  3. Multiplication Operator: Multiplication operator denoted by “*”
  4. Division Operator: Division operator denoted by “/”
    • NOTE: Division operator give in float value’s.
  5. Modulo Operator: Modulo operator denoted by “%”
  6. Floor Division Operator: Floor division operator denotes by “//”
    • Note: It will generate int or float depends on value’s.
  7. Exponent Operator: Exponent operator denotes by “**”

Relational operator: Relational operator also know as comparison operator.

>>=<
<===!=
  1. Less Than Operator: Less than operator denotes by “<“
  2. Less Than equal to Operator: Less than equal to operator denotes by “<=”
  3. Greater Than Operator: Greater than operator denotes by “>”
  4. Greater Than equal to Operator: Greater than equal to operator denotes by “>=”
  5. Equality Operator: equality operator denotes by “==”
  6. Not Equality Operator: Not equality operator denotes by “!=”

Logical Operator: Logical operator contains three operator’s. those are

  • Logical And Operator
  • Logical OR Operator
  • Logical NOT Operator
  1. Logical And Operator: Returns true if both statements are true
    • True and True = True
  2. Logical OR Operator: Returns true if one of the statements is true.
    • True or False = True
  3. Logical NOT Operator: Reverse the result, returns false if the result is true.
    • not True = False

Assignment Operator: Assignment operators are used to assign values to variables.

Concatenation Operator:

  • “stackorigin” + 3 => can only concatenate str (not int) to str
  • If we want apply “+” operator for string compalosory both arguments should be string only
    • “stackorigin”+”tutorials” => “stackorigintutorials”

Replication Operator:

  • If we want apply “*” operator compulsory one arguments should be string and another one is int.
    • “Stackorigin” * 2 = StackoriginStackorigin

Ternary Operator: If condition true firstvalue will get or else secondvalue

  • Syntax: firstvalue if condition else secondvalue
    • example: x = 30 if 10<20 else 40

Special Operator: It contain two operator’s.

  1. Identity Operator
  2. Membership Operator

Identity Operator

Membership Operator:

Share
  • Facebook

Sidebar

Ask A Question

Stats

  • Questions 1k
  • Answers 1k
  • Best Answers 80
  • Users 81

Adv 250x250

Adv 234x60

  • Recent
  • Answers
  • ashok

    How do I get the current time?

    • 2 Answers
  • ashok

    How to Install and Use Git on Windows

    • 1 Answer
  • ashok

    How to Check Git Version

    • 2 Answers
  • arjun

    Which institute is best for a data science course in ...

    • 1 Answer
  • ashok

    git stash and git pull

    • 1 Answer
  • pratap
    pratap added an answer How do I get the current time in Python: The time module… June 29, 2022 at 9:08 am
  • pratap
    pratap added an answer How do I get the current time in Python: Use datetime:… June 29, 2022 at 9:04 am
  • hari
    hari added an answer How to Install and Use Git on Windows Git is… June 29, 2022 at 8:24 am
  • sam
    sam added an answer How to Check Git Version: $ git --version git version… June 29, 2022 at 8:13 am
  • sam
    sam added an answer How to Check Git Version: In a command prompt: $… June 29, 2022 at 8:13 am

New Members

Sakshigupta1998

Sakshigupta1998

  • 0 Questions
  • 0 Answers
legal heir certificate online apply

legal heir certificate online apply

  • 0 Questions
  • 0 Answers
Mutual divorce process india

Mutual divorce process india

  • 0 Questions
  • 0 Answers
propertyregistration

propertyregistration

  • 0 Questions
  • 0 Answers
Best Gynecologist Hospital in Delhi

Best Gynecologist Hospital in Delhi

  • 0 Questions
  • 0 Answers

Adv 234x60

Trending Categories

Programming
825Questions
, 0Followers
Technology
209Questions
, 3Followers
General Knowledge
127Questions
, 0Followers
Business & Finance
81Questions
, 4Followers
Employment
73Questions
, 3Followers

Trending Tags

django (95) git (57) google (29) india (35) mysql (22) oil (54) pandas (23) python (241) usa (25) youtube (24)

Recent posts

    • On: June 29, 2022

    Bitbucket Cloud recently stopped supporting account passwords for Git authentication

    • On: June 21, 2022

    Best Telegram Movie Channels

    • On: June 17, 2022

    How to Open ICICI Bank Savings Account

    • On: June 15, 2022

    How to Download Your Own Twitch Videos

    • On: June 14, 2022

    How To Permanently Delete Your PSN Account

Explore Our Blog

Adv 234x60

Subscribe

Explore

  • Recent Questions
  • Most Answered
  • Answers
  • No Answers
  • Most Visited
  • Most Voted
  • Random

Footer

Stackorigin - The Community of Question and Answers

Stackorigin

Stackorigin is the world’s largest Q&A networking site, Stackorigin community brings you the collaboration of all the various Questions and the related Answers given by the community.

About

  • About Us
  • Contact Us
  • FAQ
  • Submit Guest Post Article on Technology, Education, Health, Apps, Gadgets, IoT, AI, Business, Digital Marketing and More

Info

  • Privacy Policy
  • Terms and Conditions
  • Community Guidelines
  • Tags

Products

  • Tutorials
  • Advertising
  • Categories
  • Corona
  • StackHow

Follow

© 2022 Stackorigin. All Rights Reserved.