Basics
Data Types and Operators
print () - built-in function that displays input values as text in the output
The pythonic way to name variables is to use all lowercase letters and underscores to separate words. Example:
my_height = 58 my_lat = 40 my_long = 105
Arithmetic Operators
+Addition-Subtraction*Multiplication/Division//Divides and rounds down to the nearest integer%Mod (the remainder after dividing)**Exponentiation (note that^does not do this operation, as you might have seen in other languages)
Assignment Operators
=Assignment+=Addition Assignment-=Subtraction Assignment*=Multiplication Assignment/=Division Assignment%=Remainder Assignment**=Exponent Assignment
Integers and Floats
int - for integer values
float - for decimal or floating point values
x = int(4.7) # x is now an integer 4
y = float(4) # y is now a float of 4.0Last updated
Was this helpful?