''List index out of range error for strip()

I keep getting list index out of range error for following code while using 'strip()'

    duration = list(dataset['Duration'])
duration_hrs = []
dur = []
for i in range(len(duration)):
    duration[i].split(sep='h')
    duration[i].strip('m')
    dur.append(dur[i])
dur

IndexError                                Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_2384/3886452692.py in <module>
      6     duration[i].split(sep='h')
      7     duration[i].strip('m')
----> 8     dur.append(dur[i])
      9 dur

IndexError: list index out of range


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source