Which built-in function is used to convert a value to an integer?
A. int()
B. integer()
C. to_int()
D. convert_int()
Answer: Option A
Solution (By Examveda Team)
The correct answer is Option A: int().The int() function in Python is used to convert a value to an integer.
It can convert a string representing a number, a float, or even another integer to an integer data type.
For example:
num_str = "10"
num_float = 3.14
converted_str = int(num_str)
converted_float = int(num_float)
print(converted_str) # Output: 10
print(converted_float) # Output: 3

Join The Discussion