0

for loops in pyhon

I see a code on the internet and I can't understand why print() is used in the outer loop?? rows = int(input("how many rows?")) columns = int(input("how many columns?")) symbol = input("enter your symbol : ") for i in range(rows): for j in range(columns): print(symbol, end="") print()

18th Mar 2024, 12:05 AM
Yashar
Yashar - avatar
2 Answers
+ 11
What it does is print a new line when all columns of symbols have been printed You can understand it if you comment the #print() and you will see that the result would be pasted on the same line
18th Mar 2024, 12:43 AM
STE4LPH
STE4LPH - avatar
+ 2
Yashar , Ah. A new misspelling specimen for my collection, pyhon. Collected so far: pthon Pthon Puthon Phyton Putgon pyhton pyhon
18th Mar 2024, 2:48 AM
Rain
Rain - avatar