ARTESH
Chief Master Sergeant
Howdy!
Here is my First Homework, Learning Python Programming Language... I hope you Enjoy it.
Copy Paste the Text here, to test / try:
Here is my First Homework, Learning Python Programming Language... I hope you Enjoy it.
Python:
print("A simple vending machine\n")
cake = 10
tea = 10
while tea > 0 or coffee > 0:
print("Remaining Tea:",tea)
print("Remaining Cake:",cake)
print("\nWhat would you like?\n(1) Tea\n(2) Cake")
selection = input("> ")
if selection == '1':
if tea > 0:
print("\nHere is your Tea\n")
tea -= 1
else:
print("\nI'm sorry, but we're all out of Tea\n")
elif selection == '2':
if cake > 0:
print("\nHere is your Cake\n")
cake -= 1
else:
print("\nI'm sorry, but we're all out of Cake\n")
else:
print("Remaining Tea:",tea)
print("Remaining Cake:",cake)
print("Sold out")
Copy Paste the Text here, to test / try:
Online Python - IDE, Editor, Compiler, Interpreter
Build and Run your Python code instantly. Online-Python is a quick and easy tool that helps you to build, compile, test your python programs.
www.online-python.com
Last edited: