Does anyone happen to know why the result of executing the below code prints ace alongside the Boys? Given ace is on a separate line plus it isn't indented same as the 2nd line shouldn't it print a second row instead of continuing?
for i in range(8):
print ("Boy", end=" ")
Boy Boy Boy Boy Boy Boy Boy Boy ace
Order of printing
nr: #1 dodano: 2017-12-17 01:12
Think of the 'end' parameter as the controller for the next 'print' statement.
During the last iteration of the loop, the 'end' parameter sets the control on the same line as 'Boy Boy... Boy'. So, ace is printed after space (" ")
By default, the value of 'end' is '\n', which represents new-line. So the control goes to the next line after printing the 'ace'