Reputation: 1919
# Assign list "time" with the following time values.
time = [15, 27, 32, 36.5, 38.5, 40.5, 41.5, 42, 43.5, 45.5, 47.5, 52.5]
# Remove 1st value(0) from the list
time[0] = []
# Show time
time
[[], 27, 32, 36.5, 38.5, 40.5, 41.5, 42, 43.5, 45.5, 47.5, 52.5]
# Print time
print(time)
[[], 27, 32, 36.5, 38.5, 40.5, 41.5, 42, 43.5, 45.5, 47.5, 52.5]
I'm just following what the tutorial has taught me so far:
http://docs.python.org/py3k/tutorial/introduction.html#lists
Upvotes: 2
Views: 6271
Reputation: 39406
Actually, if you want to do as the example suggests, you'd be doing
time[0:1] = []
Upvotes: 1
Reputation: 172249
For completeness:
time.remove(15)
But in this case I'd use:
del time[0]
Upvotes: 4
Reputation: 3375
There are literally countless ways to do this.
I prefer time = time[1:]
Upvotes: 0