dimanche 10 juillet 2016

Sum of squares

Today Tom the super boss has meeting with his staff. One the worst staff in the world said there was an alien doing stupid things and said that he needs to know the sum of squares or he will blow the world up.  And then there was superman but the alien was too strong so he crushed the superman into two pieces (and died).

And then we called the most smartest person in the world but when the smartest person finished telling the alien that the genius died because the alien couldn't understand. So we were thinking for a new plan.....

So we then knew what to do, we used our computer to do some coding. Tom's super assistant Daddy has prepared a pseudo code. Then Tom the smartest boss tried to reproduce it on his laptop (what, the boss does the hardest part of the job, that's a real master / boss!!!). Of course, Tom the super boss was surprised that Daddy's pseudo code not working. Angry, he asked: "why Daddy you put some codes not working at all there...?"

Daddy stupidly said: "That's called a pseudo code, my dear..."

"Ok, so now remove all pseudo stuff from that, please."

Daddy finished to remove all pseudo stuff and below is the result / code:

from math import sqrt

n = 100

for a in xrange(1,int(sqrt(n))):
  for b in xrange(a,int(sqrt(n))):
    if a**2 + b**2 == n:
      print a,'^2 +',b,'^2 =',n
      exit(0)

print "no solution"

And then the alien understood and went on his spaceship and left. So basically our company has saved the world and we are the richest company in the whole wide world.

                                                                The End

2 commentaires:

Poem : Windrush Generation

Windrush Generation Past glory of England Succes of this Nation Based on the strength of this land Many Jamaicans Find work, prosperity Have...