DEV Community

Cover image for Being lazy: not bad after all
Shaibu Zachariyya
Shaibu Zachariyya

Posted on

Being lazy: not bad after all

It's common for a programmer to refer to himself/herself as being "lazy". This is because of a belief that "laziness" begets innovation.

For instance Imagine you are tasked to write "I'm lazy" 3 times on the screen.

This can be achieved in Python by writing the following code:

print("I'm lazy")
print("I'm lazy")
print("I'm lazy")

This is easy right. Well now what if you are asked to write this same sentence 1,000,000 (one million) times. Hahaa, I guess you will say this is punishment.

A lazy programmer will find a way to get the work done with minimum effort.

Well once upon a time, there lived a "lazy" programmer who was faced with a similar problem then he invented a concept in programming called LOOP.

A loop is a programming structure that provide a way to repeat a piece of code until a certain condition is reached. In our case the condition is met after we write the sentence one million times.

Now let's use a LOOP to solve our problem. The code is as follows:

for counter in range(1000000):
print("I'm lazy")

...and that's all. The job is done!

Incredible easy, isn't it? With 2 line of codes we are able to write "I'm lazy" one million times. How the LOOP works is beyond the scope of this post.

Computer was invented to automate our everyday "boring" repetitive tasks.

"Copy => paste" was invented because someone doesn't want to be writing the same thing over and over again.

TV remote was invented because someone was feeling "lazy" get up and change the channel over and over again.

Now you have it. The next time you find yourself feeling "lazy" about doing something, instead of complaining, you should rather start thinking about how you can create a solution for the benefit of yourself and humanity.

“I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.” - Bill Gates : quotes.

Oldest comments (0)