+ 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()

9th Aug 2020, 11:24 AM
Shivam Kumar
Shivam Kumar - avatar
4 Antworten
+ 5
So what you don't understand really?
9th Aug 2020, 11:37 AM
Abhay
Abhay - avatar
+ 2
After print in first one Syntax
9th Aug 2020, 12:33 PM
Shivam Kumar
Shivam Kumar - avatar
+ 2
From "n
9th Aug 2020, 12:33 PM
Shivam Kumar
Shivam Kumar - avatar
+ 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
9th Aug 2020, 9:19 PM
Arshia Tamimi
Arshia Tamimi - avatar