Tell me the logic of program to reverse a given string word by word without using any built in function.
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
Anonymous
4mo
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
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...
Top Cognizant Python Developer interview questions & answers
Popular interview questions of Python Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app