#100daysofcode :: Python 3.0 , interrupting an endless loop from the keyboard,gracefully

Recently I started out on a mission to further hone my programming skills. Out of the courses that I explored online, the #100daysofcode course from the TalkPython folks appealed to me the most. It is challenging,structured and the instructors are great.

I will be blogging my micro-learnings onthis journey. This is the first one from Day #3

I was in a situation where I had to execute a piece of code and output it’s  result on the console until the flow is interrupted by the user (through the console)

Ctrl+C can achieve it .However the interruption was not graceful, it resulted in my Python program “crashing”. So, I had handle this through exception handling.

Here the code that I wrote to handle the keyboard interrupt gracefully


Leave a Reply