Python Practice › String Programs › Program 85
Add two numeric strings
Write a Python program to add two strings as numbers and return a string.
Input
"3", "7"
Output
'10' | without conversion: 37
Approach
- Convert to int, add, convert back.
Solution
a, b = "3", "7"print(repr(str(int(a) + int(b))), "| without conversion:", a + b)Output
'10' | without conversion: 37
Learn the concept
New to this topic? Read the lesson, then come back.