Advertisement
erg0naft

calculate_cnange.py

Mar 10th, 2022
58
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. price = float(input())
  2. paid_price = float(input())
  3.  
  4. change = (paid_price - price)*100
  5.  
  6. if change >= 0:
  7. num_lev = change // 100
  8. change %= 100
  9. if num_lev:
  10. print(f'{int(num_lev)} x 1 lev')
  11.  
  12. num_petdeset_st = change // 50
  13. change %= 50
  14. if num_petdeset_st:
  15. print(f'{int(num_petdeset_st)} x 50 stotinki')
  16.  
  17. num_dvadeset_st= change // 20
  18. change %= 20
  19. if num_dvadeset_st:
  20. print(f'{int(num_dvadeset_st)} x 20 stotinki')
  21.  
  22. num_deset_st = change // 10
  23. change %= 10
  24. if num_deset_st:
  25. print(f'{int(num_deset_st)} x 10 stotinki')
  26.  
  27. num_pet_st = change // 5
  28. change %= 5
  29. if num_pet_st:
  30. print(f'{int(num_pet_st)} x 5 stotinki')
  31. num_dve_st = change // 2
  32. change %= 2
  33. if num_dve_st:
  34. print(f'{int(num_dve_st)} x 2 stotinki')
  35. num_edna_st = change // 1
  36. change %= 1
  37. if num_edna_st:
  38. print(f'{int(num_edna_st)} x 1 stotinka')
Advertisement
RAW Paste Data Copied
Advertisement