+ 2
Plz make me understand it really 😭
print('\n'.join([''.join(['{}'.format(i) for i in range(1,j)]) for j in range(2,6)])) It is equal to this That I know For i in range(1,4) For j in range(1,I) Print(j,end="") Print()
4 odpowiedzi
+ 5
So what you don't understand really?
+ 2
After print in first one Syntax
+ 2
From "n
+ 1
Lets Start with most inside thing.
x = ['{}'.format(i) for i in range(1,j)]
now we can see There is a list contains i in (j - 1) times.
Then you can see this:
y = [''.join(x) for j in range(2,6)] # x is what we calculated before
join method will connect array elements together. For example:
####### Example #######
x = ['name', ':', 'Arshia']
print(''.join(x)) # Output is name:Arshia
####### Example #######
And this thing repeats in 4 times.
Now next sentence:
print('\n'.join(y))
the final part is parsing into (separated/delimited i dont know i cant speak well 😶) lines. at the end answer might be:
12
123
1234
12345