Problem with raw_input

Hi everybody,
It is about Review: Functions 17/19 https://www.codecademy.com/courses/learn-python/lessons/python-functions/exercises/review-functions

I decided to make the exercise more interesting and put the function in work. It works fine when I set a value for “s” in the code, but adding ‘raw_input()’ broke it.

1
2 def shut_down(s):
3 if s == “yes”:
4 print “Shutting down”
5 return “Shutting down”
6 elif s == “no”:
7 print “Shutdown aborted”
8 return “Shutdown aborted”
9 print “Sorry”
10 return “Sorry”
11 s = raw_input('Type “yes” or “no” ')
12 shut_down(s)

After typing anything and hitting “Enter” it hangs for a while and than this message appears:

Traceback (most recent call last):
File “python”, line 12, in
ExecTimeoutException: Program took too long to terminate.

What is so wrong with me? As I can see the syntax is the same as in the previous lessons.

Hello @script4494162026 welcome to the forums. The problem is not with your code, but with the Codecademy learning environment; sometimes it doesn’t let raw_input()

1 Like

@script4494162026,

Try refreshing the page. I just went back to that exercise and tried to run your code. At first it didn’t work, but after refreshing it worked fine.

2 Likes

Welcome to the forums!!

I believe it is because codecademy is running over the internet.
Not sure why but there is be a time limit on how long you can enter raw input before the program stops.

I would imagine it is so someone doesn’t start the program and it keep running indefintly, taking up data.

1 Like

Thank you,

I did as you said, this time it worked.

Realy want to thank everyone for the great support.

3 Likes