SHARE
TWEET

Untitled

Gonef Feb 24th, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while True:
  2.     try:
  3.         x = kwota = float(input('Wprowadź kwotę\n'))
  4.         break
  5.     except:
  6.         print('Jesteś głupim kutasem, to ma być liczba niedorozwoju.')
  7. nominal = (500,200,100,50,20,10,5,2,1,0.5,0.2,0.1,0.05,0.02,0.01)
  8. y = 0
  9. lista = []
  10. while kwota > 0:
  11.     if kwota >= (nominal[y]):
  12.         z = int(kwota / nominal[y])
  13.         lista.append(str(z) + ' * ' + str(nominal[y]))
  14.         kwota = kwota - z * (nominal[y])
  15.         y = y + 1
  16.     elif kwota < 0:
  17.         print('Chyba popadłeś w długi ;)')
  18.     else:
  19.         y = y + 1
  20.  
  21. print('Kwotę ' + str(x) + ' można rozmienić na nominały: ' + str(lista))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top