Module (52%)
Section (93%)
LAB

Estimated time

15 minutes

Level of difficulty

Medium

Objectives

  • improving the student's skills in creating classes representing candies;
  • improving the student's skills in operating with deepcopy() and copy.

Scenario

The previous task was a very easy one. Now let's rework the code a bit:

  1. introduce the Delicacy class to represent a generic delicacy. The objects of this class will replace the old school dictionaries. Suggested attribute names: name, price, weight;
  2. your class should implement the __str__() method to represent each object state;
  3. experiment with the copy.copy() and deepcopy.copy() methods to see the difference in how each method copies objects .

Code

{{ dockerServerErrorMsg }} ×
{{ errorMsg }} ×
{{ successMsg }} ×