Code to print a Triangle in Python
from math import ceil as ce
def tri(n):
low=n//2
high=n//2
for i in range(ce(n/2)):
for j in range(n):
if(low<=j<=high):
print("*",end="")
else:
print(" ",end="")
print()
low-=1
high+=1
tri(13)
# print(math.ceil(5/2))
Comments
Post a Comment