14ee2f7
joyvan 6 years ago
2 changed file(s) with 62 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
1010 "cell_type": "markdown",
1111 "metadata": {},
1212 "source": [
13 "## 1.1 Python 简介\n",
13 "## 1.1.1 Python 简介\n",
1414 "\n",
1515 "<img src=\"https://www.python.org/static/img/python-logo@2x.png\" width=300/> \n",
1616 "\n",
4040 "cell_type": "markdown",
4141 "metadata": {},
4242 "source": [
43 "## 1.2 数据类型\n",
43 "## 1.1.2 数据类型\n",
4444 "\n",
4545 "| 类型| 例子|\n",
4646 "| ----- | ----- |\n",
189189 "cell_type": "markdown",
190190 "metadata": {},
191191 "source": [
192 "## 1.3 字符串"
192 "数值型转字符串:"
193 ]
194 },
195 {
196 "cell_type": "code",
197 "execution_count": null,
198 "metadata": {},
199 "outputs": [],
200 "source": [
201 "str(1)"
202 ]
203 },
204 {
205 "cell_type": "markdown",
206 "metadata": {},
207 "source": [
208 "字符串转数字型:"
209 ]
210 },
211 {
212 "cell_type": "code",
213 "execution_count": null,
214 "metadata": {},
215 "outputs": [],
216 "source": [
217 "int('1')"
218 ]
219 },
220 {
221 "cell_type": "markdown",
222 "metadata": {},
223 "source": [
224 "## 1.1.3 字符串"
193225 ]
194226 },
195227 {
364396 "cell_type": "markdown",
365397 "metadata": {},
366398 "source": [
367 "## 1.4 索引和分片\n",
399 "## 1.1.4 索引和分片\n",
368400 "\n",
369401 "### 索引\n",
370402 "\n",
440472 "cell_type": "markdown",
441473 "metadata": {},
442474 "source": [
443 "## 1.5 列表\n",
475 "## 1.1.5 列表\n",
444476 "\n",
445477 "列表是一个有序的序列。\n",
446478 "\n",
918950 "cell_type": "markdown",
919951 "metadata": {},
920952 "source": [
921 "## 1.6 字典\n",
953 "## 1.1.6 字典\n",
922954 "\n",
923955 "字典 `dictionary` ,在一些编程语言中也称为 `hash` , `map` ,是一种由键值对组成的数据结构。\n",
924956 "\n",
10971129 "cell_type": "markdown",
10981130 "metadata": {},
10991131 "source": [
1100 "## 1.7 元组\n",
1132 "## 1.1.7 元组\n",
11011133 "\n",
11021134 "元组`Tuple`也是个有序序列,但是元组是不可变的,用`()`生成。"
11031135 ]
11531185 "cell_type": "markdown",
11541186 "metadata": {},
11551187 "source": [
1156 "## 1.8 集合"
1188 "可以把元组转为列表:"
1189 ]
1190 },
1191 {
1192 "cell_type": "code",
1193 "execution_count": null,
1194 "metadata": {},
1195 "outputs": [],
1196 "source": [
1197 "a = (10, 11, 12, 13, 14)\n",
1198 "b = list(a)\n",
1199 "print(b)\n",
1200 "type(b)"
1201 ]
1202 },
1203 {
1204 "cell_type": "markdown",
1205 "metadata": {},
1206 "source": [
1207 "## 1.1.8 集合"
11571208 ]
11581209 },
11591210 {
12391290 "cell_type": "markdown",
12401291 "metadata": {},
12411292 "source": [
1242 "## 1.9 判断语句"
1293 "## 1.1.9 判断语句"
12431294 ]
12441295 },
12451296 {
14791530 "cell_type": "markdown",
14801531 "metadata": {},
14811532 "source": [
1482 "## 1.10 循环\n",
1533 "## 1.1.10 循环\n",
14831534 "\n",
14841535 "循环的作用在于将一段代码重复执行多次。\n",
14851536 "\n",
14651465 "fruits = ['apple', 'orange', 'pear']\n",
14661466 "sales = [100,250,300]\n",
14671467 "plt.pie(sales, labels=fruits)\n",
1468 "plt.savefig('pie.jpg')\n",
1468 "plt.savefig('pie.png')\n",
14691469 "plt.show()\n"
14701470 ]
14711471 },