Implement a small package that provides electricity consumption/cost calculations for mining.
Requirements
Create a package directory /app/decred/ with an init.py (can be empty) and a single implementation file /app/decred/mining.py. Put all logic in mining.py.
Implement a class named Consumption in /app/decred/mining.py with the exact signature and behavior below.
Class and API
class Consumption:
init(self, idle_watts: int, mining_watts: int)
Parameters:
idle_watts: power used when not mining (watts)
mining_watts: power used when mining (watts)
Must store these values on the instance (e.g., self.idle_watts, self.mining_watts).
Initialize an instance attribute price_kwh: float defaulting to 0.0 (this should be writable).
extra_power_when_mining(self) -> int
Returns the extra power in watts consumed when mining compared to idle.
Calculated as mining_watts - idle_watts.
Return type should be numeric (int is fine when inputs are ints).
mining_cost(self, hours: float) -> float
Returns the cost of mining for the given number of hours.
Uses the current instance price_kwh attribute as the price per kWh.
The calculation should multiply the extra power (from extra_power_when_mining) by price_kwh and by hours.
(i.e., cost = extra_power * price_kwh * hours)