Which function converts a string to an integer in Python?
-
A
str()
-
B
int()
Correct answer
-
C
float()
-
D
bool()
10 views
Explanation
int() converts a string (or float) to an integer. Source: Standard Python content (FBISE-aligned).
Reference
Asked in: Matric,FBISE
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ