diff --git a/Untitled1.ipynb b/Untitled1.ipynb index 0237543c51be11d304b52e7f4ed7de2a1a635600..f477d9d99b7462e3c9f19c2621ac5b42cfc230a4 100644 --- a/Untitled1.ipynb +++ b/Untitled1.ipynb @@ -117,7 +117,28 @@ "id": "27161d42", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "function bubbleSort(arr) {\n", + " var len = arr.length;\n", + " for (var i = 0; i < len - 1; i++) {\n", + " for (var j = 0; j < len - 1 - i; j++) {\n", + " if (arr[j] > arr[j + 1]) {\n", + " var temp = arr[j + 1];\n", + " arr[j + 1] = arr[j];\n", + " arr[j] = temp;\n", + " }\n", + " }\n", + " }\n", + " return arr;\n", + "}\n", + "\n", + "document.getElementById(\"myBtn\").addEventListener(\"click\", function() {\n", + " var arr = [64, 34, 25, 12, 22, 11, 90];\n", + " console.log(\"排序前的数组: \" + arr);\n", + " bubbleSort(arr);\n", + " console.log(\"排序后的数组: \" + arr);\n", + "});\n" + ] } ], "metadata": { @@ -136,7 +157,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.8.10 (default, Mar 13 2023, 10:26:41) \n[GCC 9.4.0]" }, "vscode": { "interpreter": { diff --git a/main.py b/main.py index 4c0c135f61696bcf42c375ca5ab62aa5b105afc8..7fa5312230adab94604800ce0df00d08dd2f257f 100644 --- a/main.py +++ b/main.py @@ -1 +1,4 @@ -print('欢迎来到 InsCode') \ No newline at end of file +print('欢迎来到 InsCode') +with open('example.txt', 'r') as file: + content = file.read() + print(content)