Is there any better way of doing it?Also, how do I make it so that it takes all the numbers are shown upto 1? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Is there any better way of doing it?Also, how do I make it so that it takes all the numbers are shown upto 1?

https://code.sololearn.com/cvLHs9UyAHt5/?ref=app

19th Feb 2020, 11:42 AM
sTiNgRaY
sTiNgRaY - avatar
5 Answers
19th Feb 2020, 12:19 PM
David Ashton
David Ashton - avatar
+ 5
This is just a short form for if j: end=" " else: end="\n" Since False is equivalent to zero and True to anything else, the else branch is only entered if j=0. Otherwise the first branch is entered. You only want line brakes if j becomes 0.
19th Feb 2020, 1:03 PM
Matthias
Matthias - avatar
+ 1
Thanks! Exactly what I was looking for!
19th Feb 2020, 12:21 PM
sTiNgRaY
sTiNgRaY - avatar
+ 1
That explains it! Thanks a ton! Matthias
19th Feb 2020, 1:05 PM
sTiNgRaY
sTiNgRaY - avatar
0
I don't get the if else statement in the end tho...
19th Feb 2020, 12:22 PM
sTiNgRaY
sTiNgRaY - avatar