Aswin Edavalath

Jul 15, 2025 • 1 min read

A common mistake we all make in coding?

Jumping into the solution without understanding the problem.

I was recently solving a logic puzzle:
Converting Excel column names to numbers (like A → 1, Z → 26, AA → 27…)

Most people rush to write code.
But here’s what helped me:
Understanding the math behind the mapping
Treating it like a base-26 system

Check this breakdown:

A = 1

Z = 26

AA = 27 (26×1 + 1)

ZZ = 702

AAA = 703

ALL = 1000

ZAZB = 458330

Here’s my Python code for it:

word = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def get_num(char):

return word.lower().index(char.lower()) + 1

def excel_to_num(value):

ans = 0

for ch in value:

ans = ans * 26 + get_num(ch)

return ans

print(excel_to_num('ALL')) # Output: 1000

The real learning?
Break it down first. Code later.

How would you solve this differently?
Drop your logic or approach — curious to learn how others break it down.

#Python #ProblemSolving #CodeBreakdown #LogicPuzzle #SDET #Excel #CleanCode #LearnToCode #PeerlistPost

Join Aswin on Peerlist!

Join amazing folks like Aswin and thousands of other builders on Peerlist.

peerlist.io/

It’s available... this username is available! 😃

Claim your username before it's too late!

This username is already taken, you’re a little late.😐

0

1

0