I have a task for split any string value without using reversed() and [::-1].
using [::-1] is too much easy but there is a task to get output without using it.
I have a task for split any string value without using reversed() and [::-1].
using [::-1] is too much easy but there is a task to get output without using it.
A ugly way is using
original_string = "abcde"
output = ""
for c in original_string:
ouput = c + output
split() is a method {you can call it as a function but methods are mapped using dot.}
>>>'Hello'.split()
...['H', 'e', 'l', 'l', 'o']
>>>list(reversed(list(reversed ('Hello'))))
...['H', 'e', 'l', 'l', 'o']
>>>'Hello'[::-1]
...olleH