Welcome to the forums.
You can post code so it is readable using the markup describe here: About the Python Help category Without this care, readers have to guess at the indenting that defines loops and functions.
for i in nwA: puts successive elements of nwA into i, which isn’t what you want. Then (it looks like) you overwrite this with 1. But you want this to be an integer you use as an index, that runs from 1 to one less than the last index.
It would probably work to write:
for i in range(1, len(nwA)):
rampslope = abs(nwA[i + 1][“N”] - nwA[i][“N”])
total = total + rampslope
However, nwA is a dictionary, and this isn’t the best way to organise your information. It will fail, for example, if you miss one of the indices, because i+1 won’t be there. (E.g comment out line 5:... and watch it die when when i=4.)
A list seems a more natural structure here. (It will index from zero.) Like this:
nwA =[
{“E”: 315650, “N”: 425000, “RL”: 1625.50},
{“E”: 315475, “N”: 424925, “RL”: 1640.50},
...
{“E”: 314500, “N”: 424250, “RL”: 1760.50},
]
for i in range(len(nwA)-1):
...
It would also be simpler (and more efficient) to use tuples in the list, although it is less expressive. If you like having names, but want to avoid the strings and colons, the dataclass is a good thing to learn.