#Boolean values, comparison operators, and Boolean operators
Operator Meaning
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
Python considers the integer 42 to be different from the string '42'
-
The == operator (equal to) asks whether two values are the same as each other.
-
The = operator (assignment) puts the value on the right into the variable on the left.
##Binary Boolean Operators
Expression Evaluates to...
True and True True
True and False False
False and True False
False and False False
The or operator evaluates an expression to True if either of the two Boolean values is True. If both are False, it evaluates to False
#Flow Control Statements > if, else, and elif`
while Loop Statements
The while loop keeps looping while its condition is True
break Statements
continue Statements
for Loops and the range() Function
print('My name is')
for i in range(5):
print('Jimmy Five Times (' + str(i) + ')')
The above program works as same as following one.
print('My name is')
i = 0
while i < 5:
print('Jimmy Five Times (' + str(i) + ')')
i = i + 1
---
for i in range(12, 16):
print(i)
->12, 13, 14, 15
for i in range(0, 10, 2):
print(i)
->0, 2, 4, 6, 8
for i in range(5, -1, -1):
print(i)
->5, 4, 3, 2, 1, 0
#Importing Modules
Ending a Program Early with sys.exit()