The following code will get a list as input, and it will use the split method to split the input list with a space.
student_heights = input("Input a list of student heights ").split()
for n in range(0, len(student_heights)):
student_heights[n] = int(student_heights[n])
If I wanted to split with comma, I will just ad a comma on the split()
method above and that would be split(", ")
My question is, what if I want it separated both with a space and with , at the same time depending on the user so the user can input the list comma separated or non comma separated. I tried and/or but no luck so far.