Dark theme

Hints


So, you need four sets of code for this: one for the model, one for Agent, one for English, and one for the other nation. These can be inside one, two, or four files, but you'll need to sort out imports for some of them. The Agent code needs an __init__ that makes x and y variables and sets them as something random. It also needs associated get_x and get_y functions. The other two classes need to inherit Agent and have a say_hello function that prints "hello" in the appropriate language; note that they'll inheit x and y, rather than needing new versions themselves. The fourth file is the model script. In this, build two agents using the sub-classes, e.g.:
english_person = English()
and test you can get the x and y variables they inherit, plus get them to say their own hellos.


One answer