Python Practice › String Programs › Program 85

Add two numeric strings

EasyString Programs · 85 of 106

Write a Python program to add two strings as numbers and return a string.

Advertisement
Input
"3", "7"
Output
'10' | without conversion: 37

Approach

  1. Convert to int, add, convert back.

Solution

Python
a, b = "3", "7"print(repr(str(int(a) + int(b))), "| without conversion:", a + b)
Output
'10' | without conversion: 37
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More string programs

← All 106 String Programs