0

Hopefully this makes sense. Details in the title. Let me know if more details are needed.

Code:

userinput = input("Line: ")
userlen = len(userinput)
output = userinput
count = 0

print(userinput[-0])

while count != userlen:
  count2 = count - (count + 1)
  output[count] = userinput[count2]
  count = count + 1

print(output)

2 Answers2

0

You can do:

>>> "test word"[::-1]
'drow tset'

This uses extended slices.

izhang05
  • 744
  • 2
  • 11
  • 26
0

You could try it like this :

userinput = input("line: ")
userlen = len(userinput)
output = []
for index in range (userlen -1, -1, -1) :
    output.append (userinput [index])
print(''.join (output))
bashBedlam
  • 1,402
  • 1
  • 7
  • 11