Ad
Code
Diff
  • def palindrome(string):
        middle = int(len(string) / 2)
        is_palindrome = False
        
        for i in range(0, middle):
            if string[i].lower() == string[-i - 1].lower():
                is_palindrome = True
            else:
                is_palindrome = False
        return is_palindrome
    
    • using System;
    • class Palindrome
    • {
    • public static bool Check(string word){
    • for(int i = 0; i < word.Length; i++)
    • {
    • word = word.ToUpper();
    • if(i >= word.Length /2)
    • {
    • break;
    • }
    • if(word[i] != word[word.Length - 1 - i])
    • {
    • return false;
    • }
    • }
    • return true;
    • }
    • }
    • def palindrome(string):
    • middle = int(len(string) / 2)
    • is_palindrome = False
    • for i in range(0, middle):
    • if string[i].lower() == string[-i - 1].lower():
    • is_palindrome = True
    • else:
    • is_palindrome = False
    • return is_palindrome