Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class drobne:
- monety={"5zl":50, "2z":50, "1zl":50, "0.50zl":50, "0.20zl":50, "0.10zl":10}
- class napoje:
- cola=50
- pepsi=50
- sprite=50
- fanta=50
- mirinda=50
- class automat(napoje,drobne):
- def sellDrink(self):
- print("Cena napoju wynosi : 2zl")
- print("Prosze o wybranie cyfry odpowiadajacej napojowi\n\
- 1 Cola\n\
- 2 Pepsi\n\
- 3 Sprite\n\
- 4 Fanta\n\
- 5 Mirinda")
- wybor=input()
- print("Prosze o wrzucenie pieniedzy za napój")
- self.getMoney()
- def getMoney(self):
- kredyt =0
- monety=[]
- print("1. 5zl \n\
- 2. 2zl \n\
- 3. 1zl \n\
- 4. 50gr \n\
- 5. 20gr \n\
- 6. 10gr")
- while kredyt<2:
- userChoice=input()
- if userChoice=="1":
- kredyt+=5
- monety.append(5)
- print("Kredyt wynosi", kredyt)
- if userChoice=="2":
- kredyt+=2
- monety.append(2)
- print("Kredyt wynosi", kredyt)
- if userChoice=="3":
- kredyt+=1
- monety.append(1)
- print("Kredyt wynosi", kredyt)
- if userChoice=="4":
- kredyt+=0.50
- monety.append(0.50)
- print("Kredyt wynosi", kredyt)
- if userChoice=="5":
- kredyt+=0.20
- monety.append(0.20)
- print("Kredyt wynosi", kredyt)
- if userChoice=="6":
- kredyt+=0.10
- monety.append(0.10)
- print("Kredyt wynosi", kredyt)
- print("Wprowadzono ", kredyt, "zl kredytu")
- print("Wrzucone monety to", monety)
- print("Trzeba wydać: ", kredyt-2," reszty")
- returnList=[kredyt, monety]
- return returnList
- napojeUczelnia=automat()
- results=[]
- results=napojeUczelnia.sellDrink()
- for i in results:
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement