Re-arrange the string

In this program, we will take a string as input and re-arrange the string.

Steps to solve the program
  1. Take a string as input.
  2. Convert the string into a list using Split().
  3. Arrange the string in the required manner.
  4. Convert the list into a string using join().
  5. Print the output.
				
					#Input string
string = "Cricket Plays Virat"

#Converting to a list
List = string.split(" ")
List.reverse()

#Printing output
" ".join(List)
				
			

Output :

				
					'Virat Plays Cricket'
				
			

repeat vowels 3 times and consonants 2 times.

get all the digits from the given string.

Leave a Comment