-3

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.

Student
  • 5
  • 2
  • Does this answer your question? [How to split a string into a list?](https://stackoverflow.com/questions/743806/how-to-split-a-string-into-a-list) – MatBBastos Sep 14 '21 at 15:10

2 Answers2

0

A ugly way is using

original_string = "abcde"
output = ""

for c in original_string:
    ouput = c + output
   
tomas
  • 36
  • 2
0

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

More on split()

More on reversed() and [::-1]