Created
June 11, 2019 12:44
-
-
Save worldmind/cad3701ddb937bdce0168502e3bf460f to your computer and use it in GitHub Desktop.
Most science based 5 factor psychology test :)
This file contains 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
from math import ceil, floor | |
import numpy as np | |
LEVELS = 10 | |
CENTER = int(LEVELS/2) | |
FACTORS = [ | |
'Agreeableness', | |
'Conscientiousness', | |
'Extraversion', | |
'Emotional Stability', | |
'Openness to Experience', | |
] | |
def round_to_center(num): | |
if num < CENTER: | |
return floor(num) | |
return ceil(num) | |
def get_result(): | |
res = np.random.normal(CENTER, LEVELS/6) | |
res = round_to_center(res) | |
if res <= 0 or res > LEVELS: | |
res = CENTER | |
return res | |
def main(): | |
for factor in FACTORS: | |
res = get_result() | |
output = '-'*(res-1) + str(res) + '-'*(LEVELS-res) | |
print(f"{factor:24} {output}") | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment