This is my first time posting in this forum so sorry in advance if i have done something wrong or not explained the problem clearly!
Hi,
so my python program to create a coffee ordering system was working great but has now suddenly stopped working. When I go to the shell and enter main() or define main () nothing happens. Literally no errors. nothing.
Here is the code:
# 10 TECH ASSIGNMENT
# Created by G_109 on 30/5/18
https://imgur.com/a/1WLUrTE
(sorry if the link doesn't work, but it just basically shows how it jumps a line down from where i type "main()" and then the chevrons disappear!)
Hi,
so my python program to create a coffee ordering system was working great but has now suddenly stopped working. When I go to the shell and enter main() or define main () nothing happens. Literally no errors. nothing.
Here is the code:
# 10 TECH ASSIGNMENT
# Created by G_109 on 30/5/18
############################ START OF FUNCTIONS ############################### def create_list(): global menu menu = ["\nAHS COFFEE CART MENU" ] menu.append("1. Cafe Latte, Regular $") menu.append("2. Cafe Latte, Large $") menu.append("3. Cappuccino, Regular $") menu.append("4. Cappuccino, Large $") menu.append("5. Espresso, Regular $") menu.append("6. Espresso, Large $") menu.append("7. Americano, Regular $") menu.append("8. Americano, Large $") menu.append("9. Macchiato, Regular $") menu.append("10. Macchiato, Large $") menu.append("11. Caffe Mocha, Regular $") menu.append("12. Caffe Mocha, Large $") menu.append("13. English Breakfast Tea, Regular $") menu.append("14. English Breakfast Tea, Large $") global menu_price menu_price = [""] menu_price.append(4.5) menu_price.append(5.0) menu_price.append(4.5) menu_price.append(5.1) menu_price.append(4.0) menu_price.append(4.8) menu_price.append(4.1) menu_price.append(4.8) menu_price.append(4.5) menu_price.append(5.0) menu_price.append(3.5) menu_price.append(4.5) menu_price.append(3.0) menu_price.append(4.0) menu_price.append("") newCustomer() def newCustomer(): global customerNum while customerNum < 100: customerNum + 1 else: customerNum = 1 global totalCost totalCost = 0 print("Welcome to the All Hallows Coffee Cart") global customer_Name customer_Name = input("Please enter your name: ") customer_Name = customer_Name.capitalize() displayMenu() def displayMenu (): num = 0 for num in range(0, 15): print(menu[num], menu_price[num]) num+=1 print("Q. Quit") print("") menu_order() def menu_order(): menu_order = input("Please enter the number of your drink order: ") if(menu_order == "Q")|(menu_order == "q"): quit() elif int(menu_order) in range (1, 14): menu_order = int(menu_order) extras_menu_sugar() def extras_menu_sugar(): sugar_amount = input("Sugars are $0.1 per tsp. Enter how many sugars you would like: ") if (sugar_amount == "1")|(sugar_amount == "2")|(sugar_amount == "3")|(sugar_amount == "4"): sugar_amount = int(sugar_amount) sugar_cost = (sugar_amount * 0.1) extras_menu_chocolate() elif (sugar_amount == "0"): extras_menu_chocolate() else: print("Invalid order.") extra_menu_sugar() def extras_menu_chocolate(): chocolate_amount = input("Chocolate is $0.5 per tsp. Enter how much chocolate you would like: ") if (chocolate_amount == "1")|(chocolate_amount == "2")|(chocolate_amount == "3")|(chocolate_amount == "4"): chocolate_amount = int(chocolate_amount) chocolate_cost = (chocolate_amount * 0.5) lucky_number() elif (chocolate_amount == "0"): lucky_number() else: print("Invalid order.") extra_menu_chocolate() def lucky_number(): import random lucky_number = (random.randint(0,100)) if lucky_number == 30: set (totalCost == 0) print("Congratulations, you have recieved the lucky number for today! Enjoy your free order") else: print("Your lucky number was",lucky_number) print("You did not recieve the lucky number for today.") def customer_reciept(): print("") print("CUSTOMER RECEIPT") print("Your customer number is:",customerNum) print("Your menu order is",menu_order) print("Your extra cost for sugar is",extras_menu_sugar) print("Your extra cost for chocolate is",extras_menu_chocolate) print("Your total is",totalCost) ############################ END OF FUNCTIONS ############################### # Functions are run in order to output the digital solution in the shell def main(): global customerNum customerNum = 0 create_list() customer_reciept() print("Thankyou", customer_Name, "for purchasing from the AHS Coffee Cart. Hope to see you back again soon!")]Here is the output in the shell:
https://imgur.com/a/1WLUrTE
(sorry if the link doesn't work, but it just basically shows how it jumps a line down from where i type "main()" and then the chevrons disappear!)