dylan.lange.16 0 Newbie Poster

Heya fellas, I'm writing a little program to take a pizza order... All has been fine and dandy until the line in the takeOrderDetails() function.

None of the code in the while loop there is being addressed at all as far as i can see from the code and how i've tested it.

----> Line 69 is where the problem's at.

I was wondering if any of you guys would be able to help me out here, thanks!

import time

pizzaAmount = 0
pizzaAmountTemp = 0
name = ''
nameTemp = ''
address = ''
addressTemp = ''
addressTemp2 = ''
phoneNumber = 0
phoneNumberTemp = 0
forPickup = True
deliveryCheck = ''
pizzaNames = ('Meat Lovers','Hawaiian','Mr Wedge','Pepperoni',
                'Vegetarian','Chocolate','Tomato','Napoletana',
                'Romana','Margherita','Viennese','Capricciosa')
pizzaPrices = (8.50, 8.50, 8.50, 8.50,
                8.50, 8.50, 8.50, 13.50,
                13.50, 13.50, 13.50, 13.50)
__tempValue3__ = 0
pizzaMenuNumbers = (0, 0, 0, 0, 0)
subTotalPrice = 0.00

def collectCustomerInfo():
    while True:
        deliveryCheck = input("Is the pizza order for pickup or delivery?\n ")
        if(deliveryCheck.lower() == 'pickup'): #.lower is an inbuilt method to make the string all lowecase. I used this to make the checking more efficient.
            forPickup = True
            break
        elif(deliveryCheck.lower() == 'delivery'):
            forPickup = False
            break
        elif(deliveryCheck.lower() != 'delivery' and deliveryCheck.lower() != 'pickup'):
            print('Please enter either "Pickup" or "Delivery" (Not case sensitive)')

    while True:
        nameTemp = input("Please enter the customer's name:\n   ")
        if(nameTemp.isalpha()): #.isalpha() - inbuilt method to check if the string contains only letters. Returns false otherwise
            name = nameTemp
            break
        else:
            print('Please only include letters for this\n')

    if(forPickup == False):
        while True:
            addressTemp = input("Please enter the customer's address:\n ")
            addressTemp2 = addressTemp.replace(' ', '') #Temporarily removing spaces from the string to check for non-letter/non-number characters
            if(addressTemp2.isalnum()): #If the address input is all numbers/letters (when spaces are removed), continue.
                address = addressTemp
                break
            else:
                print('Please only include numbers and letters for this\n')

        while True:
            phoneNumberTemp = input("Please enter the customer's phone number:\n    ")
            if(phoneNumberTemp.isdigit()):
                phoneNumber = int(phoneNumberTemp)
                break
            else:
                print('Please only include numbers for this\n')
    pizzaAmountTemp = input("Please enter the amount of pizzas total that the customer wants to purchase:\n ")
    pizzaAmount = int(pizzaAmountTemp)
    time.sleep(3)

def takeOrderDetails():
    loopCount = 0 #Loop 'counter'
    orderNumberTemp = 0 #Object to hold the value for 1b
    orderNumber = 0 #Number which identifies the menu numbers for pizzas ordered
    while(loopCount < pizzaAmount):
        orderNumberTemp = input("Enter the pizza number of a pizza the customer wants from the menu:\n  ")
        orderNumber = int(orderNumberTemp)
        subTotalPrice += pizzaPrices[orderNumber]
        pizzaMenuNumbers[loopCount] = v #Storing the order in a list to use for displaying later.
        loopCount += 1

def displayMenu():
    print('      Pizza Menu        ')
    for x in range(len(pizzaNames)):
        print(' ' + str(pizzaNames[x]) + '      $' + str(pizzaPrices[x]) + '0')
    print('------------------------------------------')
    print('')

def run():
    displayMenu()
    # time.sleep(2)
    # collectCustomerInfo()
    takeOrderDetails()

run()
time.sleep(5)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.