Advertisement
Guest User

Untitled

a guest
Apr 17th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. class drobne:
  2. monety={"5zl":50, "2z":50, "1zl":50, "0.50zl":50, "0.20zl":50, "0.10zl":10}
  3.  
  4. class napoje:
  5. cola=50
  6. pepsi=50
  7. sprite=50
  8. fanta=50
  9. mirinda=50
  10.  
  11. class automat(napoje,drobne):
  12.  
  13. def sellDrink(self):
  14. print("Cena napoju wynosi : 2zl")
  15. print("Prosze o wybranie cyfry odpowiadajacej napojowi\n\
  16. 1 Cola\n\
  17. 2 Pepsi\n\
  18. 3 Sprite\n\
  19. 4 Fanta\n\
  20. 5 Mirinda")
  21. wybor=input()
  22. print("Prosze o wrzucenie pieniedzy za napój")
  23. self.getMoney()
  24.  
  25. def getMoney(self):
  26. kredyt =0
  27. monety=[]
  28.  
  29. print("1. 5zl \n\
  30. 2. 2zl \n\
  31. 3. 1zl \n\
  32. 4. 50gr \n\
  33. 5. 20gr \n\
  34. 6. 10gr")
  35. while kredyt<2:
  36. userChoice=input()
  37. if userChoice=="1":
  38. kredyt+=5
  39. monety.append(5)
  40. print("Kredyt wynosi", kredyt)
  41. if userChoice=="2":
  42. kredyt+=2
  43. monety.append(2)
  44. print("Kredyt wynosi", kredyt)
  45. if userChoice=="3":
  46. kredyt+=1
  47. monety.append(1)
  48. print("Kredyt wynosi", kredyt)
  49. if userChoice=="4":
  50. kredyt+=0.50
  51. monety.append(0.50)
  52. print("Kredyt wynosi", kredyt)
  53. if userChoice=="5":
  54. kredyt+=0.20
  55. monety.append(0.20)
  56. print("Kredyt wynosi", kredyt)
  57. if userChoice=="6":
  58. kredyt+=0.10
  59. monety.append(0.10)
  60. print("Kredyt wynosi", kredyt)
  61.  
  62. print("Wprowadzono ", kredyt, "zl kredytu")
  63. print("Wrzucone monety to", monety)
  64. print("Trzeba wydać: ", kredyt-2," reszty")
  65. returnList=[kredyt, monety]
  66. return returnList
  67.  
  68.  
  69. napojeUczelnia=automat()
  70. results=[]
  71. results=napojeUczelnia.sellDrink()
  72. for i in results:
  73. print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement