Skip to content

Commit 4fe3bf5

Browse files
committed
2016.11.26 create dir, begin to edit python basic lesson 1 notebook
1 parent 39823d3 commit 4fe3bf5

File tree

2 files changed

+297
-0
lines changed

2 files changed

+297
-0
lines changed
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"Preparation Work\n",
8+
"\n",
9+
"Please visit: https://www.python.org/downloads/ download the latest Python and tools\n",
10+
"Python version: 3.5.2 and 2.7.12\n",
11+
"\n",
12+
"Why we study Python\n",
13+
"\n",
14+
"Top-ranked CS departments at MIT and UC Berkeley recently switched their introductory courses to Python. \n",
15+
"The largest three MOOC providers (edX, Coursera, and Udacity) all offer introductory programming courses in Python. \n",
16+
"And professors in diverse subfields (e.g., Lorena Barba) are now advocating for teaching Python to novices.\n",
17+
"\n",
18+
"Shortcut of programming\n",
19+
"\n",
20+
"世界观和人生观\n",
21+
"天赋\n",
22+
"勤奋\n",
23+
"阅读\n",
24+
"实践,实践,再实践\n",
25+
"搜索技巧\n",
26+
"\n",
27+
"\n",
28+
"Python 简介\n",
29+
"基本变量概念\n",
30+
"Print() 和 Input() 用法\n",
31+
"Python IDLE 用法\n",
32+
"交互式 python 环境 Juypter 介绍\n",
33+
"\n",
34+
"about LISTS\n",
35+
"\n",
36+
"“Lists are mutable sequences, typically used to store collections of homogeneous items (where the precise degree of similarity will vary by application).” \n",
37+
"Very powerful, can store many kinds of real world data \n",
38+
"Create list\n",
39+
"Add an item\n",
40+
"Delete an item\n",
41+
"Sort\n",
42+
"Multidimensional\n",
43+
"Save and load\n",
44+
"\n",
45+
"Homework\n",
46+
"What can PRINT() statement do? please name an example of a relatively complicated coding\n",
47+
"If you were asked to develop an XPRINT statement in order to extend current one, which functions do you think need to be improved or added?\n",
48+
"Group assignment\n",
49+
"\n",
50+
"\n"
51+
]
52+
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": 1,
56+
"metadata": {
57+
"collapsed": false
58+
},
59+
"outputs": [
60+
{
61+
"name": "stdout",
62+
"output_type": "stream",
63+
"text": [
64+
"100\n",
65+
"100\n"
66+
]
67+
}
68+
],
69+
"source": [
70+
"print(100)\n",
71+
"\n",
72+
"a = 100\n",
73+
"print(a)"
74+
]
75+
},
76+
{
77+
"cell_type": "code",
78+
"execution_count": null,
79+
"metadata": {
80+
"collapsed": true
81+
},
82+
"outputs": [],
83+
"source": [
84+
"print(100, 200, 300)"
85+
]
86+
},
87+
{
88+
"cell_type": "code",
89+
"execution_count": null,
90+
"metadata": {
91+
"collapsed": true
92+
},
93+
"outputs": [],
94+
"source": [
95+
"name = input('name:')\n",
96+
"print( 'hello', name)"
97+
]
98+
},
99+
{
100+
"cell_type": "code",
101+
"execution_count": null,
102+
"metadata": {
103+
"collapsed": true
104+
},
105+
"outputs": [],
106+
"source": [
107+
"a = 10\n",
108+
"if a > 10:\n",
109+
" print('big')\n",
110+
"else:\n",
111+
" print('small')"
112+
]
113+
},
114+
{
115+
"cell_type": "code",
116+
"execution_count": null,
117+
"metadata": {
118+
"collapsed": true
119+
},
120+
"outputs": [],
121+
"source": [
122+
"for i in range(10):\n",
123+
" print(i)"
124+
]
125+
},
126+
{
127+
"cell_type": "code",
128+
"execution_count": null,
129+
"metadata": {
130+
"collapsed": true
131+
},
132+
"outputs": [],
133+
"source": [
134+
"a = ['pig', 'cat', 'dog']\n",
135+
"print(a)\n",
136+
"print(a[0])\n",
137+
"print(a[-1])"
138+
]
139+
},
140+
{
141+
"cell_type": "code",
142+
"execution_count": null,
143+
"metadata": {
144+
"collapsed": true
145+
},
146+
"outputs": [],
147+
"source": [
148+
"a.append('snake')\n",
149+
"print(a)\n",
150+
"\n",
151+
"a.pop(1)\n",
152+
"print(a)\n",
153+
"\n",
154+
"a.remove('dog')\n",
155+
"print(a)\n",
156+
"\n",
157+
"a = ['pig', 'cat', 'dog', 'snake', 'snake']\n",
158+
"a.sort()\n",
159+
"print(a)\n",
160+
"\n",
161+
"b = ['cat1', 'cat2', 'cat3']\n",
162+
"a.append(b)\n",
163+
"print(a)\n",
164+
"\n",
165+
"import pickle\n",
166+
"f = open('list_dump.txt', 'wb')\n",
167+
"a = ['pig', 'cat', 'dog', 'snake', 'snake']\n",
168+
"pickle.dump(a, f)\n",
169+
"f.close()\n",
170+
"\n",
171+
"f = open('list_dump.txt', 'rb')\n",
172+
"a1 = pickle.load(f)\n",
173+
"f.close()\n",
174+
"print(a1)\n",
175+
"\n",
176+
"a = ['pig', 'cat', 'dog', 'dog']\n",
177+
"a1 = [x for x in a if a.count(x) <= 1]\n",
178+
"print(a1)"
179+
]
180+
}
181+
],
182+
"metadata": {
183+
"kernelspec": {
184+
"display_name": "Python 3",
185+
"language": "python",
186+
"name": "python3"
187+
},
188+
"language_info": {
189+
"codemirror_mode": {
190+
"name": "ipython",
191+
"version": 3
192+
},
193+
"file_extension": ".py",
194+
"mimetype": "text/x-python",
195+
"name": "python",
196+
"nbconvert_exporter": "python",
197+
"pygments_lexer": "ipython3",
198+
"version": "3.5.1"
199+
}
200+
},
201+
"nbformat": 4,
202+
"nbformat_minor": 0
203+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"python 学习初级大纲(暂定)\n",
8+
"\n",
9+
"最后更新日期:2016.11.26\n",
10+
"\n",
11+
"lesson 1\n",
12+
"1.\tpython 简介\n",
13+
"2.\t基本变量概念\n",
14+
"3.\tprint() 和 input() 用法\n",
15+
"4.\tpython idle 用法\n",
16+
"5.\tjupyter 和 notebook介绍\n",
17+
"\n",
18+
"lesson 2 \n",
19+
"1.\t循环语句 for 用法\n",
20+
"2.\trange() 用法\n",
21+
"3.\t举例\n",
22+
"\n",
23+
"lesson 3\n",
24+
"1.\t字符串基本用法\n",
25+
"2.\t表达式用法\n",
26+
"3.\t举例\n",
27+
"\n",
28+
"lesson 4\n",
29+
"\n",
30+
"1.\t数据类型 list 基本用法\n",
31+
"2.\t编程思维解释\n",
32+
"\n",
33+
"lesson 5\n",
34+
"1.\t数据类型 dict 基本用法\n",
35+
"2.\t循环语句 while 用法\n",
36+
"3.\t举例:猜数游戏\n",
37+
"\n",
38+
"lesson 6\n",
39+
"1.\ttuple 用法,相对 list 比较\n",
40+
"2.\t随机数介绍\n",
41+
"3.\t函数 基本用法1\n",
42+
"4.\t举例:剪刀石头布\n",
43+
"\n",
44+
"lesson 7\n",
45+
"1.\tlist 的切片用法\n",
46+
"2.\t函数 基本用法2\n",
47+
"3.\t测验:input, print, for, while, if, list, dict, tuple, 随机数, 函数\n",
48+
"\n",
49+
"lesson 8\n",
50+
"1.\t日期库 datetime 用法介绍,datetime、time 等库的介绍,获得日期,字符串和日期转换,日期格式介绍,日期加减计算\n",
51+
"\n",
52+
"lesson 9\n",
53+
"2.\t集合库 collections 简介\n",
54+
"3.\tOrderedDict 有序字典介绍\n",
55+
"4.\tCounter 计数器介绍\n",
56+
"5.\t函数不同参数形式介绍和举例 \n",
57+
"\n",
58+
"lesson 10\n",
59+
"1.\t错误处理介绍\n",
60+
"2.\t复习概念1\n",
61+
"3.\t程序训练1\n",
62+
"\n",
63+
"lesson 11\n",
64+
"1.\t复习概念2\n",
65+
"2.\t程序训练2\n",
66+
"\n",
67+
"lesson 12\n",
68+
"1.\tpython 功能介绍\n",
69+
"2.\t初级考试\n"
70+
]
71+
}
72+
],
73+
"metadata": {
74+
"kernelspec": {
75+
"display_name": "Python 3",
76+
"language": "python",
77+
"name": "python3"
78+
},
79+
"language_info": {
80+
"codemirror_mode": {
81+
"name": "ipython",
82+
"version": 3
83+
},
84+
"file_extension": ".py",
85+
"mimetype": "text/x-python",
86+
"name": "python",
87+
"nbconvert_exporter": "python",
88+
"pygments_lexer": "ipython3",
89+
"version": "3.5.1"
90+
}
91+
},
92+
"nbformat": 4,
93+
"nbformat_minor": 0
94+
}

0 commit comments

Comments
 (0)