Turned over several blogs have not found, or know the strong ah ....
such as output
*
**
***
****
*****
In Python, add a comma after the print, although there is no line break, but an extra space is output
After the print is added end= "", that is, print ("*", end= ""), is the content in Python3, to be in 2. x, you need to increase the from __future__ import Print_functio in the first line of code
In Python2, add a comma at the end of the print to eliminate the wrapping, and there are extra spaces between the asterisks, as follows:
*
* *
* * *
* * * *
* * * * *
#from __future__ Import print_function
i = 1 while
i <= 5:
j = 1 while
j <= I:
if J < i:
print "*",
else:
print ("*")
J + + 1
#print
i = 1
In Python2, the correct code is as follows:
From __future__ import print_function
i = 1 while
i <= 5:
j = 1 while
j <= I:
if J < i:
# Output character "*"
print ("*", end= "")
Else:
print ("*")
J + + 1
#print
i = 1
Or: The simple output line wrap is print ("")
From __future__ import print_function
i = 1
while I <= 5:
j = 1 while
j <= I:
print ("*", End = "")
J + + 1
print ("")
i = 1