So I want to print this:
*
**
***
****
*****
And my code is:
for row in range(1,6):
for col in range(row):
print('*', end="")
print('')
My question is about print function, since it includes new line. Knowing some C before, I just can't figure it out what the last print('') does, and why my code doesn't work without it.
The end=''
parameter to the first call to print
suppresses printing a newine after the *
, and the second call to print
prints only a newline.