Introduction
Ordering pizza in python: In this post, you will learn how to write a python code to order a pizza. And also below is the video format of the post, check it out ????????
Ordering pizza in python code ????????
Let me explain what I have done here…
Firstly I have greeted the user, Then I have asked the user to input the size of the pizza and then I asked the user to want some pepperoni and finally, I have asked the user to input whether they want cheese or not.
Then I added a variable bill = 0
Then I added the if statement for Small (S), Medium(M) and Large(L) pizza if yes then I added the amount for the size and the amount will be added to the bill variable.
Here we use += operator, Which will plus the values.
And then I added an If statement for adding pepperoni, If yes I added the amount, which will get automatically added up.
Finally, This is the last if statement. I asked for any extra cheese and if yes the bill will be added up.
Lastly adding print () statement for the pizza python code.
The output looks something like this ????????????
Click here to view the result ????????
Conclusion
Finally, we have seen how to order a pizza in python and have any doubts comment down below or watch the video I made. Ordering pizza in python
Also Read: Elif full tutorial in python for beginners | Python Bootcamp
Also Read: Leap Year in python for beginners | Python Bootcamp