I am trying to pass in an object so that it will be modified by the method defined infection. However, when I do pass it in, as I show below, it only does it once. This is my first experience making dynamic objects, so I'm not quite sure how to get it to keep going.
class Region:
def __init__(self, name, population, cases, deaths):
self.name = name
self.population = population
self.cases = cases
self.deaths = deaths
print(name, cases)
def infection(self, name, population, cases):
while population > cases:
cases = cases + 1
return (cases)
westernEurope = Region("Western Europe", 1000000, 0, 0)
print(westernEurope.infection("Western Europe", 1000000, 0))
What I want to happen is that the infection method should keep incrementing until it reaches the number of cases, but I also need to be able to print each incrementation. Any help is much appreciated.