Guest User

Untitled

a guest
Jan 11th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 1.04 KB | None | 0 0
  1. #For those just starting out, one suggested way to work on your code is to have a command window open and a text editor with this
  2. #file loaded.  Make changes to this file and then run 'ruby part1.rb' at the command line, this will run your program.  Once you're
  3. #satisfied with your work, save your file and upload it to the checker.
  4.  
  5.  
  6. def palindrome?(str)
  7.   # YOUR CODE HERE
  8. end
  9.  
  10. def count_words(str)
  11.   # YOUR CODE HERE
  12. end
  13.  
  14.  
  15. #the code below this line will test your functions.  You should remove everything below this line prior to submitting your file
  16.  
  17.  
  18. test_str = "there goes the neighborhood"
  19.  
  20. if palindrome? test_str
  21.   puts test_str + " is a palindrome!"
  22. else
  23.   puts test_str + " is NOT a palindrome!"
  24. end
  25.  
  26.  
  27. test_str = "Madam, I'm Adam"
  28.  
  29. if palindrome? test_str
  30.   puts test_str " is a palindrome!"
  31. else
  32.   puts test_str " is NOT a palindrome!"
  33. end
  34.  
  35.  
  36. test_str = "The rent is due on the first day of the month unless the first day of the month falls on a Saturday or Sunday"
  37.  
  38. word_count = count_words test_str
  39. puts word_count
Add Comment
Please, Sign In to add comment