Computer Science, asked by shaileshmrj2001, 8 months ago

Write a simple python program to take input from the user and then print it's length and reverse using for loop and len function.

Answers

Answered by pmvjs299
1

Answer:

This program will take a string as an input and does the particulars mentioned on the question.

CODING:

string = input ( " Enter a string : " )

length = len( string )

print ( "Length of the string is : " , length)

reverse_string = ""

for i in range ( -1 , - (length - 1) ) :

       reverse_string += string[ i ]

print ( "The reverse of the string is : ", reverse_string)

OUTPUT:

Enter a string : Python

Length of the string is : 6

The reverse of the string is :  nohtyP^{}

Hope it helps !

Similar questions