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)

Select
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?
Cognizant Python Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits