Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Learn Java & Python Basics</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
<style> | |
.code-editor { | |
font-family: 'Courier New', Courier, monospace; | |
background-color: #2d2d2d; | |
color: #f8f8f2; | |
padding: 1rem; | |
border-radius: 0.5rem; | |
tab-size: 2; | |
} | |
.tab-button { | |
transition: all 0.2s ease; | |
} | |
.tab-button.active { | |
border-bottom: 3px solid #3b82f6; | |
font-weight: 600; | |
} | |
.exercise-card { | |
transition: transform 0.2s ease; | |
} | |
.exercise-card:hover { | |
transform: translateY(-2px); | |
} | |
.language-icon { | |
width: 80px; | |
height: 80px; | |
} | |
</style> | |
</head> | |
<body class="bg-gray-50 min-h-screen"> | |
<div class="container mx-auto px-4 py-8"> | |
<!-- Header with Theme Image --> | |
<header class="text-center mb-12 relative"> | |
<div class="absolute inset-0 bg-gradient-to-r from-blue-500 to-purple-600 rounded-2xl opacity-20 h-64"></div> | |
<div class="relative z-10"> | |
<h1 class="text-5xl font-bold text-gray-800 mb-6 pt-8">Learn Java & Python Basics</h1> | |
<p class="text-xl text-gray-600 max-w-3xl mx-auto mb-8"> | |
Master the fundamentals of two powerful programming languages through interactive lessons | |
</p> | |
<div class="flex justify-center space-x-12 mb-8"> | |
<div class="text-center"> | |
<img src="https://cdn-icons-png.flaticon.com/512/226/226777.png" alt="Java" class="language-icon mx-auto mb-2"> | |
<span class="font-medium text-gray-700">Java</span> | |
</div> | |
<div class="text-center"> | |
<img src="https://cdn-icons-png.flaticon.com/512/5968/5968350.png" alt="Python" class="language-icon mx-auto mb-2"> | |
<span class="font-medium text-gray-700">Python</span> | |
</div> | |
</div> | |
</div> | |
</header> | |
<!-- Learning Path Navigation --> | |
<section class="mb-16 bg-white rounded-xl shadow-lg overflow-hidden"> | |
<div class="p-6"> | |
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center"> | |
<i class="fas fa-road mr-3 text-blue-500"></i> | |
Learning Path | |
</h2> | |
<div class="grid grid-cols-1 md:grid-cols-2 gap-8"> | |
<!-- Java Path --> | |
<div class="border-l-4 border-blue-500 pl-6"> | |
<h3 class="text-xl font-medium text-gray-800 mb-4 flex items-center"> | |
<img src="https://cdn-icons-png.flaticon.com/512/226/226777.png" alt="Java" class="w-6 h-6 mr-2"> | |
Java Fundamentals | |
</h3> | |
<ol class="space-y-4"> | |
<li class="flex items-start"> | |
<span class="flex-shrink-0 bg-blue-500 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">1</span> | |
<div> | |
<h4 class="font-medium text-gray-800">Variables & Data Types</h4> | |
<p class="text-sm text-gray-600">Learn primitive types, declarations, and type casting</p> | |
</div> | |
</li> | |
<li class="flex items-start"> | |
<span class="flex-shrink-0 bg-blue-500 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">2</span> | |
<div> | |
<h4 class="font-medium text-gray-800">Control Structures</h4> | |
<p class="text-sm text-gray-600">Master if-else, switch, loops (for, while, do-while)</p> | |
</div> | |
</li> | |
<li class="flex items-start"> | |
<span class="flex-shrink-0 bg-blue-500 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">3</span> | |
<div> | |
<h4 class="font-medium text-gray-800">Methods & Classes</h4> | |
<p class="text-sm text-gray-600">Understand OOP concepts, constructors, and methods</p> | |
</div> | |
</li> | |
<li class="flex items-start"> | |
<span class="flex-shrink-0 bg-blue-500 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">4</span> | |
<div> | |
<h4 class="font-medium text-gray-800">Arrays & Collections</h4> | |
<p class="text-sm text-gray-600">Work with arrays, ArrayLists, and basic data structures</p> | |
</div> | |
</li> | |
</ol> | |
</div> | |
<!-- Python Path --> | |
<div class="border-l-4 border-green-500 pl-6"> | |
<h3 class="text-xl font-medium text-gray-800 mb-4 flex items-center"> | |
<img src="https://cdn-icons-png.flaticon.com/512/5968/5968350.png" alt="Python" class="w-6 h-6 mr-2"> | |
Python Fundamentals | |
</h3> | |
<ol class="space-y-4"> | |
<li class="flex items-start"> | |
<span class="flex-shrink-0 bg-green-500 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">1</span> | |
<div> | |
<h4 class="font-medium text-gray-800">Variables & Data Types</h4> | |
<p class="text-sm text-gray-600">Learn dynamic typing, numbers, strings, and lists</p> | |
</div> | |
</li> | |
<li class="flex items-start"> | |
<span class="flex-shrink-0 bg-green-500 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">2</span> | |
<div> | |
<h4 class="font-medium text-gray-800">Control Flow</h4> | |
<p class="text-sm text-gray-600">Master if-elif-else, loops (for, while), and range()</p> | |
</div> | |
</li> | |
<li class="flex items-start"> | |
<span class="flex-shrink-0 bg-green-500 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">3</span> | |
<div> | |
<h4 class="font-medium text-gray-800">Functions</h4> | |
<p class="text-sm text-gray-600">Define functions, parameters, return values, and scope</p> | |
</div> | |
</li> | |
<li class="flex items-start"> | |
<span class="flex-shrink-0 bg-green-500 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">4</span> | |
<div> | |
<h4 class="font-medium text-gray-800">Lists & Dictionaries</h4> | |
<p class="text-sm text-gray-600">Work with sequences, list comprehensions, and dictionaries</p> | |
</div> | |
</li> | |
</ol> | |
</div> | |
</div> | |
</div> | |
</section> | |
<!-- Lesson 1: Variables & Data Types --> | |
<section class="mb-16 bg-white rounded-xl shadow-lg overflow-hidden"> | |
<div class="p-6"> | |
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center"> | |
<i class="fas fa-cubes mr-3 text-blue-500"></i> | |
Lesson 1: Variables & Data Types | |
</h2> | |
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8"> | |
<div> | |
<h3 class="text-xl font-medium text-gray-800 mb-3">Java Variables</h3> | |
<p class="text-gray-600 mb-4"> | |
Java is statically typed, meaning you must declare the variable type before using it. | |
Primitive types include <code class="bg-gray-100 px-1 rounded">int</code>, <code class="bg-gray-100 px-1 rounded">double</code>, | |
<code class="bg-gray-100 px-1 rounded">boolean</code>, and <code class="bg-gray-100 px-1 rounded">char</code>. | |
</p> | |
<div class="code-editor mb-4"> | |
<pre><code>// Variable declaration and initialization | |
int age = 25; | |
double price = 19.99; | |
boolean isJavaFun = true; | |
char grade = 'A'; | |
// Constants (cannot be changed) | |
final double PI = 3.14159;</code></pre> | |
</div> | |
</div> | |
<div> | |
<h3 class="text-xl font-medium text-gray-800 mb-3">Python Variables</h3> | |
<p class="text-gray-600 mb-4"> | |
Python is dynamically typed - you don't need to declare variable types. | |
Common types include <code class="bg-gray-100 px-1 rounded">int</code>, <code class="bg-gray-100 px-1 rounded">float</code>, | |
<code class="bg-gray-100 px-1 rounded">bool</code>, <code class="bg-gray-100 px-1 rounded">str</code>, and <code class="bg-gray-100 px-1 rounded">list</code>. | |
</p> | |
<div class="code-editor mb-4"> | |
<pre><code># Variable assignment | |
age = 25 | |
price = 19.99 | |
is_python_fun = True | |
grade = 'A' | |
# Constants (by convention, not enforced) | |
PI = 3.14159</code></pre> | |
</div> | |
</div> | |
</div> | |
<div class="bg-blue-50 p-6 rounded-lg border border-blue-100 mb-8"> | |
<h3 class="text-lg font-medium text-blue-800 mb-3 flex items-center"> | |
<i class="fas fa-lightbulb mr-2 text-blue-600"></i> | |
Key Differences | |
</h3> | |
<ul class="list-disc pl-5 text-gray-700 space-y-2"> | |
<li><strong>Type Declaration:</strong> Java requires explicit type declaration, Python infers types</li> | |
<li><strong>Constants:</strong> Java has <code class="bg-blue-100 px-1 rounded">final</code> keyword, Python uses naming conventions (UPPER_CASE)</li> | |
<li><strong>Strings:</strong> Java uses double quotes, Python can use single or double quotes</li> | |
<li><strong>Boolean Values:</strong> Java uses <code class="bg-blue-100 px-1 rounded">true</code>/<code class="bg-blue-100 px-1 rounded">false</code>, Python uses <code class="bg-blue-100 px-1 rounded">True</code>/<code class="bg-blue-100 px-1 rounded">False</code></li> | |
</ul> | |
</div> | |
<!-- Interactive Exercise --> | |
<div class="bg-white border border-gray-200 rounded-lg p-6 shadow-sm"> | |
<h3 class="text-xl font-medium text-gray-800 mb-4 flex items-center"> | |
<i class="fas fa-pencil-alt mr-3 text-green-500"></i> | |
Interactive Exercise | |
</h3> | |
<div class="mb-6"> | |
<div class="flex border-b border-gray-200 mb-4"> | |
<button class="tab-button active px-4 py-2 text-blue-600" onclick="changeTab('exercise1', 'java')"> | |
Java | |
</button> | |
<button class="tab-button px-4 py-2 text-green-600" onclick="changeTab('exercise1', 'python')"> | |
Python | |
</button> | |
</div> | |
<div id="exercise1-java" class="exercise-content"> | |
<p class="text-gray-600 mb-4"> | |
Fix the variable declarations in this Java code. There are 3 errors to correct. | |
</p> | |
<div class="code-editor mb-4"> | |
<pre id="java-code" contenteditable="true">public class Main { | |
public static void main(String[] args) { | |
// Fix these variable declarations | |
int count = "10"; | |
double average = 3.5 | |
boolean isCorrect = "true"; | |
char initial = A; | |
System.out.println("Count: " + count); | |
} | |
}</pre> | |
</div> | |
<button onclick="checkExercise('java')" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition"> | |
Check Solution | |
</button> | |
<div id="java-feedback" class="mt-3 hidden"></div> | |
</div> | |
<div id="exercise1-python" class="exercise-content hidden"> | |
<p class="text-gray-600 mb-4"> | |
Complete the Python code to calculate the area of a rectangle. Use variables <code class="bg-gray-100 px-1 rounded">length</code> and <code class="bg-gray-100 px-1 rounded">width</code>. | |
</p> | |
<div class="code-editor mb-4"> | |
<pre id="python-code" contenteditable="true"># Calculate rectangle area | |
length = 5 | |
width = 3 | |
# Your code here | |
print(f"The area is: {area}")</pre> | |
</div> | |
<button onclick="checkExercise('python')" class="bg-green-600 text-white px-4 py-2 rounded-md hover:bg-green-700 transition"> | |
Check Solution | |
</button> | |
<div id="python-feedback" class="mt-3 hidden"></div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</section> | |
<!-- Lesson 2: Control Structures --> | |
<section class="mb-16 bg-white rounded-xl shadow-lg overflow-hidden"> | |
<div class="p-6"> | |
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center"> | |
<i class="fas fa-code-branch mr-3 text-blue-500"></i> | |
Lesson 2: Control Structures | |
</h2> | |
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8"> | |
<div> | |
<h3 class="text-xl font-medium text-gray-800 mb-3">Java Control Structures</h3> | |
<p class="text-gray-600 mb-4"> | |
Java uses traditional C-style control structures with curly braces <code class="bg-gray-100 px-1 rounded">{}</code>. | |
</p> | |
<div class="code-editor mb-4"> | |
<pre><code>// If-else statement | |
int score = 85; | |
if (score >= 90) { | |
System.out.println("A"); | |
} else if (score >= 80) { | |
System.out.println("B"); | |
} else { | |
System.out.println("C"); | |
} | |
// For loop | |
for (int i = 0; i < 5; i++) { | |
System.out.println(i); | |
} | |
// While loop | |
int count = 0; | |
while (count < 3) { | |
System.out.println(count); | |
count++; | |
}</code></pre> | |
</div> | |
</div> | |
<div> | |
<h3 class="text-xl font-medium text-gray-800 mb-3">Python Control Structures</h3> | |
<p class="text-gray-600 mb-4"> | |
Python uses indentation (whitespace) to define code blocks instead of curly braces. | |
</p> | |
<div class="code-editor mb-4"> | |
<pre><code># If-elif-else statement | |
score = 85 | |
if score >= 90: | |
print("A") | |
elif score >= 80: | |
print("B") | |
else: | |
print("C") | |
# For loop (often used with range()) | |
for i in range(5): | |
print(i) | |
# While loop | |
count = 0 | |
while count < 3: | |
print(count) | |
count += 1</code></pre> | |
</div> | |
</div> | |
</div> | |
<!-- Control Structures Exercise --> | |
<div class="bg-white border border-gray-200 rounded-lg p-6 shadow-sm"> | |
<h3 class="text-xl font-medium text-gray-800 mb-4 flex items-center"> | |
<i class="fas fa-puzzle-piece mr-3 text-purple-500"></i> | |
Control Structures Challenge | |
</h3> | |
<div class="mb-6"> | |
<div class="flex border-b border-gray-200 mb-4"> | |
<button class="tab-button active px-4 py-2 text-blue-600" onclick="changeTab('exercise2', 'java')"> | |
Java | |
</button> | |
<button class="tab-button px-4 py-2 text-green-600" onclick="changeTab('exercise2', 'python')"> | |
Python | |
</button> | |
</div> | |
<div id="exercise2-java" class="exercise-content"> | |
<p class="text-gray-600 mb-4"> | |
Write a Java program that prints numbers from 1 to 100. For multiples of 3 print "Fizz", | |
for multiples of 5 print "Buzz", and for multiples of both print "FizzBuzz". | |
</p> | |
<div class="code-editor mb-4"> | |
<pre id="java-control-code" contenteditable="true">public class FizzBuzz { | |
public static void main(String[] args) { | |
// Your code here | |
} | |
}</pre> | |
</div> | |
<button onclick="checkControlExercise('java')" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition"> | |
Check Solution | |
</button> | |
<div id="java-control-feedback" class="mt-3 hidden"></div> | |
</div> | |
<div id="exercise2-python" class="exercise-content hidden"> | |
<p class="text-gray-600 mb-4"> | |
Write the same FizzBuzz program in Python. Remember Python uses indentation for blocks! | |
</p> | |
<div class="code-editor mb-4"> | |
<pre id="python-control-code" contenteditable="true"># FizzBuzz in Python | |
# Your code here | |
</pre> | |
</div> | |
<button onclick="checkControlExercise('python')" class="bg-green-600 text-white px-4 py-2 rounded-md hover:bg-green-700 transition"> | |
Check Solution | |
</button> | |
<div id="python-control-feedback" class="mt-3 hidden"></div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</section> | |
<!-- Additional Practice --> | |
<section class="mb-16"> | |
<h2 class="text-2xl font-semibold text-gray-800 mb-6 text-center">Additional Practice Exercises</h2> | |
<div class="grid grid-cols-1 md:grid-cols-3 gap-6"> | |
<div class="exercise-card bg-white p-6 rounded-lg shadow-md border border-gray-100"> | |
<div class="bg-blue-100 w-12 h-12 rounded-full flex items-center justify-center mb-4 text-blue-600"> | |
<i class="fas fa-calculator text-xl"></i> | |
</div> | |
<h3 class="font-medium text-gray-800 mb-2">Calculator Program</h3> | |
<p class="text-sm text-gray-600 mb-4">Create a simple calculator that can add, subtract, multiply, and divide two numbers.</p> | |
<div class="flex space-x-2"> | |
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Java</span> | |
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded">Python</span> | |
</div> | |
</div> | |
<div class="exercise-card bg-white p-6 rounded-lg shadow-md border border-gray-100"> | |
<div class="bg-purple-100 w-12 h-12 rounded-full flex items-center justify-center mb-4 text-purple-600"> | |
<i class="fas fa-sort-amount-down text-xl"></i> | |
</div> | |
<h3 class="font-medium text-gray-800 mb-2">Number Guessing Game</h3> | |
<p class="text-sm text-gray-600 mb-4">Program generates a random number and user tries to guess it with hints.</p> | |
<div class="flex space-x-2"> | |
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Java</span> | |
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded">Python</span> | |
</div> | |
</div> | |
<div class="exercise-card bg-white p-6 rounded-lg shadow-md border border-gray-100"> | |
<div class="bg-amber-100 w-12 h-12 rounded-full flex items-center justify-center mb-4 text-amber-600"> | |
<i class="fas fa-user-friends text-xl"></i> | |
</div> | |
<h3 class="font-medium text-gray-800 mb-2">Student Gradebook</h3> | |
<p class="text-sm text-gray-600 mb-4">Store student names and grades, then calculate averages and find highest/lowest.</p> | |
<div class="flex space-x-2"> | |
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Java</span> | |
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded">Python</span> | |
</div> | |
</div> | |
</div> | |
</section> | |
<!-- Resources Section --> | |
<section class="bg-gray-100 rounded-xl p-8 mb-16"> | |
<h2 class="text-2xl font-semibold text-gray-800 mb-6 text-center">Learning Resources</h2> | |
<div class="grid grid-cols-1 md:grid-cols-2 gap-8"> | |
<div> | |
<h3 class="text-xl font-medium text-gray-800 mb-4 flex items-center"> | |
<img src="https://cdn-icons-png.flaticon.com/512/226/226777.png" alt="Java" class="w-6 h-6 mr-2"> | |
Java Resources | |
</h3> | |
<ul class="space-y-3"> | |
<li> | |
<a href="https://docs.oracle.com/javase/tutorial/" class="flex items-center text-blue-600 hover:underline"> | |
<i class="fas fa-book mr-2"></i> | |
Official Java Tutorials | |
</a> | |
</li> | |
<li> | |
<a href="https://www.codecademy.com/learn/learn-java" class="flex items-center text-blue-600 hover:underline"> | |
<i class="fas fa-laptop-code mr-2"></i> | |
Codecademy Java Course | |
</a> | |
</li> | |
<li> | |
<a href="https://codingbat.com/java" class="flex items-center text-blue-600 hover:underline"> | |
<i class="fas fa-edit mr-2"></i> | |
CodingBat Java Practice | |
</a> | |
</li> | |
</ul> | |
</div> | |
<div> | |
<h3 class="text-xl font-medium text-gray-800 mb-4 flex items-center"> | |
<img src="https://cdn-icons-png.flaticon.com/512/5968/5968350.png" alt="Python" class="w-6 h-6 mr-2"> | |
Python Resources | |
</h3> | |
<ul class="space-y-3"> | |
<li> | |
<a href="https://docs.python.org/3/tutorial/" class="flex items-center text-green-600 hover:underline"> | |
<i class="fas fa-book mr-2"></i> | |
Official Python Tutorial | |
</a> | |
</li> | |
<li> | |
<a href="https://www.learnpython.org/" class="flex items-center text-green-600 hover:underline"> | |
<i class="fas fa-laptop-code mr-2"></i> | |
LearnPython Interactive Tutorial | |
</a> | |
</li> | |
<li> | |
<a href="https://leetcode.com/problemset/all/" class="flex items-center text-green-600 hover:underline"> | |
<i class="fas fa-edit mr-2"></i> | |
LeetCode Python Problems | |
</a> | |
</li> | |
</ul> | |
</div> | |
</div> | |
</section> | |
<footer class="text-center text-gray-600 text-sm mb-8"> | |
<p>Happy coding! Remember that consistent practice is key to mastering programming.</p> | |
<p class="mt-2">Created with β€οΈ using HTML, CSS, and JavaScript</p> | |
</footer> | |
</div> | |
<script> | |
// Tab switching functionality | |
function changeTab(exerciseId, language) { | |
// Hide all exercise contents for this exercise | |
document.querySelectorAll(`#${exerciseId}-java, #${exerciseId}-python`).forEach(el => { | |
el.classList.add('hidden'); | |
}); | |
// Show selected exercise content | |
document.getElementById(`${exerciseId}-${language}`).classList.remove('hidden'); | |
// Update tab buttons | |
const buttons = document.querySelectorAll(`#${exerciseId}-java, #${exerciseId}-python`).forEach(el => { | |
el.parentNode.querySelectorAll('.tab-button').forEach(btn => { | |
btn.classList.remove('active'); | |
}); | |
}); | |
event.target.classList.add('active'); | |
} | |
// Exercise checking functionality | |
function checkExercise(language) { | |
const feedbackId = `${language}-feedback`; | |
const feedbackElement = document.getElementById(feedbackId); | |
if (language === 'java') { | |
const code = document.getElementById('java-code').textContent; | |
// Check for common mistakes | |
if (code.includes('int count = "10"')) { | |
showFeedback(feedbackElement, "β Error: You can't assign a String to an int variable", false); | |
} else if (code.includes('double average = 3.5')) { | |
showFeedback(feedbackElement, "β Error: Missing semicolon after 3.5", false); | |
} else if (code.includes('boolean isCorrect = "true"')) { | |
showFeedback(feedbackElement, "β Error: Boolean values don't use quotes", false); | |
} else if (code.includes('char initial = A')) { | |
showFeedback(feedbackElement, "β Error: Char values need single quotes", false); | |
} else { | |
showFeedback(feedbackElement, "β Correct! All variable declarations are fixed!", true); | |
} | |
} else { // python | |
const code = document.getElementById('python-code').textContent; | |
if (code.includes('area = length * width')) { | |
showFeedback(feedbackElement, "β Correct! The area is calculated properly.", true); | |
} else { | |
showFeedback(feedbackElement, "β Try calculating the area by multiplying length and width", false); | |
} | |
} | |
} | |
function checkControlExercise(language) { | |
const feedbackId = `${language}-control-feedback`; | |
const feedbackElement = document.getElementById(feedbackId); | |
if (language === 'java') { | |
const code = document.getElementById('java-control-code').textContent; | |
if (code.includes("if (i % 15 == 0)") || | |
(code.includes("i % 3 == 0") && code.includes("i % 5 == 0"))) { | |
showFeedback(feedbackElement, "β Excellent FizzBuzz implementation!", true); | |
} else if (code.includes("System.out.println") && code.includes("for")) { | |
showFeedback(feedbackElement, "β οΈ Close! Did you handle the FizzBuzz case (divisible by 3 and 5)?", false); | |
} else { | |
showFeedback(feedbackElement, "β Try using a for loop and if-else conditions", false); | |
} | |
} else { // python | |
const code = document.getElementById('python-control-code').textContent; | |
if (code.includes("if i % 15 == 0") || | |
(code.includes("i % 3 == 0") && code.includes("i % 5 == 0"))) { | |
showFeedback(feedbackElement, "β Perfect Python FizzBuzz solution!", true); | |
} else if (code.includes("print") && code.includes("for i in range")) { | |
showFeedback(feedbackElement, "β οΈ Almost there! Check your conditions for FizzBuzz", false); | |
} else { | |
showFeedback(feedbackElement, "β Remember Python uses indentation and elif", false); | |
} | |
} | |
} | |
function showFeedback(element, message, isSuccess) { | |
element.classList.remove('hidden'); | |
element.textContent = message; | |
element.className = isSuccess ? 'mt-3 text-green-600' : 'mt-3 text-red-600'; | |
} | |
</script> | |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 𧬠<a href="https://enzostvs-deepsite.hf.space?remix=Puretarantino/learning-tools" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
</html> |