Ask coding questions

← Back to all posts
Not a coding question (for once)

Hi everybody, it's me again. Don't worry I'm not going to bother you about codes that I find really difficult (yet), I'm just honestly curious about something. Has anyone else noticed that most of the time when you think you have to write a giant code, and the model solution is like the simplest thing ever? Like, this one time I had to write a code that printed the number directly after the decimal. Any decimal size. My code looked like this:

a = input()
b = a.split(" . ")
c = len(b)
if (c == 2):
c = pop(1)
clo = list(str(c))
ans = clo.pop(0)

And the sample solution was this:

I was so pissed. I was working on this code for two freaking days and it was this simple? Has this ever happened to anyone or does this kind of thing just happen to me?

21natzil (1119)

What about "12.43".split(".")[1][0]?

pyelias (1435)

I think what happens here is that once you think of a solution, you just use it without consider other possible approaches. Planning is always helpful. (and if your code is too complicated, you're probably doing something wrong)
Even most large projects I've worked on usually have simple code, just a lot of it.