Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions Students/Nishan/To do list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>To-Do List</title>

<style>
body {
font-family: Arial, sans-serif;
background: #1e1e2f;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.container {
background: white;
padding: 20px;
width: 350px;
border-radius: 10px;
}

h2 {
text-align: center;
}

.input-area {
display: flex;
gap: 10px;
}

input {
flex: 1;
padding: 8px;
}

button {
padding: 8px 12px;
cursor: pointer;
border: none;
background: #4CAF50;
color: white;
border-radius: 5px;
}

ul {
list-style: none;
padding: 0;
margin-top: 15px;
}

li {
background: #f4f4f4;
padding: 8px;
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 5px;
}

li.completed {
text-decoration: line-through;
color: gray;
}

.delete {
background: red;
color: white;
border: none;
padding: 5px 8px;
cursor: pointer;
border-radius: 5px;
}
</style>
</head>

<body>

<div class="container">
<h2>To-Do List</h2>

<div class="input-area">
<input type="text" id="taskInput" placeholder="Enter task...">
<button onclick="addTask()">Add</button>
</div>

<ul id="taskList"></ul>
</div>

<script>
let tasks = JSON.parse(localStorage.getItem("tasks")) || [];

function saveTasks() {
localStorage.setItem("tasks", JSON.stringify(tasks));
}

function renderTasks() {
const list = document.getElementById("taskList");
list.innerHTML = "";

tasks.forEach((task, index) => {
const li = document.createElement("li");
li.textContent = task.text;

if (task.completed) {
li.classList.add("completed");
}

// toggle complete
li.addEventListener("click", () => {
tasks[index].completed = !tasks[index].completed;
saveTasks();
renderTasks();
});

// delete button
const btn = document.createElement("button");
btn.textContent = "X";
btn.classList.add("delete");

btn.addEventListener("click", (e) => {
e.stopPropagation();
tasks.splice(index, 1);
saveTasks();
renderTasks();
});

li.appendChild(btn);
list.appendChild(li);
});
}

function addTask() {
const input = document.getElementById("taskInput");
const text = input.value.trim();

if (text === "") return;

tasks.push({ text, completed: false });
input.value = "";
saveTasks();
renderTasks();
}

// initial load
renderTasks();
</script>

</body>
</html>
```
35 changes: 35 additions & 0 deletions Students/Nishan/python/calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
def add(a, b):
return a + b

def subtract(a, b):
return a - b

def multiply(a, b):
return a * b

def divide(a, b):
if b == 0:
return "Cannot divide by zero"
return a / b

print("Select operation:")
print("1. Add")
print("2. Subtract")
print("3. Multiply")
print("4. Divide")

choice = input("Enter choice (1/2/3/4): ")

num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))

if choice == '1':
print("Result:", add(num1, num2))
elif choice == '2':
print("Result:", subtract(num1, num2))
elif choice == '3':
print("Result:", multiply(num1, num2))
elif choice == '4':
print("Result:", divide(num1, num2))
else:
print("Invalid input")
1 change: 1 addition & 0 deletions Students/Nishan/python/first class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print ("hello world")
108 changes: 108 additions & 0 deletions Students/Nishan/slider.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Slider</title>

<style>
body {
margin: 0;
font-family: Arial;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #222;
}

.slider {
position: relative;
width: 800px;
overflow: hidden;
}

.slides {
display: flex;
transition: transform 0.5s ease-in-out;
}

.slides img {
width: 800px;
height: 400px;
object-fit: cover;
}

/* Buttons */
button {
position: absolute;
top: 50%;
transform: translateY(-50%);
font-size: 30px;
background: rgba(0,0,0,0.5);
color: white;
border: none;
cursor: pointer;
padding: 10px;
}

.prev {
left: 10px;
}

.next {
right: 10px;
}
</style>
</head>

<body>

<div class="slider">
<div class="slides">
<img src="https://picsum.photos/id/1015/800/400">
<img src="https://picsum.photos/id/1016/800/400">
<img src="https://picsum.photos/id/1018/800/400">
</div>

<button class="prev">&#10094;</button>
<button class="next">&#10095;</button>
</div>

<script>
const slides = document.querySelector('.slides');
const images = document.querySelectorAll('.slides img');

let index = 0;
const total = images.length;

// Next
document.querySelector('.next').addEventListener('click', () => {
index++;
if (index >= total) index = 0;
updateSlide();
});

// Prev
document.querySelector('.prev').addEventListener('click', () => {
index--;
if (index < 0) index = total - 1;
updateSlide();
});

// Auto slide
setInterval(() => {
index++;
if (index >= total) index = 0;
updateSlide();
}, 3000);

function updateSlide() {
slides.style.transform = `translateX(-${index * 800}px)`;
}
</script>

</body>
</html>
```
1 change: 0 additions & 1 deletion getStarted/jsAdvance/simplecart.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
flex-shrink: 0;
margin-top: 4px;
}
.section-title-group {}
.section-num {
font-family: 'IBM Plex Mono', monospace;
font-size: 11px;
Expand Down
Loading