Python Project: Pizza Menu

This Python code represents a simple program for ordering pizzas from a menu. Here's a brief overview of how it works:

  1. Menu Setup:

    • The code begins by defining a menu with four pizza options (p1 to p4) and an extra item (extra for salad).

    • Each menu item is represented as a list with three elements: name, price, and currency.

  2. Printing the Menu:

    • The program then prints the pizza menu, displaying the options and their prices.
  3. Ordering Process:

    • The code enters a while loop to repeatedly prompt the user for pizza orders until explicitly exited.

    • Inside the loop, the user is asked to choose a pizza (valtpizza) and specify the quantity (antal).

  4. Calculating Total Price:

    • Based on the user's selection, the code calculates the total price for the chosen pizzas.

    • If the user wants an extra item (salad), the code adds the corresponding price to the total.

  5. Finalizing the Order:

    • After processing the user's choices, the program prints a summary of the order, including the selected items and the total price.
  6. Exiting the Program:

    • The program then breaks out of the loop and ends.

Note: The code is in Swedish. The code uses explicit conditions for each pizza option (1 to 4) and handles the case where the user enters an invalid option. Additionally, it checks if the user wants to add a salad to the order. The user is prompted to make selections until the loop is explicitly broken by the user.

print("     Pizza Meny")
p1 = ["p1:kebab pizza","135","kr"]
p2 = ["p2:Hawaii pizza","120","kr"]
p3 = ["p3:Kyckling pizza","130","kr"]
p4 = ["p4:Vegetarisk pizza","130","kr"]
extra = ["Sallad:","20","kr"]
print("1.kebab pizza:135kr")
print("2.Hawaii pizza:120kr")
print("3.Kckling pizza:130kr")
print("4.Vegetarisk pizza:130kr")
print("Extra sallad,20 kr")
#pris = 120
#valtpizza=input("Välja pizza1 till pizza4:")
#antal=input("Hur många pizza vill du ha?")
#extra_val=input("Något mer? Sallad eller läsk?(ja/nej)")
while True:
  valtpizza=input("Välja pizza mellan 1 till 4: ")
  antal=input("Hur många pizza vill du ha? ")
  if valtpizza == "1":
     p1[1] = int(p1[1])
     antal = int(antal)
     pris = p1[1] * antal
     print("Tack.Du har valt",antal,"kebab pizza och det blir ",pris,"kr.")
     extra_val=input("Något mer? Sallad?(ja/nej)")
     if extra_val == "ja":
       extra[1] = int(extra[1])
       pris = pris + extra[1]
       print("Tack.Du har valt sallad och det blir ",pris,"kr.")
       print("Tack för beställning, det blir",pris,"kr totalt.")
       break
     else:
       print("Tack för beställning, det blir",pris,"kr totalt.")
       break   
  elif valtpizza == "2":
     p2[1] = int(p2[1])
     antal = int(antal)
     pris = p2[1] * antal
     print("Tack.Du har valt",antal,"Hawaii pizza och det blir ",pris,"kr.")
     extra_val = input("Något mer? Sallad?(ja/nej) ")
     if extra_val == "ja":
        extra[1] = int(extra[1])
        pris = pris + extra[1]
        print("Tack.Du har valt sallad och det blir",pris,"kr.")
        print("Tack för beställning, det blir",pris,"kr totalt.")
        break
     else:
        print("Tack för beställning, det blir",pris,"kr totalt.")
        break
  elif valtpizza == "3":
      p3[1] = int(p3[1])
      antal = int(antal)
      pris = p3[1] * antal
      print("Tack.Du har valt",antal,"Kyckling pizza och det blir ",pris,"kr.")
      extra_val=input("Något mer? Sallad?(ja/nej) ")
      if extra_val == "ja":
         extra[1] = int(extra[1])
         pris = pris + extra[1]
         print("Tack.Du har valt sallad och det blir",pris,"kr.")
         print("Tack för beställning, det blir",pris,"kr totalt.")
         break
      else:
          print("Tack för beställning, det blir",pris,"kr totalt.")
          break
  else:
      valtpizza == "4"
      p4[1] = int(p4[1])
      antal = int(antal)
      pris = p4[1] * antal
      print("Tack.Du har valt",antal,"Vegtarisk pizza och det blir ",pris,"kr.")
      extra_val=input("Något mer? Sallad?(ja/nej) ")
      if extra_val == "ja":
         extra[1] = int(extra[1])
         pris = pris + extra[1]
         print("Tack.Du har valt sallad och det blir",pris,"kr.")
         print("Tack för beställning, det blir",pris,"kr totalt.")
         break

      else:
          print("Tack för beställning, det blir",pris,"kr totalt.")
          break