Monday, 21 May 2012

EPIC abs(num)



http://codingbat.com/prob/p124676

This post refers to "near_hundred" problem in the Warmup-1 section of
Codingbat /python

My solution was this:


def near_hundred(n):
    if n<100:
       if 100-n<=10:
           return True
       else:
           return False
    
    if n>=100 and n<=200:
       if n-100<=10:
           return True
       if n-100>10:
            if 200-n<=10:
               return True
            else: 
                return False   
       
    
    if n>=200:
       if n-200<=10:
          return True
       else:
         return False
                             
Codebat's Solution


def near_hundred(n):
  return ((abs(100 - n) <= 10) or (abs(200 - n) <= 10))




this function makes the other way of doing it sound so lame.
one cool and handy function this is.  
Its just like taking modulus in mathematics.
thats how we take mod in python.




God-Bless IITians



So the JEE results are announced and , I got AIR 6448.

After 3 of dedication , hard-work, expectations, procrastination, more procrastination, my dreams of going to IIT are finally crushed.

And I have no one to blame but me.

Thats just so not what i had expected of myself, till last year I was hoping to make it to AIR 500 , but things turned all around me in a span of 3 months (January -February-March).

Thats is so not cool man, after three years of working for getting a good rank at jee , I get AIR 6k.

Its obvious that I messed up big time, I procastinated , I got distracted when I was so near the end of the tunnel , and I stopped studying altogether in the month of march,

WTH man?
Seriously? WTH happened?
I dont know man,its just so daym complicated.(*frowns*)

Whining aside, lets look forward, to think about this critically, any rank below 997 is just worthless, since I need to get btech CS ,  (and 997 is the rank Rajan got, and he did it right ), so its not that bad if I think it that way.

And also there are so many good things to look forward to , like learning python and C++ and stuff, so I am  letting go of this now.

Some philosophy

And universe tends to unfold in the most spontaneous of fashion, and we must accept this fact and move forward, life is too short to get sad about things of past, though a lesson must be learned with previous mistakes.

After all I have is this one life, maybe one day I will do something so phenomenal that I would be laughing at me being sad about such a small thing as AIR.
I so much look forward to that day.

"Find what you love and follow it with your heart", that s what Steve Job said.

You make that sound so easy Steve, how did you find what you love?

"and dont worry if you dont find it, keep looking dont settle, as of all matters of heart you will know when you find it" Steve Jobs

Ok I will just keep looking then.

Its hard to think clearly with so much things going in mind, anyways I will end this post by saying.

"Life is life is life lifefefefefefefef WTH is life??????"


Looking at the sunny side, my days of hating chemistry are behind me, and I have gathered some pretty awesome memories over the last 3 years preparing for JEE, which I will cherish throughout my life.

God-Bless IITians...