Determine the sequence of 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 on Python 3
📁 python, пример, работа
I try to solve the problem:
Write a program that displays part of the sequence of 1 2 2 3 3 4 4 4 4 5 5 5 5 5 ... (the number is repeated so many times, which is equal). The input program transmits a positive integer N&MDash; So many elements of the sequence should display the program. At the output, a sequence of numbers recorded through a gap in one line is expected.
for example, if n = 7, then the program should dial 1 2 2 3 3 3 4.
sample input: 7
sample output: 1 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4
This is what it tus out, the problem is that it doesn’t work on large numbers.
a = int ( input ()) b = '' ' for i in range (a+ 1 ): b = b + ( str (i) + '' )*it print (b [ 0 : a* 2 ])