FAQ: Putting the Form in Formatter - Repeat for More Input

This community-built FAQ covers the “Repeat for More Input” exercise from the lesson “Putting the Form in Formatter”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Ruby

FAQs on the exercise Repeat for More Input

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 (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 (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I can’t seem to figure out how to get this right. I am stuck on step 4
print "What’s your first name? "
first_name = gets.chomp

print “what’s your last name?”
last_name = gets.chomp

print “what city were you born?”
city = gets.chomp

print “what state were you born?”
state = gets.chomp

what am i doing wrong?

inside print prompt tell user to provide only abbreviation and add upcase after state=gets.chomp then print all variables separetely

Hey Core!

You will need to add the variable before first_name, last_name, city, state, etc.
Something like this:

Remember to not use spaces around =

I hope this is helpful!


When I Run what I’ve entered, the first question prompts for an answer, which I then type and hit enter. Once I hit enter, all the other questions appear at once without spaces to answer them individually. What am I missing? Shouldn’t it prompt for each question in turn?

Code I’ve written:
print “What’s your first name?”
print “What’s your last name?”
print “What city were you born in?”
print “What state were you born in?”

Output after I enter my first name:
What’s your last name?What city were you born in?What state were you born in?

1 Like

I am also experiencing the same issue. Have you found a solution?

Not yet, haven’t had a chance to look more deeply since I experienced it. Hoping to find something over the weekend - will post here if I do.

I had this problem as well. I just refreshed my browser or closed out of codeA and logged back in. When I did this everything started working properly.


I got the same problem on my MacOS10.14/AppleKB/Opera(uptodate)
First, at the prompt, my answear “first name” is not print as i write it. Still the prompt.
Then with the cmd+return the question disappears. Only the prompt remains.
After a while, i got “execution expired” and the prompt.
Some times i got all the question on a single line
Some times i got
“execution expired
What is your last name ?”
without any prompt after the second question.

I can’t hint the next button as it stay greyed

I try to close every thing, do the opera update, change for safari,firefox,chrome. reboot…
It is weird.

If someone has a solution to that i would be grateful

TY!! this helped me a bunch, for everyone still confused you just have to add the extra line (using her example) after last name city and state and once you answer in the black space you will need to press enter twice after those specifically. It basically just creates more space after the questions.

This worked for me, hope it helps!

print “Whats’s your first name?”
first_name = gets.chomp
print “What’s your last name?”
last_name = gets.chomp
print “Which city are you from?”
city = gets.chomp
print “Which state are you from(abbreviation)?”
state = gets.chomp.upcase

1 Like

I’ve tried all the input versions mentioned on this FAQ and I’m still getting told that I haven’t completed all tasks. Can anybody provide the answer please, as the last answer provided on this chat didn’t work for me

I had the exact same problem… what it tells us to do is completely different fro what they had asked

When I click the ‘Run’ button on any parts of this exercise it just keeps loading. I am unable to enter any input in the Terminal. After a while it says ‘Execution Expired’.
I have tried code from others above that say their’s works and i get the same issue so it isn’t my code.
Have logged out and back in. Restarted my computer.

Any ideas? Anyone else having the same issue?

My code just in case for step 3:

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 are you from? (Please use abbreviated form e.g. NY for New York) "
state = gets.chomp

Just ran the exercise. You are correct that after clicking “Run”, the exercise appears to be stuck loading. But, it still works.

Click the “Run” button. The first prompt will appear in the terminal. Ignore the loading. Click on the terminal window and start typing. If you take too long to enter input, you will get “Execution Expired” message.

1 Like

Thank you that worked

As an example I used this code to get this working below for Repeat for More Input and Printing the Output Sections.

puts at the end gives statement, Your last name is Wilkinson and you’re from Wellington, WGTN!
Please note that we don’t have states where I am from, just provinces.

print "What's your last name? "

last_name = gets.chomp


print "What city are you from? "

city = gets.chomp


print "What province are you from (you can provide an abbreviation for the province, such as WGTN for Wellington if you want to) ?"

province = gets.chomp


puts "Your last name is #{last_name} and you're from #{city}, #{province}!"