youjunhyeok commited on
Commit
a694e00
·
verified ·
1 Parent(s): c5f798d

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +492 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Pylearn
3
- emoji: 🐨
4
- colorFrom: pink
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: pylearn
3
+ emoji: 🐳
4
+ colorFrom: green
5
+ colorTo: red
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,492 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>PyLearn - Interactive Python Learning Platform</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
10
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"></script>
11
+ <style>
12
+ .editor {
13
+ height: 400px;
14
+ width: 100%;
15
+ }
16
+ .dark-mode {
17
+ background-color: #1a202c;
18
+ color: #e2e8f0;
19
+ }
20
+ .dark-mode .bg-gray-100 {
21
+ background-color: #2d3748;
22
+ }
23
+ .dark-mode .text-gray-800 {
24
+ color: #e2e8f0;
25
+ }
26
+ .dark-mode .border-gray-200 {
27
+ border-color: #4a5568;
28
+ }
29
+ .tab-active {
30
+ border-bottom: 3px solid #4299e1;
31
+ color: #4299e1;
32
+ font-weight: 600;
33
+ }
34
+ .progress-bar {
35
+ height: 6px;
36
+ transition: width 0.3s ease;
37
+ }
38
+ .slide-fade-enter-active {
39
+ transition: all 0.3s ease;
40
+ }
41
+ .slide-fade-leave-active {
42
+ transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
43
+ }
44
+ .slide-fade-enter, .slide-fade-leave-to {
45
+ transform: translateX(20px);
46
+ opacity: 0;
47
+ }
48
+ </style>
49
+ </head>
50
+ <body class="bg-gray-100 text-gray-800 font-sans">
51
+ <!-- Navigation -->
52
+ <nav class="bg-white shadow-md dark-mode:bg-gray-800">
53
+ <div class="container mx-auto px-4 py-3 flex justify-between items-center">
54
+ <div class="flex items-center space-x-4">
55
+ <div class="text-2xl font-bold text-blue-600 dark-mode:text-blue-400">
56
+ <i class="fab fa-python mr-2"></i>PyLearn
57
+ </div>
58
+ <div class="hidden md:flex space-x-6">
59
+ <a href="#" class="hover:text-blue-600 dark-mode:hover:text-blue-400">Home</a>
60
+ <a href="#" class="hover:text-blue-600 dark-mode:hover:text-blue-400">Courses</a>
61
+ <a href="#" class="hover:text-blue-600 dark-mode:hover:text-blue-400">Exercises</a>
62
+ <a href="#" class="hover:text-blue-600 dark-mode:hover:text-blue-400">Community</a>
63
+ </div>
64
+ </div>
65
+ <div class="flex items-center space-x-4">
66
+ <button id="darkModeToggle" class="p-2 rounded-full hover:bg-gray-200 dark-mode:hover:bg-gray-700">
67
+ <i class="fas fa-moon dark-mode:hidden"></i>
68
+ <i class="fas fa-sun hidden dark-mode:block"></i>
69
+ </button>
70
+ <button class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 hidden md:block">
71
+ Sign In
72
+ </button>
73
+ <button class="md:hidden p-2">
74
+ <i class="fas fa-bars"></i>
75
+ </button>
76
+ </div>
77
+ </div>
78
+ </nav>
79
+
80
+ <!-- Main Content -->
81
+ <div class="container mx-auto px-4 py-8">
82
+ <div class="flex flex-col lg:flex-row gap-8">
83
+ <!-- Sidebar -->
84
+ <div class="w-full lg:w-1/4 bg-white rounded-lg shadow-md p-4 dark-mode:bg-gray-800">
85
+ <h2 class="text-xl font-semibold mb-4">Python Basics</h2>
86
+ <div class="space-y-2">
87
+ <div class="flex items-center justify-between p-2 rounded hover:bg-gray-100 dark-mode:hover:bg-gray-700 cursor-pointer">
88
+ <span class="flex items-center">
89
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
90
+ <span>Introduction to Python</span>
91
+ </span>
92
+ <i class="fas fa-play text-blue-500"></i>
93
+ </div>
94
+ <div class="flex items-center justify-between p-2 rounded hover:bg-gray-100 dark-mode:hover:bg-gray-700 cursor-pointer">
95
+ <span class="flex items-center">
96
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
97
+ <span>Variables and Data Types</span>
98
+ </span>
99
+ <i class="fas fa-play text-blue-500"></i>
100
+ </div>
101
+ <div class="flex items-center justify-between p-2 rounded hover:bg-gray-100 dark-mode:hover:bg-gray-700 cursor-pointer">
102
+ <span class="flex items-center">
103
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
104
+ <span>Operators</span>
105
+ </span>
106
+ <i class="fas fa-play text-blue-500"></i>
107
+ </div>
108
+ <div class="flex items-center justify-between p-2 rounded bg-blue-50 dark-mode:bg-gray-700">
109
+ <span class="flex items-center">
110
+ <i class="fas fa-circle text-blue-500 mr-2"></i>
111
+ <span class="font-medium">Conditional Statements</span>
112
+ </span>
113
+ <i class="fas fa-play text-blue-500"></i>
114
+ </div>
115
+ <div class="flex items-center justify-between p-2 rounded hover:bg-gray-100 dark-mode:hover:bg-gray-700 cursor-pointer">
116
+ <span class="flex items-center">
117
+ <i class="far fa-circle text-gray-400 mr-2"></i>
118
+ <span>Loops</span>
119
+ </span>
120
+ <i class="fas fa-lock text-gray-400"></i>
121
+ </div>
122
+ <div class="flex items-center justify-between p-2 rounded hover:bg-gray-100 dark-mode:hover:bg-gray-700 cursor-pointer">
123
+ <span class="flex items-center">
124
+ <i class="far fa-circle text-gray-400 mr-2"></i>
125
+ <span>Functions</span>
126
+ </span>
127
+ <i class="fas fa-lock text-gray-400"></i>
128
+ </div>
129
+ </div>
130
+
131
+ <div class="mt-8">
132
+ <h3 class="font-semibold mb-2">Your Progress</h3>
133
+ <div class="bg-gray-200 rounded-full h-2.5 dark-mode:bg-gray-700">
134
+ <div class="bg-blue-600 h-2.5 rounded-full progress-bar" style="width: 45%"></div>
135
+ </div>
136
+ <div class="flex justify-between text-sm mt-1">
137
+ <span>45% Complete</span>
138
+ <span>3/7 Lessons</span>
139
+ </div>
140
+ </div>
141
+ </div>
142
+
143
+ <!-- Main Content Area -->
144
+ <div class="w-full lg:w-3/4">
145
+ <!-- Lesson Content -->
146
+ <div class="bg-white rounded-lg shadow-md p-6 mb-6 dark-mode:bg-gray-800">
147
+ <h1 class="text-2xl font-bold mb-4">Conditional Statements</h1>
148
+ <div class="flex border-b mb-4">
149
+ <button class="tab-button px-4 py-2 tab-active">Lesson</button>
150
+ <button class="tab-button px-4 py-2">Exercise</button>
151
+ <button class="tab-button px-4 py-2">Solution</button>
152
+ <button class="tab-button px-4 py-2">Discussion</button>
153
+ </div>
154
+
155
+ <div class="prose dark-mode:prose-invert max-w-none">
156
+ <p>Conditional statements allow your program to make decisions based on certain conditions. In Python, we use <code class="bg-gray-100 dark-mode:bg-gray-700 px-1 rounded">if</code>, <code class="bg-gray-100 dark-mode:bg-gray-700 px-1 rounded">elif</code>, and <code class="bg-gray-100 dark-mode:bg-gray-700 px-1 rounded">else</code> statements.</p>
157
+
158
+ <h3 class="text-xl font-semibold mt-4">Basic Syntax</h3>
159
+ <pre class="bg-gray-100 dark-mode:bg-gray-700 p-4 rounded-md"><code>if condition:
160
+ # code to execute if condition is True
161
+ elif another_condition:
162
+ # code to execute if another_condition is True
163
+ else:
164
+ # code to execute if no conditions are True</code></pre>
165
+
166
+ <h3 class="text-xl font-semibold mt-4">Example</h3>
167
+ <p>Let's write a program that checks if a number is positive, negative, or zero:</p>
168
+
169
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
170
+ <div>
171
+ <h4 class="font-medium mb-2">Interactive Example</h4>
172
+ <div id="editor" class="editor border border-gray-300 rounded-t-md dark-mode:border-gray-600"></div>
173
+ <div class="bg-gray-100 dark-mode:bg-gray-700 p-3 rounded-b-md flex justify-between items-center">
174
+ <button id="runCode" class="bg-green-600 text-white px-4 py-2 rounded-md hover:bg-green-700">
175
+ <i class="fas fa-play mr-2"></i>Run Code
176
+ </button>
177
+ <button class="text-blue-600 hover:text-blue-800 dark-mode:hover:text-blue-400">
178
+ <i class="fas fa-share-alt mr-1"></i>Share
179
+ </button>
180
+ </div>
181
+ </div>
182
+ <div>
183
+ <h4 class="font-medium mb-2">Output</h4>
184
+ <div id="output" class="bg-gray-100 dark-mode:bg-gray-700 p-4 rounded-md h-full min-h-[200px] border border-gray-300 dark-mode:border-gray-600">
185
+ <p class="text-gray-500">Click "Run Code" to see the output here.</p>
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+ <div class="mt-6 bg-blue-50 dark-mode:bg-blue-900 p-4 rounded-md">
191
+ <h4 class="font-semibold text-blue-800 dark-mode:text-blue-200 mb-2">
192
+ <i class="fas fa-lightbulb mr-2"></i>Pro Tip
193
+ </h4>
194
+ <p>Python uses indentation to define code blocks. Make sure to use consistent indentation (4 spaces is recommended) for your <code class="bg-blue-100 dark-mode:bg-blue-800 px-1 rounded">if</code> statements.</p>
195
+ </div>
196
+ </div>
197
+ </div>
198
+
199
+ <!-- Exercise -->
200
+ <div class="bg-white rounded-lg shadow-md p-6 mb-6 dark-mode:bg-gray-800">
201
+ <h2 class="text-xl font-bold mb-4">Exercise: Grade Calculator</h2>
202
+ <div class="prose dark-mode:prose-invert max-w-none">
203
+ <p>Write a program that takes a student's score (0-100) as input and prints their grade based on the following criteria:</p>
204
+ <ul class="list-disc pl-5">
205
+ <li>90-100: A</li>
206
+ <li>80-89: B</li>
207
+ <li>70-79: C</li>
208
+ <li>60-69: D</li>
209
+ <li>Below 60: F</li>
210
+ </ul>
211
+
212
+ <div class="mt-6">
213
+ <h4 class="font-medium mb-2">Your Solution</h4>
214
+ <div id="exerciseEditor" class="editor border border-gray-300 rounded-t-md dark-mode:border-gray-600"></div>
215
+ <div class="bg-gray-100 dark-mode:bg-gray-700 p-3 rounded-b-md flex justify-between items-center">
216
+ <div>
217
+ <button id="runExercise" class="bg-green-600 text-white px-4 py-2 rounded-md hover:bg-green-700 mr-2">
218
+ <i class="fas fa-play mr-2"></i>Run & Test
219
+ </button>
220
+ <button id="submitExercise" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700">
221
+ <i class="fas fa-check mr-2"></i>Submit
222
+ </button>
223
+ </div>
224
+ <button class="text-blue-600 hover:text-blue-800 dark-mode:hover:text-blue-400">
225
+ <i class="fas fa-question-circle mr-1"></i>Hint
226
+ </button>
227
+ </div>
228
+ </div>
229
+
230
+ <div id="testResults" class="mt-4 hidden">
231
+ <h4 class="font-medium mb-2">Test Results</h4>
232
+ <div class="space-y-2">
233
+ <div class="test-case p-3 rounded-md border border-green-200 bg-green-50 dark-mode:bg-green-900 dark-mode:border-green-800">
234
+ <div class="flex items-center">
235
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
236
+ <span>Test Case 1: Score 95 → A</span>
237
+ </div>
238
+ </div>
239
+ <div class="test-case p-3 rounded-md border border-green-200 bg-green-50 dark-mode:bg-green-900 dark-mode:border-green-800">
240
+ <div class="flex items-center">
241
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
242
+ <span>Test Case 2: Score 85 → B</span>
243
+ </div>
244
+ </div>
245
+ <div class="test-case p-3 rounded-md border border-red-200 bg-red-50 dark-mode:bg-red-900 dark-mode:border-red-800">
246
+ <div class="flex items-center">
247
+ <i class="fas fa-times-circle text-red-500 mr-2"></i>
248
+ <span>Test Case 3: Score 55 → F (Your output: D)</span>
249
+ </div>
250
+ </div>
251
+ <div class="test-case p-3 rounded-md border border-green-200 bg-green-50 dark-mode:bg-green-900 dark-mode:border-green-800">
252
+ <div class="flex items-center">
253
+ <i class="fas fa-check-circle text-green-500 mr-2"></i>
254
+ <span>Test Case 4: Score 72 → C</span>
255
+ </div>
256
+ </div>
257
+ </div>
258
+
259
+ <div class="mt-4 bg-yellow-50 dark-mode:bg-yellow-900 p-3 rounded-md border border-yellow-200 dark-mode:border-yellow-800">
260
+ <h4 class="font-medium text-yellow-800 dark-mode:text-yellow-200">
261
+ <i class="fas fa-exclamation-triangle mr-2"></i>Feedback
262
+ </h4>
263
+ <p>Your code works for most cases but fails when the score is below 60. Check your conditions for the 'F' grade.</p>
264
+ </div>
265
+ </div>
266
+ </div>
267
+ </div>
268
+
269
+ <!-- Community Section -->
270
+ <div class="bg-white rounded-lg shadow-md p-6 dark-mode:bg-gray-800">
271
+ <h2 class="text-xl font-bold mb-4">Community Discussion</h2>
272
+ <div class="mb-6">
273
+ <div class="flex items-start space-x-3">
274
+ <div class="flex-shrink-0">
275
+ <div class="h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 dark-mode:bg-blue-900 dark-mode:text-blue-300">
276
+ <i class="fas fa-user"></i>
277
+ </div>
278
+ </div>
279
+ <div class="flex-1">
280
+ <div class="bg-gray-100 dark-mode:bg-gray-700 p-3 rounded-lg">
281
+ <div class="flex justify-between items-center mb-1">
282
+ <span class="font-medium">JaneDoe</span>
283
+ <span class="text-sm text-gray-500">2 hours ago</span>
284
+ </div>
285
+ <p>I'm confused about when to use elif vs multiple if statements. Can someone explain?</p>
286
+ <div class="flex space-x-4 mt-2 text-sm">
287
+ <button class="text-blue-600 hover:text-blue-800 dark-mode:hover:text-blue-400">
288
+ <i class="far fa-thumbs-up mr-1"></i>Like (5)
289
+ </button>
290
+ <button class="text-blue-600 hover:text-blue-800 dark-mode:hover:text-blue-400">
291
+ <i class="far fa-comment mr-1"></i>Reply
292
+ </button>
293
+ </div>
294
+ </div>
295
+ </div>
296
+ </div>
297
+ </div>
298
+
299
+ <div class="mb-6 ml-12">
300
+ <div class="flex items-start space-x-3">
301
+ <div class="flex-shrink-0">
302
+ <div class="h-10 w-10 rounded-full bg-green-100 flex items-center justify-center text-green-600 dark-mode:bg-green-900 dark-mode:text-green-300">
303
+ <i class="fas fa-user-tie"></i>
304
+ </div>
305
+ </div>
306
+ <div class="flex-1">
307
+ <div class="bg-gray-100 dark-mode:bg-gray-700 p-3 rounded-lg">
308
+ <div class="flex justify-between items-center mb-1">
309
+ <span class="font-medium">PythonTutor</span>
310
+ <span class="text-sm text-gray-500">1 hour ago</span>
311
+ </div>
312
+ <p>Great question! Use <code class="bg-gray-200 dark-mode:bg-gray-600 px-1 rounded">elif</code> when the conditions are mutually exclusive (only one can be true). Use multiple <code class="bg-gray-200 dark-mode:bg-gray-600 px-1 rounded">if</code> statements when multiple conditions could be true and you want to check all of them.</p>
313
+ <div class="flex space-x-4 mt-2 text-sm">
314
+ <button class="text-blue-600 hover:text-blue-800 dark-mode:hover:text-blue-400">
315
+ <i class="far fa-thumbs-up mr-1"></i>Like (12)
316
+ </button>
317
+ <button class="text-blue-600 hover:text-blue-800 dark-mode:hover:text-blue-400">
318
+ <i class="far fa-comment mr-1"></i>Reply
319
+ </button>
320
+ </div>
321
+ </div>
322
+ </div>
323
+ </div>
324
+ </div>
325
+
326
+ <div class="ml-12">
327
+ <div class="flex items-start space-x-3">
328
+ <div class="flex-shrink-0">
329
+ <div class="h-10 w-10 rounded-full bg-gray-100 flex items-center justify-center text-gray-600 dark-mode:bg-gray-600 dark-mode:text-gray-300">
330
+ <i class="fas fa-user"></i>
331
+ </div>
332
+ </div>
333
+ <div class="flex-1">
334
+ <div class="bg-gray-100 dark-mode:bg-gray-700 p-3 rounded-lg">
335
+ <textarea class="w-full bg-white dark-mode:bg-gray-600 border border-gray-300 dark-mode:border-gray-500 rounded-md p-2" rows="3" placeholder="Add to the discussion..."></textarea>
336
+ <div class="flex justify-end mt-2">
337
+ <button class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700">
338
+ Post Comment
339
+ </button>
340
+ </div>
341
+ </div>
342
+ </div>
343
+ </div>
344
+ </div>
345
+ </div>
346
+ </div>
347
+ </div>
348
+ </div>
349
+
350
+ <!-- Footer -->
351
+ <footer class="bg-gray-800 text-white py-8 mt-12">
352
+ <div class="container mx-auto px-4">
353
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
354
+ <div>
355
+ <h3 class="text-xl font-bold mb-4">PyLearn</h3>
356
+ <p class="text-gray-400">The best way to learn Python interactively, right in your browser.</p>
357
+ </div>
358
+ <div>
359
+ <h4 class="font-semibold mb-4">Resources</h4>
360
+ <ul class="space-y-2 text-gray-400">
361
+ <li><a href="#" class="hover:text-white">Documentation</a></li>
362
+ <li><a href="#" class="hover:text-white">Tutorials</a></li>
363
+ <li><a href="#" class="hover:text-white">Blog</a></li>
364
+ <li><a href="#" class="hover:text-white">Cheat Sheets</a></li>
365
+ </ul>
366
+ </div>
367
+ <div>
368
+ <h4 class="font-semibold mb-4">Community</h4>
369
+ <ul class="space-y-2 text-gray-400">
370
+ <li><a href="#" class="hover:text-white">Forums</a></li>
371
+ <li><a href="#" class="hover:text-white">Discord</a></li>
372
+ <li><a href="#" class="hover:text-white">Events</a></li>
373
+ <li><a href="#" class="hover:text-white">Contributors</a></li>
374
+ </ul>
375
+ </div>
376
+ <div>
377
+ <h4 class="font-semibold mb-4">Company</h4>
378
+ <ul class="space-y-2 text-gray-400">
379
+ <li><a href="#" class="hover:text-white">About Us</a></li>
380
+ <li><a href="#" class="hover:text-white">Careers</a></li>
381
+ <li><a href="#" class="hover:text-white">Privacy Policy</a></li>
382
+ <li><a href="#" class="hover:text-white">Terms of Service</a></li>
383
+ </ul>
384
+ </div>
385
+ </div>
386
+ <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
387
+ <p>© 2023 PyLearn. All rights reserved.</p>
388
+ </div>
389
+ </div>
390
+ </footer>
391
+
392
+ <script>
393
+ // Dark mode toggle
394
+ const darkModeToggle = document.getElementById('darkModeToggle');
395
+ const html = document.documentElement;
396
+
397
+ // Check for saved user preference or system preference
398
+ if (localStorage.getItem('darkMode') === 'true' ||
399
+ (!localStorage.getItem('darkMode') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
400
+ html.classList.add('dark-mode');
401
+ }
402
+
403
+ darkModeToggle.addEventListener('click', () => {
404
+ html.classList.toggle('dark-mode');
405
+ localStorage.setItem('darkMode', html.classList.contains('dark-mode'));
406
+ });
407
+
408
+ // Tab functionality
409
+ const tabButtons = document.querySelectorAll('.tab-button');
410
+ tabButtons.forEach(button => {
411
+ button.addEventListener('click', () => {
412
+ tabButtons.forEach(btn => btn.classList.remove('tab-active'));
413
+ button.classList.add('tab-active');
414
+ });
415
+ });
416
+
417
+ // Initialize code editor
418
+ const editor = ace.edit("editor");
419
+ editor.setTheme("ace/theme/chrome");
420
+ editor.session.setMode("ace/mode/python");
421
+ editor.setValue(`# Check if a number is positive, negative or zero\nnum = float(input("Enter a number: "))\n\nif num > 0:\n print("Positive number")\nelif num == 0:\n print("Zero")\nelse:\n print("Negative number")`);
422
+ editor.setOptions({
423
+ fontSize: "14px",
424
+ enableBasicAutocompletion: true,
425
+ enableLiveAutocompletion: true
426
+ });
427
+
428
+ // Initialize exercise editor
429
+ const exerciseEditor = ace.edit("exerciseEditor");
430
+ exerciseEditor.setTheme("ace/theme/chrome");
431
+ exerciseEditor.session.setMode("ace/mode/python");
432
+ exerciseEditor.setValue(`# Write your grade calculator here\nscore = int(input("Enter score (0-100): "))\n\n# Your code here\n`);
433
+ exerciseEditor.setOptions({
434
+ fontSize: "14px",
435
+ enableBasicAutocompletion: true,
436
+ enableLiveAutocompletion: true
437
+ });
438
+
439
+ // Run code button
440
+ document.getElementById('runCode').addEventListener('click', () => {
441
+ const outputDiv = document.getElementById('output');
442
+ outputDiv.innerHTML = '<p class="text-green-600">Running code...</p>';
443
+
444
+ // Simulate code execution (in a real app, this would call a backend API)
445
+ setTimeout(() => {
446
+ outputDiv.innerHTML = `
447
+ <p class="font-medium">Enter a number: 5</p>
448
+ <p>Positive number</p>
449
+ <p class="text-gray-500 mt-4">Execution finished in 0.02 seconds</p>
450
+ `;
451
+ }, 800);
452
+ });
453
+
454
+ // Run exercise button
455
+ document.getElementById('runExercise').addEventListener('click', () => {
456
+ const testResults = document.getElementById('testResults');
457
+ testResults.classList.remove('hidden');
458
+
459
+ // Scroll to results
460
+ testResults.scrollIntoView({ behavior: 'smooth' });
461
+ });
462
+
463
+ // Submit exercise button
464
+ document.getElementById('submitExercise').addEventListener('click', () => {
465
+ alert('Exercise submitted! Your progress has been saved.');
466
+
467
+ // In a real app, this would send to backend for grading
468
+ const progressBar = document.querySelector('.progress-bar');
469
+ progressBar.style.width = '60%';
470
+
471
+ // Update progress text
472
+ const progressText = document.querySelector('.flex.justify-between.text-sm.mt-1');
473
+ progressText.innerHTML = `
474
+ <span>60% Complete</span>
475
+ <span>4/7 Lessons</span>
476
+ `;
477
+ });
478
+
479
+ // Responsive adjustments
480
+ function handleResize() {
481
+ if (window.innerWidth < 768) {
482
+ // Mobile adjustments
483
+ } else {
484
+ // Desktop adjustments
485
+ }
486
+ }
487
+
488
+ window.addEventListener('resize', handleResize);
489
+ handleResize();
490
+ </script>
491
+ <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=youjunhyeok/pylearn" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
492
+ </html>