I have a Game class which creates an object of games. I want to create a function that deletes an object when a user inputs a name of a game. I created a function that I thought it will do what I want to do but it doesn't. Please tell me what is wrong.
class Game:
def __init__(self, game_title, publisher, num_of_sales):
self._chart_position = 4
self._game_title = game_title
self._publisher = publisher
self._num_of_sales = num_of_sales
def set_game_title(self, game_title):
self._game_title = game_title
def set_chart_position(self, chart_position):
self._chart_position = chart_position
def set_num_of_sales(self, num_of_sales):
self._num_of_sales = num_of_sales
def get_game_details(self):
if self._chart_position <= 5:
return self._chart_position, self._game_title, self._publisher, self._num_of_sales
def game_del(game):
del game
cup = Game("cupfight", "A", 13)
game_del(cup)