Jan-27-2020, 11:01 PM
Currently:
For ex:
a = "abcde" print("b[::-1] : ", b[::-1]) print("b[5:0:-1] : ", b[5:0:-1])Output:
Output:>>> b[::-1] : edcba
>>> b[5:0:-1] : edcb
Can a custom function be defined that avoids duplicity in typing?For ex:
def fuc(a) print(a, ":", a) # change here fuc(b[::-1]) fuc(b[5:0:-1])Output:
Output:>>> b[::-1] : edcba
>>> b[5:0:-1] : edcb