Python 101: Operators

Python… It’s simple, it’s easily readable, and it’s just generally super powerful! What if I told you there is a certain group of symbols…

Python… It’s simple, it’s easily readable, and it’s just generally super powerful! What if I told you there is a certain group of symbols called “operators” that python quite literally would be NOTHING without.

Yep, you guessed it. We are learning about those today! Seeya down below. (And no, not h*ll)


Basic Operators:

''' 
> BASIC OPERATORS 
  SET TO: = [Set a value or variable.] 
  EQUAL TO: == [Compare values, return true if they are the same.] 
  NOT EQUAL TO: != [Compare values, return true if they are different.] 
 
> COMPARISON OPERATORS 
  GREATER THAN: > 
  LESS THAN: < 
  GREATER THAN/EQUAL TO: >= 
  LESS THAN/EQUAL TO: <= 
 
> MATHIMATIC OPERATORS 
  ADDITION: + 
  SUBTRACTION: - 
  MULTIPLICATION: * 
  DIVISION: / 
  MODULUS: % 
  EXPONENTIATION: ** 
  FLOOR DIVISION: // 
 
> LOGIC OPERATORS 
  AND: "and" -> Aslong as both values are true, return True. Else False. 
  OR: "or" -> Aslong as one value is true, return True. 
  NOT: "not" -> Returns true if a value is NOT equal to another value. 
  IS: "is" -> Checks if a variable is the same as another. (Similar to ==) 
  NOT IN: "not in" -> Checks if an item is not in a certain location. 
  IS NOT: "is not" -> Compares the memory location of two objects. 
'''

There are some more operators, but they aren’t as important as the ones above. At least in most situations. You should also know about IF statements. It’s simple! IF (value1) == (value2), then it will return True. Else return False. And yep, we can replace it with: IF (value1 is value2), then it will return True. Well, that is of course if it contains the same value AND type.

Please be sure to check out other articles on my blog to learn more! I hope you enjoyed it. :D