0

This is my program I can't understand what is wrong with this program. I want to Print the pattern shown in the given sample output

for i in range(1,int(input())):
    print(i for x in list(range(0,i)))

Sample Input:

5

Sample output:

1
22
333
4444

Output Given By the program:

<generator object <genexpr> at 0x7feb4598cdb0>
<generator object <genexpr> at 0x7feb4598cdb0>
<generator object <genexpr> at 0x7feb4598cdb0>
<generator object <genexpr> at 0x7feb4598cdb0>

1 Answers1

0
for i in range(1,int(input())):
    print([i for x in range(0,i)])

Generators in python are defined with (), make sure you use the brackets, to make a list comprehension.

cap
  • 365
  • 2
  • 14