0
Can someone please explain why the 1st output and how can I fix it?
I want the second output but I need to delete more times from the list, not just once. Can someone please explain why the 1st output and how can I fix it? # However this works if I want lower numbers (see below), which makes it even weirder https://code.sololearn.com/co2D3hwY5m7K/?ref=app
2 Answers
+ 1
You have to understand what the slice notation actually does.
I have linked the article treating the topic, so that you can study up.
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2453/?ref=app
nums[7500:] accesses all the numbers FROM 7500 to the end.
nums[:7500] accesses the numbers TO 7500, from the beginning.
Try to think through your code again like this, I'm sure you will understand the output better.
One more thing:
This forum is meant to become a 'library' for others as well. So it is actually required that you write a proper question with a proper headline and proper tags *here*!
+ 1
HonFu Thanks!