Pizza Stacking System












-2















I am making a pizza ordering system. It works up until I tried to make it let you order more than one pizza. How would I use tuples to correctly print off the pizza Size and pizza Topppings without weird list syntax?
I do not know how to use it as namedtuples is new to me. I am putting the pizza details into another tuple.
The pizza details are: size, topping and cost. The toppings are in a tuple of their own and I do not know how to call the details within calling the topping in another tuple.



This is complicated to explain but any help is appreciated! If you don't understand any bit of it then reply and tell me what, I will try my best to explain it.



Thanks



import pygame, collections

pizzaList =

def order():
pizzaCost = 0.00
pizzaSize = None
small = ["small","£3.00"]
medium = ["medium","£4.50"]
large = ["large","£5.00"]
pizzaToppings =
pizzaToppingsList = ["Pepperoni","Chicken","Cajun Chicken","Mushrooms","Red Onions","Sweetcorn","Ham"]
pizzaToppingsMax = 0


#pizza size
print("How big would you like your pizza? ")
pizzaSizeInput = input("Small (max 2 toppings), Medium (max 4 toppings) or Large? (max 6 toppings) ")

if pizzaSizeInput == "Small":
pizzaSize=small
pizzaCost+=3.00
pizzaToppingsMax=2

if pizzaSizeInput == "Medium":
pizzaSize=medium
pizzaCost+=4.50
pizzaToppingsMax=4

if pizzaSizeInput == "Large":
pizzaSize=large
pizzaCost+=5.00
pizzaToppingsMax=6

pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,0,1,pizzaToppingsList)

def pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,pizzaToppingCount,y,pizzaToppingsList):
Toppings = collections.namedtuple('Toppings', ['index','description','price'])

#pizza toppings
print("What toppings would you like? ")
toppingsInput = input(str(pizzaToppingsList) + " ")
pizzaToppingCount+=1
print(str(pizzaToppingsMax - pizzaToppingCount) + " Toppings Left")

if toppingsInput in pizzaToppingsList:
y+=1
pizzaToppings.append(Toppings(y, str(toppingsInput), '£0.50'))
pizzaToppingsList.remove(toppingsInput)
pizzaCost+=0.50

if pizzaToppingsMax==2:
if pizzaToppingCount==2:
print("Here is your current pizza: ")
pIndex = "1".ljust(5)
pDesc = str(pizzaSize[0]).ljust(25)
pPrice = str(pizzaSize[1]).ljust(7)
print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

for x in pizzaToppings:
index = str(getattr(x,'index')).ljust(5)
descr = getattr(x,'description').ljust(25)
price = getattr(x,'price').ljust(7)
print('{0}{1}{2}'.format(index,descr,price))
finishTopping(pizzaToppings,pizzaCost,pizzaSize)

if pizzaToppingsMax==4:
if pizzaToppingCount==4:
print("Here is your current pizza: ")
pIndex = "1".ljust(5)
pDesc = str(pizzaSize[0]).ljust(25)
pPrice = str(pizzaSize[1]).ljust(7)
print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

for x in pizzaToppings:
index = str(getattr(x,'index')).ljust(5)
descr = getattr(x,'description').ljust(25)
price = getattr(x,'price').ljust(7)
print('{0}{1}{2}'.format(index,descr,price))
finishTopping(pizzaToppings,pizzaCost,pizzaSize)

if pizzaToppingsMax==6:
if pizzaToppingCount==6:
print("Here is your current pizza: ")
pIndex = "1".ljust(5)
pDesc = str(pizzaSize[0]).ljust(25)
pPrice = str(pizzaSize[1]).ljust(7)
print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

for x in pizzaToppings:
index = str(getattr(x,'index')).ljust(5)
descr = getattr(x,'description').ljust(25)
price = getattr(x,'price').ljust(7)
print('{0}{1}{2}'.format(index,descr,price))
finishTopping(pizzaToppings,pizzaCost,pizzaSize)

anotherT = input("Would you like another topping? ")
if anotherT == "yes":
pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,pizzaToppingCount,y,pizzaToppingsList)
else:
print("Here is your current pizza: ")
pIndex = "1".ljust(5)
pDesc = str(pizzaSize[0]).ljust(25)
pPrice = str(pizzaSize[1]).ljust(7)
print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

for x in pizzaToppings:
index = str(getattr(x,'index')).ljust(5)
descr = getattr(x,'description').ljust(25)
price = getattr(x,'price').ljust(7)
print('{0}{1}{2}'.format(index,descr,price))
finishTopping(pizzaToppings,pizzaCost,pizzaSize)
else:
print("That ingredient doesn't exist or you cannot have it.")
pizzaToppingss(pizzaCost,pizzaToppings,pizzaToppingsMax,y)

def finishTopping(pizzaToppings,pizzaCost,pizzaSize):
global pizzaList
pizzaSSSList = collections.namedtuple('pizzas', ['size','toppings','cost'])
pizzaList.append(pizzaSSSList(pizzaSize, pizzaToppings, pizzaCost))
inp = input("Would you like another pizza?")
if inp == "yes":
print("yes")
order()
else:
print(" ")
print("Here is your final order: ")
pIndex = "1".ljust(5)
pDesc = str(pizzaSize[0]).ljust(25)
pPrice = str(pizzaSize[1]).ljust(7)
print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))
for x in pizzaList:
topp = str(getattr(x,'toppings')).ljust(5)
cost = str(getattr(x,'cost')).ljust(25)
size = str(getattr(x,'size')).ljust(7)
print('{0}{1}{2}'.format(size,topp,cost))

print("The grand total is: £" + str(pizzaCost) + "0")
exit()
def ask():
inp = input("Hello! Would you like to order a pizza? ")
if inp == "Yes":
order()
if inp == "yes":
order()
else:
ask()

ask()









share|improve this question



























    -2















    I am making a pizza ordering system. It works up until I tried to make it let you order more than one pizza. How would I use tuples to correctly print off the pizza Size and pizza Topppings without weird list syntax?
    I do not know how to use it as namedtuples is new to me. I am putting the pizza details into another tuple.
    The pizza details are: size, topping and cost. The toppings are in a tuple of their own and I do not know how to call the details within calling the topping in another tuple.



    This is complicated to explain but any help is appreciated! If you don't understand any bit of it then reply and tell me what, I will try my best to explain it.



    Thanks



    import pygame, collections

    pizzaList =

    def order():
    pizzaCost = 0.00
    pizzaSize = None
    small = ["small","£3.00"]
    medium = ["medium","£4.50"]
    large = ["large","£5.00"]
    pizzaToppings =
    pizzaToppingsList = ["Pepperoni","Chicken","Cajun Chicken","Mushrooms","Red Onions","Sweetcorn","Ham"]
    pizzaToppingsMax = 0


    #pizza size
    print("How big would you like your pizza? ")
    pizzaSizeInput = input("Small (max 2 toppings), Medium (max 4 toppings) or Large? (max 6 toppings) ")

    if pizzaSizeInput == "Small":
    pizzaSize=small
    pizzaCost+=3.00
    pizzaToppingsMax=2

    if pizzaSizeInput == "Medium":
    pizzaSize=medium
    pizzaCost+=4.50
    pizzaToppingsMax=4

    if pizzaSizeInput == "Large":
    pizzaSize=large
    pizzaCost+=5.00
    pizzaToppingsMax=6

    pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,0,1,pizzaToppingsList)

    def pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,pizzaToppingCount,y,pizzaToppingsList):
    Toppings = collections.namedtuple('Toppings', ['index','description','price'])

    #pizza toppings
    print("What toppings would you like? ")
    toppingsInput = input(str(pizzaToppingsList) + " ")
    pizzaToppingCount+=1
    print(str(pizzaToppingsMax - pizzaToppingCount) + " Toppings Left")

    if toppingsInput in pizzaToppingsList:
    y+=1
    pizzaToppings.append(Toppings(y, str(toppingsInput), '£0.50'))
    pizzaToppingsList.remove(toppingsInput)
    pizzaCost+=0.50

    if pizzaToppingsMax==2:
    if pizzaToppingCount==2:
    print("Here is your current pizza: ")
    pIndex = "1".ljust(5)
    pDesc = str(pizzaSize[0]).ljust(25)
    pPrice = str(pizzaSize[1]).ljust(7)
    print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

    for x in pizzaToppings:
    index = str(getattr(x,'index')).ljust(5)
    descr = getattr(x,'description').ljust(25)
    price = getattr(x,'price').ljust(7)
    print('{0}{1}{2}'.format(index,descr,price))
    finishTopping(pizzaToppings,pizzaCost,pizzaSize)

    if pizzaToppingsMax==4:
    if pizzaToppingCount==4:
    print("Here is your current pizza: ")
    pIndex = "1".ljust(5)
    pDesc = str(pizzaSize[0]).ljust(25)
    pPrice = str(pizzaSize[1]).ljust(7)
    print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

    for x in pizzaToppings:
    index = str(getattr(x,'index')).ljust(5)
    descr = getattr(x,'description').ljust(25)
    price = getattr(x,'price').ljust(7)
    print('{0}{1}{2}'.format(index,descr,price))
    finishTopping(pizzaToppings,pizzaCost,pizzaSize)

    if pizzaToppingsMax==6:
    if pizzaToppingCount==6:
    print("Here is your current pizza: ")
    pIndex = "1".ljust(5)
    pDesc = str(pizzaSize[0]).ljust(25)
    pPrice = str(pizzaSize[1]).ljust(7)
    print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

    for x in pizzaToppings:
    index = str(getattr(x,'index')).ljust(5)
    descr = getattr(x,'description').ljust(25)
    price = getattr(x,'price').ljust(7)
    print('{0}{1}{2}'.format(index,descr,price))
    finishTopping(pizzaToppings,pizzaCost,pizzaSize)

    anotherT = input("Would you like another topping? ")
    if anotherT == "yes":
    pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,pizzaToppingCount,y,pizzaToppingsList)
    else:
    print("Here is your current pizza: ")
    pIndex = "1".ljust(5)
    pDesc = str(pizzaSize[0]).ljust(25)
    pPrice = str(pizzaSize[1]).ljust(7)
    print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

    for x in pizzaToppings:
    index = str(getattr(x,'index')).ljust(5)
    descr = getattr(x,'description').ljust(25)
    price = getattr(x,'price').ljust(7)
    print('{0}{1}{2}'.format(index,descr,price))
    finishTopping(pizzaToppings,pizzaCost,pizzaSize)
    else:
    print("That ingredient doesn't exist or you cannot have it.")
    pizzaToppingss(pizzaCost,pizzaToppings,pizzaToppingsMax,y)

    def finishTopping(pizzaToppings,pizzaCost,pizzaSize):
    global pizzaList
    pizzaSSSList = collections.namedtuple('pizzas', ['size','toppings','cost'])
    pizzaList.append(pizzaSSSList(pizzaSize, pizzaToppings, pizzaCost))
    inp = input("Would you like another pizza?")
    if inp == "yes":
    print("yes")
    order()
    else:
    print(" ")
    print("Here is your final order: ")
    pIndex = "1".ljust(5)
    pDesc = str(pizzaSize[0]).ljust(25)
    pPrice = str(pizzaSize[1]).ljust(7)
    print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))
    for x in pizzaList:
    topp = str(getattr(x,'toppings')).ljust(5)
    cost = str(getattr(x,'cost')).ljust(25)
    size = str(getattr(x,'size')).ljust(7)
    print('{0}{1}{2}'.format(size,topp,cost))

    print("The grand total is: £" + str(pizzaCost) + "0")
    exit()
    def ask():
    inp = input("Hello! Would you like to order a pizza? ")
    if inp == "Yes":
    order()
    if inp == "yes":
    order()
    else:
    ask()

    ask()









    share|improve this question

























      -2












      -2








      -2








      I am making a pizza ordering system. It works up until I tried to make it let you order more than one pizza. How would I use tuples to correctly print off the pizza Size and pizza Topppings without weird list syntax?
      I do not know how to use it as namedtuples is new to me. I am putting the pizza details into another tuple.
      The pizza details are: size, topping and cost. The toppings are in a tuple of their own and I do not know how to call the details within calling the topping in another tuple.



      This is complicated to explain but any help is appreciated! If you don't understand any bit of it then reply and tell me what, I will try my best to explain it.



      Thanks



      import pygame, collections

      pizzaList =

      def order():
      pizzaCost = 0.00
      pizzaSize = None
      small = ["small","£3.00"]
      medium = ["medium","£4.50"]
      large = ["large","£5.00"]
      pizzaToppings =
      pizzaToppingsList = ["Pepperoni","Chicken","Cajun Chicken","Mushrooms","Red Onions","Sweetcorn","Ham"]
      pizzaToppingsMax = 0


      #pizza size
      print("How big would you like your pizza? ")
      pizzaSizeInput = input("Small (max 2 toppings), Medium (max 4 toppings) or Large? (max 6 toppings) ")

      if pizzaSizeInput == "Small":
      pizzaSize=small
      pizzaCost+=3.00
      pizzaToppingsMax=2

      if pizzaSizeInput == "Medium":
      pizzaSize=medium
      pizzaCost+=4.50
      pizzaToppingsMax=4

      if pizzaSizeInput == "Large":
      pizzaSize=large
      pizzaCost+=5.00
      pizzaToppingsMax=6

      pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,0,1,pizzaToppingsList)

      def pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,pizzaToppingCount,y,pizzaToppingsList):
      Toppings = collections.namedtuple('Toppings', ['index','description','price'])

      #pizza toppings
      print("What toppings would you like? ")
      toppingsInput = input(str(pizzaToppingsList) + " ")
      pizzaToppingCount+=1
      print(str(pizzaToppingsMax - pizzaToppingCount) + " Toppings Left")

      if toppingsInput in pizzaToppingsList:
      y+=1
      pizzaToppings.append(Toppings(y, str(toppingsInput), '£0.50'))
      pizzaToppingsList.remove(toppingsInput)
      pizzaCost+=0.50

      if pizzaToppingsMax==2:
      if pizzaToppingCount==2:
      print("Here is your current pizza: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

      for x in pizzaToppings:
      index = str(getattr(x,'index')).ljust(5)
      descr = getattr(x,'description').ljust(25)
      price = getattr(x,'price').ljust(7)
      print('{0}{1}{2}'.format(index,descr,price))
      finishTopping(pizzaToppings,pizzaCost,pizzaSize)

      if pizzaToppingsMax==4:
      if pizzaToppingCount==4:
      print("Here is your current pizza: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

      for x in pizzaToppings:
      index = str(getattr(x,'index')).ljust(5)
      descr = getattr(x,'description').ljust(25)
      price = getattr(x,'price').ljust(7)
      print('{0}{1}{2}'.format(index,descr,price))
      finishTopping(pizzaToppings,pizzaCost,pizzaSize)

      if pizzaToppingsMax==6:
      if pizzaToppingCount==6:
      print("Here is your current pizza: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

      for x in pizzaToppings:
      index = str(getattr(x,'index')).ljust(5)
      descr = getattr(x,'description').ljust(25)
      price = getattr(x,'price').ljust(7)
      print('{0}{1}{2}'.format(index,descr,price))
      finishTopping(pizzaToppings,pizzaCost,pizzaSize)

      anotherT = input("Would you like another topping? ")
      if anotherT == "yes":
      pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,pizzaToppingCount,y,pizzaToppingsList)
      else:
      print("Here is your current pizza: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

      for x in pizzaToppings:
      index = str(getattr(x,'index')).ljust(5)
      descr = getattr(x,'description').ljust(25)
      price = getattr(x,'price').ljust(7)
      print('{0}{1}{2}'.format(index,descr,price))
      finishTopping(pizzaToppings,pizzaCost,pizzaSize)
      else:
      print("That ingredient doesn't exist or you cannot have it.")
      pizzaToppingss(pizzaCost,pizzaToppings,pizzaToppingsMax,y)

      def finishTopping(pizzaToppings,pizzaCost,pizzaSize):
      global pizzaList
      pizzaSSSList = collections.namedtuple('pizzas', ['size','toppings','cost'])
      pizzaList.append(pizzaSSSList(pizzaSize, pizzaToppings, pizzaCost))
      inp = input("Would you like another pizza?")
      if inp == "yes":
      print("yes")
      order()
      else:
      print(" ")
      print("Here is your final order: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))
      for x in pizzaList:
      topp = str(getattr(x,'toppings')).ljust(5)
      cost = str(getattr(x,'cost')).ljust(25)
      size = str(getattr(x,'size')).ljust(7)
      print('{0}{1}{2}'.format(size,topp,cost))

      print("The grand total is: £" + str(pizzaCost) + "0")
      exit()
      def ask():
      inp = input("Hello! Would you like to order a pizza? ")
      if inp == "Yes":
      order()
      if inp == "yes":
      order()
      else:
      ask()

      ask()









      share|improve this question














      I am making a pizza ordering system. It works up until I tried to make it let you order more than one pizza. How would I use tuples to correctly print off the pizza Size and pizza Topppings without weird list syntax?
      I do not know how to use it as namedtuples is new to me. I am putting the pizza details into another tuple.
      The pizza details are: size, topping and cost. The toppings are in a tuple of their own and I do not know how to call the details within calling the topping in another tuple.



      This is complicated to explain but any help is appreciated! If you don't understand any bit of it then reply and tell me what, I will try my best to explain it.



      Thanks



      import pygame, collections

      pizzaList =

      def order():
      pizzaCost = 0.00
      pizzaSize = None
      small = ["small","£3.00"]
      medium = ["medium","£4.50"]
      large = ["large","£5.00"]
      pizzaToppings =
      pizzaToppingsList = ["Pepperoni","Chicken","Cajun Chicken","Mushrooms","Red Onions","Sweetcorn","Ham"]
      pizzaToppingsMax = 0


      #pizza size
      print("How big would you like your pizza? ")
      pizzaSizeInput = input("Small (max 2 toppings), Medium (max 4 toppings) or Large? (max 6 toppings) ")

      if pizzaSizeInput == "Small":
      pizzaSize=small
      pizzaCost+=3.00
      pizzaToppingsMax=2

      if pizzaSizeInput == "Medium":
      pizzaSize=medium
      pizzaCost+=4.50
      pizzaToppingsMax=4

      if pizzaSizeInput == "Large":
      pizzaSize=large
      pizzaCost+=5.00
      pizzaToppingsMax=6

      pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,0,1,pizzaToppingsList)

      def pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,pizzaToppingCount,y,pizzaToppingsList):
      Toppings = collections.namedtuple('Toppings', ['index','description','price'])

      #pizza toppings
      print("What toppings would you like? ")
      toppingsInput = input(str(pizzaToppingsList) + " ")
      pizzaToppingCount+=1
      print(str(pizzaToppingsMax - pizzaToppingCount) + " Toppings Left")

      if toppingsInput in pizzaToppingsList:
      y+=1
      pizzaToppings.append(Toppings(y, str(toppingsInput), '£0.50'))
      pizzaToppingsList.remove(toppingsInput)
      pizzaCost+=0.50

      if pizzaToppingsMax==2:
      if pizzaToppingCount==2:
      print("Here is your current pizza: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

      for x in pizzaToppings:
      index = str(getattr(x,'index')).ljust(5)
      descr = getattr(x,'description').ljust(25)
      price = getattr(x,'price').ljust(7)
      print('{0}{1}{2}'.format(index,descr,price))
      finishTopping(pizzaToppings,pizzaCost,pizzaSize)

      if pizzaToppingsMax==4:
      if pizzaToppingCount==4:
      print("Here is your current pizza: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

      for x in pizzaToppings:
      index = str(getattr(x,'index')).ljust(5)
      descr = getattr(x,'description').ljust(25)
      price = getattr(x,'price').ljust(7)
      print('{0}{1}{2}'.format(index,descr,price))
      finishTopping(pizzaToppings,pizzaCost,pizzaSize)

      if pizzaToppingsMax==6:
      if pizzaToppingCount==6:
      print("Here is your current pizza: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

      for x in pizzaToppings:
      index = str(getattr(x,'index')).ljust(5)
      descr = getattr(x,'description').ljust(25)
      price = getattr(x,'price').ljust(7)
      print('{0}{1}{2}'.format(index,descr,price))
      finishTopping(pizzaToppings,pizzaCost,pizzaSize)

      anotherT = input("Would you like another topping? ")
      if anotherT == "yes":
      pizzaToppingss(pizzaCost,pizzaSize,pizzaToppings,pizzaToppingsMax,pizzaToppingCount,y,pizzaToppingsList)
      else:
      print("Here is your current pizza: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))

      for x in pizzaToppings:
      index = str(getattr(x,'index')).ljust(5)
      descr = getattr(x,'description').ljust(25)
      price = getattr(x,'price').ljust(7)
      print('{0}{1}{2}'.format(index,descr,price))
      finishTopping(pizzaToppings,pizzaCost,pizzaSize)
      else:
      print("That ingredient doesn't exist or you cannot have it.")
      pizzaToppingss(pizzaCost,pizzaToppings,pizzaToppingsMax,y)

      def finishTopping(pizzaToppings,pizzaCost,pizzaSize):
      global pizzaList
      pizzaSSSList = collections.namedtuple('pizzas', ['size','toppings','cost'])
      pizzaList.append(pizzaSSSList(pizzaSize, pizzaToppings, pizzaCost))
      inp = input("Would you like another pizza?")
      if inp == "yes":
      print("yes")
      order()
      else:
      print(" ")
      print("Here is your final order: ")
      pIndex = "1".ljust(5)
      pDesc = str(pizzaSize[0]).ljust(25)
      pPrice = str(pizzaSize[1]).ljust(7)
      print('{0}{1}{2}'.format(pIndex,pDesc,pPrice))
      for x in pizzaList:
      topp = str(getattr(x,'toppings')).ljust(5)
      cost = str(getattr(x,'cost')).ljust(25)
      size = str(getattr(x,'size')).ljust(7)
      print('{0}{1}{2}'.format(size,topp,cost))

      print("The grand total is: £" + str(pizzaCost) + "0")
      exit()
      def ask():
      inp = input("Hello! Would you like to order a pizza? ")
      if inp == "Yes":
      order()
      if inp == "yes":
      order()
      else:
      ask()

      ask()






      python python-3.x






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 '18 at 13:17









      CyanDeathReaperCyanDeathReaper

      12




      12
























          1 Answer
          1






          active

          oldest

          votes


















          0














          If you are in python3, you can use the unpacking operator and the print method to print your list with space separator by default.



          >>> print(*[0, 1, 2])
          0 1 2


          you can also specify the separator



          >>> print(*[1, 'pizza', 'peperoni'], sep=' ==> ')
          1 ==> pizza ==> peperoni





          share|improve this answer





















          • 1





            The star * does not belong to the print()-function. It is the unpacking operator for iterables. A better wording could be you can use the unpacking operator for iterables to print a list with ...

            – colidyre
            Nov 22 '18 at 13:26











          • You are right, I will rephrase for clarification.

            – BlueSheepToken
            Nov 22 '18 at 13:34











          • When I print it currently, it gives [small, someothervalue]. How would I get the small part of this? I already tried size[0]

            – CyanDeathReaper
            Nov 22 '18 at 16:47











          • So I do not know what the topping will be for the topping one. Same kind of problem. Have you run the code to see it?

            – CyanDeathReaper
            Nov 22 '18 at 16:48











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431887%2fpizza-stacking-system%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If you are in python3, you can use the unpacking operator and the print method to print your list with space separator by default.



          >>> print(*[0, 1, 2])
          0 1 2


          you can also specify the separator



          >>> print(*[1, 'pizza', 'peperoni'], sep=' ==> ')
          1 ==> pizza ==> peperoni





          share|improve this answer





















          • 1





            The star * does not belong to the print()-function. It is the unpacking operator for iterables. A better wording could be you can use the unpacking operator for iterables to print a list with ...

            – colidyre
            Nov 22 '18 at 13:26











          • You are right, I will rephrase for clarification.

            – BlueSheepToken
            Nov 22 '18 at 13:34











          • When I print it currently, it gives [small, someothervalue]. How would I get the small part of this? I already tried size[0]

            – CyanDeathReaper
            Nov 22 '18 at 16:47











          • So I do not know what the topping will be for the topping one. Same kind of problem. Have you run the code to see it?

            – CyanDeathReaper
            Nov 22 '18 at 16:48
















          0














          If you are in python3, you can use the unpacking operator and the print method to print your list with space separator by default.



          >>> print(*[0, 1, 2])
          0 1 2


          you can also specify the separator



          >>> print(*[1, 'pizza', 'peperoni'], sep=' ==> ')
          1 ==> pizza ==> peperoni





          share|improve this answer





















          • 1





            The star * does not belong to the print()-function. It is the unpacking operator for iterables. A better wording could be you can use the unpacking operator for iterables to print a list with ...

            – colidyre
            Nov 22 '18 at 13:26











          • You are right, I will rephrase for clarification.

            – BlueSheepToken
            Nov 22 '18 at 13:34











          • When I print it currently, it gives [small, someothervalue]. How would I get the small part of this? I already tried size[0]

            – CyanDeathReaper
            Nov 22 '18 at 16:47











          • So I do not know what the topping will be for the topping one. Same kind of problem. Have you run the code to see it?

            – CyanDeathReaper
            Nov 22 '18 at 16:48














          0












          0








          0







          If you are in python3, you can use the unpacking operator and the print method to print your list with space separator by default.



          >>> print(*[0, 1, 2])
          0 1 2


          you can also specify the separator



          >>> print(*[1, 'pizza', 'peperoni'], sep=' ==> ')
          1 ==> pizza ==> peperoni





          share|improve this answer















          If you are in python3, you can use the unpacking operator and the print method to print your list with space separator by default.



          >>> print(*[0, 1, 2])
          0 1 2


          you can also specify the separator



          >>> print(*[1, 'pizza', 'peperoni'], sep=' ==> ')
          1 ==> pizza ==> peperoni






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 22 '18 at 13:36

























          answered Nov 22 '18 at 13:22









          BlueSheepTokenBlueSheepToken

          1,545516




          1,545516








          • 1





            The star * does not belong to the print()-function. It is the unpacking operator for iterables. A better wording could be you can use the unpacking operator for iterables to print a list with ...

            – colidyre
            Nov 22 '18 at 13:26











          • You are right, I will rephrase for clarification.

            – BlueSheepToken
            Nov 22 '18 at 13:34











          • When I print it currently, it gives [small, someothervalue]. How would I get the small part of this? I already tried size[0]

            – CyanDeathReaper
            Nov 22 '18 at 16:47











          • So I do not know what the topping will be for the topping one. Same kind of problem. Have you run the code to see it?

            – CyanDeathReaper
            Nov 22 '18 at 16:48














          • 1





            The star * does not belong to the print()-function. It is the unpacking operator for iterables. A better wording could be you can use the unpacking operator for iterables to print a list with ...

            – colidyre
            Nov 22 '18 at 13:26











          • You are right, I will rephrase for clarification.

            – BlueSheepToken
            Nov 22 '18 at 13:34











          • When I print it currently, it gives [small, someothervalue]. How would I get the small part of this? I already tried size[0]

            – CyanDeathReaper
            Nov 22 '18 at 16:47











          • So I do not know what the topping will be for the topping one. Same kind of problem. Have you run the code to see it?

            – CyanDeathReaper
            Nov 22 '18 at 16:48








          1




          1





          The star * does not belong to the print()-function. It is the unpacking operator for iterables. A better wording could be you can use the unpacking operator for iterables to print a list with ...

          – colidyre
          Nov 22 '18 at 13:26





          The star * does not belong to the print()-function. It is the unpacking operator for iterables. A better wording could be you can use the unpacking operator for iterables to print a list with ...

          – colidyre
          Nov 22 '18 at 13:26













          You are right, I will rephrase for clarification.

          – BlueSheepToken
          Nov 22 '18 at 13:34





          You are right, I will rephrase for clarification.

          – BlueSheepToken
          Nov 22 '18 at 13:34













          When I print it currently, it gives [small, someothervalue]. How would I get the small part of this? I already tried size[0]

          – CyanDeathReaper
          Nov 22 '18 at 16:47





          When I print it currently, it gives [small, someothervalue]. How would I get the small part of this? I already tried size[0]

          – CyanDeathReaper
          Nov 22 '18 at 16:47













          So I do not know what the topping will be for the topping one. Same kind of problem. Have you run the code to see it?

          – CyanDeathReaper
          Nov 22 '18 at 16:48





          So I do not know what the topping will be for the topping one. Same kind of problem. Have you run the code to see it?

          – CyanDeathReaper
          Nov 22 '18 at 16:48




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431887%2fpizza-stacking-system%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

          Alcedinidae

          RAC Tourist Trophy