I am not completely green to Python, but I am interested in learning/keeping good practices while I develop my skills.
I want to remove the high and low values from a list of numbers, which I know how to do, but am curious if there is a better/preferred way to do this.
mylist = [1, 4, 0, 3, 2]
mylist.sort() #[0, 1, 2, 3, 4]
trimmed = mylist[1:-1] #[1, 2, 3]
I get the desired answer, but did I get the right answer appropriately?
mylist
to remain and have the trimmed version intrimmed
, you should copy it first. – Suspension