Sorry if I seem stupid but I need help to understand this code.
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 ;)
Thank you Danigamy
What exactly do you not understand?
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: ***** ***** ***** ***** *****
Yusof Hany You are welcome!
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
Problem Statement Given two integers a and b, your task is to calculate and print the following four values:
Please help, any idea?
Loop question, I've tried everything that I knew I just don't know. Please help me solve it out
Help me wiht python