A

Admin • 832.52K Points
Coach

Q. How can you convert a string `'123'` to an integer in Python?

Code:
s = '123'
  • (A) int(s)
  • (B) str(s)
  • (C) float(s)
  • (D) bool(s)
  • Correct Answer - Option(A)
  • Views: 24
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

`int()` converts a numeric string to an integer.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.