I'm very new to programming and am learning Python through Automate the Boring Stuff. I'm looking at While Loops and put the following into the file editor window:
name = ''
while name != 'your name':
print('Please type your name.')
name = input()
print('Thank you!')
In the interactive shell of IDLE, the author uses the following as an example of While Loops:
>>>
Please type your name.
your name
Thank you!
>>> while True:
print('Hello!')
And then Hello! appears dozens of times. The book says to click Shell -> Restart Shell, or to use Ctrl + C to interrupt the execution. This does not work for me.
I'm using Python IDLE Shell 3.12.2, Lenovo IdeaPad Slim 5 16IRL8, and Windows 11.
I can't interrupt the execution as this bug is happening. I can only do this when the program is not going haywire. Otherwise, Ctrl + C, Ctrl + Fn + F6, and navigating the toolbar all work.
While the loop is happening, my keystrokes are ignored, and the toolbar is frozen when I try to click on anything. Eventually, I am told that Python is not responding, and I close the program. I don't want to lose my work in the future, so I would like to know how to fix this.
I have tried Ctrl + Fn + F6 to Restart Shell, which again only works when I'm not running the program above. I have tried a few other keys like D and \ instead of C as well, and these do not work. I do not see a Break or Pause key on my keyboard.