files
This commit is contained in:
16
python/12-is-palindrome/README.md
Normal file
16
python/12-is-palindrome/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
Sarah Palindrome
|
||||
============
|
||||
|
||||
Write a function that when given a word or sentence returns True if it is a palindrome and False if it isn't.
|
||||
|
||||
Your program should accept input using sys.argv.
|
||||
|
||||
python3 palindrome.py Taco Cat ###returns true
|
||||
|
||||
###OOP
|
||||
|
||||
Let's make sure this program adheres to good object oriented design. Your main function should ONLY check if it is a palindrome and return True or False. Any other functions you might need, like string operations - should be seperated. Every function should do only one thing.
|
||||
|
||||
|
||||
Make the asserts pass and write more assert statements to test your code.
|
||||
|
14
python/12-is-palindrome/palindrome.py
Normal file
14
python/12-is-palindrome/palindrome.py
Normal file
@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def is_palindrome(string):
|
||||
pass
|
||||
##this function should only check validity of the string, and rely on other functions for string operations
|
||||
|
||||
|
||||
|
||||
|
||||
#assert statements
|
||||
|
||||
assert(is_palindrome('greg is the man') == False), "Presumably random sentence should return false"
|
||||
|
||||
assert(is_palindrome('No Mel Gibson is a casino’s big lemon') == True), "Palindrome should return true"
|
Reference in New Issue
Block a user