Why when I open a file with .py extension after executing the code it automatically closes?And How can I prevent it from closing | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why when I open a file with .py extension after executing the code it automatically closes?And How can I prevent it from closing

21st Oct 2017, 11:47 AM
Amit Rawat
Amit Rawat - avatar
2 Answers
+ 1
You can place an anonymous input() statement at the end. If you wanted to be fancy, you can put a "Press ENTER to exit" quote within. The above are basic implementations. You can certainly run a function at the end, which runs an input() statement, too - by doing this, you've made an 'out of bounds catcher'! Congrats.
21st Oct 2017, 12:22 PM
ghostwalker13
ghostwalker13 - avatar