Exit while loop by user hitting ENTER key

前端 未结 14 1864
难免孤独
难免孤独 2020-12-08 23:01

I am a python newbie and have been asked to carry out some exercises using while and for loops. I have been asked to make a program loop until exit is requested by the user

14条回答
  •  死守一世寂寞
    2020-12-09 00:02

    Use a print statement to see what raw_input returns when you hit enter. Then change your test to compare to that.

提交回复
热议问题