Exercise 1.11 - make a ‘Food’ class

1.11 a)

Create a class called Food with the attributes ‘name’ and ‘calories’.

1.11 b)

Add a method to your person class called eat and make it so that they are not hungry if they eat a food with more than 100 calories.

Go to Exercise 1.13 - using classes with PsychoPy


Back to top