File size: 1,565 Bytes
644c189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Math Quiz App

A multiplication quiz web application built with Python Flask.

## Overview

Users configure a quiz (number range, question count, difficulty), answer timed multiplication questions, and view results on a leaderboard.

## Architecture

- **Backend**: Python 3.12 + Flask
- **Frontend**: Jinja2 HTML templates (server-side rendered)
- **Storage**: `leaderboard.json` file (local JSON file for scores)

## Project Structure

```
main.py              # Flask app with all routes
templates/
  configure_quiz.html  # Quiz setup form
  quiz.html            # Question page with countdown timer
  summary.html         # End-of-quiz results
  submit_score.html    # Score submission form
  leaderboard.html     # Leaderboard display
  index.html           # (unused)
leaderboard.json     # Persisted leaderboard data (auto-created)
```

## Routes

- `GET/POST /` β€” Configure quiz (number range, difficulty, question count)
- `GET/POST /quiz` β€” Active quiz with per-question countdown timer
- `GET/POST /summary` β€” Quiz results summary
- `POST /submit_score` β€” Save score to leaderboard
- `GET /leaderboard` β€” View all scores

## Running

**Development:** `python main.py` (Flask dev server on port 5000)

**Production:** `gunicorn --bind=0.0.0.0:5000 --reuse-port main:app`

## Dependencies

- `flask` β€” Web framework
- `gunicorn` β€” Production WSGI server

## Workflow

- Workflow: `Start application` β†’ `python main.py` on port 5000 (webview)

## Deployment

- Target: autoscale
- Run: `gunicorn --bind=0.0.0.0:5000 --reuse-port main:app`