# Money converter

Jul 30th, 2021
700
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. from typing import List, Tuple
2. from decimal import Decimal as d
3. import math
4. import random
5. coupier = [10,50,100,500,1000] #купюры
6. coupierfm = [] #купюры которые получит человек
7. coins =[0.01,0.05,0.1,0.25,0.5,1,5] # монеты
8. coinsfm = [] #монеты человеку
9. def main(input_coins: List[float]) -> Tuple[List[int], List[float]]:
10.   input_coins = map(str, input_coins)
11.   count = sum(map(d, input_coins))
12.   print(count, "сумма декимал")
13.   for i in reversed(coupier):
14.     a = count//d(str(i))
15.     if a >= 1:
16.       coupierfm.extend([i] * int(a))
17.       count -= d(str(i))*d(str(a))
18.   for i in reversed(coins):
19.     a = count//d(str(i))
20.     if a >= 1:
21.       coinsfm.extend([i] * int(a))
22.       count -= d(str(i))*d(str(a))
23.   print(coupierfm,coinsfm,count)
24. input_coins = []
25. for i in range(0, 18):
26.   n = random.choice(coins)
27.   input_coins.append(n)
28. n = round(sum(input_coins), 2)
29. print(input_coins, "сумма рандом", n)
30. main(input_coins)
RAW Paste Data