MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / palindromeCheck

Function palindromeCheck

GeeksForGeeks/Pallindrome String/solution2.py:6–22  ·  view source on GitHub ↗

This function checks if a string is a palindrome by comparing a string with it's reverse

(string: str)

Source from the content-addressed store, hash-verified

4"""
5
6def palindromeCheck(string: str) -> str:
7 """
8 This function checks if a string is a palindrome
9 by comparing a string with it's reverse
10 """
11
12 # convert the string to all lower case
13 lower_string = string.lower()
14
15 # create a reversed version of the string
16 string_reverse = lower_string[::-1]
17
18 # compare the string with its reverse
19 if lower_string == string_reverse:
20 return True # string is a palindrome
21 else:
22 return False # string is not a palindrome
23
24# Test case 1
25print(palindromeCheck("RaCecAr")) # returns True

Callers 1

solution2.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected