You are on page 1of 6

Leean's Pizza Code Snippets

Below are the codes for Leeans Pizza

Price Declaration The code below contains the cell array of the items in the menu.

The following code is a 2-D Matrix consisting of the item name and prices. The prices for the different varieties of
pizza are stored in the same row with per item.

In [1]: #Price Matrix

pizza_Data = [['Cheese Lovers Pizza', 180.00, 250.00, 420.00],


['Meat Lovers Pizza', 195.00, 265.00, 430.00],
['Pepperoni Lovers Pizza', 200.00, 250.00, 425.00],
['Vegie Lovers Pizza', 210.00, 275.00, 450.00],
['Supreme Pizza', 220.00, 280.00, 480.00]]

Order Function Declaration


In [7]: def order_Pizza(pD):
print('Olaes Pizza')
for k in range(len(pD)):
print(str(k + 1) + '.) ' + pD[k][0])
print('Single: ' + str(pD[k][1]) + ' | Double: ' + str(pD
[k][2]) + ' | Family: ' + str(pD[k][3]))
print('______________________________________________________
__________________________________________')

o_m = []
isOrdering = True
while isOrdering == True:
#Pizza Choice
var = 0
while not(var > 0 and var < 6):
var = int(input('Please choose the number of your Pizza:
'))
if not(var > 0 and var < 6):
print('Error! Invalid Choice.')

#Size Choice
size = 0
print('Choose Size: 1 - Single, 2 - Double, 3 - Family')
while not(size > 0 and size < 4):
size = int(input('Please choose the number indicated: '))
if not(size > 0 and size < 4):
print('Error! Invalid Choice.')

#Quantity Query
qty = 2.75
qty = int(input('Please input quantity: '))

o_m.append([var, size, qty])

#Validation
inp = 'z'
while not (inp == 'y' or inp == 'n'):

while not (inp == 'y' or inp == 'n'):


inp = input('Order More? y - yes or n - no')
inp.lower()
if not (inp == 'y' or inp == 'n'):
print('Error! Invalid Choice.')

if inp == 'y':
isOrdering = True
print('Ordering . . . . .')
elif inp == 'n':
isOrdering = False
print('Summarizing . . . . . ')

#Summary

#Order Summary

print('\n')
print('\n')
print('\n')
print('\n')

print('Order Summary: ')


print('Order Queries: ' + str(len(o_m)))
total = 0
for j in range(len(o_m)):
if o_m[j][1] == 1:
t_s = 'Single Size '
elif o_m[j][1] == 2:
t_s = 'Double Size '
else:
t_s = 'Family Size '

print('Order No. ' + str(j + 1) + ' --- ' + t_s + pD[o_m[j][0


] - 1][0])
total = total + (pD[o_m[j][0] - 1][o_m[j][1]]*o_m[j][2])

print(' Price: ' + str(pD[o_m[j][0] - 1][o_m[j][1]]) + ' x


' + str(o_m[j][2]) + ' = ' + str(pD[o_m[j][0] - 1][o_m[j][1]]*o_m[j]
[2]))
print('__________________________________________________________
________________________________________')
print('Total Amount: ' + str(total) + ' PHP ')
In [8]: order_Pizza(pizza_Data)
Olaes Pizza
1.) Cheese Lovers Pizza
Single: 180.0 | Double: 250.0 | Family: 420.0
_____________________________________________________________________
___________________________
2.) Meat Lovers Pizza
Single: 195.0 | Double: 265.0 | Family: 430.0
_____________________________________________________________________
___________________________
3.) Pepperoni Lovers Pizza
Single: 200.0 | Double: 250.0 | Family: 425.0
_____________________________________________________________________
___________________________
4.) Vegie Lovers Pizza
Single: 210.0 | Double: 275.0 | Family: 450.0
_____________________________________________________________________
___________________________
5.) Supreme Pizza
Single: 220.0 | Double: 280.0 | Family: 480.0
_____________________________________________________________________
___________________________
Please choose the number of your Pizza: 1
Choose Size: 1 - Single, 2 - Double, 3 - Family
Please choose the number indicated: 3
Please input quantity: 4
Order More? y - yes or n - no2
Error! Invalid Choice.
Order More? y - yes or n - noy
Ordering . . . . .
Please choose the number of your Pizza: 3
Choose Size: 1 - Single, 2 - Double, 3 - Family
Please choose the number indicated: 3
Please input quantity: 3
Order More? y - yes or n - noy
Ordering . . . . .
Please choose the number of your Pizza: 4
Choose Size: 1 - Single, 2 - Double, 3 - Family
Please choose the number indicated: 3
Please input quantity: 2
Order More? y - yes or n - no5
Error! Invalid Choice.
Order More? y - yes or n - noy
Ordering . . . . .
Please choose the number of your Pizza: 5
Choose Size: 1 - Single, 2 - Double, 3 - Family
Please choose the number indicated: 2
Please input quantity: 1
Order More? y - yes or n - non
Summarizing . . . . .
Order Summary:
Order Queries: 4
Order No. 1 --- Family Size Cheese Lovers Pizza
Price: 420.0 x 4 = 1680.0
Order No. 2 --- Family Size Pepperoni Lovers Pizza
Price: 425.0 x 3 = 1275.0
Order No. 3 --- Family Size Vegie Lovers Pizza
Price: 450.0 x 2 = 900.0
Order No. 4 --- Double Size Supreme Pizza
Price: 280.0 x 1 = 280.0
_____________________________________________________________________
_____________________________
Total Amount: 4135.0 PHP

You might also like