Ronald's uncle left him 3 fertile chickens in his will. When life gives you chickens, you start a business selling chicken eggs which is exactly what Ronald decided to do. 

A chicken lays 300 eggs in its first year. However, each chicken's egg production decreases by 20% every following year (rounded down) until when it dies (after laying its quota of eggs). 

After his first successful year of business, Ronald decides to buy 3 more chickens at the start of each year.  


Your Task: 

For a given year, and life span of chicken span,  calculate how many eggs Ronald's chickens will lay him that year, whereby year=1 is when Ronald first got his inheritance and span>0.

If year=0, make sure to return "No chickens yet!".


Note: 
1. All chickens have the same life span regardless of when they are bought. 
2. Let's assume all calculations are made at the end of the year so don't bother taking eggs laid per month into consideration. 
3. Each chicken's egg production goes down by 20% each year, NOT the total number of eggs produced by each 'batch' of chickens. While this might appear to be the same thing, it doesn't once non-integers come into play so take care that this is reflected in your kata!

Difficulty: introductory

Starter code:

def egged(year, span):
	

Solutions:
def egged(year, span):   
    total = 0
    eggs_per_chicken = 300
    for i in range(min(span,year)):
        total += 3 * eggs_per_chicken
        eggs_per_chicken = int(eggs_per_chicken * 0.8)
        
    return total or "No chickens yet!"

def egged(year, span, chickens = 3):
    production = [300, 240, 192, 153, 122, 97, 77, 61, 48, 38, 30, 24, 19, 15, 12, 9, 7, 5, 4, 3, 2, 1]
    return 'No chickens yet!' if not year else sum(production[:min(year, span)]) * chickens

def produce(n):
    x = 300
    for i in range(n):
        yield x
        x = int(x * 0.8)

def egged(year, span):
    if year == 0:
        return 'No chickens yet!'
    return sum(produce(min(year, span))) * 3

def egged(year, span):
    eggs = lambda e,n: 0 if n==0 else e + eggs(int(e*.8), n-1)
    return eggs(300,min(year,span)) * 3 if year else 'No chickens yet!'

def egged(year, span):
    NBASE, NCB = 300, 3
    if year < 1:
        return "No chickens yet!"
    nc = []
    ttl = []
    n = 0
    nc.append(NBASE)
    ttl.append(span)
    for i in range(year):
        for k in range(len(nc) - 1, -1, -1):
            n += nc[k] * NCB
            ttl[k] -= 1
            if ttl[k] < 1:
                nc.pop(k)
                ttl.pop(k)
            else:
                nc[k] = nc[k] * 4 // 5
    return n

import math

def egged(year, span):
    
    if year == 0:
        return "No chickens yet!"
    
    i = 1
    chickens = list()
    while i <= year:
        #Reduce production of each chicken and shorten its life by one year.
        new_chickens = list()
        for chicken in chickens:
            new_chickens.append([math.floor(chicken[0] * .8), chicken[1] - 1])
        #Each year add three new chickens
        new_chickens.append([300, span])
        new_chickens.append([300, span])
        new_chickens.append([300, span])
        chickens = new_chickens
        total_eggs = 0
        #cycle through the chickens and see how man eggs they produced, and add to total
        for chicken in chickens:
            if chicken[1] > 0:
                total_eggs = total_eggs + chicken[0]
        i = i + 1
    
    return total_eggs

def egged(year, span):
    if year==0:
        return 'No chickens yet!'
    egg=[]
    for i in range(year):
        egg=[int(e*0.8) for e in egg]
        egg.append(300)
    return sum(egg[-span:])*3

def egged(year, span):
    if year==0: return "No chickens yet!"
    chickens=[]
    for y in range(year):
        for i in range(len(chickens)):
            chickens[i][1]+=1
            chickens[i][0]=int(0.8*chickens[i][0])
        chickens.append([300,0])
        chickens.append([300,0])
        chickens.append([300,0])
    return sum(i[0] for i in chickens if i[1]<span)

class Chicken:
    def __init__(self, lifespan):
        self.eggs = 300
        self.lifespan = lifespan
        self.age = lifespan
        
    def birthday(self):
        self.age -= 1
        self.eggs //= (10/8)
        self.eggs = 0 if self.age == 0 else self.eggs
        return self

    def __repr__(self):
        return f'Chicken(eggs={self.eggs!r})'


def egged(n,s):
    chickens = [Chicken(s) for _ in range(3)]
    for i in range(n-1):
        chickens = [c.birthday() for c in chickens]
        chickens.extend([Chicken(s) for _ in range(3)])       
    return sum(map(lambda x: x.eggs, chickens)) if n>0 else 'No chickens yet!'

def egged(year, span):
    eggs = [300]
    while len(eggs) < span:
        eggs.append(eggs[-1] // 1.25)
    chickens = [3] * year + [0] * span
    return sum(c * e for c, e in zip(chickens, eggs)) if year else 'No chickens yet!'