Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/usr/bin/python3
# Sample
# python3 palindrome.py "Dabale arroz a la zorra el Abad"
# python3 palindrome.py "Anita lava la tina"
import sys
def checkPalindrome(str):
str = str.replace(" ", "")
if len(str) <= 1:
return True
if str[0].lower() != str[-1].lower():
return False
return checkPalindrome(str[1:-1])
print(f"Is '{sys.argv[1]}' a Palindrome?")
print(checkPalindrome(sys.argv[1]))
#!/usr/bin/python3 # Sample # python3 palindrome.py "Dabale arroz a la zorra el Abad" # python3 palindrome.py "Anita lava la tina" import sys def checkPalindrome(str): str = str.replace(" ", "") if len(str) <= 1: return True if str[0].lower() != str[-1].lower(): return False return checkPalindrome(str[1:-1]) print(f"Is '{sys.argv[1]}' a Palindrome?") print(checkPalindrome(sys.argv[1]))
#!/usr/bin/python3

# Sample
# python3 palindrome.py "Dabale arroz a la zorra el Abad"
# python3 palindrome.py "Anita lava la tina"

import sys

def checkPalindrome(str):
	str = str.replace(" ", "")

	if len(str) <= 1:
		return True

	if str[0].lower() != str[-1].lower():
		return False

	return checkPalindrome(str[1:-1])

print(f"Is '{sys.argv[1]}' a Palindrome?")
print(checkPalindrome(sys.argv[1]))

By horaz

Hello, my name is Horacio Conde, Vic’s proud father, an apprentice maker and a computer science engineer. I live in Mexico City and I’ve been working professionally in software development for more than fifteen years now. I’m very interested in technologies such as programming, The Internet of Things (IoT) (Arduino, Raspberry Pi), electronics, physical computing, automation, woodworking.

Leave a Reply

Your email address will not be published. Required fields are marked *