Skip to content

Instantly share code, notes, and snippets.

@FrenzyExists
Created February 26, 2024 07:09
Show Gist options
  • Save FrenzyExists/b799e18b066a4d3b45e96cd197124234 to your computer and use it in GitHub Desktop.
Save FrenzyExists/b799e18b066a4d3b45e96cd197124234 to your computer and use it in GitHub Desktop.
Personality Test Example
from time import sleep
import sys
QuestionBank = [
{
"question": "I prefer working independently rather than in a team.",
"pointer": ["INDEPENDENT", "TEAM_PLAYER"]
},
{
"question": "I am comfortable taking risks to achieve my career \
goals.",
"pointer": ["RISK_TAKER", "RISK_AVERSE"]
},
{
"question": "I enjoy taking on new challenges even if they are \
outside of my comfort zone.",
"pointer": ["CHALLENGES", "COMFORT_ZONE"]
},
{
"question": "I am motivated to constantly improve my skills and \
knowledge.",
"pointer": ["SELF_IMPROVEMENT", "COMPLACENCY"]
},
{
"question": "I enjoy taking the lead and making decisions in a \
group setting.",
"pointer": ["LEADERSHIP", "FOLLOWER"]
},
{
"question": "I prefer a stable and predictable work environment.",
"pointer": ["STABILITY", "CHANGE_AGENT"]
},
{
"question": "I feel energized when working on long-term projects \
with big goals.",
"pointer": ["LONG_TERM", "SHORT_TERM"]
},
{
"question": "I am good at adapting to new situations and changes.",
"pointer": ["ADAPTABILITY", "ROUTINE"]
},
{
"question": "I enjoy networking and meeting new people in \
professional settings.",
"pointer": ["NETWORKING", "INTROVERT"]
},
{
"question": "I value work-life balance and prioritize my \
personal life.",
"pointer": ["WORK_LIFE_BALANCE", "WORKAHOLIC"]
},
{
"question": "I am drawn to careers that allow for creativity \
and innovation.",
"pointer": ["CREATIVITY", "ROUTINE"]
},
{
"question": "I believe that continuous learning and growth \
are essential in a career.",
"pointer": ["CONTINUOUS_LEARNING", "SETTLING"]
},
{
"question": "I am comfortable with public speaking and giving \
presentations.",
"pointer": ["PUBLIC_SPEAKING", "AVOID_PUBLIC"]
},
{
"question": "I prefer a job that offers a high level of autonomy \
and decision-making.",
"pointer": ["AUTONOMY", "MICROMANAGED"]
},
{
"question": "I enjoy problem-solving and finding innovative \
solutions.",
"pointer": ["PROBLEM_SOLVING", "AVOID_PROBLEMS"]
},
{
"question": "I am comfortable with taking on leadership roles \
and responsibilities.",
"pointer": ["LEADERSHIP_ROLES", "FOLLOWER"]
},
{
"question": "I thrive in fast-paced and dynamic work environments.",
"pointer": ["FAST_PACED", "SLOW_PACED"]
},
{
"question": "I am motivated by achieving results and meeting goals.",
"pointer": ["RESULTS_DRIVEN", "PROCESS_DRIVEN"]
},
{
"question": "I enjoy analyzing data and using it to make \
informed decisions.",
"pointer": ["ANALYTICAL", "INTUITIVE"]
},
{
"question": "I am comfortable with multitasking and handling \
multiple responsibilities.",
"pointer": ["MULTITASKING", "FOCUS"]
}
]
Category = {
# The lists are cats more in specifics
# Not sure how I can categorize this with the question bank
"ENG": ["ICOM", "INSO", "INEL", "INME"],
"ADEM": ["CFA", "CFM"],
"A&C": ["BIOL", "QUIM"]
}
def generate_output(data) -> None:
for item in data:
left: str = item["left"]
right: str = item["right"]
ans: int = item["ans"]
a = ["🔴"] * 5
a[ans - 1] = "🌟"
print(f"{left.ljust(18)} { ' '.join(a)} {right}")
def main():
print("""
Welcome to the Material Advantage Personality Questionnaire!
We will go over some questions to see what kind of person you are
and the careers that best suit you.
""")
how_to_ans = """
1 => Strongly Disagree
2 => Disagree
3 => Neutral
4 => Agree
5 => Strongly Agree
"""
responses = []
print("Answer carefully")
for question in QuestionBank:
while True:
try:
print(question["question"])
a = int(input(how_to_ans + "\nYour answer: "))
if not isinstance(a, int) or a < 1 or a > 5:
assert ValueError
else:
responses.append({
"left": question["pointer"][0],
"right": question["pointer"][1],
"ans": a
})
break
except ValueError:
print("Can't understand this answer of yours, try again")
print("Good! Next question")
print("""
Congrats on completing the questionaire! Give us a few moments while we \
go over your answers...
""")
animation = "|/-\\"
for i in range(32):
sleep(0.1)
sys.stdout.write(f"\rLoading... {animation[i % len(animation)]}")
sys.stdout.flush()
print("")
generate_output(responses)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment