From 6abd04b77b51fe5fbde097c4c1de848ea23c0923 Mon Sep 17 00:00:00 2001 From: 622aa39c1f9b166ab1a38c05 <622aa39c1f9b166ab1a38c05@devide> Date: Wed, 17 May 2023 07:46:00 +0000 Subject: [PATCH] Wed May 17 07:46:00 UTC 2023 inscode --- Untitled1.ipynb | 25 +++++++++++++++++++++++-- main.py | 5 ++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Untitled1.ipynb b/Untitled1.ipynb index 0237543..f477d9d 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 4c0c135..7fa5312 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) -- GitLab