An Illusion of mastery

Published Apr 28, 2017Last updated May 08, 2017
An Illusion of mastery

Most people a few months after taking up programming will reach a certain point where they feel they are the best at what they do. In reality they know but a small fraction of the vast world that is programming. Which is why this post is targeted to the beginners. "But wait how do I know I'm not beginner ?" I've a simple Python problem below. Read on.

Who wrote the better version?

# Store a list of all whole numbers upto 1000 divisble by 12

# Programmer 1
numbers = list(range(1000))[::12]

# Programmer 2
numbers = filter(lambda x: not(x % 12), range(1000))

# Programmer 3
numbers = []
for num in range(1000):
    if num % 12 == 0:
        numbers.append(num)

If you are a beginner in Python chances are you've never come accross lambdas and the filter function and that's alright. The purpose of this post is not to discourage you. It is to enlighten you of the fact that being modest with yourself is the only way. Not only is this attitude helpful in the industry but it will also push you to dig deeper, to find asnwers.

If you think you know which version is the best. Leave a comment below and you'll be surprised by how many people disagree with you. Whatever the option you pick there is no right answer. A mark of a good programmer is knowing what you don't know. So get your head out of the clouds and start poking around on google or better yet find a mentor who can guide you. Hopefully you'll determine what you know is not enough.

Discover and read more posts from Vivek Joshy
get started
Enjoy this post?

Leave a like and comment for Vivek

10
16