﻿ Python: Compute the digit number of sum of two given integers - w3resource

# Python: Compute the digit number of sum of two given integers

## Python Basic - 1: Exercise-33 with Solution

Write a Python program to compute the digit number of sum of two given integers.

Input:
Each test case consists of two non-negative integers x and y which are separated by a space in a line.
0 ≤ x, y ≤ 1,000,000

Pictorial Presentation:

Sample Solution:

Python Code:

``````print("Input two integers(a b): ")
a,b = map(int,input().split(" "))
print("Number of digit of a and b.:")
print(len(str(a+b)))
``````

Sample Output:

```Input two integers(a b):
5 7
Number of digit of a and b.:
2
```

Flowchart:

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿

## Python: Tips of the Day

What is the difference between Python's list methods append and extend?

append: Appends object at the end.

```x = [1, 2, 3]
x.append([4, 5])
print (x)
```

Output:

```[1, 2, 3, [4, 5]]
```

extend: Extends list by appending elements from the iterable.

```x = [1, 2, 3]
x.extend([4, 5])
print (x)
```

Output:

```[1, 2, 3, 4, 5]
```

Ref: https://bit.ly/2AZ6ZFq