Ad: This forum contains affiliate links to products on Amazon and eBay. More information in Terms and rules
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")
Ahhh yes the good ole days of messing around with Commodore 64
What's a drink without a nosh?Very nice first attempt. However there is a minor bug in your code. In the while loop you have coffee, which is undefined. Your program won't fail until you run out of tea and have to test for coffee. Maybe coffee should be cake?
Back in the days when you wanted to do things in the OS that weren't supported by any version of BASIC, so BASIC was extended to do "a little bit of Assembler stuff".Ahhh yes the good ole days of messing around with Commodore 64
Newbies and their 64 - I started with the VIC 20!Ahhh yes the good ole days of messing around with Commodore 64
I also used Amiga now happily running Linux, running my own desktop. No need for Windhog at all.Started on a Trash-80, first bought myself an Amiga 500.
Now, alas, it's nothing but Windog but I do still have a real computer: a Sun Blade 2500 Silver workstation running Solaris 10 for when I need a break from barely functional garbage from Redmond.
Several reasons but the most important is a game my son and I play that won't run under WINE or any other emulation.I also used Amiga now happily running Linux, running my own desktop. No need for Windhog at all.
Thank a lot, mate. I'm working on newer version with extended menu, right now.Very nice first attempt. However there is a minor bug in your code. In the while loop you have coffee, which is undefined. Your program won't fail until you run out of tea and have to test for coffee. Maybe coffee should be cake?
Thanks.Great! Python is my favourite program language. I've been programming in Python professionally since the old 2.6 version in 2009. If you need any help, just ask.
Dual boot helps with that.Several reasons but the most important is a game my son and I play that won't run under WINE or any other emulation.