I’m currently undergoing Python Code Challenges(Optional). At the part of Python Code Challenges: Lists (Advanced), for Double Index (the 4th challenges), I think the provided solution code can go wrong if the parameter “index” was -1.
So, the provided solution code look like this:
Which the output would be [3, 8, -10, 24, 3, 8, -10, 12]
And, my code looks like this, which may seen longer but as I tested there was no bug:
Which the output would be: [3, 8, -10, 24]
Just want to share with you guys and wanna know if there is a cleaner code for this challenge.