Created
July 31, 2016 17:21
-
-
Save Miha-Pleskovic/1ac2fb6c7fc5ab71a6ffad2e118d4d14 to your computer and use it in GitHub Desktop.
Resturant Menu
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
# -*- coding: utf-8 -*- | |
# ENTERS A NEW DISH | |
def new_dish(): | |
print "Vnesite željeno jed:" | |
dish = raw_input("").lower() | |
print "" | |
print "Vnesite ceno jedi:" | |
price = raw_input("") | |
print "" | |
if price.replace(".", "").isdigit() or price.isdigit(): | |
menu = {} | |
menu_list = open("menu.txt", "a+") | |
menu[dish] = price | |
menu_list.write(dish.capitalize() + ": " + price + "\n") | |
print dish + ": " + price + " -- SHRANJENO" | |
print "" | |
menu_list.close() | |
start_menu() | |
else: | |
print "Prosimo, poskusite znova." | |
new_dish() | |
# DISPLAYS SAVED DISHES IN FILE | |
def menu_print(): | |
try: | |
menu_list = open("menu.txt", "r") | |
for item in menu_list: | |
print item | |
menu_list.close() | |
except: | |
print "Jedilni list je prazen ali ne obstaja." | |
print "" | |
start_menu() | |
# MAIN MENU | |
def start_menu(): | |
print "Vpišite številko zraven opcije, ki jo želite izbrati:" | |
print "1 - PREGLED JEDILNIKA" | |
print "2 - NOVA JED" | |
print "3 - IZHOD" | |
choice = raw_input("").lower() | |
print "" | |
if choice == "1" or choice == "nova jed": | |
menu_print() | |
elif choice == "2" or choice == "pregled jedilnika": | |
new_dish() | |
elif choice == "3" or choice == "izhod": | |
print "Zapiranje programa ........" | |
else: | |
print "Prosimo, poskusite znova." | |
print "" | |
start_menu() | |
# PROGRAM STARTS HERE | |
print "" | |
print " JEDILNI LIST " | |
print "==========================================" | |
print " program za urejanje jedilnega lista " | |
print "" | |
start_menu() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍