Quarantine diary – Person Crazyness Calculator

It was saturday afternoon and I was bored! I had just upgraded the family notebook with a new SSD hard drive and a more memory. It makes a great difference and I recommend you to do it as well, if you have a slow Intel I3 notebook around. While I was setting it up the idea of a calculating one´s crazyness hit me. Here it is.

Tolerance (determined by the Patience function) is defined by oneˋs age minus the quarantine days minus the number of kids – tolerance = (age – days) – kids

Crazyness (determined by the Crazy function) is defined by the number of quarantine days times the number of kids split by one´s age. – crazy = (kids * days) / age

Crazyness is reached if tolerance is lower than crazy. Check it out


#!/usr/bin/python

class Person:

def __init__(self,kids,age):
self.kids = kids # How many kids one has
self.age = age # Mom Age
self.quarantine = 0 # Days that you are in quarantine
self.confined = True # Confined - default to Yes

def patience(self,days):
tolerance = (self.age - days) - self.kids
return tolerance

def crazy(self,days):
crazyness = (days * self.kids) / self.age
return crazyness

def is_goingNuts(self):
while(self.confined):
tolerance = self.patience(self.quarantine)
crazyness = self.crazy(self.quarantine)
if (tolerance >= crazyness):
print ("Days: %s, Tolerance: %s, Crazyness: %s - Person is doing Alright") %(self.quarantine, tolerance, crazyness)
else:
print ("Days: %s, Tolerance: %s, Crazyness: %s - Person tolerance has reached its limit") %(self.quarantine, tolerance, crazyness)
break
self.quarantine += 1

person = Person(3,30)
person.is_goingNuts()

Output

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *