Jul-07-2021, 10:58 AM
I find this the most elegant way to process the list:
the_list = [1,2,3,4] for i in the_list[0:-1]: print(f"Processing {i}") print(f"Post processing {the_list[-1]}")
Output:Processing 1
Processing 2
Processing 3
Post processing 4