-
-
Save dpickett/f887e6c0386095451f27 to your computer and use it in GitHub Desktop.
names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def palindrome?(the_name) | |
the_name.downcase == the_name.downcase.reverse | |
end | |
def instructor?(the_name) | |
the_name == "Dan" | |
end | |
def ta?(the_name) | |
the_name == "Louise" || the_name == "Beth" || the_name == "Kyle" | |
end | |
names = [] | |
while true | |
puts "What is the name?" | |
name = gets.chomp | |
break if name == 'exit' | |
names << name | |
end | |
for name in names | |
puts "===#{name} Information===" | |
if palindrome?(name) | |
puts "#{name} is a palindrome" | |
else | |
puts "#{name} is not a palindrome" | |
end | |
puts "#{name} spelled backwards is #{name}" | |
puts "There are #{name.length} characters in the name" | |
if instructor?(name) | |
puts "#{name} is the instructor" | |
else | |
puts "#{name} is not the instructor" | |
end | |
if ta?(name) | |
puts "#{name} is a TA" | |
else | |
puts "#{name} is not a TA" | |
end | |
puts "" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment