Save
Tve 3
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Stella Bagotao
Visit profile
Cards (22)
Arithmetic
Operators
Operations that can be performed on
numbers
Subtraction
Operation where one number is taken
away
from another
Subtraction
10 - 5 = 3
Addition
5 + 3
Multiplication
5 * 3
Division
Operation where one number is
divided
by another
Division
5 / 3
Modulus
Operation that returns the
remainder
of a division
Modulus
5 % 3 = 2
Floor
Division
Operation
that returns the integer part of a division
Floor Division
5 // 3 = 1
Exponent
Operation that
raises
a number to a
power
Exponent
5 ** 3 =
125
PEMDAS rule:
Parentheses
,
Exponents
, Multiplication/Division, Addition/Subtraction
Whitespace
in
between
operators and values doesn't matter for Python
Input
statement
Allows a user to
input
data in the console and stores it in a
variable
Input statement syntax: variable =
input()
or variable = input("prompt")
Input
statement stores
input
as a string by default
len
() function
Counts the
number of characters
including
whitespaces
in a sentence, phrase or word
len(
)
function
len('hello')
returns
5
len
('I look good today.')
returns
18
str(
)
,
int(
)
,
float(
)
functions
Used to
convert
variables/constants to a desired data type (
casting
)
Strings
and integers/floats cannot be concatenated together without using str(), int() or
float
()