Lecture 3 Flashcards
=
Is the assignment operator and is not an = as we used it in mathematics. For example i=i+5 is valid
+
Addition
-
Subtraction
*
Multiplication
/
Division
//
Floor division
%
Modulus (remainder)
**
Exponentiation
-
Unary minus
+
Unary plu
What type of variable will division return?
A float
()
Parentheses
+x , -x
Unary plus/minus
Is and is not
Our identity operators, and check the memory location of two variables. They do not compare values.
In and not in
Our membership operators and check if a character is in a string
&
And
|
Or
XOR
~
Not (bit inversion)
«
Left shift
> >
Right shift
Conditionals definition
Conditionals or construct in programming languages that control the flow of a program based on whether a condition is true or false
If statement
Executes code only if the statement is true
None
Has no value and it of the type Nonetype
Else
The L statement is used to execute a certain block of code if and only if the proceeding if statement condition is false.
Elif
The elifstatement is used to execute a certain block of code if and only if the proceeding if statement condition is false, and the elf condition is true.