0

How to write a code to add a sequence D+DD+DDD+DDDD form

in the above sequence value of D is 5 and the sum value is 6710

9th Aug 2018, 5:09 PM
Anand Rajaboina
Anand Rajaboina - avatar
3 Answers
+ 2
print(sum([int('5'*i) for i in range(1,5)]))
9th Aug 2018, 5:14 PM
Louis
Louis - avatar
+ 1
5+55+555+5555=6170
9th Aug 2018, 5:40 PM
Louis
Louis - avatar
0
That's 6170
9th Aug 2018, 5:35 PM
SlowFast
SlowFast - avatar