title: Shopping Cart and item class in python, issue with accessing objects from one class and using them in another
body: <p>Attempting to create a program in python 3 that takes object(s) created from one class <code>item</code> to another, <code>shoppingCart</code>. The idea is to create a list of objects created by the <code>item</code> class using the <code>shoppingCart</code>class, while still being able to access attributes of the <code>item</code> class such as price and quantity.</p>
  
  <pre><code>class item:
      def __init__(self,n,p,q):
          self.name = n
          self.price = p
          self.quantity = q
      def show(self):
          z = (str(self.name))
          print(z)
          self1 =("$")+(str(self.price))
          print(self1)
      def getName(self):
          return self.name
      def getPrice(self):
          return ("$") + str(self.price)
      def getQuantity(self):
          return self.quantity
  
  class shoppingCart:
      def __init__(self, items):
          self.items = []
      def show(self):
          print(self.items)
      def addItem(self,item):
          if item not in self.items:
              self.items.append(item)
          else:
              item.q += 1
      def deleteItem(self,item):
          if item in self.items:
              self.items.remove(item)
          else:
              return print("Not in Cart")
      def checkOut (self):
          total = 0
          for i in self.items:
              price = i[1]
              total += price
          return total
  item1 = item("Chocolate",5 ,3)
  item2 = item("Bacon",15,1)
  item3 =  item("Eggs",2,5)
  c = shoppingCart([])
  c.addItem(item1)
  c.addItem(item2)
  c.addItem(item3)
  c.show()
  print ("You have 3 items in your cart for a total of" (c.checkOut()))
  c.removeItem(item3)
  print ("You have 2 items in your cart for a total of" (c.checkOut()))
  </code></pre>
  
  <p>The above code currently creates two errors, firstly, the c.show is printing the IDs of the objects appended to the shopping cart. In addition, the <code>checkOut</code> method creates an error regarding <code>price = i[1]</code> saying that the <code>item</code> object does not support indexing. Alternate solutions to this problem that still bares some resemblance to my original code will be welcome!</p>