SyntaxFix
Write A Post
Hire A Developer
Questions
>>> import random >>> d = dict(Venezuela = 1, Spain = 2, USA = 3, Italy = 4) >>> random.choice(d.keys()) 'Venezuela' >>> random.choice(d.keys()) 'USA'
By calling random.choice on the keys of the dictionary (the countries).
keys