0
I have to print reverse of text without knowing the length of text in python
5 Réponses
+ 4
Mention languages Please in which Programming languages u want.
mention languages in relevant tag
+ 3
Python options
text = 'jtskys yskysky dky'
print(text[::-1])
or
print(input()[::-1])
+ 2
Jyoti
Please mention the language you want it to implement.
In JavaScript:
--------------
// Taking user input
let inputText = prompt("Enter a string to reverse");
//Splitting it into an array
let inputArr = inputText.split('');
//Reversing the array
let inputArrRevered = inputArr.reverse();
//Joining the array elements to a string
let inputTextReversed = input ArrReversed.join('');
-------------
I have made a code example:
https://code.sololearn.com/WTF1fgf07cXw/?ref=app
+ 1
#Overprogramming!
x=input(type the word: ")
def reversing(word):
z=list(word)
z.reverse()
new_word="".join(z)
return(new_word)
print(reversing(x))
+ 1
You can use len (str)