You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
programming-basics-2022/02/04.py

19 lines
331 B

from typing import Callable, Tuple
type_F = Callable[[int], int]
def factory(total: int) -> Tuple[type_F, type_F]:
def adder(k):
return k + total
def subtractor(k):
return total - k
return adder, subtractor
if __name__ == "__main__":
add, min = factory(5)
print(add(1))
print(min(3))