![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2006
Location: Germany
Posts: 2
Rep Power: 0
![]() |
picking random dictionariy entries
Hey guys
i am just doing my first (rather small) project: a vocabulary learning device. i just need a way to pick a random entry from a dictionary. thx for all help |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
The aptly named random.choice function should apply here:
import random key, value = random.choice(your_dictionary.items()) |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Apr 2006
Location: Germany
Posts: 2
Rep Power: 0
![]() |
thx
just read so myself... sry for bothering u guys... :-) |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|