Closed coderatul closed 1 year ago
dear @kiozet thanks for showing interest, i wasn't expecting that someone would really want to solve this issue but here we go ,so here is problem discription
inorder to get name of the items that user wants to buy are inputed using a while loop where serial no. and quantity againts the item is asked
i was wondering that often one buys only 1 quantity of product and entering 1 as quantity would be redundant so , it would be nice if default quantity of item(S) bought was 1
------------------- Menu -------------------
+------+----------------------------+-------+
| S.no | Items | Cost |
+------+----------------------------+-------+
| 1 | Margherita | 75 |
| 2 | Double cheese Margherita | 130 |
| 3 | Pepper | 175 |
| 4 | Cheese & Barbeque Chicken | 130 |
| 5 | Veg Extravaganza | 210 |
| 6 | Meatza | 245 |
| 7 | Veg singles | 170 |
| 8 | Chochlate lava cake | 160 |
| 9 | mogumogu | 80 |
| 10 | coke | 50 |
| 11 | mazza | 25 |
+------+----------------------------+-------+
--------------------------------------------
enter the slno. of item you want to order: 1
enter quantity desired: 1
enter the slno. of item you want to order: 3
enter quantity desired: 1
if you still have questions feel free to ask
@coderatul Got your idea! If you haven't figured out how to implement it yet, I'm willing to try! Thanks for the reply, sorry for the long reply, studying.
@coderatul We can not reinvent the wheel and just change the code line {quantity = int(input("enter quantity desired: "))} to {quantity = int(input("enter quantity desired (defalut = 1, to skip press enter): "))} and set default value quantity = 1 and write checker on space. But if you really want to see "1" on the pre-input, let's try ;)! Waiting for your answer, then contribute, if that's what you want to do.
@coderatul The result of what this will look like.
I think this will be the best option, because it saves time if a person wants to enter for example 6 instead of 1, to do this he will have to delete the unit and only then enter 6, and in this solution, if he wants 1 unit of product, he just presses enter, if another amount, just enter it.
i have merged your PR good job
Hi buddy! Can you please explain in more detail what is the "default value for quantity of items bought", as far as I understand your project is designed to count the bill in the restaurant, then I do not really understand what value should be the "default" there. It would be cool if you could describe the problem in a little more detail and give the input and output data, if you have a rough idea what they are!