0
Sorry if I seem stupid but I need help to understand this code.
7 Respostas
+ 1
With end = "" in print you dont make a new line when calling print.
Surrounded by a for loop "*" is printed 5 times in one line.
After the inner for loop you call print () which prints a new line by default so in the 5 iterations of the outer for loop you print 5 lines with each 5 times "*"
And dont call yourself stupid. Everyone has to start at some point ;)
+ 1
Thank you Danigamy
0
What exactly do you not understand?
0
Let's first look at the inner for loop:
for i in range(5):
print("*", end="")
What does it do? It prints "*" for 5 times, each time without moving to a new line. So you get output as:
*****
Now let's look with the outer loop:
for i in range(5):
for i in range(5):
print("*",end="")
print()
It repeats what the inner loop does, for 5 times (plus it adds a new line with print()). And hence "*****" with new line 5 times gives:
*****
*****
*****
*****
*****
0
Yusof Hany You are welcome!
0
thank youJnn
0
you could have just run the code its kinda self explanatory you should learn the basics or at least play with the code and see what it does