You are viewing a single comment's thread. Return to all comments →
w = 4*n-3 chars = [] line = "" lines = [] for i in range(n): chars.append(chr(96+(n-i))) line = "-".join(chars + chars[-2::-1]) lines.append(line.center(w,"-")) print("\n".join(lines + lines[-2::-1]))
chars[-2::-1] is the same as list(reversed(chars[:-1]))
chars[-2::-1]
list(reversed(chars[:-1]))
Seems like cookies are disabled on this browser, please enable them to open this website
Alphabet Rangoli
You are viewing a single comment's thread. Return to all comments →
chars[-2::-1]is the same aslist(reversed(chars[:-1]))