User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 426,333 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,413 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums

Starting Python

Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,468
Reputation: vegaseat will become famous soon enough vegaseat will become famous soon enough 
Rep Power: 10
Solved Threads: 176
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Starting Python

  #43  
Jan 19th, 2006
Just a little thing about reverse spelling I picked up from the internet ...
  1. # reverse the spelling of an input string
  2. # string reverse slice [::-1] introduced in Python23
  3. # reversed() introduced in Python24
  4.  
  5. text = raw_input("Enter a string: ")
  6. print text[::-1]
  7.  
  8. # or
  9. print raw_input("Enter a string: ")[::-1]
  10.  
  11. # or
  12. print ''.join(reversed(raw_input("Enter a string: ")))
Last edited by vegaseat : Mar 1st, 2007 at 2:54 pm. Reason: [code=python] tag
May 'the Google' be with you!
Reply With Quote  
All times are GMT -4. The time now is 11:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC