Sunday, December 14, 2014

Python exercise: read line of input, 'q' to quit

Python example to read line of input, 'q' to quit, using raw_input().



exit = False
while not exit:
    r = raw_input('Enter something, "q" to quit"')
    print(r)
    if r=='q':
        exit=True

No comments: