title: Vending Machine Project - Guidance on OOP code [Python]
body: <p>Quite new to programming and have got an issue with some of my python code. I feel like there would be an easier way to write it/ simplify it. I am still working through it (working on the first item before and have got my 'tea' in the virtual vending machine. However I am not sure using that many if elif statements is the cleanest way to complete the code? Also, I want the code to constantly have an input available to the user so they can order more that one drink (if they have the money). So I would like it to loop and start again without losing the coin, how would I go about that? </p>
  
  <p>I know it isn't much, but its my first assignment and I am happy that I have got it this far! </p>
  
  <pre><code>class Vending_Machine: 
  aussie_coins = (0.05, 0.10, 0.20, 0.50, 1.00, 2.00)
  items = ['Tea','Coffee', 'Coke', 'Orange Juice']
  item_price = [0.50, 1.00, 1.50, 1.00]
  item_code = ['1', '2', '3', '4']
  
  def __init__(self): #define total in vending machine. 
      self.total = 0.00
  
  def insert_coin(self,coin):
      if float(coin) not in (self.aussie_coins):
          print ('The Vending Machine accepts only: {}. ' .format(self.aussie_coins), end = '')
      else:
          self.total += coin
          print ('Currently there is a total of {: .2f} in machine' .format(self.total))
  
  class interface(Vending_Machine):            
  def menu(self):
      print("##################################")
      print(" Welcome to my Vending Machine ")
      print("All items below are readily available")
      print(Vending_Machine.item_code[0], Vending_Machine.items[0], "${: .2f}".format(Vending_Machine.item_price[0])) #
      print(Vending_Machine.item_code[1], Vending_Machine.items[1], "${: .2f}".format(Vending_Machine.item_price[1]))
      print(Vending_Machine.item_code[2], Vending_Machine.items[2], "${: .2f}".format(Vending_Machine.item_price[2]))
      print(Vending_Machine.item_code[3], Vending_Machine.items[3], "${: .2f}".format(Vending_Machine.item_price[3]))
      print("##################################")
  
  class user_input(interface):
      def choice (self):
          choice = input("Please enter the item code of an item you would like to purchase: ")
          if choice == Vending_Machine.item_code[0]:
              print ("You have selected {} - the price is ${: .2f}. Currently you have a total of ${: .2f} in the machine." .format(Vending_Machine.items[0], Vending_Machine.item_price[0], self.total))
              if self.total &lt; Vending_Machine.item_price[0]: 
                  coins = float(input("Insert a coin into the vending machine: "))
                  Vending_Machine.insert_coin(self,coins)
                  if self.total == Vending_Machine.item_price[0]:
                      self.total -= Vending_Machine.item_price[0]
                      print('Please take your {}. There is currently ${: .2f} left in the Machine. Thanks, have a nice day!'.format(Vending_Machine.items[0], self.total))
                  elif self.total &gt; Vending_Machine.item_price[0]:
                      self.total -= Vending_Machine.item_price[0]
                      print ('Please take your {}. There is currently ${: .2f} left in the Machine. Thanks, have a nice day!'.format(Vending_Machine.items[0], self.total))
              elif self.total &gt; Vending_Machine.item_price[0]:
                  self.total -= Vending_Machine.item_price[0]
                  print('Please take your {}. Total of {: .2f} in the machine' .format(Vending_Machine.items[0],self.total))
              elif self.total == Vending_Machine.item_price[0]:
                  self.total -= Vending_Machine.item_price[0]
                  print('Please take your {}. Thanks, have a nice day!'.format(Vending_Machine.items[0]))
  
          elif choice == Vending_Machine.item_code[1]:
              print ("You have selected {} - the price is ${: .2f}. Currently you have a total of ${: .2f} in the machine." .format(Vending_Machine.items[1], Vending_Machine.item_price[1], self.total))
              if self.total &lt; Vending_Machine.item_price[1]: 
                  insert_coin(input("Insert a coin into the vending machine: "))
              elif self.total &gt; Vending_Machine.item_price[1]:
                  self.total -= Vending_Machine.item_price[1]
                  print('Please take your {}. Total of {: .2f} in the machine' .format(Vending_Machine.items[1],self.total))
              elif self.total == Vending_Machine.item_price[1]:
                  self.total -= Vending_Machine.item_price[1]
                  print('Please take your {}. Thanks, have a nice day!'.format(Vending_Machine.items[1]))
  
          elif choice == Vending_Machine.item_code[2]:
              print ("You have selected {} - the price is ${: .2f}. Currently you have a total of ${: .2f} in the machine." .format(Vending_Machine.items[2], Vending_Machine.item_price[2], self.total))
              if self.total &lt; Vending_Machine.item_price[2]: 
                  insert_coin(input("Insert a coin into the vending machine: "))
              elif self.total &gt; Vending_Machine.item_price[2]:
                  self.total -= Vending_Machine.item_price[2]
                  print('Please take your {}. Total of {: .2f} in the machine' .format(Vending_Machine.items[2],self.total))
              elif self.total == Vending_Machine.item_price[2]:
                  self.total -= Vending_Machine.item_price[2]
                  print('Please take your {}. Thanks, have a nice day!'.format(Vending_Machine.items[2]))
  
          elif choice == Vending_Machine.item_code[3]:
              print ("You have selected {} - the price is ${: .2f}. Currently you have a total of ${: .2f} in the machine." .format(Vending_Machine.items[3], Vending_Machine.item_price[3], self.total))
              if self.total &lt; Vending_Machine.item_price[3]: #if not the price of tea then.. 
                  insert_coin(input("Insert a coin into the vending machine: "))
              elif self.total &gt; Vending_Machine.item_price[3]:
                  self.total -= Vending_Machine.item_price[3]
                  print('Please take your {}. Total of {: .2f} in the machine' .format(Vending_Machine.items[3],self.total))
              elif self.total == Vending_Machine.item_price[3]:
                  self.total -= Vending_Machine.item_price[3]
                  print('Please take your {}. Thanks, have a nice day!'.format(Vending_Machine.items[3]))
  
              elif choice not in item_code:
                  print("Sorry we do not have item number {} available. Please try again" .format(choice))  
  
  
  vm = Vending_Machine()
  i1 = interface()
  u1 = user_input()
  
  i1.menu()
  u1.choice()
  </code></pre>