1/29
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
+
Addition - Adds values on either side of the operator
-
Subtraction - Subtracts right hand operand from left hand operand
*
Multiplication - Multiplies values on either side of the operator
**
Exponent - Performs exponential (power) calculation on operators
/
Division - Divides left hand operand by right hand operand
//
Floor Division - The division of operands where the result is the quotient in which the digits after the decimal point are removed.
9//2 is equal to 4 and 9.0//2.0 is equal to 4.0
%
Modulus - Divides left hand operand by right hand operand and returns remainder
<
Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.
>
Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.
<=
Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.
>=
Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.
==
Checks if the value of two operands are equal or not, if yes then condition becomes true.
!=
Checks if the value of two operands are equal or not, if values are not equal then condition becomes true.
<>
Checks if the value of two operands are equal or not, if values are not equal then condition becomes true.
(a <> b) is true. This is similar to != operator.
( )
Used to define the parameters of a function, specify arguments passed to a function, or to specify the order of operations in a formula.
[ ]
Used to create a list object.
{ }
Used to create a dictionary object.
@
This is known as decorator syntax. Decorators allow you to inject or modify code in functions or classes.
@decoratorName
def desiredFunction():
pass
,
Commas separate parameters or arguments.
:
Colons denote the beginning of a block of code, or the presence of an index between the objects on its left and right.
.
A dot separates an object's name from the object's attribute being accessed or method being called. Note that some programmers refer to methods as attributes since they belong to an object.
car.door='red'
car.start()
=
Simple assignment operator, Assigns values from right side operands to left side operand
c = a + b will assign value of a + b into c
;
Semicolons can separate different statements on a single line of code.
a = b; d = b + 1; f = "cat"
+=
Add AND assignment operator. It adds right operand to the left operand and assign the result to left operand.
c += a is equivalent to c = c + a
-=
Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand
c -= a is equivalent to c = c - a
*=
Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand
c = a is equivalent to c = c a
/=
Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand
c /= a is equivalent to c = c / a
//=
Floor Dividion and assigns a value, Performs floor division on operators and assign value to the left operand
c //= a is equivalent to c = c // a
%=
Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand
c %= a is equivalent to c = c % a
**=
Exponent AND assignment operator, Performs exponential (power) calculation on operators and assign value to the left operand
c *= a is equivalent to c = c * a