0
Frustrated. How can I refer to an index of a string argument??😭😭😭😭(Line 5)
2 odpowiedzi
+ 2
if string == string[::-1]
+ 1
space =" "
def checkstring(string):
for n in range(len(string)):
if space in string:
spaceremover(string )
if string[n]==string[-(n+1)]:
print ("palindrome")
else:
print ("Not a palindrome")
def spaceremover(string):
Newstring = string.replace(space,"")
checkstring (Newstring)
while True:
yourPalindrome = input("Type a palindrome:")
checkstring(yourPalindrome)