There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
ok, yeah i have the same issue.
my code looks as such:
print "What’s your first name? "
first_name = gets.chomp
print "What’s your last name? "
last_name = gets.chomp
print "What city are you from? "
city = gets.chomp
print "What state is that city in? "
state = gets.chomp
puts “Your name is #{first_name} #{last_name}, and I’m from #{city}, #{state.upcase}.”
and when i run the program it places the first question by itself and works properly, but the moment i answer it and press return, all off my other code gets executed at once and only the answer to the state question works.
i have tried using puts as opposed to print and the result is the same.
I’m having similar problems. I think the exercises are just a little buggy. If I refresh the page, it usually starts working again - if not, I just keep refreshing until it works.
I have written the following code (as in the example), but the program does not run as intended.
print “What’s your first name?”
first_name = gets.chomp
print “What’s your last name?”
last_name = gets.chomp
print “What city are you from?”
city = gets.chomp
print “How is your (US) State abbreviated?”
state = gets.chomp
puts “Your name is #(first_name) #(last_name) and you are from #(city)”
When I first did Printing the Output, I linked .capitalize! to the end of .chomp.
While it gave me a checkmark for completing the exercise, the results for answers entered without needing changes came back blank. Am just curious, why is that?
I then changed .capitalize! to its own line so the results would be correct.
Hi everyone. I found out what helped me to complete this session. I made sure that I used the quotation marks after every question that was asked. I used a set of double quotes for every set of “#{name}” “#{city}” etc. Hope that this helps. Hermanator
Im having a hard time getting my code to output properly. i know my code is correct but it only outputs the first line. ive tried logging out and restarting my computer but its not fixing the problem. its also telling me that my answer correct and to move on but i dont want to move on if i cant see my work. can anyone help me?
After you hit the “Run” button, the first line will show up in the console. You must click in the console window to focus your mouse on the console window AND then quickly type the name and press enter. If you take too long, you will get the “execution expired” error.