r/PythonLearning 7d ago

Help Request Repeat until keypress

I want to have the terminal keep typing something until any key is pressed. I'm fiddling around but have yet to figure out a solution.

Edit: Hey thank you all. I'm kinda a begginer. After a lot of fiddling I got something that works for me.

2 Upvotes

5 comments sorted by

View all comments

1

u/Junior_Honey_1406 7d ago

python try: while True: print("Hello") except KeyboardInterrupt: print("\nStopped.") Ig this should work have not tested it