1a
Add a Tank class with a minimum level, a maximum level and a current level. The minimum defaults to 5, the maximum to 20, and the current level starts at the minimum. Create a Tank() and print its current_level.
Hint 1
The slide The init Initializer shows how default arguments and instance attributes go together.
Check your output
5Show solutionHide solution
class Tank:
def __init__(self, min_level: int = 5, max_level: int = 20) -> None:
self.min_level = min_level
self.max_level = max_level
self.current_level = min_level
print(Tank().current_level)