FAQ: Putting the Form in Formatter - Great Work!

This community-built FAQ covers the “Great Work!” 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 Great Work!

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!

When I click “run” on this exercise, it only prints “What’s your first name?” then I get red letters for execution expired…

I’m confused about what this exercise is or building upon. Even when I click “get the code solution” and click “run” it just executes the first question with none of the other variables. Apologies if this is a dumb question, I just want to understand,

Hey there, @course2126733002. Welcome to the forums!

See where it says “What’s your first name?”, there should be a blinking cursor right next to it. Click on it multiple times, until you’re able to provide input. Then press enter.

If you don’t do this, you’ll get the “execution expired” message.

This is slightly tricky to get to work, and may be confusing at first, but it happens a lot with the Ruby course. It has nothing to do with Ruby, but rather the Learning Environment and this course.

1 Like

Hi, I’m having a similar problem but in my case, I can answer the first question “What’s your first name?” but it doesn’t go to the next one, and consequently getting the “execution expired” message after while.
Does anyone know what would be the cause for that?

Not sure. I just tried it, and it works for me (Firefox).

Which browser are you using and, could you perhaps try using another? :slight_smile:

I’m having the same issue on Chrome.

Hey there, welcome to the forums!

Could you perhaps try using another browser, just to check?

1 Like

I just tried Edge and it works just fine there.

Hi everyone! I got this question. What’s if my city is compose of two words (such as San Francisco) and I want to get both capitalized in the first letter? The method capitalize don’t do that. What method should I use. Thanks in advance

1 Like

hello javier, i had the same problem untill i realized that for the state you should use upcase method istead of capitalize method.
just in case anyone have the same problem . :wink:

1 Like

I was having the same issue using Edge. Then I changed to Firefox and worked fine.

Thank you for the useful reply!

Hey I’m having the same issue
I tried using a different browser but it won’t work. Kindly advise I know its being lazy…but hey I’m stuck.

Did you follow the advice given by ghostlovescore earlier in the thread?
After you run your code, make sure you click in the the console window (the one with the blinking cursor) till you are able to type in that window. If that window is not highlighted, you will time out and get an execution expired error.

This question relates to step 6/7. Why is my code below not returning the variables of first_name, last_name, and city as capitalized words in the string that I print? I thought if used the .capitalize! command it would print the variables as capitalized words in the string that prints to the console.

print “What is your first name?”

first_name = gets.chomp

first_name.capitalize!

print “What is your last name?”

last_name = gets.chomp

last_name.capitalize!

print “City?”

city = gets.chomp

city.capitalize!

print “State? (use two letter abbreviation)”

state = gets.chomp

state.upcase!

print “#{first_name}, #{last_name}, #{city}, #{state} are the data”

1 Like

I copy pasted your code and ran it in an online Ruby compiler. The final string did have the capitalized words, so the code seems to be working fine. e.g. john was capitalized to John.

Thank you. I reran it again and it worked. Not sure why it did not work the first time. Thanks.

1 Like

Hello, everyone. I am having a problem but not with the original task. It worked perfectly with the original four questions: first_name, last_name, city, state.

The directions suggest to add additional questions formatted in the same way, which I did. However, now it doesn’t run at all. Clicking the Run button, and nothing happens, not even the original What’s your name? prompt.

Here is the code— I don’t see any errors, but there must be one somewhere. Thanks in advance!

rhprint "What’s your first name? "
first_name = gets.chomp
first_name2 = first_name.capitalize
first_name.capitalize!
puts “Your name is #{first_name}.”
print “What is your last name?”
last_name = gets.chomp
last_name2 = last_name.capitalize
last_name.capitalize!
puts “Your last name is #{last_name}.”
print “What is your city?”
city = gets.chomp
city2 = city.capitalize
city.capitalize!
puts “Your city is #{city}.”
print “What is your state or province? Use abbreviation”
state = gets.chomp
state2 = state.upcase
state.upcase!
puts “Your state is #{state}.”
print “What is your first language?”
firstlang = gets.chomp
firstlang2 = firstlang.capitalize
firstlang.capitalize!
puts “Your first language is #{firstlang}.”
print “What other languages do you speak?”
otherlang = gets.chomp
otherlang2 = otherlang.capitalize
otherlang.capitalize!
puts “You also speak #{otherlang}.”

Much appreciated!

In your code in the lesson, are you using “smart quotes” as you are in a few places in the code you pasted here (such as and instead of " and instead of ')? If so, you will get a syntax error. Try this code:

print "What's your first name? "
first_name = gets.chomp
first_name2 = first_name.capitalize
first_name.capitalize!
puts "Your name is #{first_name}."
print "What is your last name? "
last_name = gets.chomp
last_name2 = last_name.capitalize
last_name.capitalize!
puts "Your last name is #{last_name}."
print "What is your city? "
city = gets.chomp
city2 = city.capitalize
city.capitalize!
puts "Your city is #{city}."
print "What is your state or province? Use abbreviation "
state = gets.chomp
state2 = state.upcase
state.upcase!
puts "Your state is #{state}."
print "What is your first language? "
firstlang = gets.chomp
firstlang2 = firstlang.capitalize
firstlang.capitalize!
puts "Your first language is #{firstlang}."
print "What other languages do you speak? "
otherlang = gets.chomp
otherlang2 = otherlang.capitalize
otherlang.capitalize!
puts "You also speak #{otherlang}."

Thanks! I will try that. I use my iPad Pro for my Codecademy lessons— perhaps it’s an iOS default?

I did. have one other question related to that specific exercise: if the state name or city name is two words— Manitou Springs, Cedar Rapids, New Hampshire— how do you get the .capitalize! function to capitalize both words in the name?

Thanks!

~RK