online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
''' In main, import only your is_palindrome function here: ''' from palindrome import is_palindrome ''' Test cases (Don't mess with anything. We will learn all this stuff, but for now ignore it) ''' def main(): tests = ["ababa", "a", "", "abc", "aaaa", "cc", "tacocat", "$2!taccat!2$", "madam", "adam", "c++", "racecar", "madaminedenimadam", "{}"] for _ in tests: print(f"{_:>18} : {is_palindrome(_)}"); if __name__ == '__main__': main(); is_palindrome(input ('enter a palindrome here: '))
''' Create a function called is_palindrome(). Takes a str and returns a bool. Here is the expected output: ababa : True a : True : True abc : False aaaa : True cc : True tacocat : True $2!taccat!2$ : True madam : True adam : False c++ : False racecar : True madaminedenimadam : True {} : False ''' def is_palindrome (s): v=len (s) i=0 o=-1 while (i<=v and s [o]==s [i]): i+=1 o-=1 if (i==v-1): return (True) else: return (False)

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue