class Country: 
    '''Fields: continent (Str), 
               leader (Str), 
               population (Nat)'''
    
    def __init__(self, cont, lead, pop):
	     self.continent = cont
	     self.leader = lead
	     self.population = pop
	
    def __repr__(self):
	     return "continent: {0.continent}; L: {0.leader}; POP: {0.population}".format(self)

    def __eq__(self, other):
	     return isinstance(other,Country) and \
	            self.population == other.population and \
	            self.leader == other.leader and \
	            self.continent == other.continent

	
#election: Country Str -> None

    def election(self, winner):
        print("Election Results:")
        if self.leader == winner:
            print("{0} re-elected".format(self.leader))
        else:
            print("{0} replaces {1} as leader".format(winner, self.leader))
            self.leader = winner
	


#hpop: Country Country -> Country
def hpop(c1,c2):
    if c1.population > c2.population: return c1
    return c2


def leader_most_populous(countries):
    MAPPPP = map(lambda x: x.population,countries)
    MAPPPP = list(MAPPPP)
    maximum = max(MAPPPP)
    return list(filter(lambda x: x.population == maximum,countries))[0].leader

def lmp(countries):
    cur_max = 0
    cur_leader = ""
    for c in countries:
        if c.population>cur_max:
            cur_max = c.population
            cur_leader = c.leader
    return cur_leader



canada = Country("North America", "Harper", 35344962)
canada2 = Country("North America", "Trudeau", 35344962)
usa = Country("North America", "Trump", 312345678)
india = Country("Asia","Modi",1241491960)
india_copy = Country(india.continent, india.leader, india.population)
L = [canada, india, usa, canada2]





#election: Country Str -> None
#usa.election("Trump")
#Country.election(usa, "Trump")




class Video_Game_Character:
    '''
    fields: 
    
    name (Str),
    my_class (Str),
    level (Nat),
    position (list Int Int)
    
    '''
    
    def __init__(self, name, c, pos):
        self.name = name
        self.my_class = c
        self.position = pos
        self.level = 1
    
    def __repr__(self):
        return self.name + " of class " + self.my_class + " with level " + str(self.level) + " and position " + str(self.position[0]) + "," + str(self.position[1])
    
    def move_up(self):
        self.position[1] += 1

    def fight(self,other):
        if self.level > other.level:
            print(str(self.name) + " is the winner!")
        else:
            print(str(other.name) + " is the winner!")
    
char1 = Video_Game_Character("Carmen", "Professor", [0,0])
    