By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

A quick question

P: n/a
Hey everyone,

I just started using python and cant figure this out, I'm trying to
make a program where someone types in a word and the program gives it
back backwards. For example if the person puts in "cat" I want the
program to give it back as "tac" and what it does is prints out 3,2,1.
How can I get these integers to print as letters? This is what I have,

word = raw_input("Type a word:")
start = len(word)

for letter in range(start, 0, -1):
print letter
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On May 28, 11:25 am, "James" <cobro...@msn.comwrote:
word = raw_input("Type a word:")
start = len(word)

for letter in range(start, 0, -1):
print letter
Hi James,

for letter in reversed(word):
print letter

--
Paul Hankin
Jun 27 '08 #2

P: n/a
On May 28, 12:25*pm, "James" <cobro...@msn.comwrote:
Hey everyone,

I just started using python and cant figure this out, I'm trying to
make a program where someone types in a word and the program gives it
back backwards. *For example if the person puts in "cat" I want the
program to give it back as "tac" and what it does is prints out 3,2,1. *
How can I get these integers to print as letters? *This is what I have,

word = raw_input("Type a word:")
start = len(word)

for letter in range(start, 0, -1):
* * print letter *
word = raw_input("Type a word:")
print 'Reversed : %s' % word[::-1]
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.