Last active
June 29, 2018 15:12
-
-
Save HubertArciszewski95/d3e3d7f2fc4348cf9c4952ea2a4498fa to your computer and use it in GitHub Desktop.
Program do maszyny z napojami
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
#price | |
water = 1.00 | |
cola = 1.50 | |
Redbull = 2.00 | |
#Printing what machine have in menu | |
print("1.Water = $%s" % water) | |
print("2.Cola = $%s" % cola) | |
print("3.Redbull = $%s" % Redbull) | |
print(" ") | |
#Custorem give input, what he want | |
orderInput = input("Please choose number of item you want to buy :") | |
orderInput = int(orderInput) | |
#water cash input | |
if orderInput == 1: | |
banknoty = int(input("Pleas put banknot ammount :")) | |
zloty = int(input("Please put zloty ammount :")) | |
grosz = float(input("Please put grosz ammount :")) | |
#In total | |
total = banknoty + zloty + grosz | |
print(" ") | |
print("You put in total %s zloty" % total) | |
#cola cash input | |
elif orderInput == 2: | |
banknoty = int(input("Please put banknot ammount :")) | |
zloty = int(input("Please put zloty ammount :")) | |
grosz = float(input("Please put grosz ammount :")) | |
#In total | |
total = banknoty + zloty + grosz | |
print(" ") | |
print("You put in total %s zloty" % total) | |
#Gatorade cash input | |
elif orderInput == 3: | |
banknoty = int(input("Please put banknot ammount :")) | |
zlotyCola = int(input("Please put zloty ammount :")) | |
groszCola = float(input("Please put grosz ammount :")) | |
# In total | |
total = banknoty + zlotyCola + groszCola | |
print(" ") | |
print("You put in total %s zloty" % total) | |
#error communicate | |
else: | |
print("Wrong number") | |
print("Try again") | |
sys.exit() | |
#reszta water | |
if orderInput == 1 and total >= water: | |
change = total - water | |
print("Your Change: %s zloty" % change) | |
print(" ") | |
print("Dont forgot your Water!") | |
#Za malo pieniedzy - woda | |
elif orderInput == 1 and total < water: | |
print("Not enought monety. Water cost %s zloty. Try again" % water) | |
#reszta cola | |
elif orderInput == 2 and total >= cola: | |
change = total - cola | |
print("Your Change :%s zloty" % change) | |
print(" ") | |
print("Dont forgot your Cola!") | |
#Za malo pieniedzy - cola | |
elif orderInput == 2 and total < cola: | |
print("Not enought monety. Cola cost %s zloty. Try again" % cola) | |
#reszta Redbull | |
elif orderInput == 3 and total >= Redbull: | |
change = total - Redbull | |
print("Your Change: %s zloty" % change) | |
print(" ") | |
print("Dont forgot your Redbull!") | |
#Za malo pieniedzy - Redbull | |
elif orderInput == 3 and total < Redbull: | |
print("Not enought monety. Redbull cost %s zloty. Try again" % Redbull) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment