k = 5
for j in range(5 ,0, -1):
if(j < k):
#print ((" " * (k - j)) + ("*" + " ") * (j))
if (j - 2 > 0):
print ((" " * (k - j)) + "*" + (" " * ((j - 2) * 2 + 1)) + "*")
else:
print ((" " * (k - j)) + ("*" + " ") * (j))
else:
#print ("*" + (" " * (j -2))) * 2
print "*" + (" " * ((j - 2) * 2 + 1)) + "*"
#print "Done with descending"
for x in range(1, 6):
if(x < k):
if(x - 2 >= 0):
print ((" " * (k - x - 1)) + "*" + (" " * ((x - 1) * 2 + 1)) + "*")
else:
print ((" " * (k - x - 1)) + ("*" + " ") * (x + 1))
Output:
* *
* *
* *
* *
*
* *
* *
* *
* *
for j in range(5 ,0, -1):
if(j < k):
#print ((" " * (k - j)) + ("*" + " ") * (j))
if (j - 2 > 0):
print ((" " * (k - j)) + "*" + (" " * ((j - 2) * 2 + 1)) + "*")
else:
print ((" " * (k - j)) + ("*" + " ") * (j))
else:
#print ("*" + (" " * (j -2))) * 2
print "*" + (" " * ((j - 2) * 2 + 1)) + "*"
#print "Done with descending"
for x in range(1, 6):
if(x < k):
if(x - 2 >= 0):
print ((" " * (k - x - 1)) + "*" + (" " * ((x - 1) * 2 + 1)) + "*")
else:
print ((" " * (k - x - 1)) + ("*" + " ") * (x + 1))
Output:
* *
* *
* *
* *
*
* *
* *
* *
* *
No comments:
Post a Comment