ExamVeda
Login
Home
Python Built In Functions
?

Which built-in function is used to convert a value to an integer?

Answer & Solution
Correct Answer: Option A
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
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.