class dvd:      def __init__(self, title, director, producer, release_date, duration, dvd_id):          self.title = title        self.director = director        self.producer = producer        self.release_date = release_date        self.duration = duration        self.dvd_id = dvd_id      def get_title(self):          return self.title      def get_director(self):          return self.director      def get_producer(self):          return self.producer      def get_release_date(self):          return self.release_date      def get_duration(self):          return self.duration      def get_dvd_id(self):          return self.dvd_id     class customer:      def __init__(self, name, customer_id):          self.name = name        self.customer_id = customer_id      def get_name(self):          return self.name      def get_customer_id(self):          return self.customer_id     class store:      def __init__(self):          self.dvds = []        self.customers = []      def add_dvd(self, dvd):          self.dvds.append(dvd)      def add_customer(self, customer):          self.customers.append(customer)      def rent_dvd(self, dvd_id, customer_id):          for dvd in self.dvds:            if dvd.get_dvd_id() == dvd_id:                for customer in self.customers:                    if customer.get_customer_id() == customer_id:                        customer.dvds.append(dvd)                        self.dvds.remove(dvd)      def return_dvd(self, dvd_id, customer_id):          for customer in self.customers:            if customer.get_customer_id() == customer_id:                for dvd in customer.dvds:                    if dvd.get_dvd_id() == dvd_id:                        self.dvds.append(dvd)                        customer.dvds.remove(dvd)      def get_dvd(self, dvd_id):          for dvd in self.dvds:            if dvd.get_dvd_id() == dvd_id:                return dvd      def get_customer(self, customer_id):          for customer in self.customers:            if customer.get_customer_id() == customer_id:                return customer      def get_dvds(self):          return self.dvds      def get_customers(self):          return self.customers      def get_dvds_for_customer(self, customer_id):          for customer in self.customers:            if customer.get_customer_id() == customer_id:                return customer.dvds     # main   store = store()   dvd1 = dvd("The Godfather", "Francis Ford Coppola", "Albert S. Ruddy", 1972, 175, 1) dvd2 = dvd("The Shawshank Redemption", "Frank Darabont", "Niki Marvin", 1994, 142, 2) dvd3 = dvd("Pulp Fiction", "Quentin Tarantino", "Lawrence Bender", 1994, 154, 3)   store.add_dvd(dvd1) store.add_dvd(dvd2) store.add_dvd(dvd3)   customer1 = customer("John Smith", 1) customer2 = customer("Mary Johnson", 2) customer3 = customer("Mike Williams", 3)   store.add_customer(customer1) store.add_customer(customer2) store.add_customer(customer3)   store.rent_dvd(1, 1) store.rent_dvd(2, 1) store.rent_dvd(3, 2) store.rent_dvd(3, 3) store.return_dvd(2, 1)   print(store.get_dvd(1)) print(store.get_dvd(2)) print(store.get_dvd(3))   print(store.get_customer(1)) print(store.get_customer(2)) print(store.get_customer(3))   print(store.get_dvds()) print(store.get_customers()) print(store.get_dvds_for_customer(1)) print(store.get_dvds_for_customer(2)) print(store.get_dvds_for_customer(3))   Attribute Error: 'customer' object has no attribute 'dvds' Eliminate This Attribute Error.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

class dvd:
 

   def __init__(self, title, director, producer, release_date, duration, dvd_id):

 

       self.title = title

       self.director = director

       self.producer = producer

       self.release_date = release_date

       self.duration = duration

       self.dvd_id = dvd_id

 

   def get_title(self):

 

       return self.title

 

   def get_director(self):

 

       return self.director

 

   def get_producer(self):

 

       return self.producer

 

   def get_release_date(self):

 

       return self.release_date

 

   def get_duration(self):

 

       return self.duration

 

   def get_dvd_id(self):

 

       return self.dvd_id

 

 

class customer:

 

   def __init__(self, name, customer_id):

 

       self.name = name

       self.customer_id = customer_id

 

   def get_name(self):

 

       return self.name

 

   def get_customer_id(self):

 

       return self.customer_id

 

 

class store:

 

   def __init__(self):

 

       self.dvds = []

       self.customers = []

 

   def add_dvd(self, dvd):

 

       self.dvds.append(dvd)

 

   def add_customer(self, customer):

 

       self.customers.append(customer)

 

   def rent_dvd(self, dvd_id, customer_id):

 

       for dvd in self.dvds:

           if dvd.get_dvd_id() == dvd_id:

               for customer in self.customers:

                   if customer.get_customer_id() == customer_id:

                       customer.dvds.append(dvd)

                       self.dvds.remove(dvd)

 

   def return_dvd(self, dvd_id, customer_id):

 

       for customer in self.customers:

           if customer.get_customer_id() == customer_id:

               for dvd in customer.dvds:

                   if dvd.get_dvd_id() == dvd_id:

                       self.dvds.append(dvd)

                       customer.dvds.remove(dvd)

 

   def get_dvd(self, dvd_id):

 

       for dvd in self.dvds:

           if dvd.get_dvd_id() == dvd_id:

               return dvd

 

   def get_customer(self, customer_id):

 

       for customer in self.customers:

           if customer.get_customer_id() == customer_id:

               return customer

 

   def get_dvds(self):

 

       return self.dvds

 

   def get_customers(self):

 

       return self.customers

 

   def get_dvds_for_customer(self, customer_id):

 

       for customer in self.customers:

           if customer.get_customer_id() == customer_id:

               return customer.dvds

 

 

# main

 

store = store()

 

dvd1 = dvd("The Godfather", "Francis Ford Coppola", "Albert S. Ruddy", 1972, 175, 1)

dvd2 = dvd("The Shawshank Redemption", "Frank Darabont", "Niki Marvin", 1994, 142, 2)

dvd3 = dvd("Pulp Fiction", "Quentin Tarantino", "Lawrence Bender", 1994, 154, 3)

 

store.add_dvd(dvd1)

store.add_dvd(dvd2)

store.add_dvd(dvd3)

 

customer1 = customer("John Smith", 1)

customer2 = customer("Mary Johnson", 2)

customer3 = customer("Mike Williams", 3)

 

store.add_customer(customer1)

store.add_customer(customer2)

store.add_customer(customer3)

 

store.rent_dvd(1, 1)

store.rent_dvd(2, 1)

store.rent_dvd(3, 2)

store.rent_dvd(3, 3)

store.return_dvd(2, 1)

 

print(store.get_dvd(1))

print(store.get_dvd(2))

print(store.get_dvd(3))

 

print(store.get_customer(1))

print(store.get_customer(2))

print(store.get_customer(3))

 

print(store.get_dvds())

print(store.get_customers())

print(store.get_dvds_for_customer(1))

print(store.get_dvds_for_customer(2))

print(store.get_dvds_for_customer(3))

 

Attribute Error: 'customer' object has no attribute 'dvds'

Eliminate This Attribute Error.

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY