0
Country list
I want to practice by making some country list with capital city, region, currency, etc as it attributes for each country. Will it better use inheritance classes for each country or just can store all in the main class Country like below example? class Country: def __init__(self, name, capital, region): self.name = name self.capital = capital self.region = region NZ = Country ("New Zealand", "Wellington", "Oceania")
1 Antwort
+ 2
Since you probably want to have each of the countries as single, differentiated objects but with the same type of data and methods inside, it's the best to use one class for that.