Imagine you are given a string that represents a sentence or a phrase. Create a program that scans a string as single line input. Your program should print the word count in that string and the reversed string separated by a newline.
Working with strings: basic methods
Counting words and reversing a string
Report a typo
Sample Input 1:
Hello WorldSample Output 1:
2
World HelloSample Input 2:
Python is funSample Output 2:
3
fun is PythonWrite a program in Python 3.10
# We need to create a function that accepts a string as argument
def process_string(s):
# YOUR CODE HERE
# The next line is for invoking the function and you can replace 'your_string_here' with your actual string
process_string('your_string_here')
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.