mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-08 03:54:26 +08:00
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -20,7 +20,7 @@ def molarity_to_normality(nfactor: int, moles: float, volume: float) -> float:
|
||||
>>> molarity_to_normality(4, 11.4, 5.7)
|
||||
8
|
||||
"""
|
||||
return round((float(moles / volume) * nfactor))
|
||||
return round(float(moles / volume) * nfactor)
|
||||
|
||||
|
||||
def moles_to_pressure(volume: float, moles: float, temperature: float) -> float:
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""
|
||||
Convert International System of Units (SI) and Binary prefixes
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from typing import Union
|
||||
|
||||
|
||||
class SI_Unit(Enum):
|
||||
@ -41,8 +42,8 @@ class Binary_Unit(Enum):
|
||||
|
||||
def convert_si_prefix(
|
||||
known_amount: float,
|
||||
known_prefix: Union[str, SI_Unit],
|
||||
unknown_prefix: Union[str, SI_Unit],
|
||||
known_prefix: str | SI_Unit,
|
||||
unknown_prefix: str | SI_Unit,
|
||||
) -> float:
|
||||
"""
|
||||
Wikipedia reference: https://en.wikipedia.org/wiki/Binary_prefix
|
||||
@ -70,8 +71,8 @@ def convert_si_prefix(
|
||||
|
||||
def convert_binary_prefix(
|
||||
known_amount: float,
|
||||
known_prefix: Union[str, Binary_Unit],
|
||||
unknown_prefix: Union[str, Binary_Unit],
|
||||
known_prefix: str | Binary_Unit,
|
||||
unknown_prefix: str | Binary_Unit,
|
||||
) -> float:
|
||||
"""
|
||||
Wikipedia reference: https://en.wikipedia.org/wiki/Metric_prefix
|
||||
|
Reference in New Issue
Block a user