I am trying to return and then print the string version of values in a list, but it keeps printing only the Memory Address instead of the String itself.
To solve this issue I figured defining it as a string would be pretty straightforward, but I continue to have issues even after adding it. My code is below, any help would be appreciated!
class Statistic:
def __init__(self, stat_name, stat_value, team_name):
self.stat_name = stat_name
self.stat_value = stat_value
self.team_name = team_name
def __str__(self):
return Statistic(self.stat_name + ": " +self.stat_value + " - " + self.team_name)
run_stat_list = []
i = 0
while (i < 20):
run_stat = Statistic("Runs", runvalueslist[i], runvalueslist[i + 1])
run_stat_list.append(run_stat)
i = i + 2
print(run_stat_list)