Last active
December 20, 2015 07:29
-
-
Save myano/6093817 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
This file contains fake data which may be useful in | |
demonstrating basic principles in Python. | |
''' | |
import random | |
colors = [ | |
'red', | |
'orange', | |
'yellow', | |
'green', | |
'blue', | |
'purple', | |
'black', | |
'white' | |
] | |
ages = { | |
'alice': 26, | |
'bob': 29, | |
'charlie': 23, | |
'david': 37, | |
'edward': 47, | |
'frankie': 33, | |
'george': 42, | |
} | |
ranges = { | |
'height': (60, 80), | |
'weight': (150, 300), | |
} | |
## generate "random" profiles | |
''' | |
## declare a dictionary | |
profiles = dict() | |
for name in ages: | |
profiles[name] = dict() | |
for item in ranges: | |
profiles[name][item] = random.choice(range(ranges[item][0], | |
ranges[item][1])) | |
''' | |
profiles = { | |
'alice': { | |
'age': ages['alice'], | |
'height': 74, | |
'weight': 177 | |
}, | |
'bob': { | |
'age': ages['bob'], | |
'height': 68, | |
'weight': 208, | |
}, | |
'charlie': { | |
'age': ages['charlie'], | |
'height': 79, | |
'weight': 220, | |
}, | |
'david': { | |
'age': ages['david'], | |
'height': 82, | |
'weight': 160, | |
}, | |
'edward': { | |
'age': ages['edward'], | |
'height': 77, | |
'weight': 250, | |
}, | |
'frankie': { | |
'age': ages['frankie'], | |
'height': 80, | |
'weight': 195, | |
}, | |
'george': { | |
'age': ages['george'], | |
'height': 73, | |
'weight': 188, | |
}, | |
} | |
if __name__ == '__main__': | |
print __doc__.strip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment