How To Make Triangle Using Python 2.7
I want to create the hollow triangle pattern in python 2.7 like this * * * * * * * * * * * * I think I can use loop code line = 5 for i in range (line): print
Solution 1:
line = 5
print (line-1) * " " + "* "
for i in xrange(1,line-1):
print (line-i-1)* " " + "*" + (2*i -1)*" " + "* "
print (line) * "* "
Post a Comment for "How To Make Triangle Using Python 2.7"