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,485 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,212 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: Jul 2005
Location: France
Posts: 1,005
Reputation: bumsfeld is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 45
bumsfeld's Avatar
bumsfeld bumsfeld is offline Offline
Veteran Poster

Re: Starting Python

  #131  
Apr 17th, 2008
Get your lotto numbers here, simple with Python:
  1. # select 6 unique lotto numbers from 1 - 49
  2.  
  3. import random
  4.  
  5. lotto_list = random.sample(range(1, 50), 6)
  6.  
  7. print lotto_list
  8. print sorted(lotto_list)
  9.  
  10. """
  11. possible result --->
  12. [49, 43, 8, 42, 1, 33]
  13. [1, 8, 33, 42, 43, 49]
  14. """
Should you find Irony, you can keep her!
Reply With Quote  
All times are GMT -4. The time now is 4:42 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC