I think you're overthinking this:

First, reverse the list:

inverselist = k1[::-1]

Then, replace the first nonzero element:

for i, item in enumerate(inverselist):
    if item:
        inverselist[i] += 100
        break
Answer from Tim Pietzcker on Stack Overflow
🌐
Codecademy
codecademy.com › article › how-to-reverse-a-list-in-python
How to Reverse a List in Python | Codecademy
This approach is less commonly used but gives us full control over the reversal process. ... range(len(list_name) - 1, -1, -1): Iterates over the indices of the list in reverse order, starting from the last index and ending ...
Discussions

loops - Traverse a list in reverse order in Python - Stack Overflow
How do I traverse a list in reverse order in Python? So I can start from collection[len(collection)-1] and end in collection[0]. I also want to be able to access the loop index. More on stackoverflow.com
🌐 stackoverflow.com
Why does [::-1] reverse a list?
[Start:stop:step] if you're going in steps by negative one, you're going backwards More on reddit.com
🌐 r/learnpython
57
187
March 12, 2022
iterate over a string in reverse
https://docs.python.org/3/library/functions.html#reversed More on reddit.com
🌐 r/learnpython
7
1
February 7, 2023
Why is list.reverse() an O(n) operation?
Well, because it's an in-place operation on a list (not an array). Indexing tricks work great up until the next append operation or similar. There's the built-in reversed which gives you a reverse-order iterator (and as such is O(1), naturally). More on reddit.com
🌐 r/learnpython
12
8
April 7, 2022
🌐
Vertabelo
academy.vertabelo.com › blog › how-do-you-list-reverse-in-python
Vertabelo Academy Blog | How Do You List Reverse in Python?
March 3, 2020 - The syntax for slicing list elements using indexes is this: list[start:stop:step]. “Start” denotes the index of the first element that you want to retrieve · “Stop” denotes the index of the last element that you want to retrieve · ...
🌐
Programiz
programiz.com › python-programming › methods › list › reverse
Python List reverse()
Created with over a decade of experience and thousands of feedback. ... Try Programiz PRO! ... Become a certified Python programmer. Try Programiz PRO! ... The reverse() method reverses the elements of the list.
🌐
Real Python
realpython.com › python-reverse-list
Reverse Python Lists: Beyond .reverse() and reversed() – Real Python
June 28, 2023 - This diagram shows that you can access the first element of the list (or sequence) using either 0 or -5 with the indexing operator, like in sequence[0] and sequence[-5], respectively. You can use this Python feature to reverse the underlying sequence in place.
🌐
datagy
datagy.io › home › python posts › how to reverse a python list (6 ways)
How to Reverse a Python List (6 Ways) • datagy
February 15, 2023 - Moving over a list from end to the beginning is the same as reversing it. Let’s see how we can use Python’s list indexing to reverse a list: # Reverse a Python list with list indexing original_list = [1,2,3,4,5,6,7,8,9] reversed_list = original_list[::-1] print(reversed_list) # Returns: [9, 8, 7, 6, 5, 4, 3, 2, 1]
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python-reversing-list
Reversing a List in Python - GeeksforGeeks
We can use this method if we want to reverse the list in-place (without creating new list) using for loop. ... a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # Define the start and end indices start, end = 2, 6 # Reverse the elements from index 2 to 6 while start < end: # Swap elements at start and end a[start], a[end] = a[end], a[start] # Move the start index forward start += 1 # Move the end index backward end -= 1 print(a)
Published   October 15, 2024
🌐
Medium
geekpython.medium.com › 8-ways-to-reverse-the-elements-in-a-python-list-ad50889bdd7e
8 Ways To Reverse The Elements In A Python List | by Sachin Pal | Medium
November 25, 2022 - In the above Python program, a list is defined and then the variable index is defined that stores the list’s index value by taking the list’s length minus 1. Then created a list comprehension that accesses each index item of the list using the range function from the index to the end of the list in reverse order.
🌐
Tutorialspoint
tutorialspoint.com › python › python_reverse_a_list.htm
Python Reverse a List
The reverse() method in list class reverses the order of items in the list. The item in last index is relocated to 0th index, and one originally at index 0 goes to the last position.
🌐
freeCodeCamp
freecodecamp.org › news › python-reverse-list-reversing-an-array-in-python
Python Reverse List – Reversing an Array in Python
September 6, 2022 - That said, it is more of an intermediate to advanced feature and not that beginner friendly compared to the .reverse() method, which is more intuitive and self-descriptive. Let's go over a quick overview of how slicing works.
🌐
Finxter
blog.finxter.com › python-list-reverse
Python List reverse() – Be on the Right Side of Change
March 21, 2020 - Here’s how you’d use list comprehension to reverse a list: ... You go over all indices in negative order—starting with the last list index len(lst)-1 and ending in the first list index 0.
🌐
freeCodeCamp
freecodecamp.org › news › python-reverse-list-how-to-reverse-a-range-or-array
Python Reverse List – How to Reverse a Range or Array
November 22, 2021 - You see that the initial order of the list has now changed and the elements inside it have been reversed. The slicing operator works similarly to the range() function you saw earlier on. It also accepts the start, stop, step arguments. The syntax looks like this: start:end:step. ... In the example above, we wanted to fetch the items starting from index 1 up to, but not including, the item with index 3, incrementing one number at a time. Indexing in Python starts from 0, so the first element has an index of 0, the second element has an index of 1, and so on.
🌐
Mimo
mimo.org › glossary › python › list-reverse-method
Python List reverse() Method: Syntax, Methods, and Examples
From the in-place mutation of reverse() to elegant slicing and iterator-based reversal with reversed(), Python gives you the tools to reverse lists flexibly and efficiently. You also learned how to reverse a list using enumerate Python supports, which gives you low-level control over index logic.
🌐
dbader.org
dbader.org › blog › python-reverse-list
How to Reverse a List in Python – dbader.org
July 11, 2017 - Be sure to remember the wise words of master Yoda: With great power, great responsibility comes 🙂 · Reversing a list this way takes advantage of Python’s “slicing” syntax that can be used to do a number of interesting things. List slicing uses the “[]” indexing syntax with the following “[start:stop:step]” pattern:
🌐
Towards Data Science
towardsdatascience.com › home › latest › how to reverse python lists more efficiently
How To Reverse Python Lists More Efficiently | Towards Data Science
January 20, 2025 - We can reverse the list using slicing and a step size of 1. >>> my_lst_reversed = my_lst[::-1] >>> my_lst_reversed [80, 100, 40, 25, 30, 0, 10] ... It specifies a negative step size of 1, which means that the element are retrieved in the reversed order (from end to start) If you would like to understand more about slicing and indexing in Python...
🌐
Career Karma
careerkarma.com › blog › python › python reverse list: a step-by-step tutorial
Python Reverse List: A Step-by-Step Tutorial | Career Karma
December 1, 2023 - When working with a lot of data, it can be useful to declare a list instead of declaring multiple variables. While you don’t need to know about list slicing to perform a reverse list operation, it can be helpful. ... We have just declared a variable, studentNames, and assigned a list of values—in this case, the names of students—to the variable. If we want to get a particular value from our list, we can use its index ...
🌐
FavTutor
favtutor.com › blogs › reverse-list-python
Reverse Python List (9 Easy Ways) | FavTutor
March 30, 2022 - One more way to reverse the list in python is by using two built-in functions append() and pop(). This works by popping the last element from the original list and appending it to the new list.