I'm trying to work on a program that allows users to add numbers to an array and then perform mathematical operations on the arrays via NumPy but I'm having trouble working out how users can add numbers to the list.
I have a code that is a variation of the following:
list = np.array[(1, 2, 3)]
list = np.append(int(input("Please add a number to the list:")))
print(list)
And I want the user to able to input "4" and have it show up at the end of the array like: [1, 2, 3, 4].
Never used NumPy before so I'm unsure as to how a lot of it works. Is there an alternative method I should be using?
np.append? Or did you just assume it behaves just like list append? Either way, I discourage its use. List append is better - safer and faster.