Skip to content
Open
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
Empty file.
69 changes: 69 additions & 0 deletions css/advanced/Assignment-1/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: Arial, sans-serif;
line-height: 1.6;
}

header {
background: #0d0a99;
color: #fff;
padding: 20px;
text-align: center;
}

nav ul {
list-style: none;
display: flex;
justify-content: center;
gap: 20px;
margin-top: 10px;
}

nav a {
color: #fff;
text-decoration: none;
}

main {
display: flex;
padding: 20px;
gap: 20px;
}

article {
flex: 3;
background: #2c13a8;
color: #fff;
padding: 20px;
border-radius: 8px;
}

aside {
flex: 1;
background: #4d119b;
color: #fff;
padding: 20px;
border-radius: 8px;
}

footer {
background: #3f12ba;
color: #fff;
text-align: center;
padding: 15px;
margin-top: 20px;
bottom: auto;
}

@media (max-width: 768px) {
main {
flex-direction: column;
flex:1;
}
}
60 changes: 60 additions & 0 deletions css/advanced/Assignment-2/animations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Animation & Media Queries</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #f0f0f0;
}
.box {
width: 150px;
height: 150px;
background: #3498db;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: bold;
animation: bounce 2s infinite;
}
@keyframes bounce {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-50px);
}
}
@media (max-width: 768px) {
.box {
width: 120px;
height: 120px;
font-size: 14px;
background: #e67e22;
}
}

@media (max-width: 480px) {
.box {
width: 90px;
height: 90px;
font-size: 12px;
background: #2ecc71;
}
}
</style>
Comment on lines +7 to +55
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The CSS rules are placed inside a <style> block within the HTML file. According to the best practices in the PR description, CSS should be in separate files to avoid mixing it with HTML and to improve maintainability.

</head>
<body>
<div class="box">Hello Guys..!</div>
</body>
</html>
28 changes: 28 additions & 0 deletions javascript/4-control-structures-loops/Assignment-1/conditions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Grading System Assignment</title>
<link rel="stylesheet" href="style.css">
</head>
<body>

<div class="container">
<h2>Grading System</h2>

<div class="row">
<label for="marks">Enter Marks:</label>
<input type="number" id="marks" placeholder="Enter your marks">
</div>

<div class="row">
<button onclick="calculateGrade()">Get Grade</button>
</div>

<div id="result">Result will appear here...</div>
</div>

<script src="script.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions javascript/4-control-structures-loops/Assignment-1/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function calculateGrade() {
let marks = Number(document.getElementById("marks").value);
let grade = "";


if (marks >= 90) {
grade = "A";
} else if (marks >= 75 && marks <= 89) {
grade = "B";
} else if (marks >= 50 && marks <= 74) {
grade = "C";
} else if (marks < 50) {
grade = "F";
} else {
grade = "Invalid Input";
}
Comment on lines +6 to +16
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The grading logic has a few issues:

  1. Invalid Input Handling: The else block for "Invalid Input" is unreachable for many invalid cases. For example, an empty input is converted to 0 and graded as "F". The logic should explicitly check for empty or non-numeric inputs.
  2. Range Validation: There's no validation for marks outside the typical 0-100 range.
  3. Redundant Conditions: In else if statements like marks >= 75 && marks <= 89, the marks <= 89 part is redundant because the previous if already handled marks >= 90.

These issues can lead to incorrect grades for certain inputs.

Suggested change
if (marks >= 90) {
grade = "A";
} else if (marks >= 75 && marks <= 89) {
grade = "B";
} else if (marks >= 50 && marks <= 74) {
grade = "C";
} else if (marks < 50) {
grade = "F";
} else {
grade = "Invalid Input";
}
if (isNaN(marks) || marks < 0 || marks > 100 || document.getElementById("marks").value.trim() === "") {
grade = "Invalid Input";
} else if (marks >= 90) {
grade = "A";
} else if (marks >= 75) {
grade = "B";
} else if (marks >= 50) {
grade = "C";
} else {
grade = "F";
}



document.getElementById("result").innerHTML = `Grade: <strong>${grade}</strong>`;
}
63 changes: 63 additions & 0 deletions javascript/4-control-structures-loops/Assignment-1/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
body {
font-family: "Segoe UI", Arial, sans-serif;
background: #f8f9fa;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.container {
background: #fff;
padding: 25px 30px;
border-radius: 15px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
width: 350px;
text-align: center;
}

h2 {
color: #ff5722;
margin-bottom: 20px;
}

.row {
margin-bottom: 15px;
}

label {
display: block;
margin-bottom: 8px;
font-weight: bold;
}

input {
padding: 8px;
width: 80%;
border: 1px solid #ccc;
border-radius: 5px;
}

button {
background: linear-gradient(90deg, #ff5722, #ff007f);
border: none;
color: white;
padding: 10px 15px;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
width: 60%;
}

button:hover {
opacity: 0.85;
}

#result {
margin-top: 20px;
background: #f0f0f0;
padding: 10px;
border-radius: 8px;
font-weight: bold;
color: #333;
}
30 changes: 30 additions & 0 deletions javascript/4-control-structures-loops/Assignment-10/arraysum.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Array Sum and Average</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>

<div class="container">
<h2>Array Sum & Average Calculator</h2>

<div class="row">
<label for="numbers">Enter numbers (comma-separated):</label>
<input type="text" id="numbers" placeholder="e.g. 10, 20, 30, 40">
</div>

<div class="row">
<button onclick="calculateArray()">Calculate</button>
</div>

<div id="result">
Results will appear here...
</div>
</div>

<script src="script.js"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions javascript/4-control-structures-loops/Assignment-10/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function calculateArray() {
const input = document.getElementById("numbers").value.trim();
const result = document.getElementById("result");

if (input === "") {
result.innerHTML = "⚠️ Please enter some numbers separated by commas!";
return;
}

const numArray = input.split(",").map(item => Number(item.trim()));

if (numArray.some(isNaN)) {
result.innerHTML = "⚠️ Please enter only valid numbers separated by commas!";
return;
}

let sum = 0;

for (let num of numArray) {
sum += num;
}

const average = sum / numArray.length;

result.innerHTML = `
✅ Entered Numbers: [${numArray.join(", ")}] <br>
➕ Sum: <strong>${sum}</strong><br>
➗ Average: <strong>${average.toFixed(2)}</strong>
`;
}
65 changes: 65 additions & 0 deletions javascript/4-control-structures-loops/Assignment-10/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
body {
font-family: "Poppins", sans-serif;
background: #f7f9fb;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.container {
background: #fff;
padding: 30px;
border-radius: 15px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
width: 400px;
text-align: center;
}

h2 {
color: #ff5722;
margin-bottom: 20px;
}

.row {
margin-bottom: 15px;
}

label {
display: block;
margin-bottom: 8px;
font-weight: bold;
}

input {
padding: 8px;
width: 80%;
border: 1px solid #ccc;
border-radius: 5px;
}

button {
background: linear-gradient(90deg, #ff5722, #ff007f);
border: none;
color: white;
padding: 10px 15px;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
width: 60%;
transition: 0.2s ease;
}

button:hover {
opacity: 0.9;
transform: scale(1.05);
}

#result {
margin-top: 20px;
background: #f0f0f0;
padding: 10px;
border-radius: 8px;
font-weight: bold;
line-height: 1.8;
}
Loading