0% found this document useful (0 votes)
15 views3 pages

Python Operators and Functions CheatSheet

This cheat sheet provides a comprehensive overview of Python operators, including arithmetic, relational, logical, bitwise, assignment, membership, identity, and unary operators. It also lists common built-in functions such as print(), input(), len(), and others. This resource serves as a quick reference for Python programming syntax and functionality.

Uploaded by

rajeshtiwari0232
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Python Operators and Functions CheatSheet

This cheat sheet provides a comprehensive overview of Python operators, including arithmetic, relational, logical, bitwise, assignment, membership, identity, and unary operators. It also lists common built-in functions such as print(), input(), len(), and others. This resource serves as a quick reference for Python programming syntax and functionality.

Uploaded by

rajeshtiwari0232
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Python Operators and Built-in Functions - Cheat Sheet

1. Arithmetic Operators

+ : Addition (e.g., a + b)

- : Subtraction (e.g., a - b)

* : Multiplication (e.g., a * b)

/ : Division (e.g., a / b)

// : Floor Division (e.g., a // b)

% : Modulus (e.g., a % b)

** : Exponentiation (e.g., a ** b)

2. Relational (Comparison) Operators

== : Equal to (a == b)

!= : Not equal to (a != b)

> : Greater than (a > b)

< : Less than (a < b)

>= : Greater than or equal to (a >= b)

<= : Less than or equal to (a <= b)

3. Logical Operators

and : Logical AND (a and b)

or : Logical OR (a or b)

not : Logical NOT (not a)

4. Bitwise Operators

& : Bitwise AND (a & b)

| : Bitwise OR (a | b)

^ : Bitwise XOR (a ^ b)

~ : Bitwise NOT (~a)

<< : Left Shift (a << 2)

>> : Right Shift (a >> 2)


Python Operators and Built-in Functions - Cheat Sheet

5. Assignment Operators

= : Assign (a = b)

+= : Add and assign (a += b)

-= : Subtract and assign (a -= b)

*= : Multiply and assign (a *= b)

/= : Divide and assign (a /= b)

//= : Floor divide and assign (a //= b)

%= : Modulus and assign (a %= b)

**= : Exponentiate and assign (a **= b)

&= : Bitwise AND and assign

|= : Bitwise OR and assign

^= : Bitwise XOR and assign

<<= : Left shift and assign

>>= : Right shift and assign

6. Membership and Identity Operators

in : True if value in sequence (x in y)

not in : True if value not in sequence

is : True if same object (x is y)

is not : True if not same object

7. Unary Operators

+ : Unary plus

- : Unary minus

not : Logical NOT

~ : Bitwise NOT

8. Python Built-in Functions (Common)

print(), input(), len(), type(), str(), int(), float()

list(), dict(), set(), tuple(), range(), zip()


Python Operators and Built-in Functions - Cheat Sheet

max(), min(), sum(), abs(), round(), sorted()

all(), any(), dir(), help(), eval(), exec()

enumerate(), map(), filter(), reduce() (from functools)

You might also like