Final_project / app.py
Dannyar608's picture
Update app.py
1d7de1f verified
raw
history blame
7.32 kB
# ========== LEARNING STYLE QUIZ ==========
learning_style_questions = [
"When you study for a test, you prefer to:",
"When you need directions to a new place, you prefer:",
"When you learn a new skill, you prefer to:",
"When you're trying to concentrate, you:",
"When you meet new people, you remember them by:",
"When you're assembling furniture or a gadget, you:",
"When choosing a restaurant, you rely most on:",
"When you're in a waiting room, you typically:",
"When giving someone instructions, you tend to:",
"When you're trying to recall information, you:",
"When you're at a museum or exhibit, you:",
"When you're learning a new language, you prefer:",
"When you're taking notes in class, you:",
"When you're explaining something complex, you:",
"When you're at a party, you enjoy:",
"When you're trying to remember a phone number, you:",
"When you're relaxing, you prefer to:",
"When you're learning to use new software, you:",
"When you're giving a presentation, you rely on:",
"When you're solving a difficult problem, you:"
]
learning_style_options = [
["Read the textbook (Reading/Writing)", "Listen to lectures (Auditory)", "Use diagrams/charts (Visual)", "Practice problems (Kinesthetic)"],
["Look at a map (Visual)", "Have someone tell you (Auditory)", "Write down directions (Reading/Writing)", "Try walking/driving there (Kinesthetic)"],
["Read instructions (Reading/Writing)", "Have someone show you (Visual)", "Listen to explanations (Auditory)", "Try it yourself (Kinesthetic)"],
["Need quiet (Reading/Writing)", "Need background noise (Auditory)", "Need to move around (Kinesthetic)", "Need visual stimulation (Visual)"],
["Their face (Visual)", "Their name (Auditory)", "What you talked about (Reading/Writing)", "What you did together (Kinesthetic)"],
["Read the instructions carefully (Reading/Writing)", "Look at the diagrams (Visual)", "Ask someone to explain (Auditory)", "Start putting pieces together (Kinesthetic)"],
["Online photos of the food (Visual)", "Recommendations from friends (Auditory)", "Reading the menu online (Reading/Writing)", "Remembering how it felt to eat there (Kinesthetic)"],
["Read magazines (Reading/Writing)", "Listen to music (Auditory)", "Watch TV (Visual)", "Fidget or move around (Kinesthetic)"],
["Write them down (Reading/Writing)", "Explain verbally (Auditory)", "Demonstrate (Visual)", "Guide them physically (Kinesthetic)"],
["See written words in your mind (Visual)", "Hear the information in your head (Auditory)", "Write it down to remember (Reading/Writing)", "Associate it with physical actions (Kinesthetic)"],
["Read all the descriptions (Reading/Writing)", "Listen to audio guides (Auditory)", "Look at the displays (Visual)", "Touch interactive exhibits (Kinesthetic)"],
["Study grammar rules (Reading/Writing)", "Listen to native speakers (Auditory)", "Use flashcards with images (Visual)", "Practice conversations (Kinesthetic)"],
["Write detailed paragraphs (Reading/Writing)", "Record the lecture (Auditory)", "Draw diagrams and charts (Visual)", "Doodle while listening (Kinesthetic)"],
["Write detailed steps (Reading/Writing)", "Explain verbally with examples (Auditory)", "Draw diagrams (Visual)", "Use physical objects to demonstrate (Kinesthetic)"],
["Conversations with people (Auditory)", "Watching others or the environment (Visual)", "Writing notes or texting (Reading/Writing)", "Dancing or physical activities (Kinesthetic)"],
["See the numbers in your head (Visual)", "Say them aloud (Auditory)", "Write them down (Reading/Writing)", "Dial them on a keypad (Kinesthetic)"],
["Read a book (Reading/Writing)", "Listen to music (Auditory)", "Watch TV/movies (Visual)", "Do something physical (Kinesthetic)"],
["Read the manual (Reading/Writing)", "Ask someone to show you (Visual)", "Call tech support (Auditory)", "Experiment with the software (Kinesthetic)"],
["Detailed notes (Reading/Writing)", "Verbal explanations (Auditory)", "Visual slides (Visual)", "Physical demonstrations (Kinesthetic)"],
["Write out possible solutions (Reading/Writing)", "Talk through it with someone (Auditory)", "Draw diagrams (Visual)", "Build a model or prototype (Kinesthetic)"]
]
def learning_style_quiz(*answers):
scores = {
"Visual": 0,
"Auditory": 0,
"Reading/Writing": 0,
"Kinesthetic": 0
}
for i, answer in enumerate(answers):
if answer == learning_style_options[i][0]:
scores["Reading/Writing"] += 1
elif answer == learning_style_options[i][1]:
scores["Auditory"] += 1
elif answer == learning_style_options[i][2]:
scores["Visual"] += 1
elif answer == learning_style_options[i][3]:
scores["Kinesthetic"] += 1
max_score = max(scores.values())
total_questions = len(learning_style_questions)
# Calculate percentages
percentages = {style: (score/total_questions)*100 for style, score in scores.items()}
# Sort styles by score (descending)
sorted_styles = sorted(scores.items(), key=lambda x: x[1], reverse=True)
# Prepare detailed results
result = "Your Learning Style Results:\n\n"
for style, score in sorted_styles:
result += f"{style}: {score}/{total_questions} ({percentages[style]:.1f}%)\n"
result += "\n"
# Determine primary and secondary styles
primary_styles = [style for style, score in scores.items() if score == max_score]
if len(primary_styles) == 1:
result += f"Your primary learning style is: {primary_styles[0]}\n\n"
# Add personalized tips based on primary style
if primary_styles[0] == "Visual":
result += "Tips for Visual Learners:\n"
result += "- Use color coding in your notes\n"
result += "- Create mind maps and diagrams\n"
result += "- Watch educational videos\n"
result += "- Use flashcards with images\n"
elif primary_styles[0] == "Auditory":
result += "Tips for Auditory Learners:\n"
result += "- Record lectures and listen to them\n"
result += "- Participate in study groups\n"
result += "- Explain concepts out loud to yourself\n"
result += "- Use rhymes or songs to remember information\n"
elif primary_styles[0] == "Reading/Writing":
result += "Tips for Reading/Writing Learners:\n"
result += "- Write detailed notes\n"
result += "- Create summaries in your own words\n"
result += "- Read textbooks and articles\n"
result += "- Make lists to organize information\n"
else: # Kinesthetic
result += "Tips for Kinesthetic Learners:\n"
result += "- Use hands-on activities\n"
result += "- Take frequent movement breaks\n"
result += "- Create physical models\n"
result += "- Associate information with physical actions\n"
else:
result += f"You have multiple strong learning styles: {', '.join(primary_styles)}\n\n"
result += "You may benefit from combining different learning approaches.\n"
return result