Skip to content

Commit 512f72c

Browse files
authored
Add files via upload
1 parent 0e32148 commit 512f72c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4591
-0
lines changed
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "4ddcd67d-36ae-41e6-b70c-134ebbd81efa",
6+
"metadata": {},
7+
"source": [
8+
"Chapter 06\n",
9+
"# 加法\n",
10+
"Book_1《编程不难》 | 鸢尾花书:从加减乘除到机器学习 "
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 1,
16+
"id": "0bfca160-0126-4006-8fcb-2a862f32fa04",
17+
"metadata": {},
18+
"outputs": [
19+
{
20+
"name": "stdout",
21+
"output_type": "stream",
22+
"text": [
23+
"30.0\n"
24+
]
25+
}
26+
],
27+
"source": [
28+
"# 数值加法\n",
29+
"a = 10 # 整数\n",
30+
"b = 20.0 # 浮点数\n",
31+
"c = a + b # 浮点数\n",
32+
"print(c) "
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": 2,
38+
"id": "8b3afba9-c268-4eae-b5d7-7a485caa9d76",
39+
"metadata": {},
40+
"outputs": [
41+
{
42+
"name": "stdout",
43+
"output_type": "stream",
44+
"text": [
45+
"1020.0\n"
46+
]
47+
}
48+
],
49+
"source": [
50+
"# 字符串拼接\n",
51+
"str_a = \"10\" # str(a)\n",
52+
"str_b = \"20.0\" # str(b)\n",
53+
"str_c = str_a + str_b\n",
54+
"print(str_c) "
55+
]
56+
}
57+
],
58+
"metadata": {
59+
"kernelspec": {
60+
"display_name": "Python 3 (ipykernel)",
61+
"language": "python",
62+
"name": "python3"
63+
},
64+
"language_info": {
65+
"codemirror_mode": {
66+
"name": "ipython",
67+
"version": 3
68+
},
69+
"file_extension": ".py",
70+
"mimetype": "text/x-python",
71+
"name": "python",
72+
"nbconvert_exporter": "python",
73+
"pygments_lexer": "ipython3",
74+
"version": "3.10.9"
75+
}
76+
},
77+
"nbformat": 4,
78+
"nbformat_minor": 5
79+
}
+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "3bf8e892-7dcf-41cf-bbc5-bac98bb95ca2",
6+
"metadata": {},
7+
"source": [
8+
"Chapter 06\n",
9+
"# 乘法\n",
10+
"Book_1《编程不难》 | 鸢尾花书:从加减乘除到机器学习 "
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 1,
16+
"id": "c0e0bb69-0e60-4910-9af3-5b26e8cf384f",
17+
"metadata": {},
18+
"outputs": [],
19+
"source": [
20+
"# 数值乘法\n",
21+
"a = 10 # 整数\n",
22+
"b = 20.0 # 浮点数"
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": 2,
28+
"id": "d87536fb-2bbd-4ef9-9e61-89a5477a2fd9",
29+
"metadata": {},
30+
"outputs": [
31+
{
32+
"name": "stdout",
33+
"output_type": "stream",
34+
"text": [
35+
"200.0\n"
36+
]
37+
}
38+
],
39+
"source": [
40+
"c = a * b # 浮点数\n",
41+
"print(c) "
42+
]
43+
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": 3,
47+
"id": "4028934d-7677-47b6-960d-fdbaa2770867",
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"# 字符串复制\n",
52+
"str_a = \"10\" # str(a)\n",
53+
"str_b = \"20.0\" # str(b)"
54+
]
55+
},
56+
{
57+
"cell_type": "code",
58+
"execution_count": 4,
59+
"id": "182310c7-a6c0-4298-bb9d-0f7f6ff38b54",
60+
"metadata": {},
61+
"outputs": [],
62+
"source": [
63+
"str_c = str_a * 3\n",
64+
"str_d = str_b * 2"
65+
]
66+
},
67+
{
68+
"cell_type": "code",
69+
"execution_count": 5,
70+
"id": "ad0d5de5-43ee-4999-a81b-940974924f7e",
71+
"metadata": {},
72+
"outputs": [
73+
{
74+
"name": "stdout",
75+
"output_type": "stream",
76+
"text": [
77+
"101010\n",
78+
"20.020.0\n"
79+
]
80+
}
81+
],
82+
"source": [
83+
"print(str_c) \n",
84+
"print(str_d) "
85+
]
86+
}
87+
],
88+
"metadata": {
89+
"kernelspec": {
90+
"display_name": "Python 3 (ipykernel)",
91+
"language": "python",
92+
"name": "python3"
93+
},
94+
"language_info": {
95+
"codemirror_mode": {
96+
"name": "ipython",
97+
"version": 3
98+
},
99+
"file_extension": ".py",
100+
"mimetype": "text/x-python",
101+
"name": "python",
102+
"nbconvert_exporter": "python",
103+
"pygments_lexer": "ipython3",
104+
"version": "3.10.9"
105+
}
106+
},
107+
"nbformat": 4,
108+
"nbformat_minor": 5
109+
}
+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "d8392c8f-74ae-4612-b2fc-a94a8b2ad16b",
6+
"metadata": {},
7+
"source": [
8+
"Chapter 06\n",
9+
"# 比较运算符\n",
10+
"Book_1《编程不难》 | 鸢尾花书:从加减乘除到机器学习 "
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 1,
16+
"id": "24ed9226-9179-4b89-9a86-002c104f5bfe",
17+
"metadata": {},
18+
"outputs": [],
19+
"source": [
20+
"x = 5\n",
21+
"y = 3"
22+
]
23+
},
24+
{
25+
"cell_type": "code",
26+
"execution_count": 2,
27+
"id": "8b56b84e-1edf-4bd7-934d-d5baface282b",
28+
"metadata": {},
29+
"outputs": [
30+
{
31+
"name": "stdout",
32+
"output_type": "stream",
33+
"text": [
34+
"False\n",
35+
"True\n",
36+
"True\n",
37+
"False\n",
38+
"False\n"
39+
]
40+
}
41+
],
42+
"source": [
43+
"print(x == y) # False\n",
44+
"print(x == 5) # True\n",
45+
"print(x != y) # True\n",
46+
"print(x != 5) # False\n",
47+
"print(x != 5.0) # False"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": 3,
53+
"id": "3de552a2-f2c8-4d73-9c7e-d4d295a96341",
54+
"metadata": {},
55+
"outputs": [
56+
{
57+
"name": "stdout",
58+
"output_type": "stream",
59+
"text": [
60+
"True\n",
61+
"False\n",
62+
"True\n",
63+
"True\n"
64+
]
65+
}
66+
],
67+
"source": [
68+
"print(x > y) # True\n",
69+
"print(x > 10) # False\n",
70+
"print(x >= y) # True\n",
71+
"print(x >= 5) # True"
72+
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": 4,
77+
"id": "2cdde88d-0452-4dfa-92e5-1551f2be7089",
78+
"metadata": {},
79+
"outputs": [
80+
{
81+
"name": "stdout",
82+
"output_type": "stream",
83+
"text": [
84+
"False\n",
85+
"True\n",
86+
"False\n",
87+
"True\n"
88+
]
89+
}
90+
],
91+
"source": [
92+
"print(x < y) # False\n",
93+
"print(x < 10) # True\n",
94+
"print(x <= y) # False\n",
95+
"print(x <= 5) # True"
96+
]
97+
}
98+
],
99+
"metadata": {
100+
"kernelspec": {
101+
"display_name": "Python 3 (ipykernel)",
102+
"language": "python",
103+
"name": "python3"
104+
},
105+
"language_info": {
106+
"codemirror_mode": {
107+
"name": "ipython",
108+
"version": 3
109+
},
110+
"file_extension": ".py",
111+
"mimetype": "text/x-python",
112+
"name": "python",
113+
"nbconvert_exporter": "python",
114+
"pygments_lexer": "ipython3",
115+
"version": "3.10.9"
116+
}
117+
},
118+
"nbformat": 4,
119+
"nbformat_minor": 5
120+
}

0 commit comments

Comments
 (0)