The word is "racecar" and this is the triangle I'm supposed to get:-
e
cec
aceca
racecar
I'm using python 2.7 I'm trying to make it using for loops. Thank you. this is the output I am getting
e
e c c
e c a a c
e c a r r a c
e c a r r r r a c
ive found the mid value and tried printing it. But the output I am getting always has e at the beginning. I am not able to get the alphabets before e and after e to print.
m="racecar"
mid=len(m)/2
for i in range(0,5):
for k in range(0,i):
print m[mid-k],
for j in range(i,0,-1):
print m[mid-j],
print
I have tried more but somehow I'm not getting the output in the proper order.