Answer to Question #238452 in Python for balu

Question #238452

Given

N = 10From 1 to 9, each number contains a single digit. From 10 onwards, the numbers contain two digits.

So the output should be 9 + 2 =

11.

Sample Input 1

10

Sample Output 1

11

Sample Input 2

4

Sample Output

4


1
Expert's answer
2021-09-17T04:13:14-0400
n = int(input('Enter n here: '))
n1 = 0
for i in range(1, n+1):
    n1 = n1 + len(str(i))
print(n1)

Enter n here: 10
11
Enter n here: 4
4

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS