Shortest infinite Python program
Student Login

Shortest infinite Python program

Today's puzzle:

What's the shortest Python program that will never end?

Think about it a moment before scrolling down...

.

.

.

Okay, I'll tell you my answer...

After imagining this little puzzle, and thinking a moment, I came up with this:

  1. while 1:0

That's it. 9 characters. It's a valid Python program, and if you run it, it won't stop until you kill the process.

Can you think of a shorter one?

I only pondered this for a few minutes, so maybe you can. If so, let me know.

Newsletter Bootcamp

Book Courses