FAQ: Thith Meanth War! - Getting User Input

This community-built FAQ covers the “Getting User Input” exercise from the lesson “Thith Meanth War!”.

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

Learn Ruby

FAQs on the exercise Getting User 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!

Hi everyone,

Been struggling a bit when it relates to gets.chomp function.

I’ve been trying many different things, even copy and paste the code from the solution but always get the same error message all the time.

Could anyone tell me what is wrong with the following code :

print "I need to go to the barber: "
user_input = gets.chomp

Thanks very much for your attention guys!

What error message are you getting?

Hi,

I was getting the one telling me my code was wrong! Even when copying the one from the solution.

Sometimes there is a problem getting using input.

Try manually entering a string and comment out the ‘gets.chomp’.

If you still get an error, post your code in a reply.

2 Likes

Just got it! Stupid mistake I made, wasn’t replying in the console :rofl:

1 Like

Hi everyone,

Could you tell me what’s wrong with this code?

print “There is something wrong with this thring!:”
user_input= gets.chomp

As julesbayon I’ve been trying many different things even copy and past the 1st exercise but the error message is always the same: Your code doesn’t look quite right. Check the first exercise if you need help!

2 Likes

Hi people! first of all forgive for my english, it is not so good.

When I run the code using the command gets.chomp what i am putting in the keyboard does not appear in the execution area. After sometime the message “execution expired” appear.

Thanks.

Hello,

I found that clicking on the blinking cursor, and then typing your input, works.
You may have to try this several times, though.

1 Like

Thanks a lot dear friend.

1 Like

Hello there! I know I’m late to the conversation, but I figure it could help in the future some newcomers like me!
So, I had a hard time with this exercice, even after copypasting from the first exercice.
Here is the key: the problem is probably not what you wrote in the central section.
The thing is that you need to write gets.chomp again in the right section, where the cursor blinks. (Sometimes we need to click a few times on the blinking cursor to sort of activate it)

Being new to Ruby, I don’t quite understand why it worked, but it did.
So, to be cristal clear, here’s what I wrote in the central section:

print "I hope I get this right!: "
user_input = gets.chomp

I RUN the thing, and then on the right section of the screen appears:

I hope I get this right!: (followed by the blinking cursor)

You just need to add: gets.chomp after the cursor.

Hope this helped!

1 Like

I am stuck on this exercise, I wrote:

print "What did you eat today? "
user_input = gets.chomp

For eg. I type pasta but then it throws the error “execution expired” and “Your code doesn’t look quite right. Check the first exercise if you need help!”

even if I use the solution it doesn’t work ???

Same here. The problem is that the console is not accepting input at all — this is a bug, and it’s preventing me from getting to the next step.

Hey there @scottenderle90286467 and @chip0086789910 , welcome to the community!

Which exercise specifically? Getting User Input?


It does work, but there’s a little trick…

After pressing Run, you need to keep clicking on the blinking cursor in the terminal (right-hand side of "Write something: "). It will eventually let you type something. If it doesn’t let you write anything, click again on the blinking cursor, and try writing once more.

Then, after that, simply press enter. I’ve added an extra puts user_input to show you the result:


Let me know if that works?

3 Likes

I could skip (or press next) the exercise by showing the solution

no, it doesn’t work with this solution. also it doesn’t even work with the solution given by codeacademy, my guess is, that it is a bug

May I ask which browser you’re using? :confused:

1 Like

im in chrome Version 83.0.4103.61 (Offizieller Build) (64-Bit)

Ok… well, I just tried it on the same version of Chrome as you, and it does work?

So I’m not sure how else to help you…

1 Like