Saturday, June 19, 2021

Reverse a String Using a Function in Python

 Machine Problem in Python


1. Write a Python program to reverse a string

2. The user will input a word

3. Create a function that will reverse the string.

4. Display the original word, the reversed word in all caps and string count.

Sample Program Output

INPUT: Hello World

OUTPUT: DLROW OLLEH (11 characters)


I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360






Program Listing

reverse_string.py

def reverse_string(word):
return word[::-1]

string = input("Enter a string: ")
print(string)
print(reverse_string(string.upper()))
print("String count: ", len(string))



No comments:

Post a Comment