Computer Science
Write a program to input a line of text and create a new line of text where each word of input line is reversed.
Python
Python String Manipulation
17 Likes
Answer
str = input("Enter a string: ")
words = str.split()
newStr = ""
for w in words :
rw = ""
for ch in w :
rw = ch + rw
newStr += rw + " "
print(newStr)
Output
Enter a string: Python is Fun
nohtyP si nuF
Answered By
5 Likes
Related Questions
Write a program to input a line of text and print the biggest word (length wise) from it.
Write a program to input a formula with some brackets and checks, and prints out if the formula has the same number of opening and closing parentheses.
Write a program that asks the user for a string (only single space between words) and returns an estimate of how many words are in the string. (Hint. Count number of spaces)
Write a program that inputs a line of text and prints out the count of vowels in it.