Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started