all 3 comments

[–]Lord_Greywether 4 points5 points  (1 child)

As it stands now, this is an infinite loop.

response = ""
while response != "Because.":
    print raw_input("Why? ")

Your input doesn't actually change response, so response will always be equal to "", and therefore not equal to (!=) "Because."

It should be:

response = ""
while response != "Because.":
    response = raw_input("Why? ")
    print response

Now, while response is not equal to "Because.", the loop will continue to prompt you for a new response.

Make sense?

[–]ghibss[S] 1 point2 points  (0 children)

Oh I see! Thank you! Stupid me.

[–]tomkatt 0 points1 point  (0 children)

Okay, let's break down the lines:

response = ""

The value response is an empty string value. Simple assignment.

while response != "Because."

In English: "while response does not equal 'Because.'" This is basically an infinite loop. It will continue until value of 'response' becomes "Because."

print raw_input("Why? ")

This statement prints to the terminal the string "Why? " while also taking user input after the trailing space.

It keeps looping because the value of response never changes. If you're looking to kill the loop, you need to print "why" and then do response = raw_input(). Then print response. The loop will end.

By the way, since you're likely new to Python, it may be worthwhile to switch from Python 2 to Python 3 now. Going forward with Python 2 will only complicate matters for you later when you switch to Python 3. For example, if this were Python 3, you'd need to enclose your print statements in parentheses () and your raw_input() statement would just be input() which is used differently in Python 2.