PDA

View Full Version : WOW Easy Python Script Not Working?



CaseyC
January 8th, 2013, 05:52 PM
What is wrong here?



while True:
print("Hello, enter STOP to stop")
varQ = str(input("Input: ")
if var == "STOP":
break

sanderj
January 8th, 2013, 07:35 PM
tip: line 3 is your problem ...

CaseyC
January 8th, 2013, 09:45 PM
Sorry this is my line 3

varQ = str(input("Input: "))


I had to type it by hand it does contain 2 )'s at the end.

CaseyC
January 8th, 2013, 09:48 PM
See attachments.

sanderj
January 8th, 2013, 10:17 PM
Sorry this is my line 3

varQ = str(input("Input: "))


I had to type it by hand it does contain 2 )'s at the end.

OK. Variable name is also correct?

So do you realise that that line is the problem? Did you Google how to get input in Python? If Google gives you a hit on stackoverflow, use that ...

BTW: I'm not going to write the script for you. That won't help you very much. I think it's better you find out how debug it yourself ...

CaseyC
January 8th, 2013, 10:35 PM
Got it :)

I used something similar to input int's into varibles but strings were handled correctly.


varQ = raw_input("Input: ")


Was what I found worked however I am unsure if that is best practice. Research and learning will continue & thanks!