-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.json
More file actions
107 lines (107 loc) · 4.09 KB
/
examples.json
File metadata and controls
107 lines (107 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{
"version": "1.0",
"Python": {
"Переменные": {
"code": "x = 10\ny = 'Привет'",
"description": "Создание числовой и строковой переменной.",
"notes": ""
},
"Условия": {
"code": "if x > 5:\n print('Больше пяти')",
"description": "Условная конструкция if.",
"notes": ""
},
"Цикл for": {
"code": "for i in range(5):\n print(i)",
"description": "Простой цикл for по диапазону.",
"notes": ""
},
"Цикл while": {
"code": "while x > 0:\n x -= 1",
"description": "Цикл while с уменьшением значения.",
"notes": ""
},
"Функции": {
"code": "def greet(name):\n return f'Привет, {name}'",
"description": "Определение функции с параметром.",
"notes": ""
},
"Списки": {
"code": "numbers = [1, 2, 3]\nnumbers.append(4)",
"description": "Работа со списками: создание и добавление элемента.",
"notes": ""
},
"Словари": {
"code": "user = {'name': 'Аня', 'age': 25}",
"description": "Создание словаря с ключами и значениями.",
"notes": ""
},
"Исключения": {
"code": "try:\n result = 10 / 0\nexcept ZeroDivisionError:\n print('Ошибка деления')",
"description": "Обработка исключений.",
"notes": ""
},
"Классы": {
"code": "class Person:\n def __init__(self, name):\n self.name = name",
"description": "Определение класса и конструктора.",
"notes": ""
},
"Модули": {
"code": "import math\nprint(math.sqrt(16))",
"description": "Импорт модуля и вызов функции.",
"notes": ""
}
},
"JavaScript": {
"Переменные": {
"code": "let x = 10;\nconst y = 'Hello';",
"description": "Объявление переменных с let и const.",
"notes": ""
},
"Условия": {
"code": "if (x > 5) {\n console.log('Больше пяти');\n}",
"description": "Условный оператор if.",
"notes": ""
},
"Цикл for": {
"code": "for (let i = 0; i < 5; i++) {\n console.log(i);\n}",
"description": "Классический цикл for.",
"notes": ""
},
"Цикл while": {
"code": "while (x > 0) {\n x--;\n}",
"description": "Цикл while с декрементом.",
"notes": ""
},
"Функции": {
"code": "function greet(name) {\n return `Hello, ${name}`;\n}",
"description": "Определение функции с параметром.",
"notes": ""
},
"Массивы": {
"code": "let nums = [1, 2, 3];\nnums.push(4);",
"description": "Создание массива и добавление элемента.",
"notes": ""
},
"Объекты": {
"code": "let user = {name: 'Anna', age: 25};",
"description": "Создание объекта с полями.",
"notes": ""
},
"Обработка ошибок": {
"code": "try {\n let r = 10 / 0;\n} catch (e) {\n console.log('Ошибка');\n}",
"description": "Обработка исключений с try-catch.",
"notes": ""
},
"Классы": {
"code": "class Person {\n constructor(name) {\n this.name = name;\n }\n}",
"description": "Определение класса с конструктором.",
"notes": ""
},
"Модули": {
"code": "// В одном файле\nexport function add(a, b) { return a + b; }\n\n// В другом файле\nimport { add } from './math.js';",
"description": "Экспорт и импорт модулей.",
"notes": ""
}
}
}