├── calculator_app ├── app.py └── templates │ └── calculator.html ├── to_dolist ├── app.py ├── templates │ └── index.html └── static │ └── style.css └── password_generator ├── templates └── index.html ├── app.py └── static └── style.css /calculator_app/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request 2 | 3 | app = Flask(__name__) 4 | 5 | @app.route("/", methods=["GET", "POST"]) 6 | def calculator(): 7 | expression = "" 8 | if request.method == "POST": 9 | btn = request.form["btn"] 10 | current = request.form["expression"] 11 | 12 | if btn == "c": 13 | expression = "" 14 | elif btn == "=": 15 | try: 16 | expression = str(eval(current.replace('x', '*'))) 17 | except: 18 | expression = "Error" 19 | else: 20 | expression = current + btn 21 | 22 | return render_template("calculator.html", expression=expression) 23 | 24 | if __name__ == "__main__": 25 | app.run(debug=True) 26 | 27 | 28 | -------------------------------------------------------------------------------- /to_dolist/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request, redirect 2 | 3 | app = Flask(__name__) 4 | tasks = [] 5 | 6 | @app.route('/') 7 | def index(): 8 | return render_template('index.html', tasks=tasks) 9 | 10 | @app.route('/add', methods=['POST']) 11 | def add(): 12 | task = request.form.get('task') 13 | if task: 14 | tasks.append({'task': task, 'done': False}) 15 | return redirect('/') 16 | 17 | @app.route('/done/') 18 | def mark_done(index): 19 | if 0 <= index < len(tasks): 20 | tasks[index]['done'] = not tasks[index]['done'] 21 | return redirect('/') 22 | 23 | @app.route('/delete/') 24 | def delete(index): 25 | if 0 <= index < len(tasks): 26 | tasks.pop(index) 27 | return redirect('/') 28 | 29 | if __name__ == '__main__': 30 | app.run(debug=True) 31 | -------------------------------------------------------------------------------- /to_dolist/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | To-Do List 7 | 8 | 9 | 10 |
11 |

📝 To-Do List

12 |
13 | 14 | 15 |
16 | 17 |
    18 | {% for task in tasks %} 19 |
  • 20 | {{ task.task }} 21 |
    22 | 23 | 24 |
    25 |
  • 26 | {% endfor %} 27 |
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /password_generator/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Password Generator 6 | 7 | 8 | 9 |
10 |

🔐 Password Generator

11 |
12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | {% if password %} 24 |
25 | Your Password: 26 | 27 |
28 | {% endif %} 29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /password_generator/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request 2 | import random 3 | import string 4 | 5 | app = Flask(__name__) 6 | 7 | def generate_password(length, use_upper, use_digits, use_special): 8 | characters = list(string.ascii_lowercase) 9 | if use_upper: 10 | characters += list(string.ascii_uppercase) 11 | if use_digits: 12 | characters += list(string.digits) 13 | if use_special: 14 | characters += list('!@#$%^&*()-_=+[]{}|;:,.<>?/') 15 | 16 | if not characters: 17 | return "Select at least one character type." 18 | 19 | password = ''.join(random.choice(characters) for _ in range(length)) 20 | return password 21 | 22 | @app.route('/', methods=['GET', 'POST']) 23 | def index(): 24 | password = "" 25 | if request.method == 'POST': 26 | length = int(request.form['length']) 27 | use_upper = 'uppercase' in request.form 28 | use_digits = 'digits' in request.form 29 | use_special = 'special' in request.form 30 | password = generate_password(length, use_upper, use_digits, use_special) 31 | return render_template('index.html', password=password) 32 | 33 | if __name__ == '__main__': 34 | app.run(debug=True) 35 | -------------------------------------------------------------------------------- /password_generator/static/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #a0b3cf; 3 | font-family: 'Segoe UI', sans-serif; 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | height: 100vh; 8 | } 9 | 10 | .container { 11 | background: #d5ecff; 12 | padding: 30px; 13 | border-radius: 12px; 14 | box-shadow: 0 8px 16px rgba(0,0,0,0.1); 15 | width: 400px; 16 | text-align: center; 17 | } 18 | 19 | h1 { 20 | margin-bottom: 20px; 21 | color: #333; 22 | } 23 | 24 | form { 25 | display: flex; 26 | flex-direction: column; 27 | gap: 15px; 28 | } 29 | 30 | input[type=number], 31 | input[type=text] { 32 | padding: 10px; 33 | border: 1px solid #ccc; 34 | border-radius: 6px; 35 | width: 100%; 36 | font-size: 16px; 37 | } 38 | 39 | input[type=checkbox] { 40 | margin-right: 8px; 41 | } 42 | 43 | button { 44 | padding: 10px; 45 | background-color: #007c2e; 46 | color: white; 47 | border: none; 48 | font-size: 16px; 49 | border-radius: 6px; 50 | cursor: pointer; 51 | transition: background 0.3s; 52 | } 53 | 54 | button:hover { 55 | background-color: #57f801; 56 | } 57 | 58 | .result { 59 | margin-top: 20px; 60 | font-size: 18px; 61 | } 62 | -------------------------------------------------------------------------------- /to_dolist/static/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 3 | background: #c0f5ff; 4 | margin: 0; 5 | padding: 0; 6 | display: flex; 7 | justify-content: center; 8 | align-items: center; 9 | height: 100vh; 10 | } 11 | 12 | .container { 13 | background: #f8fbdc; 14 | padding: 30px; 15 | border-radius: 12px; 16 | box-shadow: 0 10px 20px rgba(0,0,0,0.1); 17 | width: 400px; 18 | text-align: center; 19 | } 20 | 21 | h1 { 22 | margin-bottom: 20px; 23 | color: #333; 24 | } 25 | 26 | .task-form { 27 | display: flex; 28 | gap: 10px; 29 | margin-bottom: 20px; 30 | } 31 | 32 | .task-form input { 33 | flex: 1; 34 | padding: 10px; 35 | border: 1px solid #ccc; 36 | border-radius: 6px; 37 | } 38 | 39 | .task-form button { 40 | padding: 10px 20px; 41 | background-color: #0818ec; 42 | color: rgb(240, 218, 248); 43 | border: none; 44 | border-radius: 6px; 45 | cursor: pointer; 46 | } 47 | 48 | .task-list { 49 | list-style: none; 50 | padding: 0; 51 | } 52 | 53 | .task-item { 54 | display: flex; 55 | justify-content: space-between; 56 | align-items: center; 57 | padding: 12px; 58 | margin: 8px 0; 59 | border: 1px solid #ddd; 60 | border-radius: 6px; 61 | background: #fafafa; 62 | } 63 | 64 | .task-item.done span { 65 | text-decoration: line-through; 66 | color: gray; 67 | } 68 | 69 | .actions a { 70 | text-decoration: none; 71 | margin-left: 10px; 72 | font-size: 18px; 73 | padding: 5px 8px; 74 | border-radius: 4px; 75 | transition: background 0.2s; 76 | } 77 | 78 | .actions a.done { 79 | color: green; 80 | border: 1px solid green; 81 | } 82 | 83 | .actions a.delete { 84 | color: red; 85 | border: 1px solid red; 86 | } 87 | 88 | .actions a:hover { 89 | background: #eee; 90 | } -------------------------------------------------------------------------------- /calculator_app/templates/calculator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Calculator 6 | 87 | 88 | 89 |
90 |
Calculator
91 |
{{ expression }}
92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 |
115 |
116 | 117 | 118 | --------------------------------------------------------------------------------