You have an indentation problem with your code.
This should work for your requirement:
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
print(cases)
return (cases)
westernEurope = Region("Western Europe", 1000000, 0, 0)
print(westernEurope.infection("Western Europe", 1000000, 0))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…