casv commited on
Commit
44f5b68
·
verified ·
1 Parent(s): 7c1cbb9

The dashboards are not space efficient, also auto save progress and repeat the mistakes ones with the tags along with the mistake count and users thinking process analysis to align with the proper logical thinking required. - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +265 -5
index.html CHANGED
@@ -6,6 +6,75 @@
6
  <title>Python Quiz Generator</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  <script>
10
  tailwind.config = {
11
  theme: {
@@ -111,6 +180,17 @@
111
  <p class="text-xl text-gray-300">Test your Python knowledge with interactive challenges!</p>
112
  </header>
113
 
 
 
 
 
 
 
 
 
 
 
 
114
  <!-- Quiz Controls -->
115
  <div class="bg-gray-800 rounded-xl shadow-2xl p-6 mb-8">
116
  <div class="flex flex-wrap justify-between items-center gap-4">
@@ -245,7 +325,8 @@
245
  </div>
246
 
247
  <!-- Results Container -->
248
- <div id="resultsContainer" class="hidden bg-gray-800 rounded-xl shadow-2xl p-8 text-center">
 
249
  <div class="flex justify-center mb-6">
250
  <div class="bg-gradient-to-br from-python-blue to-python-light rounded-full w-24 h-24 flex items-center justify-center">
251
  <i class="fas fa-trophy text-white text-4xl"></i>
@@ -256,6 +337,53 @@
256
  <span id="finalScore">8</span>/<span id="finalTotal">10</span>
257
  </div>
258
  <p id="resultMessage" class="text-xl mb-8">Great job! You have a solid understanding of Python fundamentals.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  <div class="flex justify-center gap-4">
260
  <button id="restartBtn" class="bg-python-blue hover:bg-python-light text-white font-bold py-3 px-8 rounded-lg transition-all transform hover:scale-105">
261
  <i class="fas fa-redo mr-2"></i> Try Again
@@ -389,14 +517,52 @@
389
  const restartBtn = document.getElementById('restartBtn');
390
  const newQuizBtn = document.getElementById('newQuizBtn');
391
 
392
- // Quiz state
393
  let currentQuestionIndex = 0;
 
 
 
 
 
 
 
 
 
394
  let score = 0;
395
  let userAnswers = [];
396
  let quizQuestions = [];
397
 
398
- // Initialize
399
  document.addEventListener('DOMContentLoaded', () => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  generateBtn.addEventListener('click', startQuiz);
401
  optionElements.forEach((option, index) => {
402
  option.addEventListener('click', () => selectAnswer(index));
@@ -460,7 +626,32 @@
460
  nextBtn.classList.add('hidden');
461
  }
462
 
463
- // Handle answer selection
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
  function selectAnswer(selectedIndex) {
465
  const question = quizQuestions[currentQuestionIndex];
466
  const correctIndex = question.answer;
@@ -543,7 +734,67 @@
543
  }
544
  }
545
 
546
- // Show results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
  function showResults() {
548
  quizContainer.classList.add('hidden');
549
  resultsContainer.classList.remove('hidden');
@@ -551,6 +802,15 @@
551
  finalScore.textContent = score;
552
  finalTotal.textContent = quizQuestions.length;
553
 
 
 
 
 
 
 
 
 
 
554
  // Custom message based on score
555
  const percentage = (score / quizQuestions.length) * 100;
556
  if (percentage >= 90) {
 
6
  <title>Python Quiz Generator</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <!-- Shop Modal -->
10
+ <div id="shopModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
11
+ <div class="bg-gray-800 rounded-xl shadow-2xl p-8 max-w-2xl w-full max-h-[90vh] overflow-y-auto">
12
+ <div class="flex justify-between items-center mb-6">
13
+ <h2 class="text-3xl font-bold">Power-Up Shop</h2>
14
+ <button id="closeShop" class="text-gray-400 hover:text-white text-2xl">&times;</button>
15
+ </div>
16
+
17
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
18
+ <!-- Power-Up Items -->
19
+ <div class="bg-gray-700 rounded-lg p-4 border-2 border-python-blue">
20
+ <div class="flex justify-between items-start mb-3">
21
+ <h3 class="text-xl font-bold">50/50</h3>
22
+ <div class="flex items-center">
23
+ <i class="fas fa-coins text-python-yellow mr-1"></i>
24
+ <span>100</span>
25
+ </div>
26
+ </div>
27
+ <p class="text-gray-300 mb-4">Eliminates two wrong answers</p>
28
+ <button class="buy-btn w-full bg-python-blue hover:bg-python-light text-white font-bold py-2 px-4 rounded-lg transition-all" data-powerup="5050" data-cost="100">
29
+ Buy
30
+ </button>
31
+ </div>
32
+
33
+ <div class="bg-gray-700 rounded-lg p-4 border-2 border-python-yellow">
34
+ <div class="flex justify-between items-start mb-3">
35
+ <h3 class="text-xl font-bold">Time Freeze</h3>
36
+ <div class="flex items-center">
37
+ <i class="fas fa-coins text-python-yellow mr-1"></i>
38
+ <span>150</span>
39
+ </div>
40
+ </div>
41
+ <p class="text-gray-300 mb-4">Gives you extra 30 seconds per question</p>
42
+ <button class="buy-btn w-full bg-python-yellow hover:bg-yellow-400 text-gray-800 font-bold py-2 px-4 rounded-lg transition-all" data-powerup="timefreeze" data-cost="150">
43
+ Buy
44
+ </button>
45
+ </div>
46
+
47
+ <div class="bg-gray-700 rounded-lg p-4 border-2 border-python-light">
48
+ <div class="flex justify-between items-start mb-3">
49
+ <h3 class="text-xl font-bold">Double Points</h3>
50
+ <div class="flex items-center">
51
+ <i class="fas fa-coins text-python-yellow mr-1"></i>
52
+ <span>200</span>
53
+ </div>
54
+ </div>
55
+ <p class="text-gray-300 mb-4">Next correct answer gives double points</p>
56
+ <button class="buy-btn w-full bg-python-light hover:bg-blue-400 text-white font-bold py-2 px-4 rounded-lg transition-all" data-powerup="doublepoints" data-cost="200">
57
+ Buy
58
+ </button>
59
+ </div>
60
+
61
+ <div class="bg-gray-700 rounded-lg p-4 border-2 border-green-500">
62
+ <div class="flex justify-between items-start mb-3">
63
+ <h3 class="text-xl font-bold">Skip Question</h3>
64
+ <div class="flex items-center">
65
+ <i class="fas fa-coins text-python-yellow mr-1"></i>
66
+ <span>75</span>
67
+ </div>
68
+ </div>
69
+ <p class="text-gray-300 mb-4">Skip the current question</p>
70
+ <button class="buy-btn w-full bg-green-500 hover:bg-green-400 text-white font-bold py-2 px-4 rounded-lg transition-all" data-powerup="skip" data-cost="75">
71
+ Buy
72
+ </button>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </div>
77
+
78
  <script>
79
  tailwind.config = {
80
  theme: {
 
180
  <p class="text-xl text-gray-300">Test your Python knowledge with interactive challenges!</p>
181
  </header>
182
 
183
+ <!-- Currency Display -->
184
+ <div class="bg-gray-800 rounded-xl shadow-2xl p-4 mb-4 flex justify-between items-center">
185
+ <div class="flex items-center">
186
+ <i class="fas fa-coins text-python-yellow text-2xl mr-2"></i>
187
+ <span id="coinCount" class="text-xl font-bold">0</span>
188
+ </div>
189
+ <button id="shopBtn" class="bg-python-light hover:bg-python-blue text-white font-bold py-2 px-4 rounded-lg transition-all">
190
+ <i class="fas fa-store mr-2"></i> Shop
191
+ </button>
192
+ </div>
193
+
194
  <!-- Quiz Controls -->
195
  <div class="bg-gray-800 rounded-xl shadow-2xl p-6 mb-8">
196
  <div class="flex flex-wrap justify-between items-center gap-4">
 
325
  </div>
326
 
327
  <!-- Results Container -->
328
+ <div id="resultsContainer" class="hidden bg-gray-800 rounded-xl shadow-2xl p-8">
329
+ <div class="text-center mb-8">
330
  <div class="flex justify-center mb-6">
331
  <div class="bg-gradient-to-br from-python-blue to-python-light rounded-full w-24 h-24 flex items-center justify-center">
332
  <i class="fas fa-trophy text-white text-4xl"></i>
 
337
  <span id="finalScore">8</span>/<span id="finalTotal">10</span>
338
  </div>
339
  <p id="resultMessage" class="text-xl mb-8">Great job! You have a solid understanding of Python fundamentals.</p>
340
+ <!-- Analytics Section -->
341
+ <div class="bg-gray-700 rounded-xl p-6 mb-8">
342
+ <h3 class="text-2xl font-bold mb-4 text-center">Your Performance Analysis</h3>
343
+
344
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
345
+ <!-- Weak Areas -->
346
+ <div class="bg-gray-800 rounded-lg p-4">
347
+ <h4 class="text-xl font-bold mb-3 flex items-center">
348
+ <i class="fas fa-exclamation-triangle text-red-400 mr-2"></i> Weak Areas
349
+ </h4>
350
+ <ul id="weakAreas" class="space-y-2">
351
+ <!-- Dynamically populated -->
352
+ </ul>
353
+ </div>
354
+
355
+ <!-- Progress Chart -->
356
+ <div class="bg-gray-800 rounded-lg p-4">
357
+ <h4 class="text-xl font-bold mb-3 flex items-center">
358
+ <i class="fas fa-chart-line text-green-400 mr-2"></i> Progress
359
+ </h4>
360
+ <div class="h-48" id="progressChart">
361
+ <!-- Chart will be rendered here -->
362
+ </div>
363
+ </div>
364
+
365
+ <!-- Mnemonics -->
366
+ <div class="bg-gray-800 rounded-lg p-4">
367
+ <h4 class="text-xl font-bold mb-3 flex items-center">
368
+ <i class="fas fa-brain text-purple-400 mr-2"></i> Memory Aids
369
+ </h4>
370
+ <div id="mnemonics" class="space-y-3">
371
+ <!-- Dynamically populated -->
372
+ </div>
373
+ </div>
374
+
375
+ <!-- Flashcards -->
376
+ <div class="bg-gray-800 rounded-lg p-4">
377
+ <h4 class="text-xl font-bold mb-3 flex items-center">
378
+ <i class="fas fa-layer-group text-blue-400 mr-2"></i> Key Concepts
379
+ </h4>
380
+ <div id="flashcards" class="grid grid-cols-2 gap-3">
381
+ <!-- Dynamically populated -->
382
+ </div>
383
+ </div>
384
+ </div>
385
+ </div>
386
+
387
  <div class="flex justify-center gap-4">
388
  <button id="restartBtn" class="bg-python-blue hover:bg-python-light text-white font-bold py-3 px-8 rounded-lg transition-all transform hover:scale-105">
389
  <i class="fas fa-redo mr-2"></i> Try Again
 
517
  const restartBtn = document.getElementById('restartBtn');
518
  const newQuizBtn = document.getElementById('newQuizBtn');
519
 
520
+ // Enhanced quiz state
521
  let currentQuestionIndex = 0;
522
+ let coins = 0;
523
+ let powerups = {
524
+ '5050': 0,
525
+ 'timefreeze': 0,
526
+ 'doublepoints': 0,
527
+ 'skip': 0
528
+ };
529
+ let weakAreas = {};
530
+ let questionHistory = [];
531
  let score = 0;
532
  let userAnswers = [];
533
  let quizQuestions = [];
534
 
535
+ // Initialize with new features
536
  document.addEventListener('DOMContentLoaded', () => {
537
+ // Load saved coins from localStorage
538
+ coins = parseInt(localStorage.getItem('pythonQuizCoins')) || 0;
539
+ updateCoinDisplay();
540
+
541
+ // Shop functionality
542
+ const shopBtn = document.getElementById('shopBtn');
543
+ const shopModal = document.getElementById('shopModal');
544
+ const closeShop = document.getElementById('closeShop');
545
+
546
+ shopBtn.addEventListener('click', () => shopModal.classList.remove('hidden'));
547
+ closeShop.addEventListener('click', () => shopModal.classList.add('hidden'));
548
+
549
+ // Handle powerup purchases
550
+ document.querySelectorAll('.buy-btn').forEach(btn => {
551
+ btn.addEventListener('click', function() {
552
+ const powerup = this.dataset.powerup;
553
+ const cost = parseInt(this.dataset.cost);
554
+
555
+ if (coins >= cost) {
556
+ coins -= cost;
557
+ powerups[powerup]++;
558
+ updateCoinDisplay();
559
+ localStorage.setItem('pythonQuizCoins', coins);
560
+ alert(`Purchased ${powerup}! You now have ${powerups[powerup]}`);
561
+ } else {
562
+ alert("Not enough coins!");
563
+ }
564
+ });
565
+ });
566
  generateBtn.addEventListener('click', startQuiz);
567
  optionElements.forEach((option, index) => {
568
  option.addEventListener('click', () => selectAnswer(index));
 
626
  nextBtn.classList.add('hidden');
627
  }
628
 
629
+ // Update coin display
630
+ function updateCoinDisplay() {
631
+ document.getElementById('coinCount').textContent = coins;
632
+ }
633
+
634
+ // Award coins for correct answers
635
+ function awardCoins(isCorrect, difficulty) {
636
+ let amount = 0;
637
+ if (isCorrect) {
638
+ amount = difficulty === 'Beginner' ? 10 :
639
+ difficulty === 'Intermediate' ? 20 : 30;
640
+ coins += amount;
641
+ updateCoinDisplay();
642
+ localStorage.setItem('pythonQuizCoins', coins);
643
+
644
+ // Show coin animation
645
+ const coinAnim = document.createElement('div');
646
+ coinAnim.className = 'absolute -top-2 -right-2 bg-python-yellow text-gray-800 font-bold rounded-full w-8 h-8 flex items-center justify-center animate-bounce';
647
+ coinAnim.innerHTML = `+${amount}`;
648
+ document.getElementById('coinCount').parentNode.appendChild(coinAnim);
649
+
650
+ setTimeout(() => coinAnim.remove(), 2000);
651
+ }
652
+ }
653
+
654
+ // Handle answer selection with powerups
655
  function selectAnswer(selectedIndex) {
656
  const question = quizQuestions[currentQuestionIndex];
657
  const correctIndex = question.answer;
 
734
  }
735
  }
736
 
737
+ // Analyze weak areas
738
+ function analyzeWeakAreas() {
739
+ weakAreas = {};
740
+ quizQuestions.forEach((q, i) => {
741
+ if (userAnswers[i] !== q.answer) {
742
+ const category = q.question.split(' ')[0]; // Simple categorization
743
+ weakAreas[category] = (weakAreas[category] || 0) + 1;
744
+ }
745
+ });
746
+
747
+ // Sort weak areas
748
+ const sortedWeakAreas = Object.entries(weakAreas)
749
+ .sort((a, b) => b[1] - a[1])
750
+ .slice(0, 3);
751
+
752
+ // Display weak areas
753
+ const weakAreasList = document.getElementById('weakAreas');
754
+ weakAreasList.innerHTML = sortedWeakAreas.map(([area, count]) => `
755
+ <li class="flex justify-between items-center">
756
+ <span>${area}</span>
757
+ <span class="bg-red-500 text-white text-sm px-2 py-1 rounded-full">${count} mistakes</span>
758
+ </li>
759
+ `).join('');
760
+
761
+ // Generate mnemonics for weak areas
762
+ const mnemonicsContainer = document.getElementById('mnemonics');
763
+ mnemonicsContainer.innerHTML = sortedWeakAreas.map(([area]) => {
764
+ const mnemonic = generateMnemonic(area);
765
+ return `
766
+ <div class="bg-gray-900 p-3 rounded-lg">
767
+ <div class="font-bold text-python-yellow mb-1">${area}</div>
768
+ <div>${mnemonic}</div>
769
+ </div>
770
+ `;
771
+ }).join('');
772
+
773
+ // Generate flashcards
774
+ const flashcardsContainer = document.getElementById('flashcards');
775
+ flashcardsContainer.innerHTML = quizQuestions
776
+ .filter((q, i) => userAnswers[i] !== q.answer)
777
+ .slice(0, 4)
778
+ .map(q => `
779
+ <div class="flashcard bg-gray-900 p-3 rounded-lg cursor-pointer transform transition hover:scale-105" onclick="this.classList.toggle('bg-gray-800')">
780
+ <div class="font-bold text-python-blue">Q: ${q.question.substring(0, 50)}...</div>
781
+ <div class="hidden mt-2 text-sm">A: ${q.options[q.answer]}</div>
782
+ </div>
783
+ `).join('');
784
+ }
785
+
786
+ // Simple mnemonic generator
787
+ function generateMnemonic(topic) {
788
+ const mnemonics = {
789
+ "What": "When in doubt, PEMDAS rules them all (Parentheses, Exponents, Multiplication/Division, Addition/Subtraction)",
790
+ "Which": "VENV is Very Essential for New Versions",
791
+ "What does": "Yield gives you a generator - it 'yields' results one by one",
792
+ "Which method": "POP goes the last element! (like popcorn popping out)"
793
+ };
794
+ return mnemonics[topic] || "Practice makes perfect! Review this concept regularly.";
795
+ }
796
+
797
+ // Show enhanced results
798
  function showResults() {
799
  quizContainer.classList.add('hidden');
800
  resultsContainer.classList.remove('hidden');
 
802
  finalScore.textContent = score;
803
  finalTotal.textContent = quizQuestions.length;
804
 
805
+ // Award bonus coins based on performance
806
+ const bonus = Math.floor(score * 5);
807
+ coins += bonus;
808
+ updateCoinDisplay();
809
+ localStorage.setItem('pythonQuizCoins', coins);
810
+
811
+ // Analyze performance
812
+ analyzeWeakAreas();
813
+
814
  // Custom message based on score
815
  const percentage = (score / quizQuestions.length) * 100;
816
  if (percentage >= 90) {