
Asked in Cognizant
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
3mo
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)
Add answer anonymously...
Top Python Developer Interview Questions Asked at Cognizant
Q. What is the difference between a tuple and a list?
Q. Can you describe a problem that can be solved using recursion?
Q. Write a function to find the second highest number from a list without using bui...read more
Interview Questions Asked to Python Developer at Other Companies
Top Skill-Based Questions for Cognizant Python Developer
Python Interview Questions and Answers
400 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Algorithms Interview Questions and Answers
250 Questions
C++ Interview Questions and Answers
150 Questions
Django Interview Questions and Answers
20 Questions
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

