1/3
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Numeric Data Types
Whole numbers use the int
type (e.g., 3
, 42
)
Decimal numbers use the float
type (e.g., 3.14
, 0.01
)
Use type()
to check a value’s data type
Type Conversion
Mixing int
and float
results in a float
Use int()
to truncate a float (not round)
Use round()
to round a float to the nearest whole number or to a specified number of decimal places
String and Numeric Conversion
Convert strings to numbers: int("32")
, float("32.0")
Convert numbers to strings: str(10)
, str(10.0)
Math Library Usage
Import with import math
Access functions like math.sqrt(x)
, math.sin(x)
, math.log(x)
Constants like math.pi
and math.e
are available