From 4bbd8d204ddd507052131932b278fa6bdb66fedb Mon Sep 17 00:00:00 2001 From: Arjayn Piratheeparatnam <122946744+ArjaynP@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:24:20 -0500 Subject: [PATCH 1/5] Pizza order Python Script Added a new Python Script. Its in the folder named "Pizza Order" and I have also updated the README.md file as well with my project information. --- Pizza Order/PizzaTest.py | 112 ++++++++++++++++++++++++++++++++++++ Pizza Order/README.md | 6 ++ Pizza Order/order.py | 80 ++++++++++++++++++++++++++ Pizza Order/pizzaReceipt.py | 105 +++++++++++++++++++++++++++++++++ Pizza Order/pyvenv.cfg | 8 +++ README.md | 1 + 6 files changed, 312 insertions(+) create mode 100644 Pizza Order/PizzaTest.py create mode 100644 Pizza Order/README.md create mode 100644 Pizza Order/order.py create mode 100644 Pizza Order/pizzaReceipt.py create mode 100644 Pizza Order/pyvenv.cfg diff --git a/Pizza Order/PizzaTest.py b/Pizza Order/PizzaTest.py new file mode 100644 index 00000000..bc77171d --- /dev/null +++ b/Pizza Order/PizzaTest.py @@ -0,0 +1,112 @@ +import subprocess + + +def runTest (file, inText): + if file =="order": + res = subprocess.run("python " + file + ".py", input=inText, capture_output=True, text=True, shell=True) + return res.stdout + + if file == "pizzaReceipt": + res = subprocess.run("python -c \"from pizzaReceipt import *; generateReceipt([" +inText+ "])\"", capture_output=True, text=True, shell= True) + return res.stdout + + +def equalWithoutSpaces(expected, student): + expected = expected.replace(" ", "") + expected = expected.replace("\t", "") + student = student.replace(" ", "") + student = student.replace("\t", "") + return expected == student + + + +# --------------- Test 1 - No Order--------------- + +inputString = "" +studentOutput = runTest("pizzaReceipt", inputString) +expectedOutput = "You did not order anything\n" + +# Compare studentOutput to expectedOutput +if studentOutput == expectedOutput: + print("Test 1 Passed. (Receipt for empty order)") +else: + print("Test 1 Failed. (Receipt for empty order)") + +#print(studentOutput) + +# --------------- Test 2 - List of Orders--------------- + +inputString = "('L', ['HAM', 'BACON', 'ONION', 'TOMATO']), ('S', ['PEPPERONI', 'SAUSAGE', 'CHICKEN', 'HAM']), ('L', ['BROCCOLI', 'CHICKEN', 'ONION'])" +studentOutput = runTest("pizzaReceipt", inputString) +expectedOutput = "Your order: \nPizza 1: L 11.99\n- HAM\n- BACON\n- ONION\n- TOMATO\nExtra Topping (L) 1.00\n" +expectedOutput += "Pizza 2: S 7.99\n- PEPPERONI\n- SAUSAGE\n- CHICKEN\n- HAM\nExtra Topping (S) 0.50\n" +expectedOutput += "Pizza 3: L 11.99\n- BROCCOLI\n- CHICKEN\n- ONION\nTax: 4.35\nTotal: 37.82\n" + +# Compare studentOutput to expectedOutput +#if studentOutput == expectedOutput: +if equalWithoutSpaces(expectedOutput, studentOutput): + print("Test 2 Passed. (Receipt for empty order of 3 pizzas)") +else: + print("Test 2 Failed. (Receipt for empty order of 3 pizzas)") + + +# --------------- Test 3 - List of Orders--------------- + +inputString = "('XL', ['GREEN PEPPER', 'HOT PEPPER', 'MUSHROOM', 'ONION', 'SPINACH']), ('L', ['PEPPERONI', 'ONION', 'OLIVE', 'MUSHROOM']), ('L', ['PINEAPPLE', 'HAM']), ('M', ['GROUND BEEF', 'TOMATO', 'ONION', 'SPINACH'])" +studentOutput = runTest("pizzaReceipt", inputString) +expectedOutput = "Your order: \nPizza 1: XL 13.99\n- GREEN PEPPER\n- HOT PEPPER\n- MUSHROOM\n- ONION\n- SPINACH\nExtra Topping (XL) 1.25\n" +expectedOutput += "Extra Topping (XL) 1.25\nPizza 2: L 11.99\n- PEPPERONI\n- ONION\n- OLIVE\n- MUSHROOM\n" +expectedOutput += "Extra Topping (L) 1.00\nPizza 3: L 11.99\n- PINEAPPLE\n- HAM\nPizza 4: M 9.99\n" +expectedOutput += "- GROUND BEEF\n- TOMATO\n- ONION\n- SPINACH\nExtra Topping (M) 0.75\nTax: 6.79\nTotal: 59.00\n" + +# Compare studentOutput to expectedOutput +if equalWithoutSpaces(expectedOutput, studentOutput): + print("Test 3 Passed. (Receipt for empty order of 4 pizzas)") +else: + print("Test 3 Failed. (Receipt for empty order of 4 pizzas)") + +# --------------- Test 4 - Find Specific Values in Output --------------- + +studentOutput = runTest("order", "Yes\nL\nHAM\nX\nNo\n") + +if studentOutput.find("13.55") != -1: + print("Test 4 Passed. (Ordering system for order of 1 pizza)") +else: + print("Test 4 Failed. (Ordering system for order of 1 pizza)") + +#print(studentOutput) + +# --------------- Test 5 - Find Specific Values in Output--------------- + +studentOutput = runTest("order", "Yes\nmedium\nM\nLIST\npepperoni\nonion\nmushroom\nhot pepper\ntomato\nX\nq\n") + +if studentOutput.find("\"X\"\n('") != -1 and studentOutput.count("Choose a size:") == 2 and studentOutput.count("Type in one of our toppings") == 7 and studentOutput.find("1.49") != -1 and studentOutput.find("12.98") != -1: + print("Test 5 Passed. (Ordering system with typo and use of LIST)") +else: + + print("Test 5 Failed. (Ordering system with typo and use of LIST)") + +print() +print(studentOutput.find("\"X\"\n('") != -1) +print(studentOutput.count("Choose a size:") == 2) +print(studentOutput.count("Type in one of our toppings") == 7) +print(studentOutput.find("1.49") != -1) +print(studentOutput.find("12.98") != -1) +print() + +# --------------- Find Specific Values in Output --------------- + +studentOutput = runTest("order", "y\nm\nsausage\nbacon\nonion\nX\ny\nXl\nchicken\ntomato\nspinach\nmushroom\nx\ny\nm\nolive\nbroccoli\nhot pepper\ngreen pepper\nx\nno\n") + +if studentOutput.count("Type in one of our toppings") == 14 and studentOutput.find("4.68") != -1 and studentOutput.find("40.65") != -1: + print("Test 6 Passed. (Ordering system for order of 3 pizzas)") +else: + print("Test 6 Failed. (Ordering system for order of 3 pizzas)") + +# print(studentOutput) +# print(expectedOutput) +# -------------------------------- + + + + diff --git a/Pizza Order/README.md b/Pizza Order/README.md new file mode 100644 index 00000000..b859e05f --- /dev/null +++ b/Pizza Order/README.md @@ -0,0 +1,6 @@ +# OrderPizza + A program that I created in one of my computer science courses containing a frontend and backend. The frontend deals with asking the user for their order, while the backend focuses on storing the information in a receipt format along with its calculations by using functions, lists, and tuples. + + In the frontend, the user first asks if the customer would like to order. If they say no, the code exits completely and is terminated. If the user says yes, it will then ask for the size of pizza as each have a different price range. After, the user will ask for toppings. The maximum that they can enter is three. Afterwards, every topping will cost an additional price to its total. After they have completed asking toppings, the program creates the order in a tuple and is stored in a variable. If the user would like to continue to ordering, the program would loop once more using a while loop and repeat the same questions that were asked in the last instance Afterwards, the second order is incremented to the variable containing the tuple. Otherwise, the code exits and the pizza receipt file is called using the variable of the tuple containing the pizza order and will print a receipt detailing the order and the total. + + In the backend, once the customer has finished ordering, the function is called using the variable as a paramter containing the customers order and creates a receipt by first showing the first pizza, its size, toppings and the amount is placed on the right hand side. If there are more than three toppings, it will show its additional cost as well. If there are more pizzas included, it will repeat the process once more. Afterwards, it shows the total before tax, the additional 13% tax in dollar amount and the total with tax. diff --git a/Pizza Order/order.py b/Pizza Order/order.py new file mode 100644 index 00000000..3ece1594 --- /dev/null +++ b/Pizza Order/order.py @@ -0,0 +1,80 @@ +# purpose of order.py is the front end for users to submit their order +from pizzaReceipt import * # asks to import all functions found in the pizzaReceipt.py file + +# set all initial variables before beginning +size = "" +pizza_lst = [] +pizza_lst_current = [] +toppings_lst = [] # list to be a parameter for generateReceipt function +list_order_yes = ["Yes", "yes", "Y", "y", "YES"] +list_order_no = ["No", "no", "Q", "NO", "N", "n"] +TOPPINGS = ("ONION", "TOMATO", "GREEN PEPPER", "MUSHROOM", "OLIVE", "SPINACH", "BROCCOLI", "PINEAPPLE", + "HOT PEPPER", "PEPPERONI", "HAM", "BACON", "GROUND BEEF", "CHICKEN", "SAUSAGE") + +# ask user whether they want to order. +order = input("Do you want to order a pizza? ") + +# case for when an invalid input is submitted +while (order not in list_order_yes) and (order not in list_order_no): + order = input("Do you want to order a pizza? ") + +# ask for size +if order in list_order_yes: + size = input("Choose a size: ") + size.upper() + + # case for when a user inputs invalid size + while size.upper() not in ["S", "M", "L", "XL"]: + size = input("Choose a size: ") + +# entire loop to repeat if user wants to order more than one pizza +while order in list_order_yes: + # set empty toppings list as it will show empty each time loop is made + toppings_lst = [] + # ask user for topping, whether they want to see a list of the toppings, or to finish ordering toppings. + topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' + 'When you are done adding toppings, enter "X" ') + + # cae for when a user places an invalid input for this question + while (topping.upper() != "X") and (topping.upper() != "LIST") and (topping.upper() not in TOPPINGS): + topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' + 'When you are done adding toppings, enter "X" ') + + print() + # toppings while loop which ask for toppings selection or list view, multiple times until user enters X + while topping.upper() != "X": + TOPPINGS = ("ONION", "TOMATO", "GREEN PEPPER", "MUSHROOM", "OLIVE", "SPINACH", "BROCCOLI", "PINEAPPLE", + "HOT PEPPER", "PEPPERONI", "HAM", "BACON", "GROUND BEEF", "CHICKEN", "SAUSAGE") + if topping.upper() == "LIST": + print(topping.upper()) + print(TOPPINGS) + topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' + 'When you are done adding toppings, enter "X" \n \n') + elif topping.upper() in TOPPINGS: + print(topping.upper()) + print("Added", topping.upper(), "to your pizza") + toppings_lst.append(topping) + topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' + 'When you are done adding toppings, enter "X" \n \n') + + # add the size and toppings list as a tuple to pizza_lst + pizza_lst.append((size.upper(), toppings_lst)) + print(pizza_lst) + # ask whether they want to continue ordering + order = input("Do you want to continue ordering? ") + + # case for when user types invalid input + while (order not in list_order_yes) and (order not in list_order_no): + order = input("Do you want to order a pizza? ") + + # if they say no, break the loop and go through the last line of the code + if order in list_order_no: + break + elif order in list_order_yes: + size = input("Choose a size: ") # if they want to order again start by asking size + + # case for when user types invalid input + while size.upper() not in ["S", "M", "L", "XL"]: + size = input("Choose a size: ") + +generateReceipt(pizza_lst) # at the end of program, call function using pizza_lst as a parameter diff --git a/Pizza Order/pizzaReceipt.py b/Pizza Order/pizzaReceipt.py new file mode 100644 index 00000000..b7ff1d3d --- /dev/null +++ b/Pizza Order/pizzaReceipt.py @@ -0,0 +1,105 @@ +# purpose of pizzaReceipt.py is the back end where the developers create methods and functions to properly format the receipt and its total +def generateReceipt(pizzaOrder): + # parameter will be placed with pizza_lst = ("M", ["PEPPERONI", "OLIVE"], -----) + # set initial variables + size = "" + additional_price = 0 + price_before_tax = 0 + tax = 1.13 + counter = 1 # pizza number + size_price = 0 + additional_price_tag = float(0) + additional_price_tag_format = "" + + # if its an empty list, display this statement + if len(pizzaOrder) == 0: + print("You did not order anything") + exit() + + # beginning of the format of receipt + print("Your order: ") + + # a for loop which goes through all tuples in the list based on its indices + for pizza in range(len(pizzaOrder)): + # cases to determine the sizes selected and its price + if pizzaOrder[pizza][0] == "S": + size_price = 7.99 + size = "S" + elif pizzaOrder[pizza][0] == "M": + size_price = 9.99 + size = "M" + elif pizzaOrder[pizza][0] == "L": + size_price = 11.99 + size = "L" + elif pizzaOrder[pizza][0] == "XL": + size_price = 13.99 + size = "XL" + + # add the price of the size to the final price before tax + price_before_tax += size_price + + # formatting the pizza number and its size beside it and the price on the other side + if size == "XL": + print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) + elif size == "L": + print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) + elif size == "M": + print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) + elif size == "S": + print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) + + # increment counter variable by one for the pizza number + counter += 1 + + # format the toppings with a dash in front + for j in range(len(pizzaOrder[pizza][1])): + print("- " + str(pizzaOrder[pizza][1][j])) + + # if theres more than three toppings, calculate the total additional price and added to the total price before tax + if len(pizzaOrder[pizza][1]) > 3: + n = len(pizzaOrder[pizza][1]) - 3 + if size == "S": + additional_price_tag = 0.50 + additional_price_tag_format = "{:.2f}".format(additional_price_tag) + additional_price = 0.50 * n + price_before_tax += additional_price + elif size == "M": + additional_price_tag = 0.75 + additional_price = 0.75 * n + price_before_tax += additional_price + elif size == "L": + additional_price_tag = 1.00 + additional_price_tag_format = "{:.2f}".format(additional_price_tag) + additional_price = 1.00 * n + price_before_tax += additional_price + elif size == "XL": + additional_price_tag = 1.25 + additional_price = 1.25 * n + price_before_tax += additional_price + + # format the extra topping portion of the receipt with its size and price on the other side + float_additional_price = float(additional_price) + format_additional_price = "{:.2f}" .format(float_additional_price) + + for extra in range(len(pizzaOrder[pizza][1])): + if extra > 2: + if size == "XL": + print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag)) + elif size == "L": + print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag_format)) + elif size == "M": + print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag)) + elif size == "S": + print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag_format)) + # outside of loop begins, calculates the price before tax with the tax value set earlier + price_final = price_before_tax * tax + + # add the tax price to be added and set it to a float, as well as the final price with tax + float1 = float(price_before_tax * (13/100)) + float2 = float(price_final) + formatFloat1 = "{:.2f}" .format(float1) + formatFloat2 = "{:.2f}" .format(float2) + + # format the price of the tax, and the total with both values on the other side + print("Tax:" + "\t\t\t\t\t " + formatFloat1) + print("Total:" + "\t\t\t\t\t " + formatFloat2) diff --git a/Pizza Order/pyvenv.cfg b/Pizza Order/pyvenv.cfg new file mode 100644 index 00000000..b83f8fb7 --- /dev/null +++ b/Pizza Order/pyvenv.cfg @@ -0,0 +1,8 @@ +home = /Library/Frameworks/Python.framework/Versions/3.10 +implementation = CPython +version_info = 3.10.0.final.0 +virtualenv = 20.13.0 +include-system-site-packages = false +base-prefix = /Library/Frameworks/Python.framework/Versions/3.10 +base-exec-prefix = /Library/Frameworks/Python.framework/Versions/3.10 +base-executable = /usr/local/bin/python3.10 diff --git a/README.md b/README.md index fbebef09..a717c3d1 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ More information on contributing and the general code of conduct for discussion | PDF to Audio | [PDF to Audio](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20Audio) | Converts PDF to audio. | | PDF to Text | [PDF to text](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20text) | Converts PDF to text. | | PDF merger and splitter | [PDF Merger and Splitter](https://github.com/AbhijitMotekar99/Python-Scripts/blob/master/PDF%20Merger%20and%20Splitter/PDF%20Merger%20and%20Splitter.py) | Create a tool that can merge multiple PDF files into one or split a single PDF into separate pages. | +| Pizza Order | [Pizza Order](https://github.com/DhanushNehru/Python-Scripts/tree/master/Pizza%20Order) | An algorithm designed to handle pizza orders from customers with accurate receipts and calculations. | | Planet Simulation | [Planet Simulation](https://github.com/DhanushNehru/Python-Scripts/tree/master/Planet%20Simulation) | A simulation of several planets rotating around the sun. | | Playlist Exchange | [Playlist Exchange](https://github.com/DhanushNehru/Python-Scripts/tree/master/Playlist%20Exchange) | A Python script to exchange songs and playlists between Spotify and Python. | | Pigeonhole Sort | [Algorithm](https://github.com/DhanushNehru/Python-Scripts/tree/master/PigeonHole) | The pigeonhole sort algorithm to sort your arrays efficiently! | From 4ac7391c7d83bc91b3f618c9a4354da71def2df3 Mon Sep 17 00:00:00 2001 From: Arjayn Piratheeparatnam <122946744+ArjaynP@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:32:35 -0500 Subject: [PATCH 2/5] Removed recent updates seems to be an issue with performing pull request --- Pizza Order/PizzaTest.py | 112 ------------------------------------ Pizza Order/README.md | 6 -- Pizza Order/order.py | 80 -------------------------- Pizza Order/pizzaReceipt.py | 105 --------------------------------- Pizza Order/pyvenv.cfg | 8 --- 5 files changed, 311 deletions(-) delete mode 100644 Pizza Order/PizzaTest.py delete mode 100644 Pizza Order/README.md delete mode 100644 Pizza Order/order.py delete mode 100644 Pizza Order/pizzaReceipt.py delete mode 100644 Pizza Order/pyvenv.cfg diff --git a/Pizza Order/PizzaTest.py b/Pizza Order/PizzaTest.py deleted file mode 100644 index bc77171d..00000000 --- a/Pizza Order/PizzaTest.py +++ /dev/null @@ -1,112 +0,0 @@ -import subprocess - - -def runTest (file, inText): - if file =="order": - res = subprocess.run("python " + file + ".py", input=inText, capture_output=True, text=True, shell=True) - return res.stdout - - if file == "pizzaReceipt": - res = subprocess.run("python -c \"from pizzaReceipt import *; generateReceipt([" +inText+ "])\"", capture_output=True, text=True, shell= True) - return res.stdout - - -def equalWithoutSpaces(expected, student): - expected = expected.replace(" ", "") - expected = expected.replace("\t", "") - student = student.replace(" ", "") - student = student.replace("\t", "") - return expected == student - - - -# --------------- Test 1 - No Order--------------- - -inputString = "" -studentOutput = runTest("pizzaReceipt", inputString) -expectedOutput = "You did not order anything\n" - -# Compare studentOutput to expectedOutput -if studentOutput == expectedOutput: - print("Test 1 Passed. (Receipt for empty order)") -else: - print("Test 1 Failed. (Receipt for empty order)") - -#print(studentOutput) - -# --------------- Test 2 - List of Orders--------------- - -inputString = "('L', ['HAM', 'BACON', 'ONION', 'TOMATO']), ('S', ['PEPPERONI', 'SAUSAGE', 'CHICKEN', 'HAM']), ('L', ['BROCCOLI', 'CHICKEN', 'ONION'])" -studentOutput = runTest("pizzaReceipt", inputString) -expectedOutput = "Your order: \nPizza 1: L 11.99\n- HAM\n- BACON\n- ONION\n- TOMATO\nExtra Topping (L) 1.00\n" -expectedOutput += "Pizza 2: S 7.99\n- PEPPERONI\n- SAUSAGE\n- CHICKEN\n- HAM\nExtra Topping (S) 0.50\n" -expectedOutput += "Pizza 3: L 11.99\n- BROCCOLI\n- CHICKEN\n- ONION\nTax: 4.35\nTotal: 37.82\n" - -# Compare studentOutput to expectedOutput -#if studentOutput == expectedOutput: -if equalWithoutSpaces(expectedOutput, studentOutput): - print("Test 2 Passed. (Receipt for empty order of 3 pizzas)") -else: - print("Test 2 Failed. (Receipt for empty order of 3 pizzas)") - - -# --------------- Test 3 - List of Orders--------------- - -inputString = "('XL', ['GREEN PEPPER', 'HOT PEPPER', 'MUSHROOM', 'ONION', 'SPINACH']), ('L', ['PEPPERONI', 'ONION', 'OLIVE', 'MUSHROOM']), ('L', ['PINEAPPLE', 'HAM']), ('M', ['GROUND BEEF', 'TOMATO', 'ONION', 'SPINACH'])" -studentOutput = runTest("pizzaReceipt", inputString) -expectedOutput = "Your order: \nPizza 1: XL 13.99\n- GREEN PEPPER\n- HOT PEPPER\n- MUSHROOM\n- ONION\n- SPINACH\nExtra Topping (XL) 1.25\n" -expectedOutput += "Extra Topping (XL) 1.25\nPizza 2: L 11.99\n- PEPPERONI\n- ONION\n- OLIVE\n- MUSHROOM\n" -expectedOutput += "Extra Topping (L) 1.00\nPizza 3: L 11.99\n- PINEAPPLE\n- HAM\nPizza 4: M 9.99\n" -expectedOutput += "- GROUND BEEF\n- TOMATO\n- ONION\n- SPINACH\nExtra Topping (M) 0.75\nTax: 6.79\nTotal: 59.00\n" - -# Compare studentOutput to expectedOutput -if equalWithoutSpaces(expectedOutput, studentOutput): - print("Test 3 Passed. (Receipt for empty order of 4 pizzas)") -else: - print("Test 3 Failed. (Receipt for empty order of 4 pizzas)") - -# --------------- Test 4 - Find Specific Values in Output --------------- - -studentOutput = runTest("order", "Yes\nL\nHAM\nX\nNo\n") - -if studentOutput.find("13.55") != -1: - print("Test 4 Passed. (Ordering system for order of 1 pizza)") -else: - print("Test 4 Failed. (Ordering system for order of 1 pizza)") - -#print(studentOutput) - -# --------------- Test 5 - Find Specific Values in Output--------------- - -studentOutput = runTest("order", "Yes\nmedium\nM\nLIST\npepperoni\nonion\nmushroom\nhot pepper\ntomato\nX\nq\n") - -if studentOutput.find("\"X\"\n('") != -1 and studentOutput.count("Choose a size:") == 2 and studentOutput.count("Type in one of our toppings") == 7 and studentOutput.find("1.49") != -1 and studentOutput.find("12.98") != -1: - print("Test 5 Passed. (Ordering system with typo and use of LIST)") -else: - - print("Test 5 Failed. (Ordering system with typo and use of LIST)") - -print() -print(studentOutput.find("\"X\"\n('") != -1) -print(studentOutput.count("Choose a size:") == 2) -print(studentOutput.count("Type in one of our toppings") == 7) -print(studentOutput.find("1.49") != -1) -print(studentOutput.find("12.98") != -1) -print() - -# --------------- Find Specific Values in Output --------------- - -studentOutput = runTest("order", "y\nm\nsausage\nbacon\nonion\nX\ny\nXl\nchicken\ntomato\nspinach\nmushroom\nx\ny\nm\nolive\nbroccoli\nhot pepper\ngreen pepper\nx\nno\n") - -if studentOutput.count("Type in one of our toppings") == 14 and studentOutput.find("4.68") != -1 and studentOutput.find("40.65") != -1: - print("Test 6 Passed. (Ordering system for order of 3 pizzas)") -else: - print("Test 6 Failed. (Ordering system for order of 3 pizzas)") - -# print(studentOutput) -# print(expectedOutput) -# -------------------------------- - - - - diff --git a/Pizza Order/README.md b/Pizza Order/README.md deleted file mode 100644 index b859e05f..00000000 --- a/Pizza Order/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# OrderPizza - A program that I created in one of my computer science courses containing a frontend and backend. The frontend deals with asking the user for their order, while the backend focuses on storing the information in a receipt format along with its calculations by using functions, lists, and tuples. - - In the frontend, the user first asks if the customer would like to order. If they say no, the code exits completely and is terminated. If the user says yes, it will then ask for the size of pizza as each have a different price range. After, the user will ask for toppings. The maximum that they can enter is three. Afterwards, every topping will cost an additional price to its total. After they have completed asking toppings, the program creates the order in a tuple and is stored in a variable. If the user would like to continue to ordering, the program would loop once more using a while loop and repeat the same questions that were asked in the last instance Afterwards, the second order is incremented to the variable containing the tuple. Otherwise, the code exits and the pizza receipt file is called using the variable of the tuple containing the pizza order and will print a receipt detailing the order and the total. - - In the backend, once the customer has finished ordering, the function is called using the variable as a paramter containing the customers order and creates a receipt by first showing the first pizza, its size, toppings and the amount is placed on the right hand side. If there are more than three toppings, it will show its additional cost as well. If there are more pizzas included, it will repeat the process once more. Afterwards, it shows the total before tax, the additional 13% tax in dollar amount and the total with tax. diff --git a/Pizza Order/order.py b/Pizza Order/order.py deleted file mode 100644 index 3ece1594..00000000 --- a/Pizza Order/order.py +++ /dev/null @@ -1,80 +0,0 @@ -# purpose of order.py is the front end for users to submit their order -from pizzaReceipt import * # asks to import all functions found in the pizzaReceipt.py file - -# set all initial variables before beginning -size = "" -pizza_lst = [] -pizza_lst_current = [] -toppings_lst = [] # list to be a parameter for generateReceipt function -list_order_yes = ["Yes", "yes", "Y", "y", "YES"] -list_order_no = ["No", "no", "Q", "NO", "N", "n"] -TOPPINGS = ("ONION", "TOMATO", "GREEN PEPPER", "MUSHROOM", "OLIVE", "SPINACH", "BROCCOLI", "PINEAPPLE", - "HOT PEPPER", "PEPPERONI", "HAM", "BACON", "GROUND BEEF", "CHICKEN", "SAUSAGE") - -# ask user whether they want to order. -order = input("Do you want to order a pizza? ") - -# case for when an invalid input is submitted -while (order not in list_order_yes) and (order not in list_order_no): - order = input("Do you want to order a pizza? ") - -# ask for size -if order in list_order_yes: - size = input("Choose a size: ") - size.upper() - - # case for when a user inputs invalid size - while size.upper() not in ["S", "M", "L", "XL"]: - size = input("Choose a size: ") - -# entire loop to repeat if user wants to order more than one pizza -while order in list_order_yes: - # set empty toppings list as it will show empty each time loop is made - toppings_lst = [] - # ask user for topping, whether they want to see a list of the toppings, or to finish ordering toppings. - topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' - 'When you are done adding toppings, enter "X" ') - - # cae for when a user places an invalid input for this question - while (topping.upper() != "X") and (topping.upper() != "LIST") and (topping.upper() not in TOPPINGS): - topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' - 'When you are done adding toppings, enter "X" ') - - print() - # toppings while loop which ask for toppings selection or list view, multiple times until user enters X - while topping.upper() != "X": - TOPPINGS = ("ONION", "TOMATO", "GREEN PEPPER", "MUSHROOM", "OLIVE", "SPINACH", "BROCCOLI", "PINEAPPLE", - "HOT PEPPER", "PEPPERONI", "HAM", "BACON", "GROUND BEEF", "CHICKEN", "SAUSAGE") - if topping.upper() == "LIST": - print(topping.upper()) - print(TOPPINGS) - topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' - 'When you are done adding toppings, enter "X" \n \n') - elif topping.upper() in TOPPINGS: - print(topping.upper()) - print("Added", topping.upper(), "to your pizza") - toppings_lst.append(topping) - topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' - 'When you are done adding toppings, enter "X" \n \n') - - # add the size and toppings list as a tuple to pizza_lst - pizza_lst.append((size.upper(), toppings_lst)) - print(pizza_lst) - # ask whether they want to continue ordering - order = input("Do you want to continue ordering? ") - - # case for when user types invalid input - while (order not in list_order_yes) and (order not in list_order_no): - order = input("Do you want to order a pizza? ") - - # if they say no, break the loop and go through the last line of the code - if order in list_order_no: - break - elif order in list_order_yes: - size = input("Choose a size: ") # if they want to order again start by asking size - - # case for when user types invalid input - while size.upper() not in ["S", "M", "L", "XL"]: - size = input("Choose a size: ") - -generateReceipt(pizza_lst) # at the end of program, call function using pizza_lst as a parameter diff --git a/Pizza Order/pizzaReceipt.py b/Pizza Order/pizzaReceipt.py deleted file mode 100644 index b7ff1d3d..00000000 --- a/Pizza Order/pizzaReceipt.py +++ /dev/null @@ -1,105 +0,0 @@ -# purpose of pizzaReceipt.py is the back end where the developers create methods and functions to properly format the receipt and its total -def generateReceipt(pizzaOrder): - # parameter will be placed with pizza_lst = ("M", ["PEPPERONI", "OLIVE"], -----) - # set initial variables - size = "" - additional_price = 0 - price_before_tax = 0 - tax = 1.13 - counter = 1 # pizza number - size_price = 0 - additional_price_tag = float(0) - additional_price_tag_format = "" - - # if its an empty list, display this statement - if len(pizzaOrder) == 0: - print("You did not order anything") - exit() - - # beginning of the format of receipt - print("Your order: ") - - # a for loop which goes through all tuples in the list based on its indices - for pizza in range(len(pizzaOrder)): - # cases to determine the sizes selected and its price - if pizzaOrder[pizza][0] == "S": - size_price = 7.99 - size = "S" - elif pizzaOrder[pizza][0] == "M": - size_price = 9.99 - size = "M" - elif pizzaOrder[pizza][0] == "L": - size_price = 11.99 - size = "L" - elif pizzaOrder[pizza][0] == "XL": - size_price = 13.99 - size = "XL" - - # add the price of the size to the final price before tax - price_before_tax += size_price - - # formatting the pizza number and its size beside it and the price on the other side - if size == "XL": - print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) - elif size == "L": - print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) - elif size == "M": - print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) - elif size == "S": - print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) - - # increment counter variable by one for the pizza number - counter += 1 - - # format the toppings with a dash in front - for j in range(len(pizzaOrder[pizza][1])): - print("- " + str(pizzaOrder[pizza][1][j])) - - # if theres more than three toppings, calculate the total additional price and added to the total price before tax - if len(pizzaOrder[pizza][1]) > 3: - n = len(pizzaOrder[pizza][1]) - 3 - if size == "S": - additional_price_tag = 0.50 - additional_price_tag_format = "{:.2f}".format(additional_price_tag) - additional_price = 0.50 * n - price_before_tax += additional_price - elif size == "M": - additional_price_tag = 0.75 - additional_price = 0.75 * n - price_before_tax += additional_price - elif size == "L": - additional_price_tag = 1.00 - additional_price_tag_format = "{:.2f}".format(additional_price_tag) - additional_price = 1.00 * n - price_before_tax += additional_price - elif size == "XL": - additional_price_tag = 1.25 - additional_price = 1.25 * n - price_before_tax += additional_price - - # format the extra topping portion of the receipt with its size and price on the other side - float_additional_price = float(additional_price) - format_additional_price = "{:.2f}" .format(float_additional_price) - - for extra in range(len(pizzaOrder[pizza][1])): - if extra > 2: - if size == "XL": - print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag)) - elif size == "L": - print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag_format)) - elif size == "M": - print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag)) - elif size == "S": - print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag_format)) - # outside of loop begins, calculates the price before tax with the tax value set earlier - price_final = price_before_tax * tax - - # add the tax price to be added and set it to a float, as well as the final price with tax - float1 = float(price_before_tax * (13/100)) - float2 = float(price_final) - formatFloat1 = "{:.2f}" .format(float1) - formatFloat2 = "{:.2f}" .format(float2) - - # format the price of the tax, and the total with both values on the other side - print("Tax:" + "\t\t\t\t\t " + formatFloat1) - print("Total:" + "\t\t\t\t\t " + formatFloat2) diff --git a/Pizza Order/pyvenv.cfg b/Pizza Order/pyvenv.cfg deleted file mode 100644 index b83f8fb7..00000000 --- a/Pizza Order/pyvenv.cfg +++ /dev/null @@ -1,8 +0,0 @@ -home = /Library/Frameworks/Python.framework/Versions/3.10 -implementation = CPython -version_info = 3.10.0.final.0 -virtualenv = 20.13.0 -include-system-site-packages = false -base-prefix = /Library/Frameworks/Python.framework/Versions/3.10 -base-exec-prefix = /Library/Frameworks/Python.framework/Versions/3.10 -base-executable = /usr/local/bin/python3.10 From b9d4d6a8a31bdb265b85b0280c9d9c3675d2a081 Mon Sep 17 00:00:00 2001 From: Arjayn Piratheeparatnam <122946744+ArjaynP@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:33:48 -0500 Subject: [PATCH 3/5] Removed edit from README.md Issue with pull request --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index a717c3d1..fbebef09 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,6 @@ More information on contributing and the general code of conduct for discussion | PDF to Audio | [PDF to Audio](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20Audio) | Converts PDF to audio. | | PDF to Text | [PDF to text](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20text) | Converts PDF to text. | | PDF merger and splitter | [PDF Merger and Splitter](https://github.com/AbhijitMotekar99/Python-Scripts/blob/master/PDF%20Merger%20and%20Splitter/PDF%20Merger%20and%20Splitter.py) | Create a tool that can merge multiple PDF files into one or split a single PDF into separate pages. | -| Pizza Order | [Pizza Order](https://github.com/DhanushNehru/Python-Scripts/tree/master/Pizza%20Order) | An algorithm designed to handle pizza orders from customers with accurate receipts and calculations. | | Planet Simulation | [Planet Simulation](https://github.com/DhanushNehru/Python-Scripts/tree/master/Planet%20Simulation) | A simulation of several planets rotating around the sun. | | Playlist Exchange | [Playlist Exchange](https://github.com/DhanushNehru/Python-Scripts/tree/master/Playlist%20Exchange) | A Python script to exchange songs and playlists between Spotify and Python. | | Pigeonhole Sort | [Algorithm](https://github.com/DhanushNehru/Python-Scripts/tree/master/PigeonHole) | The pigeonhole sort algorithm to sort your arrays efficiently! | From 3e6f5f8b5c5438ea6c8a53d976ca9e7ee37a5127 Mon Sep 17 00:00:00 2001 From: Arjayn Piratheeparatnam <122946744+ArjaynP@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:36:00 -0500 Subject: [PATCH 4/5] Pizza Order Python Script Added my project info to the README.md file, and re-submitted my files from my project. --- Pizza Order/PizzaTest.py | 112 ++++++++++++++++++++++++++++++++++++ Pizza Order/README.md | 6 ++ Pizza Order/order.py | 80 ++++++++++++++++++++++++++ Pizza Order/pizzaReceipt.py | 105 +++++++++++++++++++++++++++++++++ Pizza Order/pyvenv.cfg | 8 +++ README.md | 1 + 6 files changed, 312 insertions(+) create mode 100644 Pizza Order/PizzaTest.py create mode 100644 Pizza Order/README.md create mode 100644 Pizza Order/order.py create mode 100644 Pizza Order/pizzaReceipt.py create mode 100644 Pizza Order/pyvenv.cfg diff --git a/Pizza Order/PizzaTest.py b/Pizza Order/PizzaTest.py new file mode 100644 index 00000000..bc77171d --- /dev/null +++ b/Pizza Order/PizzaTest.py @@ -0,0 +1,112 @@ +import subprocess + + +def runTest (file, inText): + if file =="order": + res = subprocess.run("python " + file + ".py", input=inText, capture_output=True, text=True, shell=True) + return res.stdout + + if file == "pizzaReceipt": + res = subprocess.run("python -c \"from pizzaReceipt import *; generateReceipt([" +inText+ "])\"", capture_output=True, text=True, shell= True) + return res.stdout + + +def equalWithoutSpaces(expected, student): + expected = expected.replace(" ", "") + expected = expected.replace("\t", "") + student = student.replace(" ", "") + student = student.replace("\t", "") + return expected == student + + + +# --------------- Test 1 - No Order--------------- + +inputString = "" +studentOutput = runTest("pizzaReceipt", inputString) +expectedOutput = "You did not order anything\n" + +# Compare studentOutput to expectedOutput +if studentOutput == expectedOutput: + print("Test 1 Passed. (Receipt for empty order)") +else: + print("Test 1 Failed. (Receipt for empty order)") + +#print(studentOutput) + +# --------------- Test 2 - List of Orders--------------- + +inputString = "('L', ['HAM', 'BACON', 'ONION', 'TOMATO']), ('S', ['PEPPERONI', 'SAUSAGE', 'CHICKEN', 'HAM']), ('L', ['BROCCOLI', 'CHICKEN', 'ONION'])" +studentOutput = runTest("pizzaReceipt", inputString) +expectedOutput = "Your order: \nPizza 1: L 11.99\n- HAM\n- BACON\n- ONION\n- TOMATO\nExtra Topping (L) 1.00\n" +expectedOutput += "Pizza 2: S 7.99\n- PEPPERONI\n- SAUSAGE\n- CHICKEN\n- HAM\nExtra Topping (S) 0.50\n" +expectedOutput += "Pizza 3: L 11.99\n- BROCCOLI\n- CHICKEN\n- ONION\nTax: 4.35\nTotal: 37.82\n" + +# Compare studentOutput to expectedOutput +#if studentOutput == expectedOutput: +if equalWithoutSpaces(expectedOutput, studentOutput): + print("Test 2 Passed. (Receipt for empty order of 3 pizzas)") +else: + print("Test 2 Failed. (Receipt for empty order of 3 pizzas)") + + +# --------------- Test 3 - List of Orders--------------- + +inputString = "('XL', ['GREEN PEPPER', 'HOT PEPPER', 'MUSHROOM', 'ONION', 'SPINACH']), ('L', ['PEPPERONI', 'ONION', 'OLIVE', 'MUSHROOM']), ('L', ['PINEAPPLE', 'HAM']), ('M', ['GROUND BEEF', 'TOMATO', 'ONION', 'SPINACH'])" +studentOutput = runTest("pizzaReceipt", inputString) +expectedOutput = "Your order: \nPizza 1: XL 13.99\n- GREEN PEPPER\n- HOT PEPPER\n- MUSHROOM\n- ONION\n- SPINACH\nExtra Topping (XL) 1.25\n" +expectedOutput += "Extra Topping (XL) 1.25\nPizza 2: L 11.99\n- PEPPERONI\n- ONION\n- OLIVE\n- MUSHROOM\n" +expectedOutput += "Extra Topping (L) 1.00\nPizza 3: L 11.99\n- PINEAPPLE\n- HAM\nPizza 4: M 9.99\n" +expectedOutput += "- GROUND BEEF\n- TOMATO\n- ONION\n- SPINACH\nExtra Topping (M) 0.75\nTax: 6.79\nTotal: 59.00\n" + +# Compare studentOutput to expectedOutput +if equalWithoutSpaces(expectedOutput, studentOutput): + print("Test 3 Passed. (Receipt for empty order of 4 pizzas)") +else: + print("Test 3 Failed. (Receipt for empty order of 4 pizzas)") + +# --------------- Test 4 - Find Specific Values in Output --------------- + +studentOutput = runTest("order", "Yes\nL\nHAM\nX\nNo\n") + +if studentOutput.find("13.55") != -1: + print("Test 4 Passed. (Ordering system for order of 1 pizza)") +else: + print("Test 4 Failed. (Ordering system for order of 1 pizza)") + +#print(studentOutput) + +# --------------- Test 5 - Find Specific Values in Output--------------- + +studentOutput = runTest("order", "Yes\nmedium\nM\nLIST\npepperoni\nonion\nmushroom\nhot pepper\ntomato\nX\nq\n") + +if studentOutput.find("\"X\"\n('") != -1 and studentOutput.count("Choose a size:") == 2 and studentOutput.count("Type in one of our toppings") == 7 and studentOutput.find("1.49") != -1 and studentOutput.find("12.98") != -1: + print("Test 5 Passed. (Ordering system with typo and use of LIST)") +else: + + print("Test 5 Failed. (Ordering system with typo and use of LIST)") + +print() +print(studentOutput.find("\"X\"\n('") != -1) +print(studentOutput.count("Choose a size:") == 2) +print(studentOutput.count("Type in one of our toppings") == 7) +print(studentOutput.find("1.49") != -1) +print(studentOutput.find("12.98") != -1) +print() + +# --------------- Find Specific Values in Output --------------- + +studentOutput = runTest("order", "y\nm\nsausage\nbacon\nonion\nX\ny\nXl\nchicken\ntomato\nspinach\nmushroom\nx\ny\nm\nolive\nbroccoli\nhot pepper\ngreen pepper\nx\nno\n") + +if studentOutput.count("Type in one of our toppings") == 14 and studentOutput.find("4.68") != -1 and studentOutput.find("40.65") != -1: + print("Test 6 Passed. (Ordering system for order of 3 pizzas)") +else: + print("Test 6 Failed. (Ordering system for order of 3 pizzas)") + +# print(studentOutput) +# print(expectedOutput) +# -------------------------------- + + + + diff --git a/Pizza Order/README.md b/Pizza Order/README.md new file mode 100644 index 00000000..b859e05f --- /dev/null +++ b/Pizza Order/README.md @@ -0,0 +1,6 @@ +# OrderPizza + A program that I created in one of my computer science courses containing a frontend and backend. The frontend deals with asking the user for their order, while the backend focuses on storing the information in a receipt format along with its calculations by using functions, lists, and tuples. + + In the frontend, the user first asks if the customer would like to order. If they say no, the code exits completely and is terminated. If the user says yes, it will then ask for the size of pizza as each have a different price range. After, the user will ask for toppings. The maximum that they can enter is three. Afterwards, every topping will cost an additional price to its total. After they have completed asking toppings, the program creates the order in a tuple and is stored in a variable. If the user would like to continue to ordering, the program would loop once more using a while loop and repeat the same questions that were asked in the last instance Afterwards, the second order is incremented to the variable containing the tuple. Otherwise, the code exits and the pizza receipt file is called using the variable of the tuple containing the pizza order and will print a receipt detailing the order and the total. + + In the backend, once the customer has finished ordering, the function is called using the variable as a paramter containing the customers order and creates a receipt by first showing the first pizza, its size, toppings and the amount is placed on the right hand side. If there are more than three toppings, it will show its additional cost as well. If there are more pizzas included, it will repeat the process once more. Afterwards, it shows the total before tax, the additional 13% tax in dollar amount and the total with tax. diff --git a/Pizza Order/order.py b/Pizza Order/order.py new file mode 100644 index 00000000..3ece1594 --- /dev/null +++ b/Pizza Order/order.py @@ -0,0 +1,80 @@ +# purpose of order.py is the front end for users to submit their order +from pizzaReceipt import * # asks to import all functions found in the pizzaReceipt.py file + +# set all initial variables before beginning +size = "" +pizza_lst = [] +pizza_lst_current = [] +toppings_lst = [] # list to be a parameter for generateReceipt function +list_order_yes = ["Yes", "yes", "Y", "y", "YES"] +list_order_no = ["No", "no", "Q", "NO", "N", "n"] +TOPPINGS = ("ONION", "TOMATO", "GREEN PEPPER", "MUSHROOM", "OLIVE", "SPINACH", "BROCCOLI", "PINEAPPLE", + "HOT PEPPER", "PEPPERONI", "HAM", "BACON", "GROUND BEEF", "CHICKEN", "SAUSAGE") + +# ask user whether they want to order. +order = input("Do you want to order a pizza? ") + +# case for when an invalid input is submitted +while (order not in list_order_yes) and (order not in list_order_no): + order = input("Do you want to order a pizza? ") + +# ask for size +if order in list_order_yes: + size = input("Choose a size: ") + size.upper() + + # case for when a user inputs invalid size + while size.upper() not in ["S", "M", "L", "XL"]: + size = input("Choose a size: ") + +# entire loop to repeat if user wants to order more than one pizza +while order in list_order_yes: + # set empty toppings list as it will show empty each time loop is made + toppings_lst = [] + # ask user for topping, whether they want to see a list of the toppings, or to finish ordering toppings. + topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' + 'When you are done adding toppings, enter "X" ') + + # cae for when a user places an invalid input for this question + while (topping.upper() != "X") and (topping.upper() != "LIST") and (topping.upper() not in TOPPINGS): + topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' + 'When you are done adding toppings, enter "X" ') + + print() + # toppings while loop which ask for toppings selection or list view, multiple times until user enters X + while topping.upper() != "X": + TOPPINGS = ("ONION", "TOMATO", "GREEN PEPPER", "MUSHROOM", "OLIVE", "SPINACH", "BROCCOLI", "PINEAPPLE", + "HOT PEPPER", "PEPPERONI", "HAM", "BACON", "GROUND BEEF", "CHICKEN", "SAUSAGE") + if topping.upper() == "LIST": + print(topping.upper()) + print(TOPPINGS) + topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' + 'When you are done adding toppings, enter "X" \n \n') + elif topping.upper() in TOPPINGS: + print(topping.upper()) + print("Added", topping.upper(), "to your pizza") + toppings_lst.append(topping) + topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' + 'When you are done adding toppings, enter "X" \n \n') + + # add the size and toppings list as a tuple to pizza_lst + pizza_lst.append((size.upper(), toppings_lst)) + print(pizza_lst) + # ask whether they want to continue ordering + order = input("Do you want to continue ordering? ") + + # case for when user types invalid input + while (order not in list_order_yes) and (order not in list_order_no): + order = input("Do you want to order a pizza? ") + + # if they say no, break the loop and go through the last line of the code + if order in list_order_no: + break + elif order in list_order_yes: + size = input("Choose a size: ") # if they want to order again start by asking size + + # case for when user types invalid input + while size.upper() not in ["S", "M", "L", "XL"]: + size = input("Choose a size: ") + +generateReceipt(pizza_lst) # at the end of program, call function using pizza_lst as a parameter diff --git a/Pizza Order/pizzaReceipt.py b/Pizza Order/pizzaReceipt.py new file mode 100644 index 00000000..b7ff1d3d --- /dev/null +++ b/Pizza Order/pizzaReceipt.py @@ -0,0 +1,105 @@ +# purpose of pizzaReceipt.py is the back end where the developers create methods and functions to properly format the receipt and its total +def generateReceipt(pizzaOrder): + # parameter will be placed with pizza_lst = ("M", ["PEPPERONI", "OLIVE"], -----) + # set initial variables + size = "" + additional_price = 0 + price_before_tax = 0 + tax = 1.13 + counter = 1 # pizza number + size_price = 0 + additional_price_tag = float(0) + additional_price_tag_format = "" + + # if its an empty list, display this statement + if len(pizzaOrder) == 0: + print("You did not order anything") + exit() + + # beginning of the format of receipt + print("Your order: ") + + # a for loop which goes through all tuples in the list based on its indices + for pizza in range(len(pizzaOrder)): + # cases to determine the sizes selected and its price + if pizzaOrder[pizza][0] == "S": + size_price = 7.99 + size = "S" + elif pizzaOrder[pizza][0] == "M": + size_price = 9.99 + size = "M" + elif pizzaOrder[pizza][0] == "L": + size_price = 11.99 + size = "L" + elif pizzaOrder[pizza][0] == "XL": + size_price = 13.99 + size = "XL" + + # add the price of the size to the final price before tax + price_before_tax += size_price + + # formatting the pizza number and its size beside it and the price on the other side + if size == "XL": + print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) + elif size == "L": + print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) + elif size == "M": + print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) + elif size == "S": + print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) + + # increment counter variable by one for the pizza number + counter += 1 + + # format the toppings with a dash in front + for j in range(len(pizzaOrder[pizza][1])): + print("- " + str(pizzaOrder[pizza][1][j])) + + # if theres more than three toppings, calculate the total additional price and added to the total price before tax + if len(pizzaOrder[pizza][1]) > 3: + n = len(pizzaOrder[pizza][1]) - 3 + if size == "S": + additional_price_tag = 0.50 + additional_price_tag_format = "{:.2f}".format(additional_price_tag) + additional_price = 0.50 * n + price_before_tax += additional_price + elif size == "M": + additional_price_tag = 0.75 + additional_price = 0.75 * n + price_before_tax += additional_price + elif size == "L": + additional_price_tag = 1.00 + additional_price_tag_format = "{:.2f}".format(additional_price_tag) + additional_price = 1.00 * n + price_before_tax += additional_price + elif size == "XL": + additional_price_tag = 1.25 + additional_price = 1.25 * n + price_before_tax += additional_price + + # format the extra topping portion of the receipt with its size and price on the other side + float_additional_price = float(additional_price) + format_additional_price = "{:.2f}" .format(float_additional_price) + + for extra in range(len(pizzaOrder[pizza][1])): + if extra > 2: + if size == "XL": + print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag)) + elif size == "L": + print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag_format)) + elif size == "M": + print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag)) + elif size == "S": + print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag_format)) + # outside of loop begins, calculates the price before tax with the tax value set earlier + price_final = price_before_tax * tax + + # add the tax price to be added and set it to a float, as well as the final price with tax + float1 = float(price_before_tax * (13/100)) + float2 = float(price_final) + formatFloat1 = "{:.2f}" .format(float1) + formatFloat2 = "{:.2f}" .format(float2) + + # format the price of the tax, and the total with both values on the other side + print("Tax:" + "\t\t\t\t\t " + formatFloat1) + print("Total:" + "\t\t\t\t\t " + formatFloat2) diff --git a/Pizza Order/pyvenv.cfg b/Pizza Order/pyvenv.cfg new file mode 100644 index 00000000..b83f8fb7 --- /dev/null +++ b/Pizza Order/pyvenv.cfg @@ -0,0 +1,8 @@ +home = /Library/Frameworks/Python.framework/Versions/3.10 +implementation = CPython +version_info = 3.10.0.final.0 +virtualenv = 20.13.0 +include-system-site-packages = false +base-prefix = /Library/Frameworks/Python.framework/Versions/3.10 +base-exec-prefix = /Library/Frameworks/Python.framework/Versions/3.10 +base-executable = /usr/local/bin/python3.10 diff --git a/README.md b/README.md index fbebef09..a717c3d1 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ More information on contributing and the general code of conduct for discussion | PDF to Audio | [PDF to Audio](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20Audio) | Converts PDF to audio. | | PDF to Text | [PDF to text](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20text) | Converts PDF to text. | | PDF merger and splitter | [PDF Merger and Splitter](https://github.com/AbhijitMotekar99/Python-Scripts/blob/master/PDF%20Merger%20and%20Splitter/PDF%20Merger%20and%20Splitter.py) | Create a tool that can merge multiple PDF files into one or split a single PDF into separate pages. | +| Pizza Order | [Pizza Order](https://github.com/DhanushNehru/Python-Scripts/tree/master/Pizza%20Order) | An algorithm designed to handle pizza orders from customers with accurate receipts and calculations. | | Planet Simulation | [Planet Simulation](https://github.com/DhanushNehru/Python-Scripts/tree/master/Planet%20Simulation) | A simulation of several planets rotating around the sun. | | Playlist Exchange | [Playlist Exchange](https://github.com/DhanushNehru/Python-Scripts/tree/master/Playlist%20Exchange) | A Python script to exchange songs and playlists between Spotify and Python. | | Pigeonhole Sort | [Algorithm](https://github.com/DhanushNehru/Python-Scripts/tree/master/PigeonHole) | The pigeonhole sort algorithm to sort your arrays efficiently! | From 96ca6bcb3d10fd069b8adbbf75a991916db26fc0 Mon Sep 17 00:00:00 2001 From: Arjayn Piratheeparatnam <122946744+ArjaynP@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:44:10 -0500 Subject: [PATCH 5/5] Pull Request Done Incorrectly My apologies, this was done incorrectly, will add these files and create the pull request correctly. --- Pizza Order/PizzaTest.py | 112 ------------------------------------ Pizza Order/README.md | 6 -- Pizza Order/order.py | 80 -------------------------- Pizza Order/pizzaReceipt.py | 105 --------------------------------- Pizza Order/pyvenv.cfg | 8 --- README.md | 1 - 6 files changed, 312 deletions(-) delete mode 100644 Pizza Order/PizzaTest.py delete mode 100644 Pizza Order/README.md delete mode 100644 Pizza Order/order.py delete mode 100644 Pizza Order/pizzaReceipt.py delete mode 100644 Pizza Order/pyvenv.cfg diff --git a/Pizza Order/PizzaTest.py b/Pizza Order/PizzaTest.py deleted file mode 100644 index bc77171d..00000000 --- a/Pizza Order/PizzaTest.py +++ /dev/null @@ -1,112 +0,0 @@ -import subprocess - - -def runTest (file, inText): - if file =="order": - res = subprocess.run("python " + file + ".py", input=inText, capture_output=True, text=True, shell=True) - return res.stdout - - if file == "pizzaReceipt": - res = subprocess.run("python -c \"from pizzaReceipt import *; generateReceipt([" +inText+ "])\"", capture_output=True, text=True, shell= True) - return res.stdout - - -def equalWithoutSpaces(expected, student): - expected = expected.replace(" ", "") - expected = expected.replace("\t", "") - student = student.replace(" ", "") - student = student.replace("\t", "") - return expected == student - - - -# --------------- Test 1 - No Order--------------- - -inputString = "" -studentOutput = runTest("pizzaReceipt", inputString) -expectedOutput = "You did not order anything\n" - -# Compare studentOutput to expectedOutput -if studentOutput == expectedOutput: - print("Test 1 Passed. (Receipt for empty order)") -else: - print("Test 1 Failed. (Receipt for empty order)") - -#print(studentOutput) - -# --------------- Test 2 - List of Orders--------------- - -inputString = "('L', ['HAM', 'BACON', 'ONION', 'TOMATO']), ('S', ['PEPPERONI', 'SAUSAGE', 'CHICKEN', 'HAM']), ('L', ['BROCCOLI', 'CHICKEN', 'ONION'])" -studentOutput = runTest("pizzaReceipt", inputString) -expectedOutput = "Your order: \nPizza 1: L 11.99\n- HAM\n- BACON\n- ONION\n- TOMATO\nExtra Topping (L) 1.00\n" -expectedOutput += "Pizza 2: S 7.99\n- PEPPERONI\n- SAUSAGE\n- CHICKEN\n- HAM\nExtra Topping (S) 0.50\n" -expectedOutput += "Pizza 3: L 11.99\n- BROCCOLI\n- CHICKEN\n- ONION\nTax: 4.35\nTotal: 37.82\n" - -# Compare studentOutput to expectedOutput -#if studentOutput == expectedOutput: -if equalWithoutSpaces(expectedOutput, studentOutput): - print("Test 2 Passed. (Receipt for empty order of 3 pizzas)") -else: - print("Test 2 Failed. (Receipt for empty order of 3 pizzas)") - - -# --------------- Test 3 - List of Orders--------------- - -inputString = "('XL', ['GREEN PEPPER', 'HOT PEPPER', 'MUSHROOM', 'ONION', 'SPINACH']), ('L', ['PEPPERONI', 'ONION', 'OLIVE', 'MUSHROOM']), ('L', ['PINEAPPLE', 'HAM']), ('M', ['GROUND BEEF', 'TOMATO', 'ONION', 'SPINACH'])" -studentOutput = runTest("pizzaReceipt", inputString) -expectedOutput = "Your order: \nPizza 1: XL 13.99\n- GREEN PEPPER\n- HOT PEPPER\n- MUSHROOM\n- ONION\n- SPINACH\nExtra Topping (XL) 1.25\n" -expectedOutput += "Extra Topping (XL) 1.25\nPizza 2: L 11.99\n- PEPPERONI\n- ONION\n- OLIVE\n- MUSHROOM\n" -expectedOutput += "Extra Topping (L) 1.00\nPizza 3: L 11.99\n- PINEAPPLE\n- HAM\nPizza 4: M 9.99\n" -expectedOutput += "- GROUND BEEF\n- TOMATO\n- ONION\n- SPINACH\nExtra Topping (M) 0.75\nTax: 6.79\nTotal: 59.00\n" - -# Compare studentOutput to expectedOutput -if equalWithoutSpaces(expectedOutput, studentOutput): - print("Test 3 Passed. (Receipt for empty order of 4 pizzas)") -else: - print("Test 3 Failed. (Receipt for empty order of 4 pizzas)") - -# --------------- Test 4 - Find Specific Values in Output --------------- - -studentOutput = runTest("order", "Yes\nL\nHAM\nX\nNo\n") - -if studentOutput.find("13.55") != -1: - print("Test 4 Passed. (Ordering system for order of 1 pizza)") -else: - print("Test 4 Failed. (Ordering system for order of 1 pizza)") - -#print(studentOutput) - -# --------------- Test 5 - Find Specific Values in Output--------------- - -studentOutput = runTest("order", "Yes\nmedium\nM\nLIST\npepperoni\nonion\nmushroom\nhot pepper\ntomato\nX\nq\n") - -if studentOutput.find("\"X\"\n('") != -1 and studentOutput.count("Choose a size:") == 2 and studentOutput.count("Type in one of our toppings") == 7 and studentOutput.find("1.49") != -1 and studentOutput.find("12.98") != -1: - print("Test 5 Passed. (Ordering system with typo and use of LIST)") -else: - - print("Test 5 Failed. (Ordering system with typo and use of LIST)") - -print() -print(studentOutput.find("\"X\"\n('") != -1) -print(studentOutput.count("Choose a size:") == 2) -print(studentOutput.count("Type in one of our toppings") == 7) -print(studentOutput.find("1.49") != -1) -print(studentOutput.find("12.98") != -1) -print() - -# --------------- Find Specific Values in Output --------------- - -studentOutput = runTest("order", "y\nm\nsausage\nbacon\nonion\nX\ny\nXl\nchicken\ntomato\nspinach\nmushroom\nx\ny\nm\nolive\nbroccoli\nhot pepper\ngreen pepper\nx\nno\n") - -if studentOutput.count("Type in one of our toppings") == 14 and studentOutput.find("4.68") != -1 and studentOutput.find("40.65") != -1: - print("Test 6 Passed. (Ordering system for order of 3 pizzas)") -else: - print("Test 6 Failed. (Ordering system for order of 3 pizzas)") - -# print(studentOutput) -# print(expectedOutput) -# -------------------------------- - - - - diff --git a/Pizza Order/README.md b/Pizza Order/README.md deleted file mode 100644 index b859e05f..00000000 --- a/Pizza Order/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# OrderPizza - A program that I created in one of my computer science courses containing a frontend and backend. The frontend deals with asking the user for their order, while the backend focuses on storing the information in a receipt format along with its calculations by using functions, lists, and tuples. - - In the frontend, the user first asks if the customer would like to order. If they say no, the code exits completely and is terminated. If the user says yes, it will then ask for the size of pizza as each have a different price range. After, the user will ask for toppings. The maximum that they can enter is three. Afterwards, every topping will cost an additional price to its total. After they have completed asking toppings, the program creates the order in a tuple and is stored in a variable. If the user would like to continue to ordering, the program would loop once more using a while loop and repeat the same questions that were asked in the last instance Afterwards, the second order is incremented to the variable containing the tuple. Otherwise, the code exits and the pizza receipt file is called using the variable of the tuple containing the pizza order and will print a receipt detailing the order and the total. - - In the backend, once the customer has finished ordering, the function is called using the variable as a paramter containing the customers order and creates a receipt by first showing the first pizza, its size, toppings and the amount is placed on the right hand side. If there are more than three toppings, it will show its additional cost as well. If there are more pizzas included, it will repeat the process once more. Afterwards, it shows the total before tax, the additional 13% tax in dollar amount and the total with tax. diff --git a/Pizza Order/order.py b/Pizza Order/order.py deleted file mode 100644 index 3ece1594..00000000 --- a/Pizza Order/order.py +++ /dev/null @@ -1,80 +0,0 @@ -# purpose of order.py is the front end for users to submit their order -from pizzaReceipt import * # asks to import all functions found in the pizzaReceipt.py file - -# set all initial variables before beginning -size = "" -pizza_lst = [] -pizza_lst_current = [] -toppings_lst = [] # list to be a parameter for generateReceipt function -list_order_yes = ["Yes", "yes", "Y", "y", "YES"] -list_order_no = ["No", "no", "Q", "NO", "N", "n"] -TOPPINGS = ("ONION", "TOMATO", "GREEN PEPPER", "MUSHROOM", "OLIVE", "SPINACH", "BROCCOLI", "PINEAPPLE", - "HOT PEPPER", "PEPPERONI", "HAM", "BACON", "GROUND BEEF", "CHICKEN", "SAUSAGE") - -# ask user whether they want to order. -order = input("Do you want to order a pizza? ") - -# case for when an invalid input is submitted -while (order not in list_order_yes) and (order not in list_order_no): - order = input("Do you want to order a pizza? ") - -# ask for size -if order in list_order_yes: - size = input("Choose a size: ") - size.upper() - - # case for when a user inputs invalid size - while size.upper() not in ["S", "M", "L", "XL"]: - size = input("Choose a size: ") - -# entire loop to repeat if user wants to order more than one pizza -while order in list_order_yes: - # set empty toppings list as it will show empty each time loop is made - toppings_lst = [] - # ask user for topping, whether they want to see a list of the toppings, or to finish ordering toppings. - topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' - 'When you are done adding toppings, enter "X" ') - - # cae for when a user places an invalid input for this question - while (topping.upper() != "X") and (topping.upper() != "LIST") and (topping.upper() not in TOPPINGS): - topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' - 'When you are done adding toppings, enter "X" ') - - print() - # toppings while loop which ask for toppings selection or list view, multiple times until user enters X - while topping.upper() != "X": - TOPPINGS = ("ONION", "TOMATO", "GREEN PEPPER", "MUSHROOM", "OLIVE", "SPINACH", "BROCCOLI", "PINEAPPLE", - "HOT PEPPER", "PEPPERONI", "HAM", "BACON", "GROUND BEEF", "CHICKEN", "SAUSAGE") - if topping.upper() == "LIST": - print(topping.upper()) - print(TOPPINGS) - topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' - 'When you are done adding toppings, enter "X" \n \n') - elif topping.upper() in TOPPINGS: - print(topping.upper()) - print("Added", topping.upper(), "to your pizza") - toppings_lst.append(topping) - topping = input('Type in one of our toppings to add it to your pizza. To see the list of toppings, enter "LIST". ' - 'When you are done adding toppings, enter "X" \n \n') - - # add the size and toppings list as a tuple to pizza_lst - pizza_lst.append((size.upper(), toppings_lst)) - print(pizza_lst) - # ask whether they want to continue ordering - order = input("Do you want to continue ordering? ") - - # case for when user types invalid input - while (order not in list_order_yes) and (order not in list_order_no): - order = input("Do you want to order a pizza? ") - - # if they say no, break the loop and go through the last line of the code - if order in list_order_no: - break - elif order in list_order_yes: - size = input("Choose a size: ") # if they want to order again start by asking size - - # case for when user types invalid input - while size.upper() not in ["S", "M", "L", "XL"]: - size = input("Choose a size: ") - -generateReceipt(pizza_lst) # at the end of program, call function using pizza_lst as a parameter diff --git a/Pizza Order/pizzaReceipt.py b/Pizza Order/pizzaReceipt.py deleted file mode 100644 index b7ff1d3d..00000000 --- a/Pizza Order/pizzaReceipt.py +++ /dev/null @@ -1,105 +0,0 @@ -# purpose of pizzaReceipt.py is the back end where the developers create methods and functions to properly format the receipt and its total -def generateReceipt(pizzaOrder): - # parameter will be placed with pizza_lst = ("M", ["PEPPERONI", "OLIVE"], -----) - # set initial variables - size = "" - additional_price = 0 - price_before_tax = 0 - tax = 1.13 - counter = 1 # pizza number - size_price = 0 - additional_price_tag = float(0) - additional_price_tag_format = "" - - # if its an empty list, display this statement - if len(pizzaOrder) == 0: - print("You did not order anything") - exit() - - # beginning of the format of receipt - print("Your order: ") - - # a for loop which goes through all tuples in the list based on its indices - for pizza in range(len(pizzaOrder)): - # cases to determine the sizes selected and its price - if pizzaOrder[pizza][0] == "S": - size_price = 7.99 - size = "S" - elif pizzaOrder[pizza][0] == "M": - size_price = 9.99 - size = "M" - elif pizzaOrder[pizza][0] == "L": - size_price = 11.99 - size = "L" - elif pizzaOrder[pizza][0] == "XL": - size_price = 13.99 - size = "XL" - - # add the price of the size to the final price before tax - price_before_tax += size_price - - # formatting the pizza number and its size beside it and the price on the other side - if size == "XL": - print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) - elif size == "L": - print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) - elif size == "M": - print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) - elif size == "S": - print("Pizza", str(counter) + ":", str(size) + " \t\t\t " + str(size_price)) - - # increment counter variable by one for the pizza number - counter += 1 - - # format the toppings with a dash in front - for j in range(len(pizzaOrder[pizza][1])): - print("- " + str(pizzaOrder[pizza][1][j])) - - # if theres more than three toppings, calculate the total additional price and added to the total price before tax - if len(pizzaOrder[pizza][1]) > 3: - n = len(pizzaOrder[pizza][1]) - 3 - if size == "S": - additional_price_tag = 0.50 - additional_price_tag_format = "{:.2f}".format(additional_price_tag) - additional_price = 0.50 * n - price_before_tax += additional_price - elif size == "M": - additional_price_tag = 0.75 - additional_price = 0.75 * n - price_before_tax += additional_price - elif size == "L": - additional_price_tag = 1.00 - additional_price_tag_format = "{:.2f}".format(additional_price_tag) - additional_price = 1.00 * n - price_before_tax += additional_price - elif size == "XL": - additional_price_tag = 1.25 - additional_price = 1.25 * n - price_before_tax += additional_price - - # format the extra topping portion of the receipt with its size and price on the other side - float_additional_price = float(additional_price) - format_additional_price = "{:.2f}" .format(float_additional_price) - - for extra in range(len(pizzaOrder[pizza][1])): - if extra > 2: - if size == "XL": - print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag)) - elif size == "L": - print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag_format)) - elif size == "M": - print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag)) - elif size == "S": - print("Extra Topping", "(" + size + ")" + "\t\t " + str(additional_price_tag_format)) - # outside of loop begins, calculates the price before tax with the tax value set earlier - price_final = price_before_tax * tax - - # add the tax price to be added and set it to a float, as well as the final price with tax - float1 = float(price_before_tax * (13/100)) - float2 = float(price_final) - formatFloat1 = "{:.2f}" .format(float1) - formatFloat2 = "{:.2f}" .format(float2) - - # format the price of the tax, and the total with both values on the other side - print("Tax:" + "\t\t\t\t\t " + formatFloat1) - print("Total:" + "\t\t\t\t\t " + formatFloat2) diff --git a/Pizza Order/pyvenv.cfg b/Pizza Order/pyvenv.cfg deleted file mode 100644 index b83f8fb7..00000000 --- a/Pizza Order/pyvenv.cfg +++ /dev/null @@ -1,8 +0,0 @@ -home = /Library/Frameworks/Python.framework/Versions/3.10 -implementation = CPython -version_info = 3.10.0.final.0 -virtualenv = 20.13.0 -include-system-site-packages = false -base-prefix = /Library/Frameworks/Python.framework/Versions/3.10 -base-exec-prefix = /Library/Frameworks/Python.framework/Versions/3.10 -base-executable = /usr/local/bin/python3.10 diff --git a/README.md b/README.md index a717c3d1..fbebef09 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,6 @@ More information on contributing and the general code of conduct for discussion | PDF to Audio | [PDF to Audio](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20Audio) | Converts PDF to audio. | | PDF to Text | [PDF to text](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20text) | Converts PDF to text. | | PDF merger and splitter | [PDF Merger and Splitter](https://github.com/AbhijitMotekar99/Python-Scripts/blob/master/PDF%20Merger%20and%20Splitter/PDF%20Merger%20and%20Splitter.py) | Create a tool that can merge multiple PDF files into one or split a single PDF into separate pages. | -| Pizza Order | [Pizza Order](https://github.com/DhanushNehru/Python-Scripts/tree/master/Pizza%20Order) | An algorithm designed to handle pizza orders from customers with accurate receipts and calculations. | | Planet Simulation | [Planet Simulation](https://github.com/DhanushNehru/Python-Scripts/tree/master/Planet%20Simulation) | A simulation of several planets rotating around the sun. | | Playlist Exchange | [Playlist Exchange](https://github.com/DhanushNehru/Python-Scripts/tree/master/Playlist%20Exchange) | A Python script to exchange songs and playlists between Spotify and Python. | | Pigeonhole Sort | [Algorithm](https://github.com/DhanushNehru/Python-Scripts/tree/master/PigeonHole) | The pigeonhole sort algorithm to sort your arrays efficiently! |