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 429,994 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,392 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: Aug 2005
Posts: 1,142
Reputation: Ene Uran is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 66
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Veteran Poster

Re: Starting Python

  #140  
Jul 1st, 2008
One of the features of Python3 will be that the division operator / will give a float result ( // is used for integer divisions as usual ). You can use this feature now by importing the __future__ module. Test it out with this example:
  1. # access Python3 features like / for float division
  2.  
  3. from __future__ import division
  4.  
  5. print "Enter a math statement like 355/113 or (2+3)/2 ..."
  6. while True:
  7. result = input("Statement: ")
  8. print result
  9. if raw_input("Continue? (y, n)").lower() == 'n': break
Last edited by Ene Uran : Jul 1st, 2008 at 8:57 am.
drink her pretty
Reply With Quote  
All times are GMT -4. The time now is 12:47 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC