Formatting with Strings


#1



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

https://www.codecademy.com/en/courses/ruby-beginner-en-MxXx5/0/6?curriculum_id=5059f8619189a5000201fbcb


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}!"

https://www.codecademy.com/en/courses/ruby-beginner-en-MxXx5/0/6?curriculum_id=5059f8619189a5000201fbcb


#2

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)


#3

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