int
Integers int represent whole numbers, either positive or negative.
float
Floating-point numbers float represent decimal values, either positive or negative.
bool
Booleans bool represent True or False values, often used in conditionals.
str
Strings str are sequences of Unicode characters.
None
The value None represents the absence of a value.
Data Types: Exercises
Calculate the slope from these two points (2, 3) and (5, 11).
Calculate the percentage change if price goes from 120\$ to 150\$ (answer should be in decimal format; i.e. 0.3 for 30\% )
A student has grades: 80 (weight 30\%), 90 (weight 50\%), 70 (weight 20\%). Calculate the grade of the student.
Two independent events A and B have probabilities P(A)=0.3 and P(B)=0.5. Calculate the probability that both events occur P(A \cap B).
A population of 1000 grows at 5\% per year, compounded annually. Calculate population after 3 years using:
P = P_{0}*(1 + r)^t