[Tutor] While loop issue, variable not equal to var or var

Steve Rodriguez smrodriguez88 at gmail.com
Fri Jul 11 23:16:05 CEST 2014


Hey guys n gals,

New to python, having some problems with while loops, I would like to make
a program quick once q or Q is typed, but thus far I can only get the first
variable to be recognized. My code looks like:

    message = raw_input("-> ")
    while message != 'q':
        s.send(message)
        data = s.recv(2048)
        print str(data)
        message = raw_input("-> ")
    s.close()
    print("Shutting Down")

I've tried:

while message != 'q' or 'Q':
while message != 'q' or message != 'Q':
while message != ('q' or 'Q'):

Any ideas would be much appreciated! Thanks! :D

Regards,
Steve Rodriguez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140711/25ea29de/attachment-0001.html>


More information about the Tutor mailing list