Question: The Freeze Protocol should define the following methods: chill() -> after this method is called temperature() should return the string chilling. thaw() -> after this

The Freeze Protocol should define the following methods:

  • chill() -> after this method is called temperature() should return the string "chilling".
  • thaw() -> after this method is called temperature() should return the string "thawing".
  • temperature() -> Return the temperature of the item. Initially, an item is always "thawing".

The Freezer class defines the following methods:

  • put(self, item: Feezer) -> put an item in the freezer. Call the item's chill() method.
  • take(self, item_name: str) -> take the first item that matches of the specified name out of the freezer. Call the item's thaw() method. You can assume that if an item is asked for it is already in the freezer.

from typing import Protocol class Freeze (Protocol): def chill(self) -> str: def 

from typing import Protocol class Freeze (Protocol): def chill(self) -> str: def thaw(self) -> str: *** def temperature (self) -> str: temperature = 'chilling' if self.chill(): temperature = 'chilling' elif self.thaw(): temperature = 'thawing' I am not sure if I am implementing very good the part that says: "temperature() -> Return the temperature of the item. Initially an item is always "thawing"." Also in the Freezer class the parameters inside the parenthesis have me confused. What do they mean by (self, item: Feezer) and (self, item_name: str)?

Step by Step Solution

3.33 Rating (144 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!