Formatting with strings methods help

I need help with this one. I don’t know how to add capitalize to the first name, last, city and upcase for state . Plz give me a hand

1 Like

Hi remove the dot before upcase!

state = .upcase!
1 Like

I don’t know what to do now man, i wrote answer and it doesn’t work.

1 Like

Let’s rethink this a little bit.

You are writing a program here, and the first thing you want to do is get the user’s first_name. You should ask them that instead of “This is my question?”.

Once you get their response, store it in a place like first_name, not answer.

Do you see how that will be more useful?

1 Like

I give up man, i really don’t know what to write

1 Like

I can see that you already know how to display some text on the screen.

My first question for you is, why would you display “This is my question?”, why not display “What’s your first name?”?

Just tell me what you are thinking about that one line.

You mean like this? ok but still no clue :frowning:

1 Like

Yes! line 1 is perfect now.

Next, instead of storing the response in answer, like you have done on line 2, why not store it in something more recognizable to you, like first_name?

1 Like

You aren’t quite getting my point.

Originally, you stored the user’s response in answer:

answer = gets.chomp

I’m asking you, why not store their response in first_name:

first_name = gets.chomp

Maybe you are not understanding what gets.chomp is doing for you?

can you explain it to me please? i didn’t understand it very well.

1 Like

ok, i did that but now when they ask me what’s my first name what the ■■■■ i must write.

1 Like

When you ask the user a question, you need a way to get their response. That is what get.chomp does for you.

  1. You print a question for the user,
  2. They type an answer
  3. You get.chomp it and save it for later.

You can answer with anything really, but your first name would be the normal response.

Doesn’t work man. I wrote my first name and it doesn’t work

1 Like

Well, we’ve only done the trouble shooting on lines 1 and 2. If you have those right, we can move on to line 3.

Ok, can we move on to line 3?

1 Like

The next thing the exercise wants you to do with the new first_name variable is make sure that the first letter is uppercase. You can do that like this:


1 Like

You are getting closer! Are you planning on using that answer2 variable for anything ? I would suggest deleting line 3.

And really, everything else too, except for the three lines that we have been working on so far.