title: AttributeError: 'list' object has no attribute 'drug_name' (class attribute)
body: <pre><code>class Prescription:
      def __init__(self, patient, drug_name, quantity):
          self.patient = patient
          self.drug_name = drug_name
          self.quantity = quantity
  
      def __repr__(self):
          return 'Prescription(\'' + self.patient + '\', \'' + self.drug_name + 
          '\', ' + \
          str(self.quantity) + ')'
  </code></pre>
  
  <p>And in a separate file I have: </p>
  
  <pre><code>from lab10_classes import Pharmacy, Prescription
  
  
  def batch_dispense(pharmacy, prescriptions):
      total_cost = 0
      if len(prescriptions) == 0:
          return 0
      for i in prescriptions:
          name = i.drug_name
          if name not in pharmacy.inventory:
              continue
          elif name in pharmacy.inventory:
              if pharmacy.inventory[name] &gt; i.quantity:
                  pharmacy.inventory[name] = pharmacy.inventory[name] - 
                  prescriptions.quantity
                  total_cost += pharmacy.unit_prices * prescriptions.quantity
      return total_cost and pharmacy
  
  
  Print([Prescription('Mack', 'Zocor', -27), Prescription('Rachael', 'Crestor', 
        474), Prescription('Janet', 'Adderall', 60)])
  </code></pre>
  
  <p>In the current lab I'm working on, one of my function parameter is called 'prescriptions' and it takes a list of Prescription objects such as the print statement above. However, I keep getting: </p>
  
  <blockquote>
    <p>AttributeError: 'list' object has no attribute 'drug_name'</p>
  </blockquote>
  
  <p>Theoretically, my prescriptions parameter should be valid since it has a list of instance class objects for the Prescriptions class. </p>