From b74842a24795c82f125e26440e7de7c9293fb3d9 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Mon, 21 Dec 2020 23:18:08 +0800 Subject: [PATCH 01/14] week class3 --- ...50\347\254\254\344\270\211\350\257\276.py" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\200\345\221\250\347\254\254\344\270\211\350\257\276.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\200\345\221\250\347\254\254\344\270\211\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\200\345\221\250\347\254\254\344\270\211\350\257\276.py" new file mode 100644 index 00000000..c90c7ba7 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\200\345\221\250\347\254\254\344\270\211\350\257\276.py" @@ -0,0 +1,19 @@ +aa = True +bb = b'hello world!' +cc = None + +a = [3, 3.14, 'hello world', aa, bb, cc] +b = (3, 3.14, 'hello world', aa, bb, cc) +c = { + "a01":3, + "a02":3.14, + "a03":'hello world', + "a04":aa, + "a05":bb, + "a06":cc, +} +d = {3, 3.14, 'hello world', aa, bb, cc} +print(a) +print(b) +print(c) +print(d) -- Gitee From 71bda5c92292fa4f6605fb7c9b031e2b9a211641 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Wed, 23 Dec 2020 20:10:28 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\270\200\350\257\276.py" | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" new file mode 100644 index 00000000..44f74e8b --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" @@ -0,0 +1,53 @@ + +#加法运算 +def add(a, b): + c = a+b + return c + +result = add(2, 5) +print(result) + + +#减法运算 +def sub(a, b): + c = a-b + return c + +result=sub(8, 5) +print(result) + + +#乘法运算 +def mul(a, b): + c = a*b + return c + +result=mul(2, 3) +print(result) + + +#除法运算 +def div(a, b): + c = a/b + return c + +result=div(8, 2) +print(result) + + +#取余运算 +def rem(a, b): + c = a%b + return c + +result=rem(7, 3) +print(result) + + +#开方运算 +def pre(a): + c = a**(1/2) + return c + +result=pre(9) +print(result) -- Gitee From 65b50196a968cd773563e203a04b675a6cb1cda6 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Wed, 23 Dec 2020 20:35:09 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\270\200\350\257\276.py" | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" index 44f74e8b..815c3c74 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" @@ -1,7 +1,7 @@ #加法运算 def add(a, b): - c = a+b + c = a + b return c result = add(2, 5) @@ -10,44 +10,44 @@ print(result) #减法运算 def sub(a, b): - c = a-b + c = a - b return c -result=sub(8, 5) +result = sub(8, 5) print(result) #乘法运算 def mul(a, b): - c = a*b + c = a * b return c -result=mul(2, 3) +result = mul(2, 3) print(result) #除法运算 def div(a, b): - c = a/b + c = a / b return c -result=div(8, 2) +result = div(8, 2) print(result) #取余运算 def rem(a, b): - c = a%b + c = a % b return c -result=rem(7, 3) +result = rem(7, 3) print(result) #开方运算 def pre(a): - c = a**(1/2) + c = a ** (1/2) return c -result=pre(9) +result = pre(9) print(result) -- Gitee From 76731aa7312692dff853595c2e1ba03a77d071fe Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Fri, 25 Dec 2020 22:01:49 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\272\214\350\257\276.py" | 82 +++++++++++++++++++ ...0\347\254\254\344\272\214\350\257\276.txt" | 78 ++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.txt" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" new file mode 100644 index 00000000..2ed404cc --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" @@ -0,0 +1,82 @@ +output = open("第二周第二课.txt", "w", encoding="utf-8") +content = """ + +#字符串的编码和解码 +>>> a = "我爱python" +>>> a.encode("utf-8") +b'\xe6\x88\x91\xe7\x88\xb1python' +>>> b = a.encode("utf-8") +>>> b.decode("utf-8") +'我爱python' + + +#字符串的CRUD操作 +#1、创建(create) +>>> a = "hello" +>>> a = a + "world" +>>> a +'helloworld' + + +>>> a = "hello" +>>> a += "world" +>>> a +'helloworld' + + +#2、检索 +>>> a = "I love python" +>>> a[3] +'o' +>>> a.find("o") +3 + +>>> a = "12345.*****" +>>> a.startswith("12345") +True +>>> b = "*****_python" +>>> b.endswith("python") +True + +#3、更新(update) +>>> a = "I love pythen" +>>> a.replace("en", "on") +'I love python' + +>>> b = "apple, pear, banana, orange" +>>> b.split(",") +['apple', ' pear', ' banana', ' orange'] + +>>> c = b.split(",") +>>> ",".join(c) +'apple, pear, banana, orange' + +#4、删除 +>>> d = " I love python " +>>> d.strip() +'I love python' +>>> d.lstrip() +'I love python ' +>>> d.rstrip() +' I love python' + + +#字符串的格式化输出 +>>> a = "I" +>>> b = "love" +>>> c = "python" +>>> "{} {} {}".format(a, b, c) +'I love python' +>>> "{a} {b} {c}".format(a = "I", b = "love", c = "python") +'I love python' +>>> print(f"{a} {b} {c}") +I love python + +>>> a = 2.71828 +>>> "{:.3f}".format(a) +'2.718' + + +""" +output.write(content) +output.close() \ No newline at end of file diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.txt" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.txt" new file mode 100644 index 00000000..31ce5d9b --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.txt" @@ -0,0 +1,78 @@ + + +#字符串的编码和解码 +>>> a = "我爱python" +>>> a.encode("utf-8") +b'我爱python' +>>> b = a.encode("utf-8") +>>> b.decode("utf-8") +'我爱python' + + +#字符串的CRUD操作 +#1、创建(create) +>>> a = "hello" +>>> a = a + "world" +>>> a +'helloworld' + + +>>> a = "hello" +>>> a += "world" +>>> a +'helloworld' + + +#2、检索 +>>> a = "I love python" +>>> a[3] +'o' +>>> a.find("o") +3 + +>>> a = "12345.*****" +>>> a.startswith("12345") +True +>>> b = "*****_python" +>>> b.endswith("python") +True + +#3、更新(update) +>>> a = "I love pythen" +>>> a.replace("en", "on") +'I love python' + +>>> b = "apple, pear, banana, orange" +>>> b.split(",") +['apple', ' pear', ' banana', ' orange'] + +>>> c = b.split(",") +>>> ",".join(c) +'apple, pear, banana, orange' + +#4、删除 +>>> d = " I love python " +>>> d.strip() +'I love python' +>>> d.lstrip() +'I love python ' +>>> d.rstrip() +' I love python' + + +#字符串的格式化输出 +>>> a = "I" +>>> b = "love" +>>> c = "python" +>>> "{} {} {}".format(a, b, c) +'I love python' +>>> "{a} {b} {c}".format(a = "I", b = "love", c = "python") +'I love python' +>>> print(f"{a} {b} {c}") +I love python + +>>> a = 2.71828 +>>> "{:.3f}".format(a) +'2.718' + + -- Gitee From ef56e637f83afe75a7480c729f910115a5008350 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Sun, 27 Dec 2020 22:13:15 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\270\211\350\257\276.py" | 164 ++++++++++++++++++ ...0\347\254\254\344\270\211\350\257\276.txt" | 160 +++++++++++++++++ ...50\347\254\254\344\272\214\350\257\276.py" | 2 +- 3 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" new file mode 100644 index 00000000..4911b1e8 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" @@ -0,0 +1,164 @@ +output = open("第二周第三课.txt", "w", encoding="utf-8") +content = """ + + +#append(末尾添加元素) +>>> list_1 = ['a', 'b',] +>>> list_1.append('c') +>>> list_1 +['a', 'b', 'c'] + +#+和+= +>>> list_1 = ['a', 'b'] +>>> list_2 = ['c'] +>>> list_1 = list_1 + list_2 +>>> list_1 +['a', 'b', 'c'] + +>>> list_3 = ['ff'] +>>> list_1 += list_3 +>>> list_1 +['a', 'b', 'c', 'ff'] + +#*和*= +>>> list_1 = ['cc'] +>>> list_1 = list_1 * 10 +>>> list_1 +['cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc'] +>>> list_2 = ['dd'] +>>> list_2 *= 10 +>>> list_2 +['dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd'] + +#insert指定位置添加元素 +>>> list_1 = ['1', '2', '3'] +>>> list_.insert(1,'b') +>>> list_1 +['1', 'b', '2', '3'] + +#索引取值 +>>> list_1 = ['1', '2', '3'] +>>> list_1[2] +'3' + +#切片 +>>>list_1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] +>>> list_1[0:10:2] +[1, 3, 5, 7, 9] +>>> list_1[-1] +20 +>>> list_1.index(1) +0 + +#update +>>> list_1 = ['a', 'b', 'c', 'd', 'e', 'f'] +>>> list_1[1] = '00' +>>> list_1 +['a', '00', 'c', 'd', 'e', 'f'] +>>> list_1[1:3] = "45" +>>> list_1 +['a', '4', '5', 'd', 'e', 'f'] + +#delete +>>> list_1 = ['1', '2', '3'] +>>> list_1.pop() +'3' +>>> list_1.clear() +>>> list_1 +[] + +#排序 +>>> list_1 = [1, 2, 3, 4, 5] +>>> list_1 = [5, 6, 1, 9, 10] +>>> list_1.sort() +>>> list_1 +[1, 5, 6, 9, 10] + +list_2 = [5, 6, 1, 9, 10] +>>> sorted(list_2) +[1, 5, 6, 9, 10] + +>>> list_1 = [2, 6, 8, 4, 1] +>>> list_2 = [5, 9, 3, 7] +>>> list_1.reverse() +>>> list_1 +[1, 4, 8, 6, 2] + + +#tuple +>>> tuple_1 = ('a', 'b', 'c', 'd') +>>> tuple_1[0] +'a' +>>> tuple_1.index('c') +2 +>>> tuple_1[0:2] +('a', 'b') + + +#dict +>>> dict_1 = {'a': 1, 'b': 2, 'c': 3} +>>> dict_1['d'] = 4 +>>> dict_1 +{'a': 1, 'b': 2, 'c': 3, 'd': 4} +>>> dict_2 = {'e': 5} +>>> dict_1.update(dict_2) +>>> dict_1 +{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5} +>>> dict_1.setdefault('d', 8) +4 +>>> dict_1.setdefault('f', 6) +6 +>>> dict_1['b'] +2 +>>> dict_1.get('g', 7) +7 +>>> dict_1.keys() +dict_keys(['a', 'b', 'c', 'd', 'e', 'f']) +>>> dict_1.values() +dict_values([1, 2, 3, 4, 5, 6]) +>>> dict_1.items() +dict_items([('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6)]) +>>> dict_1['b'] = 24 +>>> dict_1 +{'a': 1, 'b': 24, 'c': 3, 'd': 4, 'e': 5, 'f': 6} +>>> dict_1.update({'h': 10}) +>>> dict_1 +{'a': 1, 'b': 24, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'h': 10} +>>> dict_1.pop('c') +3 +>>> dict_1.popitem() +('h', 10) + + +#set +>>> set_1 = set([1, 2, 3]) +>>> set_1.add(4) +>>> set_1 +{1, 2, 3, 4} +>>> 2 in set_1 +True +>>> set_2 = set([5, 6]) +>>> set_1.update(set_2) +>>> set_1 +{1, 2, 3, 4, 5, 6} +>>> set_3 = set([7]) +>>> set_1.union(set_3) +{1, 2, 3, 4, 5, 6, 7} +>>> set_1.discard(3) +>>> set_1 +{1, 2, 4, 5, 6} +>>> set_1.remove(3) +Traceback (most recent call last): + File "", line 1, in +KeyError: 3 +>>> set_1.discard(3) +>>> + + + + + + +""" +output.write(content) +output.close() \ No newline at end of file diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" new file mode 100644 index 00000000..f88794c3 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" @@ -0,0 +1,160 @@ + + + +#append(末尾添加元素) +>>> list_1 = ['a', 'b',] +>>> list_1.append('c') +>>> list_1 +['a', 'b', 'c'] + +#+和+= +>>> list_1 = ['a', 'b'] +>>> list_2 = ['c'] +>>> list_1 = list_1 + list_2 +>>> list_1 +['a', 'b', 'c'] + +>>> list_3 = ['ff'] +>>> list_1 += list_3 +>>> list_1 +['a', 'b', 'c', 'ff'] + +#*和*= +>>> list_1 = ['cc'] +>>> list_1 = list_1 * 10 +>>> list_1 +['cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc'] +>>> list_2 = ['dd'] +>>> list_2 *= 10 +>>> list_2 +['dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd'] + +#insert指定位置添加元素 +>>> list_1 = ['1', '2', '3'] +>>> list_.insert(1,'b') +>>> list_1 +['1', 'b', '2', '3'] + +#索引取值 +>>> list_1 = ['1', '2', '3'] +>>> list_1[2] +'3' + +#切片 +>>>list_1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] +>>> list_1[0:10:2] +[1, 3, 5, 7, 9] +>>> list_1[-1] +20 +>>> list_1.index(1) +0 + +#update +>>> list_1 = ['a', 'b', 'c', 'd', 'e', 'f'] +>>> list_1[1] = '00' +>>> list_1 +['a', '00', 'c', 'd', 'e', 'f'] +>>> list_1[1:3] = "45" +>>> list_1 +['a', '4', '5', 'd', 'e', 'f'] + +#delete +>>> list_1 = ['1', '2', '3'] +>>> list_1.pop() +'3' +>>> list_1.clear() +>>> list_1 +[] + +#排序 +>>> list_1 = [1, 2, 3, 4, 5] +>>> list_1 = [5, 6, 1, 9, 10] +>>> list_1.sort() +>>> list_1 +[1, 5, 6, 9, 10] + +list_2 = [5, 6, 1, 9, 10] +>>> sorted(list_2) +[1, 5, 6, 9, 10] + +>>> list_1 = [2, 6, 8, 4, 1] +>>> list_2 = [5, 9, 3, 7] +>>> list_1.reverse() +>>> list_1 +[1, 4, 8, 6, 2] + + +#tuple +>>> tuple_1 = ('a', 'b', 'c', 'd') +>>> tuple_1[0] +'a' +>>> tuple_1.index('c') +2 +>>> tuple_1[0:2] +('a', 'b') + + +#dict +>>> dict_1 = {'a': 1, 'b': 2, 'c': 3} +>>> dict_1['d'] = 4 +>>> dict_1 +{'a': 1, 'b': 2, 'c': 3, 'd': 4} +>>> dict_2 = {'e': 5} +>>> dict_1.update(dict_2) +>>> dict_1 +{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5} +>>> dict_1.setdefault('d', 8) +4 +>>> dict_1.setdefault('f', 6) +6 +>>> dict_1['b'] +2 +>>> dict_1.get('g', 7) +7 +>>> dict_1.keys() +dict_keys(['a', 'b', 'c', 'd', 'e', 'f']) +>>> dict_1.values() +dict_values([1, 2, 3, 4, 5, 6]) +>>> dict_1.items() +dict_items([('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6)]) +>>> dict_1['b'] = 24 +>>> dict_1 +{'a': 1, 'b': 24, 'c': 3, 'd': 4, 'e': 5, 'f': 6} +>>> dict_1.update({'h': 10}) +>>> dict_1 +{'a': 1, 'b': 24, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'h': 10} +>>> dict_1.pop('c') +3 +>>> dict_1.popitem() +('h', 10) + + +#set +>>> set_1 = set([1, 2, 3]) +>>> set_1.add(4) +>>> set_1 +{1, 2, 3, 4} +>>> 2 in set_1 +True +>>> set_2 = set([5, 6]) +>>> set_1.update(set_2) +>>> set_1 +{1, 2, 3, 4, 5, 6} +>>> set_3 = set([7]) +>>> set_1.union(set_3) +{1, 2, 3, 4, 5, 6, 7} +>>> set_1.discard(3) +>>> set_1 +{1, 2, 4, 5, 6} +>>> set_1.remove(3) +Traceback (most recent call last): + File "", line 1, in +KeyError: 3 +>>> set_1.discard(3) +>>> + + + + + + diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" index 2ed404cc..d23ff26d 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" @@ -79,4 +79,4 @@ I love python """ output.write(content) -output.close() \ No newline at end of file +output.close() -- Gitee From f99f8dadbc13a401549f935d9816a45286adaccd Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Sun, 27 Dec 2020 22:46:57 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...72\214\345\221\250\347\254\254\344\270\211\350\257\276.py" | 4 ---- 1 file changed, 4 deletions(-) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" index 4911b1e8..89eb85bc 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" @@ -155,10 +155,6 @@ KeyError: 3 >>> - - - - """ output.write(content) output.close() \ No newline at end of file -- Gitee From 8c49c3902143c02a01d99fb360b8d28cf7569621 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Sun, 27 Dec 2020 22:50:57 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2\214\345\221\250\347\254\254\344\270\211\350\257\276.py" | 1 - ...\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" | 5 ----- 2 files changed, 6 deletions(-) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" index 89eb85bc..0ef7f37e 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" @@ -152,7 +152,6 @@ Traceback (most recent call last): File "", line 1, in KeyError: 3 >>> set_1.discard(3) ->>> """ diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" index f88794c3..fe4ee300 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" @@ -151,10 +151,5 @@ Traceback (most recent call last): File "", line 1, in KeyError: 3 >>> set_1.discard(3) ->>> - - - - -- Gitee From bfc0dd5a79721078f0b53b5e22498e97bcbce074 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Sun, 27 Dec 2020 22:52:32 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" | 2 +- ...272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" index 0ef7f37e..a4b21db3 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" @@ -152,7 +152,7 @@ Traceback (most recent call last): File "", line 1, in KeyError: 3 >>> set_1.discard(3) - +>>> """ output.write(content) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" index fe4ee300..e59f8578 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" @@ -151,5 +151,5 @@ Traceback (most recent call last): File "", line 1, in KeyError: 3 >>> set_1.discard(3) - +>>> -- Gitee From d9c0d32f1eb70511e6a7daccc3475fd8730efba8 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Sun, 27 Dec 2020 22:57:23 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" | 2 ++ ...272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" | 2 ++ 2 files changed, 4 insertions(+) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" index a4b21db3..a471612f 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" @@ -154,6 +154,8 @@ KeyError: 3 >>> set_1.discard(3) >>> + + """ output.write(content) output.close() \ No newline at end of file diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" index e59f8578..56e1d977 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" @@ -153,3 +153,5 @@ KeyError: 3 >>> set_1.discard(3) >>> + + -- Gitee From cb1ec069d9cecea98f32891a639bc5649fa8ccad Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Wed, 30 Dec 2020 22:43:38 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\270\200\350\257\276.py" | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" new file mode 100644 index 00000000..f0e1233c --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" @@ -0,0 +1,82 @@ +#痴海第二期python训练营 +#2班--wong +#第三周第一课作业 + +#作业一、用for循环和while循环实现计数 + +print("用for循环实现计数x次") +a = input('请输入计数次数:') +a = int(a) +for i in range(a): + print(i) + +print('------------------------') + + +print("用while循环实现计数x次") +a = input('请输入计数次数:') +a = int(a) +i = 0 +while i < a: + print(i) + i += 1 + +print('------------------------') + + + +#作业二、分别用for循环和while循环实现斐波那切数列,限制在100以内 + +print("用for循环实现菲波那切数列") +a = 0 #设定第一项 +b = 1 #设定第二项 +print("斐波那契数列第 1 项:" ,a) #输出第一项 +print("斐波那契数列第 2 项:" ,b) #输出第二项 +i = 3 #计数从第3项开始 +for i in range(3,1000): + c = a + b + if c >= 100: + break + print("斐波那契数列第",i,"项:", c) + a = b + b = c + +print('------------------------') + + +print("用while循环实现菲波那切数列") +a = 0 +b = 1 +print("斐波那契数列第 1 项:" ,a) #输出第一项 +print("斐波那契数列第 2 项:" ,b) #输出第二项 +i = 3 #计数从第3项开始 +while i < 1000: + c = a + b + if c >= 100: + break + print("斐波那契数列第", i, "项:", c) + a = b + b = c + i += 1 + +print('------------------------') + + + +#作业三、对计算器参数进行检查,如果报错抛出自定义异常(以取余为例) +class ParamsError(Exception): + pass + +def rem(a, b): + if b == 0: + raise ParamsError("除数不能为0,请重新输入!") + c = a % b + return c + +a = int(input("请输入被除数:")) +b = int(input("请输入除数:")) +rem(a, b) + +result = rem(7, 3) +print(result) + -- Gitee From 6a7b85afb951839ded742bbbbf83094db5aca107 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Fri, 1 Jan 2021 20:33:09 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2\347\217\255/2\347\217\255_Wong/000.py" | 6 +++ ...50\347\254\254\344\270\200\350\257\276.py" | 37 +++++++++---------- 2 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/000.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/000.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/000.py" new file mode 100644 index 00000000..f3a48836 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/000.py" @@ -0,0 +1,6 @@ +sum = 0 +i = 1 +while i<100: + sum += i + i += 2 +print(sum) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" index f0e1233c..67a45222 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" @@ -4,22 +4,22 @@ #作业一、用for循环和while循环实现计数 -print("用for循环实现计数x次") -a = input('请输入计数次数:') -a = int(a) -for i in range(a): - print(i) +print("计算100以内偶数的和") +sum = 0 +for i in range(2, 101, 2): + sum += i +print(sum) print('------------------------') -print("用while循环实现计数x次") -a = input('请输入计数次数:') -a = int(a) -i = 0 -while i < a: - print(i) - i += 1 +print("计算100以内奇数的和") +sum = 0 +i = 1 +while i < 100: + sum += i + i += 2 +print(sum) print('------------------------') @@ -33,7 +33,7 @@ b = 1 #设定第二项 print("斐波那契数列第 1 项:" ,a) #输出第一项 print("斐波那契数列第 2 项:" ,b) #输出第二项 i = 3 #计数从第3项开始 -for i in range(3,1000): +for i in range(3, 1000): c = a + b if c >= 100: break @@ -68,15 +68,14 @@ class ParamsError(Exception): pass def rem(a, b): - if b == 0: + try: + c = a % b + return c + except ZeroDivisionError: raise ParamsError("除数不能为0,请重新输入!") - c = a % b - return c a = int(input("请输入被除数:")) b = int(input("请输入除数:")) -rem(a, b) - -result = rem(7, 3) +result = rem(a, b) print(result) -- Gitee From faecdd2da1237af199d5c7a54324b2ca223547f6 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Fri, 1 Jan 2021 20:34:13 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=9C=9F=E8=AE=AD=E7=BB=83=E8=90=A5/2?= =?UTF-8?q?=E7=8F=AD/2=E7=8F=AD=5FWong/000.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2\347\217\255/2\347\217\255_Wong/000.py" | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/000.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/000.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/000.py" deleted file mode 100644 index f3a48836..00000000 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/000.py" +++ /dev/null @@ -1,6 +0,0 @@ -sum = 0 -i = 1 -while i<100: - sum += i - i += 2 -print(sum) \ No newline at end of file -- Gitee From 0b6d9b965e3daccfd9c1621569e6f73000111559 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Fri, 1 Jan 2021 20:48:34 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E8=AF=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...70\211\345\221\250\347\254\254\344\270\200\350\257\276.py" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" index 67a45222..e6996fe4 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" @@ -27,7 +27,7 @@ print('------------------------') #作业二、分别用for循环和while循环实现斐波那切数列,限制在100以内 -print("用for循环实现菲波那切数列") +print("用for循环实现斐波那契数列") a = 0 #设定第一项 b = 1 #设定第二项 print("斐波那契数列第 1 项:" ,a) #输出第一项 @@ -44,7 +44,7 @@ for i in range(3, 1000): print('------------------------') -print("用while循环实现菲波那切数列") +print("用while循环实现斐波那契数列") a = 0 b = 1 print("斐波那契数列第 1 项:" ,a) #输出第一项 -- Gitee From f5868028b214e4f3f27b9a4d5e6fd7d9badf66e0 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Sun, 3 Jan 2021 18:37:24 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" | 1 + 1 file changed, 1 insertion(+) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" index e6996fe4..4ddbed65 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\211\345\221\250\347\254\254\344\270\200\350\257\276.py" @@ -44,6 +44,7 @@ for i in range(3, 1000): print('------------------------') + print("用while循环实现斐波那契数列") a = 0 b = 1 -- Gitee