Wednesday, December 29, 2021

Reverse a String in Python in Linux

 A program that will ask the user to give a string and then the program will display the original string and the reverse string using Python programming language.

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 in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.







Program Listing

# reverse_string.py
# Reverse a String in Python in Linux
# Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.com and www.jakerpomperada.blogspot.com
# Globe Number : 09173084360
# Bacolod City, Negros Occidental Philippines.
# Version of Python : Python 2.0

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

print("\n")
print("\tReverse a String in Python in Linux")
print("\n")

string_val = raw_input("\tGive a String : ")
# In Python 3 use input instead of raw_input

# Reverse a String here

reverse_str = reverse_string(string_val)
  
# printing of results
print("\n")
print("\tOriginal String : {0} " .format(string_val))
print("\n")
print("\tReverse String  : {0} " .format(reverse_str))

print("\n")
print("\tEnd of Program")
print("\n")


No comments:

Post a Comment