python - my while loop gets called instead of my function -
python - my while loop gets called instead of my function -
so when seek phone call customer_name() function keeps calling while loops first. seems phone call phone_number while loop goes onto customer_name loop. if take phone_number while loop away calls while loop pizza_menu. i've tried prepare several times no luck, help me? tried add together variables customer_name, phone_number etc print out @ end keeps giving me "not defined" wanted add together them list print hem out @ end. wish can help me , appreciate that. not allowed have classes , such because haven't learned yet. using python 3.3
premium_pizzas = ["supreme cheese", "the legendary pizza", "pentakill supreme", "teeto shroomo supreme", "the volcanic rengar", "cheese , ham" , "vegetriano" ] gourmet_pizzas = ["flame gorilla", "snazzy chicken", "intergalactic bbq", "bbq chicken", "hellfire"] num_pizzas = -1 def customer_name(): customer_name ="" while customer_name == "": try: customer_name = str(input("please come in name")) except: print("error must come in something! (cannot number)") else: user_info() def delivery_details(): delivery_address = "" while delivery_address =="": try: delivery_address = str(input("please come in delivery address")) except: print("error must come in something!") phone_number = 0 while (phone_number <0) or (phone_number <7): try: phone_number = int(input("please come in phone number:\n\t")) except: print("phone number must integer only(no only.)") else: pizza_list() def pizza_list(): num_pizzas = -1 while( num_pizzas <= 0 ) or ( num_pizzas > 5 ): try: num_pizzas = int( input( 'how many pizzas (max of 5):')) except: print('invalid input') pizza_dict = {"premium_pizza_price":8.50, "gourmet_pizza_price":5.00, "selected_pizzas":0, "num_premium_pizzas":0, "num_gourmet_pizzas":0} print('\n==premium pizzas==\n') in range (0,len(premium_pizzas)): print (str(i+1) + '. ' + premium_pizzas[i]) print('\n==gourmet pizzas==\n') in range (0,len(gourmet_pizzas)): print (str(i+1) + '. ' + gourmet_pizzas[i]) print('\nenter "next" move on.\n') while(true): if( num_pizzas == 0 ): break; try: selected = input('select premium pizza: ') if(selected == 'next'): break; else: selected = int(selected) if(selected<=0) or (selected > len(premium_pizzas)): print('invalid input') else: pizza_dict['num_premium_pizzas']+=1 num_pizzas -=1 except: print('invalid input') print(' ') while(true): if( num_pizzas == 0 ): break; try: selected = input('select gourmet pizza: ') if(selected == 'next'): break; else: selected = int(selected) if(selected<=0) or (selected > len(gourmet_pizzas)): print('invalid input') else: pizza_dict['num_gourmet_pizzas']+=1 num_pizzas -=1 except: print('invalid input') def user_info(): get_user_info = "" while not get_user_info == "1": get_user_info =str(input("press 1 delivery press\npress 2 pickup\n\t:")) if get_user_info == "1": delivery_details() elif get_user_info == "2": pizza_list() receipt = [customer_name] #print('\ntotal number of premium pizzas: ' + str(pizza_dict['num_premium_pizzas'])); #print('total number of gourmet pizzas: ' + str(pizza_dict['num_gourmet_pizzas'])); #cost = (pizza_dict["num_premium_pizzas"]*pizza_dict['premium_pizza_price'])+(pizza_dict["num_gourmet_pizzas"]*pizza_dict['gourmet_pizza_price']*3.00); #print('\ntotal cost: ' + str(cost)) customer_name() #delivery_details() #geprint('\ntotal number of premium pizzas: ' + str(pizza_dict['num_premium_pizzas']));
this because of inconsistent indentation, phone number loop outside of function , hence gets run script is.
python python-3.x
Comments
Post a Comment