Programming Concepts 003 Flashcards
What is modulo?
Division that returns the the remainder after the operation
What symbol represents modulo?
% (E.g. 5 % 2 = 1)
What is integer division?
Division that returns a rounded down result
What symbol represents integer division?
// (E.g. 5 // 2 = 2)
What would 5/2 return in python?
2.5
What is a unary operator?
An operator that sits directly next to a variable & changes it’s negativity (E.g. if x = 5, -x = -5, and vice versa). These are limited to + and -
What is a bitwise operator?
An operator that works on the binary attribute of a number (E.g. The representation of 50 in binary is: “00110010” (x) and 19 is “00010011” (y). x & y is 00010010, or 18).
How do you turn an integer into binary in python?
:08b suffix (E.g. if x = 100, x:08b = 01100100).
How do you type “equal to” in python?
==
How do you type “not equal to” in python?
!=
How do you type greater and less than in python?
< & >
How do you type greater than or equal to and less than or equal to in python?
<= & >=