Skip to content

Instantly share code, notes, and snippets.

@housamz
Created February 3, 2020 12:37
Show Gist options
  • Save housamz/be78d8eb7a2aca909510a7de137bcec6 to your computer and use it in GitHub Desktop.
Save housamz/be78d8eb7a2aca909510a7de137bcec6 to your computer and use it in GitHub Desktop.
Python Palindrome
input = int(input("Enter your value: "))
final = ''
for i in range(1, input + 1):
for j in range(input, 0, -1):
final += ' ' if (j < i) else str(j)
for j in range(2, input + 1):
final += ' ' if (j < i) else str(j)
final += '\n'
print(final)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment