mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
7ad6c64029
* Add typing to maths/add.py https://stackoverflow.com/questions/50928592/mypy-type-hint-unionfloat-int-is-there-a-number-type * Update add.py * Update add.py
20 lines
243 B
Python
20 lines
243 B
Python
"""
|
|
Just to check
|
|
"""
|
|
|
|
|
|
def add(a: float, b: float) -> float:
|
|
"""
|
|
>>> add(2, 2)
|
|
4
|
|
>>> add(2, -2)
|
|
0
|
|
"""
|
|
return a + b
|
|
|
|
|
|
if __name__ == "__main__":
|
|
a = 5
|
|
b = 6
|
|
print(f"The sum of {a} + {b} is {add(a, b)}")
|