Variables, Data Types, and Basic Operations
What this topic covers
Assign values to variables and distinguish strings, numbers, and booleans. Convert input strings to numeric types for arithmetic, while keeping original values when they are needed for records.
Why does int('3.7') raise an error while float('3.7') works?
The int function only accepts text that looks like a whole number, so '3.7' causes a ValueError. Use float('3.7') to get 3.7, then int() on that float if you want to drop the decimal part.