Skip to content

Instantly share code, notes, and snippets.

@lyntco
Last active August 29, 2015 14:07
Show Gist options
  • Save lyntco/2438f194fd89a01ecf43 to your computer and use it in GitHub Desktop.
Save lyntco/2438f194fd89a01ecf43 to your computer and use it in GitHub Desktop.
Quiz-4 Palindrome

Quiz 4 Palindrome

Write a program that checks whether input is a palindrome or not.

Example method call:

is_palindrome?('maddam') # => true
is_palindrome?("a man a plan a canal panama") # => true
is_palindrome?('i'm the goddamn batman') # => false

Extension

Write is_palindrome? into a ruby String method. (Monkeypatching)
This means you can call this method directly on a string instead of passing the string into the function.

"maddam".is_palindrome? # => true
"a man a plan a canal panama".is_palindrome? # => "true"
"i'm the goddamn batman".is_palindrome? # => false 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment