Skip to main content
added 39 characters in body; edited tags; edited title
Source Link
Peilonrayz
  • 43.5k
  • 7
  • 76
  • 155

Is my Python palindrome program correct and in an organized way?

I have written a palindrome program. And I was just wondering if it correct? I checked using the words racecar and madam, and it says they are palindromes. I have also tested nonpalindrome words and it worked correctly.

Is my implementation correct? If it's not could you correct it for me. It it works correct, is there an easier way to implement this?

def is_palindrome(x):

    for i in range(0,len(x)):
        x = x.lower()
        if x[i::1] == x[::-1]:
            return("%s Is a palindrome" %(x))
        else:
            return("%s Is not a palindrome" %(x))

print(is_palindrome('racecar'))

Here is my palindrome program I was just wondering is it right? I checked using the words racecar and madam and it says they are palindrome and I tested nonpalindrome words and it worked. Can someone tell me if it is wrong and then correct me on my mistakes or If its right but there is an easier way can you show me?

Is my palindrome program correct and in an organized way?

def is_palindrome(x):

    for i in range(0,len(x)):
        x = x.lower()
        if x[i::1] == x[::-1]:
            return("%s Is a palindrome" %(x))
        else:
            return("%s Is not a palindrome" %(x))

print(is_palindrome('racecar'))

Here is my palindrome program I was just wondering is it right? I checked using the words racecar and madam and it says they are palindrome and I tested nonpalindrome words and it worked. Can someone tell me if it is wrong and then correct me on my mistakes or If its right but there is an easier way can you show me?

Python palindrome program

I have written a palindrome program. And I was just wondering if it correct? I checked using the words racecar and madam, and it says they are palindromes. I have also tested nonpalindrome words and it worked correctly.

Is my implementation correct? If it's not could you correct it for me. It it works correct, is there an easier way to implement this?

def is_palindrome(x):

    for i in range(0,len(x)):
        x = x.lower()
        if x[i::1] == x[::-1]:
            return("%s Is a palindrome" %(x))
        else:
            return("%s Is not a palindrome" %(x))

print(is_palindrome('racecar'))
Tweeted twitter.com/StackCodeReview/status/1222852102067757056
Became Hot Network Question
Source Link

Is my palindrome program correct and in an organized way?

def is_palindrome(x):

    for i in range(0,len(x)):
        x = x.lower()
        if x[i::1] == x[::-1]:
            return("%s Is a palindrome" %(x))
        else:
            return("%s Is not a palindrome" %(x))

print(is_palindrome('racecar'))

Here is my palindrome program I was just wondering is it right? I checked using the words racecar and madam and it says they are palindrome and I tested nonpalindrome words and it worked. Can someone tell me if it is wrong and then correct me on my mistakes or If its right but there is an easier way can you show me?