Why I get "execution expired" (clarification)

Hello,
Every once in a while I will get an “execution expired” even though I am typing answers in the console. This also doesn’t happen every time, so I did not think it was the loop. I was hoping to find out why…? :thinking: I am working on the extra part of the REDACTED! lesson:

  • How could you make your program take multiple, separate words to REDACT?

Thanks in advance for your help with this~!

Questions

  1. Is there a timed time-out for the console to avoid infinite loops from running too long?

  2. Is there a way to avoid this from happening so I can finish testing my code? (other than no loops)

  3. Are there any other possible reasons other than the browser, needing to refresh/clear cache, or not typing after a prompt in the console…

Link
https://www.codecademy.com/courses/learn-ruby/lessons/redacted/exercises/great-work-1

Code

redacted_words_list = []
redact_yes_no = "y"
redact_this_word = ""
redacted_text = ""

puts "Tell me something good:"
text = gets.chomp

loop do
  puts "Would you like to redact a(nother) word? Please type the letter Y for yes or N for no:"
  redact_yes_no = gets.downcase.chomp
  
  break if redact_yes_no == "n"
  
  if redact_yes_no == "y"
    puts "What word would you like to redact?:"
    redact_this_word = gets.chomp
    if text.downcase.include? redact_this_word.downcase
      redacted_words_list << redact_this_word
    else
      puts "Sorry, invalid answer."
    end
  else
    puts "Sorry, invalid answer."
  end 
end

if redacted_words_list.length > 0
  words = text.split(" ")

  words.each do |word|
    if redacted_words_list.include? word
      redacted_text << "REDACTED "
    else
      redacted_text << "#{word} " 
    end
  end
  print "Here is your text: \n #{redacted_text}"
else
  print "Here is your text: \n #{text}"
end

1 Like

Has anyone addressed this error? I similarly cannot advance through this project.

1 Like

Hi there!

This seems like it’s a ongoing issue, and it looks like it’s been happening for at least a year now: Code doesnt run in ruby

I’d submit a bug report just like everyone else, and hopefully they’ll be able to fix it soon :crossed_fingers:

When you get to the prompt after Run, work fast. Click prompt, type, Enter. The code can be run if we do not hesitate with the inputs. Otherwise the old fall back is to assign the values manually and bypass the user inputs.

I ran into this issue last night and initially submitted a bug report, then I noticed that my wifi had connected to my router and not my range extender which brings my wifi signal stronger to where I was working. Once I switched to the stronger wifi signal, the problem went away. So I don’t think it is a codecademy bug, but rather a user connectivity issue. Try, if you can, to sit closer to your wifi router when working through the Ruby class and see if that helps.

You can type like Data and it still ends in “execution expired”.
I was wondering, does it have a browser preference? I use Chrome usually, but could swap to Firefox if necessary.

This is a question for the engineers. I don’t have an answer.