Wed May 17 07:46:00 UTC 2023 inscode

上级 73f390cf
...@@ -117,7 +117,28 @@ ...@@ -117,7 +117,28 @@
"id": "27161d42", "id": "27161d42",
"metadata": {}, "metadata": {},
"outputs": [], "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": { "metadata": {
...@@ -136,7 +157,7 @@ ...@@ -136,7 +157,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.10" "version": "3.8.10 (default, Mar 13 2023, 10:26:41) \n[GCC 9.4.0]"
}, },
"vscode": { "vscode": {
"interpreter": { "interpreter": {
......
print('欢迎来到 InsCode') print('欢迎来到 InsCode')
with open('example.txt', 'r') as file:
content = file.read()
print(content)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册