int() do in Python?int() converts a value to an integer type. For example, it can turn a string like "123" or a float like 12.7 into an integer by removing the decimal part.
You use the str() function. For example, str(10) becomes "10" as a string.
int()?It causes an error because int() expects a whole number string. You should convert it first to float() then to int() if needed.
float() do?float() converts a value to a floating-point number (a number with decimals). For example, float("3.14") becomes 3.14.
Because sometimes you need to change data from one type to another to do calculations, display text, or store data correctly. For example, adding numbers needs numeric types, but showing them needs strings.
int("45") return?int("45") converts the string "45" to the integer 45.
str(3.14) return?str(3.14) converts the float 3.14 to the string "3.14".
int() converts a float to an integer by dropping the decimal part.
int("3.5") directly?int() cannot convert a string with decimals directly and raises a ValueError.
First convert the string to float, then convert that float to int: int(float("7.8")).