Search This Blog

Thursday, 18 November 2021

program to pass a string to a function. Return and print reverse of it

 Write a program to pass a string to a function.return and print reverse of it

def reverse(n):
n1=""
for i in n:
n1=i+n1
print("Reverse ",n1)
def main():
n=input("Enter any string ")
reverse(n)
"""
if __name__=='__main__':
main()
"""
#or
#function calling
main()




Output:-
(1). Enter any string apple
Reverse elppa
(2). Enter any string bat
Reverse tab
(3). Enter any string computer
Reverse retupmoc

No comments:

Post a Comment

Sentiment Analyzer using NLP and Python - Practical Guide How to - Ai dev Surya

Unlocking Insights: NLP Project for Sentiment Analysis Natural Language Processing (NLP) is revolutionizing how computers understan...