Prac2Code
Prac2Code
Roll – 307B037
Class – TE B
Code -
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Basic To-Do List</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
}
h1 {
color: #333;
}
input[type="text"] {
padding: 8px;
width: 300px;
margin-right: 10px;
}
button {
padding: 8px 12px;
}
ul {
list-style: none;
padding: 0;
}
li {
margin: 8px 0;
}
li.done {
text-decoration: line-through;
color: gray;
}
</style>
</head>
<body>
📝
<h1> To-Do List</h1>
<input type="text" id="taskInput" placeholder="Enter a new task">
<button onclick="addTask()">Add</button>
<ul id="taskList"></ul>
<script>
function addTask() {
const input = document.getElementById("taskInput");
const taskText = input.value.trim();
if (taskText === "") return;
const li = document.createElement("li");
li.textContent = taskText;
li.onclick = () => li.classList.toggle("done");
❌
const deleteBtn = document.createElement("button");
deleteBtn.textContent = " ";
deleteBtn.style.marginLeft = "10px";
deleteBtn.onclick = (e) => {
e.stopPropagation();
li.remove();
};
li.appendChild(deleteBtn);
document.getElementById("taskList").appendChild(li);
input.value = "";
}
</script>
</body>
</html>
app.yaml
runtime: python310
instance_class: F1
automatic_scaling:
target_cpu_utilization: 0.65
min_instances: 1
max_instances: 2
handlers:
- url: /.*
script: auto
main.py
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8082)