This question assesses your understanding of passing objects…

This question assesses your understanding of passing objects into functions and running a class method. What will be the output from the code below? Please pay close attention to the calculations.   class VideoGame:    def __init__(self, name, price):        self.name = name        self.price = price    def update_price(self, discount):        self.price = self.price * (1 – discount)def apply_discount(game, discount):    game.price = game.price – discountgame1 = VideoGame(“The Last Adventure”, 60)apply_discount(game1, 10)game1.update_price(0.5)print(game1.price)

This question evaluates your understanding of accessing an a…

This question evaluates your understanding of accessing an attribute of an object stored in a dictionary. class Movie:    def __init__(self, title, director, price):        self.title = title        self.director = director       self.price = pricemovie1 = Movie(“Inception”, “Christopher Nolan”, 12.99)movie2 = Movie(“To Kill a Mockingbird”, “Harper Lee”, 9.99)movie_catalog = {}movie_catalog[101] = movie1 movie_catalog[102] = movie2 Please write one line of code to access the director Harper Lee from the movie_catalog dictionary. 

Assuming that you have created the attributes for the Produc…

Assuming that you have created the attributes for the ProductClass mentioned in the previous question, which of the following methods would meet the criteria for updating/mutating the inventory of a product?  Criteria: The method should allow for a parameter capturing the number of items the user wishes to purchase. The method should update the inventory’s “_onHand” attribute mentioned in the previous question.  You don’t need to worry about negative inventory. If the customer orders more than we have on hand, we will place an order with our supplier and fill the order anyway. Which of the following meets the above criteria?

This question tests your understanding of passing objects as…

This question tests your understanding of passing objects as arguments into functions. Recall that when you create the movie_obj, the title is “Inception”. Your friend just called the following function. def update_title(movie, new_title):    movie.title = new_titlemovie_obj = Movie(“Inception”, “Christopher Nolan”, 2010)update_title(movie_obj, “Interstellar”)print(movie_obj.title)

Suppose you are building a program to manage a collection of…

Suppose you are building a program to manage a collection of movies in for Netflix. class Movie:    def __init__(self, title, director, year):        self.title = title        self.director = director        self.year = year Which one of the following will create an object from the Movie class? 

class Employee:    def __init__(self, name, employee_id):   …

class Employee:    def __init__(self, name, employee_id):        self.name = name        self.employee_id = employee_id # Example objectsawesome_employee = Employee(“Alice”, 101) Which line of code can you use to determine whether an object awesome_employee belongs to the class Employee?

class BoardGame:     def __initializer__(self, name, genre,…

class BoardGame:     def __initializer__(self, name, genre, playtime):        self.name = name        self.genre = genre        self.playtime = playtime     def __init__(self, name, genre, playtime):        self.name = name        self.genre = genre        self.playtime = playtime     def __str__(self):        return “BoardGame: ” + self.name + ” | Genre: ” + self.genre + ” | Playtime: ” + str(self.playtime) + ” minutes” Which method(s) is/are automatically executed when an object of a class is created in memory?