Code is wrong or is there an error?


#1

Not quite sure what I’m doing wrong but every time I hit run it says I’m incorrect. I’m comparing the code and it seems fine. This is what I’ve put. Thank You.

print "Pleathe enter a thtring: " 
user_input = gets.chomp
user_input.downcase!

if user_input.include? "s"
  user_input.gsub!(/s/, "th")
  else 
  puts "Nothing to do here!"
end

#2

Just for the fun of it, try adding a puts statement just before the if statement…

puts user_input

Now when you run the code, enter a lowercase only string. What gets printed?


#3

Thanks. It seemed to have worked. However, I’m unable to enter a string when I run the code. So all I’m getting this and I’m unable to enter anything.
23 PM


#4

I think I got it. It’s just taking a long time to run. Thank You.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.