I am issue understanding an output for the following code I wrote for a school assignment.
class Number:
def __init__(self):
self.__number = []
def pick_num(self, my_list):
x = random.choice(my_list)
self.__number = self.__number.append(x)
return print("Here's your list with the added number: ", self.__number)
def main()
random_number = Number()
my_list = [1, 2, 3, 4]
random_number.pick_num(my_list)
main()
output
Here's your list with the added number: None
I don't understand why I get None
instead of the desired output [n]