Skip to content

Instantly share code, notes, and snippets.

@dpickett
Created February 27, 2014 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpickett/f887e6c0386095451f27 to your computer and use it in GitHub Desktop.
Save dpickett/f887e6c0386095451f27 to your computer and use it in GitHub Desktop.
names
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