Explain the logic of a program to reverse a given string word by word without using any built-in functions.

AnswerBot
1y
The logic of the program is to reverse a given string word by word without using any built-in function.
Split the string into an array of words using whitespace as the delimiter.
Iterate through the arr...read more
Sriram Sivagowtham
2mo
S="Tamil"
A= " "
For i in a:
A=i+s
Print (A)
Output:
limaT

favorableeucalyptus
9mo
currently not working
u can just use indexing....like for example if the given string is stored in variable named a="xyz" then u can do it like this:
print(a[::-1])
Anonymous
3mo
mentioned word by word for that also , we can use this slicing?
Anonymous
1y
Given a string, the task is to reverse the order of the words in the given string.
Pooja Ramesh Pawar
2y
s="madam"
s1=s[::-1]
print(s1)
Purnima Mohapatra
2y
str1=input()
print(str1[-1::-1]
Sukhveer Sagar
2y
s = "man"
rev = s[::-1]
print(rev)
Anonymous
2y
s="sriraj"
s1=s[-1]
print(s1)
bharathi p
2y
s="gowtham"
s1=s[::-1]
print(s1)
sai jyothirgamai
2y
s="gowtham"
s1=s[::-1]
print(s1)
Add answer anonymously...
Cognizant Python Developer interview questions & answers
A Python Developer was asked Q. What is the difference between a tuple and a list?
A Python Developer was asked Q. Can you describe a problem that can be solved using recursion?
A Python Developer was asked Q. Write a function to find the second highest number from a list without using bui...read more
Popular interview questions of Python Developer
A Python Developer was asked Q1. What is the difference between a tuple and a list?
A Python Developer was asked Q2. Can you describe a problem that can be solved using recursion?
A Python Developer was asked Q3. Why is Python used in real-world applications?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

