Dannyar608 commited on
Commit
64fb9b0
·
verified ·
1 Parent(s): bc2e94d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -62,18 +62,25 @@ learning_style_answers = [
62
  ["Remember faces", "Remember names or voices", "Remember what you wrote about them"]
63
  ]
64
 
 
 
 
65
  def learning_style_quiz(*answers):
66
  scores = {'visual': 0, 'auditory': 0, 'reading/writing': 0}
 
67
  for i, ans in enumerate(answers):
68
  if i < len(learning_style_answers):
69
  options = learning_style_answers[i]
70
  if ans in options:
71
- # Correctly map the index to the style
72
  index = options.index(ans)
73
  style = style_count_map[index]
74
  scores[style] += 1
75
- best = max(scores, key=scores.get)
76
- return best.capitalize()
 
 
 
 
77
 
78
  # PanoramaEd categories and multiple choice questions
79
  get_to_know_categories = {
 
62
  ["Remember faces", "Remember names or voices", "Remember what you wrote about them"]
63
  ]
64
 
65
+ # Map answer positions to learning styles
66
+ style_count_map = {0: "visual", 1: "auditory", 2: "reading/writing"}
67
+
68
  def learning_style_quiz(*answers):
69
  scores = {'visual': 0, 'auditory': 0, 'reading/writing': 0}
70
+
71
  for i, ans in enumerate(answers):
72
  if i < len(learning_style_answers):
73
  options = learning_style_answers[i]
74
  if ans in options:
 
75
  index = options.index(ans)
76
  style = style_count_map[index]
77
  scores[style] += 1
78
+
79
+ # Determine all learning styles that are tied for highest score
80
+ max_score = max(scores.values())
81
+ best_styles = [style.capitalize() for style, score in scores.items() if score == max_score]
82
+
83
+ return ", ".join(best_styles)
84
 
85
  # PanoramaEd categories and multiple choice questions
86
  get_to_know_categories = {