6/7 Already Capitalized words are missed out in the output!


#1

My code looks like this:

print "What's your first name?"
first_name=gets.chomp.capitalize!
print "What's your last name?"
last_name=gets.chomp.capitalize!
print "Which city are you in?"
city=gets.chomp.capitalize!
print "Which state are you from?(Use an abbreviation)"
state=gets.chomp.upcase!
puts "Your first name is #{first_name} and your second name is #{last_name}.You are from #{city} in #{state}"

But the inputs that we give in already capitalized form like "Harry" is omitted in output.

How to resolve this error?


#2

Take out the ! operators. Even on upcase.