Python – weird number counter printer thingie
Question:
numbers = int(input())
Hi,
I was also given this homework python thingie to do. I am supposed to solve it using some loop or cycle. But I am really lost, because I have no idea, how to solve it. Can someone of you please help me.
"Read a string containing only digits from the input. Print to the output a string that contains each digit from the input as many times as the value of the digit."
Input: 25104
Output: 225555514444
Answers:
You can use a for
loop:
for number in str(numbers):
print(number * int(number), end='')
numbers = int(input())
Hi,
I was also given this homework python thingie to do. I am supposed to solve it using some loop or cycle. But I am really lost, because I have no idea, how to solve it. Can someone of you please help me.
"Read a string containing only digits from the input. Print to the output a string that contains each digit from the input as many times as the value of the digit."
Input: 25104
Output: 225555514444
You can use a for
loop:
for number in str(numbers):
print(number * int(number), end='')