5th Jan 2022, 6:20 PM
alagammai uma
alagammai uma - avatar
3 odpowiedzi
5th Jan 2022, 6:25 PM
FanYu
FanYu - avatar
+ 1
python We can try to convert the source code to python, like this: def PySlice_AdjustIndices(length, start, stop, step): assert step != 0 assert step >= -2**64 if (start < 0): start += length if (start < 0): start = (step < 0) and -1 or 0 elif (start >= length): start = (step < 0) and length - 1 or length if (stop < 0): stop += length if (stop < 0): stop = (step < 0) and -1 or 0 elif (stop >= length): stop = (step < 0) and length - 1 or length if (step < 0): if (stop < start): return (start - stop - 1) // (-step) + 1 else: if (start < stop): return (stop - start - 1) // step + 1 return 0 a = "Hello Everyone" print(PySlice_AdjustIndices(len(a), 0, -100, -1))
5th Jan 2022, 6:30 PM
FanYu
FanYu - avatar
0
𝓕𝓛𝓨 thank you
5th Jan 2022, 6:35 PM
alagammai uma
alagammai uma - avatar