diff --git a/README.md b/README.md index 979a993..ae4e10b 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ ->In the begning when God created the heavens and the earth. the earth was a formless void and darkness covered the face of the deep, while a wind from God swept over the face of the waters. Then God said,"Let there be light"; and there was light. And God saw that the light was good; and God separated the light from the darkness. (GENESIS 1:1-4) +# 注意:本书已经停止印刷,请学习者转到:《Python完全自学教程》中学习,这是一本开源免费的在线读物,地址:https://github.com/qiwsir/PythonBook # 《跟老齐学Python:轻松入门》 @@ -7,30 +7,3 @@ ![](./python-book1.png) # 相关资源 - -## 个人网站 - -[itdiffer.com](http://www.itdiffer.com) - -## QQ群:26913719 - -说明:此QQ群是读者交流,而非作者答疑区,请特别注意。如果读者有问题,可以在群里面跟其它读者交流。作者没有答疑的义务。恕不接待任何形式的答疑。 - -关于本QQ群的更多说明: - -- 加入本群,收费1元,目的是免群主审核,并且拦住广告发布人。如果对此有异议,请不要加入。 -- 因为设置了上述功能,群主无法单独邀请用户加入了(这是QQ方面的规定),所以,不要让群主邀请。 -- 更不要通过其它途径给群主一块钱,然后让群主想办法把你加到群里,群主表示做不到。 - -再次提醒:对入群收费1元,有异议者请不要加入。 - -# 本书配套小程序 - -小程序名称:跟老齐学 - - - -# Python学习资源推荐: - -- 系列图书《跟老齐学Python:Django实战》、《跟老齐学Python:数据分析》,各大网店和书店有售 -- 在线课程:[Python3入门和能力提升](https://www.cctalk.com/m/course/111302) diff --git a/videolesson/arithmetic.py b/videolesson/arithmetic.py new file mode 100644 index 0000000..b7f2ce5 --- /dev/null +++ b/videolesson/arithmetic.py @@ -0,0 +1,22 @@ +#coding:utf-8 + +''' +lesson 07-6 +filename: arithmetic.py +''' + +print('Please input two int:') +a = input('a number:') +b = input('another number:') +a = int(a) +b = int(b) + +add_result = a + b +sub_result = a - b +mul_result = a * b +div_result = a / b + +print(a, " + ", b, ' = ', add_result) +print(a, " - ", b, ' = ', sub_result) +print(a, " * ", b, ' = ', mul_result) +print(a, " / ", b, ' = ', div_result) \ No newline at end of file diff --git a/videolesson/country.py b/videolesson/country.py new file mode 100644 index 0000000..2e11dfc --- /dev/null +++ b/videolesson/country.py @@ -0,0 +1,12 @@ +#coding:utf-8 + +''' +lesson 15-3 +filename: country.py +''' + +country = {"CHINA": "BEIJING", 'CANADA': "OTTAWA", 'GREECE': 'ATHENS', 'ITALY': 'ROME'} + +name = input("input the name of country:") +capital = country[name] +print(name, "-->", capital) \ No newline at end of file diff --git a/videolesson/judge_input.py b/videolesson/judge_input.py new file mode 100644 index 0000000..0c6a52f --- /dev/null +++ b/videolesson/judge_input.py @@ -0,0 +1,13 @@ +#coding:utf-8 +''' + lesson 19-03 + filename: judge_input.py +''' +input_char = input("Input something: ") +if input_char.isdigit(): + result = int(input_char) * 10 + print("You input {0}. Output is {1}".format(input_char, result)) +elif input_char.isalpha(): + print(input_char + "@python") +else: + print(input_char) \ No newline at end of file diff --git a/videolesson/newton.py b/videolesson/newton.py new file mode 100644 index 0000000..a35f0e3 --- /dev/null +++ b/videolesson/newton.py @@ -0,0 +1,12 @@ +#coding: utf-8 +''' + calculate the square root by Newton's method. + lesson 22-1 + filename: newton.py +''' +value = 23 #f(x) = x^2 - 23 +epsilon = 0.001 +result = value / 2 +while abs(result*result - value) >= epsilon: + result = result - ((result*result - value) / (2 * result)) +print("The square root of {0} is about {1}".format(value, result)) \ No newline at end of file diff --git a/videolesson/odd_even.py b/videolesson/odd_even.py new file mode 100644 index 0000000..f2f83f1 --- /dev/null +++ b/videolesson/odd_even.py @@ -0,0 +1,16 @@ +#coding:utf-8 +''' + lesson 19-04 + filename: odd_even.py +''' +lst = [1,2,3,4,5,6,7,8,9,10] +odd = [] +even = [] +for i in lst: + if i % 2 == 0: + even.append(i) + else: + odd.append(i) + +print("odd: ", odd) +print("even: ", even) \ No newline at end of file