-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPalindrome(extended).py
More file actions
37 lines (26 loc) · 851 Bytes
/
Palindrome(extended).py
File metadata and controls
37 lines (26 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import time
print("This program checks to see if a number is a palindrome and is a loop.")
time.sleep(2)
john = True
palindrome_backwards = []
palindrome_backwards_real = ""
def list_(s, z):
for x in s:
z += x
return z
while john is True:
palindrome_backwards_real = ""
palindrome_check = input("Enter a string in: ")
i = len(palindrome_check)
while i > 0:
palindrome_backwards += str(palindrome_check[i - 1])
i = i - 1
palindrome_backwards_real = list_(palindrome_backwards, palindrome_backwards_real)
if palindrome_backwards_real == palindrome_check:
print("This is a palindrome.")
time.sleep(3)
print(50 * "\n")
elif palindrome_backwards_real != palindrome_check:
print("This is not a palindrome.")
time.sleep(2)
print(50 * "\n")