How can I create a class instance from a list Python

Viewed 5397

I'm making a program for a school project. It's a Model United Nations.

countries = ['Australia', 'Brazil', 'Canada']

class delegate(object):
   def __init__(self, country):
     self.country = country

I have a list with countries and a class called delegate. So, each delegate object must have a country. Normally I would do it like this:

mexico = delegate('Mexico')

And that would be it. But I would like to loop over the country list and create class instances for each. I mean:

australia = delegate('Australia')
brazil = delegate('Brazil')
canada = delegate('Canada')

and so on. How can I make this? Thank you very much!!

4 Answers
Related