mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-17 14:58:10 +00:00
[mypy] Add/fix type annotations for electronics algorithms (#4247)
* Fix mypy errors for scheduling/first_come_first_served * Fix mypy errors for scheduling/round_robin.py * Fix mypy errors for scheduling/shortest_job_first.py * Fix isort errors * Fix mypy errors for electronics/ohms_law.py * Fix mypy errors for electronics/electric_power.py * Fix black errors
This commit is contained in:
parent
ced83bed2c
commit
4f6a929503
|
@ -1,8 +1,9 @@
|
||||||
# https://en.m.wikipedia.org/wiki/Electric_power
|
# https://en.m.wikipedia.org/wiki/Electric_power
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
|
|
||||||
def electric_power(voltage: float, current: float, power: float) -> float:
|
def electric_power(voltage: float, current: float, power: float) -> Tuple:
|
||||||
"""
|
"""
|
||||||
This function can calculate any one of the three (voltage, current, power),
|
This function can calculate any one of the three (voltage, current, power),
|
||||||
fundamental value of electrical system.
|
fundamental value of electrical system.
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# https://en.wikipedia.org/wiki/Ohm%27s_law
|
# https://en.wikipedia.org/wiki/Ohm%27s_law
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
|
|
||||||
def ohms_law(voltage: float, current: float, resistance: float) -> float:
|
def ohms_law(voltage: float, current: float, resistance: float) -> Dict[str, float]:
|
||||||
"""
|
"""
|
||||||
Apply Ohm's Law, on any two given electrical values, which can be voltage, current,
|
Apply Ohm's Law, on any two given electrical values, which can be voltage, current,
|
||||||
and resistance, and then in a Python dict return name/value pair of the zero value.
|
and resistance, and then in a Python dict return name/value pair of the zero value.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user