Formatting with Strings


Wondering why this is not an acceptable answer? Results answer the question correctly. Thanks et al.

Oops, try again. Make sure to call capitalize! on first_name, last_name, and city.

print "What's your first name?"  

first_name = gets.chomp.capitalize
puts "Your name is #{first_name}!"
print "What's your last name?"  

last_name = gets.chomp.capitalize
puts "Your last name is #{last_name}!"
print "What's your city?"  

city = gets.chomp.capitalize
puts "Your city is #{city}!"
print "What's your state?"  

state = gets.chomp.upcase
puts "Your state is #{state}!"


Back to instructions..

After each variable assignment: first_name, last_name, and city add the .capitalize! method
For state use the .upcase! method

there is the exclamation mark after .upcase! and capitalize! method .
It simply modifies the string and you dont have to reassign to variable again(As in case of upcase and capitalize method)


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.