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)
πŸ’¬ Discuss
βœ… Correct Answer: (A) int(s)
Explanation: `int()` converts a numeric string to an integer.
Explanation by: Mr. Dubey
`int()` converts a numeric string to an integer.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
96
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
92%
Success Rate