Python Operators Cheat Sheet - Writeblocked
[Pages:2]Python Operators Cheat Sheet
Assignment
= += -= *= /= etc
Assignment a=2 value of a becomes 2 Addition and assignment Subtraction and assignment all other operators can be using in conjunction with the assignment operator
i+=1 is the same as i=i+1 i-=1 is the same as i=i-1
Arithmetic operators
Operator Description
+
Addition
-
Subtraction
*
Multiplication
/
Division
%
Modulus (or remainder)
** // abs()
Exponent (or power) Floor division (or integer division) absolute value (distance from zero)
3%2=1 10%7=3 2**4=16 3//2=1 10//3=3 abs(-2) = 2 abs(2) = 2
String operators
+
Concatenation
*
Multiplication
[]
index
[:]
slice (or range)
len()
length of string
for I in iteration through characters
"word "+" more" becomes wordmore "word"*2 becomes wordword
len("word") is 4
Comparison Operators
== returns true if values are equal
!=
Returns true if values are not equal
Returns true if values are not equal
>
Greater than
<
Less than
>= Greater than or equal to
1 is true 2 ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- ppyytthhoonn bbaassiicc ooppeerraattoorrss
- modeling with python lehigh university
- scanned by camscanner
- python reference manual mit
- revision of the basics of python
- python basic operators picone press
- introduction to python
- strings in python cs department
- python operators cheat sheet writeblocked
- tokens and python s lexical structure
Related searches
- cheat sheet for word brain game
- macro cheat sheet pdf
- logarithm cheat sheet pdf
- excel formula cheat sheet pdf
- excel formulas cheat sheet pdf
- excel cheat sheet 2016 pdf
- javascript operators cheat sheet
- python cheat sheet pdf
- python functions cheat sheet pdf
- python cheat sheet class
- python cheat sheet pdf basics
- python cheat sheet for beginners