From 146b3d51a526ded9d098b96d7cee942d29288522 Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Wed, 28 Aug 2019 22:02:55 +0800 Subject: [PATCH 01/11] 1901100191 d1 work --- exercises/1901100191/1001S02E01_helloworld.txt | 8 ++++++++ exercises/1901100191/README.md | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 exercises/1901100191/1001S02E01_helloworld.txt create mode 100644 exercises/1901100191/README.md diff --git a/exercises/1901100191/1001S02E01_helloworld.txt b/exercises/1901100191/1001S02E01_helloworld.txt new file mode 100644 index 000000000..db96d0277 --- /dev/null +++ b/exercises/1901100191/1001S02E01_helloworld.txt @@ -0,0 +1,8 @@ +{\rtf1\ansi\ansicpg936\cocoartf1671\cocoasubrtf500 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} +\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 + +\f0\fs24 \cf0 Hello world} \ No newline at end of file diff --git a/exercises/1901100191/README.md b/exercises/1901100191/README.md new file mode 100644 index 000000000..2072259db --- /dev/null +++ b/exercises/1901100191/README.md @@ -0,0 +1,8 @@ +{\rtf1\ansi\ansicpg936\cocoartf1671\cocoasubrtf500 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} +\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 + +\f0\fs24 \cf0 # learn markdown} \ No newline at end of file From e2b2580f99e525836d3fd7bd0c7203aecd98f46c Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Wed, 28 Aug 2019 22:07:49 +0800 Subject: [PATCH 02/11] 1901100191 d1 work --- exercises/1901100191/1001S02E01_helloworld.txt | 2 +- exercises/1901100191/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/1901100191/1001S02E01_helloworld.txt b/exercises/1901100191/1001S02E01_helloworld.txt index db96d0277..7aa1a1c25 100644 --- a/exercises/1901100191/1001S02E01_helloworld.txt +++ b/exercises/1901100191/1001S02E01_helloworld.txt @@ -5,4 +5,4 @@ \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\f0\fs24 \cf0 Hello world} \ No newline at end of file +\f0\fs24 \cf0 Hello world 1} \ No newline at end of file diff --git a/exercises/1901100191/README.md b/exercises/1901100191/README.md index 2072259db..6e2f7bf38 100644 --- a/exercises/1901100191/README.md +++ b/exercises/1901100191/README.md @@ -5,4 +5,4 @@ \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\f0\fs24 \cf0 # learn markdown} \ No newline at end of file +\f0\fs24 \cf0 # learn markdown1} \ No newline at end of file From 566b456df81902952e8cec0bfdf21f568f27210f Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Wed, 28 Aug 2019 22:13:51 +0800 Subject: [PATCH 03/11] 1901100191 D1 work --- exercises/1901100191/1001S02E01_helloworld.txt | 2 +- exercises/1901100191/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/1901100191/1001S02E01_helloworld.txt b/exercises/1901100191/1001S02E01_helloworld.txt index 7aa1a1c25..ed85e1541 100644 --- a/exercises/1901100191/1001S02E01_helloworld.txt +++ b/exercises/1901100191/1001S02E01_helloworld.txt @@ -5,4 +5,4 @@ \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\f0\fs24 \cf0 Hello world 1} \ No newline at end of file +\f0\fs24 \cf0 Hello world } \ No newline at end of file diff --git a/exercises/1901100191/README.md b/exercises/1901100191/README.md index 6e2f7bf38..2072259db 100644 --- a/exercises/1901100191/README.md +++ b/exercises/1901100191/README.md @@ -5,4 +5,4 @@ \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\f0\fs24 \cf0 # learn markdown1} \ No newline at end of file +\f0\fs24 \cf0 # learn markdown} \ No newline at end of file From a9a3a7fcb620bbf24f9674ae069fbb0394ab808d Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Thu, 29 Aug 2019 18:37:51 +0800 Subject: [PATCH 04/11] 1901100191 d1 work --- exercises/1901100191/1001S02E01_helloworld.txt | 2 +- exercises/1901100191/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/1901100191/1001S02E01_helloworld.txt b/exercises/1901100191/1001S02E01_helloworld.txt index ed85e1541..100a8e0bb 100644 --- a/exercises/1901100191/1001S02E01_helloworld.txt +++ b/exercises/1901100191/1001S02E01_helloworld.txt @@ -5,4 +5,4 @@ \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\f0\fs24 \cf0 Hello world } \ No newline at end of file +\f0\fs24 \cf0 Hello world } \ No newline at end of file diff --git a/exercises/1901100191/README.md b/exercises/1901100191/README.md index 2072259db..9445d76b5 100644 --- a/exercises/1901100191/README.md +++ b/exercises/1901100191/README.md @@ -5,4 +5,4 @@ \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\f0\fs24 \cf0 # learn markdown} \ No newline at end of file +\f0\fs24 \cf0 # learn markdown } \ No newline at end of file From 30c5fe6f8f6a109efe85044c29738f561dd8fb93 Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Sun, 1 Sep 2019 23:11:19 +0800 Subject: [PATCH 05/11] D2 work --- exercises/1901100191/1001S02E02_hello_python.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 exercises/1901100191/1001S02E02_hello_python.py diff --git a/exercises/1901100191/1001S02E02_hello_python.py b/exercises/1901100191/1001S02E02_hello_python.py new file mode 100644 index 000000000..7ddfc8f85 --- /dev/null +++ b/exercises/1901100191/1001S02E02_hello_python.py @@ -0,0 +1 @@ +print('hello world!') \ No newline at end of file From 65a17cc300ec1b71374fd42d5bb70baa55b5d887 Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Mon, 11 Nov 2019 19:59:05 +0800 Subject: [PATCH 06/11] day3_1901100191 --- exercises/1901100191/1001S02E03_calculator.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 exercises/1901100191/1001S02E03_calculator.py diff --git a/exercises/1901100191/1001S02E03_calculator.py b/exercises/1901100191/1001S02E03_calculator.py new file mode 100644 index 000000000..be8589f77 --- /dev/null +++ b/exercises/1901100191/1001S02E03_calculator.py @@ -0,0 +1,21 @@ +operator = input('请输入运算符(+、-、*、/):') +first_number = input('请输入第一个数字:') +second_number = input('请输入第二个数字:') + +a = int(first_number) +b = int(second_number) + +print('operator:', operator, type(operator)) +print('first_number:', first_number, type(first_number)) +print('second_number:', second_number, type(second_number)) + +if operator == '+': + print(a, '+', b, '=', a + b) +elif operator == '-': + print(a, '-', b, '=', a - b) +elif operator == '*': + print(a, '*', b, '=', a * b) +elif operator == '/': + print(a, '/', b, '=', a / b) +else: + print('无效运算符') \ No newline at end of file From 2e8d83bb83f6cadf4007ee008cb38407b80f9271 Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Mon, 11 Nov 2019 20:31:23 +0800 Subject: [PATCH 07/11] =?UTF-8?q?day3=5F13=E7=BE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exercises/1901100191/1001S02E03_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/1901100191/1001S02E03_calculator.py b/exercises/1901100191/1001S02E03_calculator.py index be8589f77..466688c42 100644 --- a/exercises/1901100191/1001S02E03_calculator.py +++ b/exercises/1901100191/1001S02E03_calculator.py @@ -18,4 +18,4 @@ elif operator == '/': print(a, '/', b, '=', a / b) else: - print('无效运算符') \ No newline at end of file + print('无效运算符') \ No newline at end of file From e37baf339ad2f2c8a40acf7ad6f94ddd4a0572e8 Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Thu, 14 Nov 2019 12:38:41 +0800 Subject: [PATCH 08/11] day4_1901100191 --- .../1901100191/1001S02E04_control_flow.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 exercises/1901100191/1001S02E04_control_flow.py diff --git a/exercises/1901100191/1001S02E04_control_flow.py b/exercises/1901100191/1001S02E04_control_flow.py new file mode 100644 index 000000000..89c90c041 --- /dev/null +++ b/exercises/1901100191/1001S02E04_control_flow.py @@ -0,0 +1,21 @@ +print('九九乘法运算') +for i in range(1,10): + for j in range(1,10): + print(j,'×',i,'=',i*j, end="\t") + print("") + + +print('九九乘法运算') +for a in range(1,10,2): + for b in range(1,10,2): + print(b,'×',a,'=',a*b, end="\t") + print("") + +print('九九乘法运算') +for c in range(1,10): + for d in range(1,c+1): + while c % 2 !=0: + print(d,'×',c,'=',c*d, end="\t") + if c == d: + print("") + break \ No newline at end of file From ba8a8783eae9297aac96d48805805622dfcce786 Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Thu, 14 Nov 2019 12:40:39 +0800 Subject: [PATCH 09/11] Revert "day4_1901100191" This reverts commit e37baf339ad2f2c8a40acf7ad6f94ddd4a0572e8. --- .../1901100191/1001S02E04_control_flow.py | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 exercises/1901100191/1001S02E04_control_flow.py diff --git a/exercises/1901100191/1001S02E04_control_flow.py b/exercises/1901100191/1001S02E04_control_flow.py deleted file mode 100644 index 89c90c041..000000000 --- a/exercises/1901100191/1001S02E04_control_flow.py +++ /dev/null @@ -1,21 +0,0 @@ -print('九九乘法运算') -for i in range(1,10): - for j in range(1,10): - print(j,'×',i,'=',i*j, end="\t") - print("") - - -print('九九乘法运算') -for a in range(1,10,2): - for b in range(1,10,2): - print(b,'×',a,'=',a*b, end="\t") - print("") - -print('九九乘法运算') -for c in range(1,10): - for d in range(1,c+1): - while c % 2 !=0: - print(d,'×',c,'=',c*d, end="\t") - if c == d: - print("") - break \ No newline at end of file From ee396b369354fdd8526d0c63e6d00663a5224647 Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Sun, 24 Nov 2019 19:41:41 +0800 Subject: [PATCH 10/11] day5_1901100191 --- exercises/1901100191/1001S05E05_array.py | 14 +++++++ exercises/1901100191/1001S05E05_stats_text.py | 38 +++++++++++++++++++ exercises/1901100191/1001S05E05_string.py | 37 ++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 exercises/1901100191/1001S05E05_array.py create mode 100644 exercises/1901100191/1001S05E05_stats_text.py create mode 100644 exercises/1901100191/1001S05E05_string.py diff --git a/exercises/1901100191/1001S05E05_array.py b/exercises/1901100191/1001S05E05_array.py new file mode 100644 index 000000000..1f1d49d49 --- /dev/null +++ b/exercises/1901100191/1001S05E05_array.py @@ -0,0 +1,14 @@ +a_list=[0,1,2,3,4,5,6,7,8,9] +a_list.sort(reverse=True) +print(a_list) +b=''.join(str(i) for i in a_list) +print(b) +c=b[2:8] +print(c) +d=c[::-1] +print(d) +int_value=int(d) +print(int_value) +print(bin(int_value)) +print(oct(int_value)) +print(hex(int_value)) \ No newline at end of file diff --git a/exercises/1901100191/1001S05E05_stats_text.py b/exercises/1901100191/1001S05E05_stats_text.py new file mode 100644 index 000000000..6b9fa2f2c --- /dev/null +++ b/exercises/1901100191/1001S05E05_stats_text.py @@ -0,0 +1,38 @@ +s=''' +The Zen of Python, by Tim Peters + + +Beautiful is better than ugly. +Explicit is better than implicit. +Simple is better than complex. +Complex is better than complicated. 9 Flat is better than nested. +Sparse is better than dense. +Readability counts. +Special cases aren't special enough to break the rules. +Although practicality beats purity. +Errors should never pass silently. +Unless explicitly silenced. +In the face of ambxiguity, refuse the temptation to guess. +There should be one-- and preferably only one --obvious way to do +it. +Although that way may not be obvious at first unless you're Dutch. +Now is better than never. +Although never is often better than *right* now. +If the implementation is hard to explain, it's a bad idea. +If the implementation is easy to explain, it may be a good idea. +Namespaces are one honking great idea -- let's do more of those!''' +i=s.split() +b=[] +d=',.*!-' +for e in i: + for f in d: + e=e.replace(f,'') + if len(e): + b.append(e) +print(b) +g={} +b_set=set(b) +for h in b_set: + g[h]=b.count(h) +print(g) +print(sorted(g.items(),key=lambda x: x[1],reverse=True)) \ No newline at end of file diff --git a/exercises/1901100191/1001S05E05_string.py b/exercises/1901100191/1001S05E05_string.py new file mode 100644 index 000000000..588e5e85c --- /dev/null +++ b/exercises/1901100191/1001S05E05_string.py @@ -0,0 +1,37 @@ +s=''' +The Zen of Python, by Tim Peters + + +Beautiful is better than ugly. +Explicit is better than implicit. +Simple is better than complex. +Complex is better than complicated. 9 Flat is better than nested. +Sparse is better than dense. +Readability counts. +Special cases aren't special enough to break the rules. +Although practicality beats purity. +Errors should never pass silently. +Unless explicitly silenced. +In the face of ambxiguity, refuse the temptation to guess. +There should be one-- and preferably only one --obvious way to do +it. +Although that way may not be obvious at first unless you're Dutch. +Now is better than never. +Although never is often better than *right* now. +If the implementation is hard to explain, it's a bad idea. +If the implementation is easy to explain, it may be a good idea. +Namespaces are one honking great idea -- let's do more of those!''' +print('better' in s) +print(s.replace('better','worse')) +b=s.replace('better','worse') +print(b.split()) +c=b.split() +d=[] +for e in c: + if e.find('ea')<0: + d.append(e) +print(d) +f=[g.swapcase()for g in d] +print(f) +f.sort() +print(f) \ No newline at end of file From 8a20c0f424c2808395d54f193487163727bb0381 Mon Sep 17 00:00:00 2001 From: xiaooyu <8507081@qq.com> Date: Thu, 28 Nov 2019 12:39:46 +0800 Subject: [PATCH 11/11] day6_1901100191 --- exercises/1901100191/1001S02E06_stats_word.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 exercises/1901100191/1001S02E06_stats_word.py diff --git a/exercises/1901100191/1001S02E06_stats_word.py b/exercises/1901100191/1001S02E06_stats_word.py new file mode 100644 index 000000000..7365384e9 --- /dev/null +++ b/exercises/1901100191/1001S02E06_stats_word.py @@ -0,0 +1,36 @@ +def stats_test_en(s): + ''' + 封装统计英文单词词频的函数''' + i=s.split() + b=[] + d=',.*!-' + for e in i: + for f in d: + e=e.replace(f,'') + if len(e): + b.append(e) + g={} + b_set=set(b) + for h in b_set: + g[h]=b.count(h) + print(g) + print(sorted(g.items(),key=lambda x: x[1],reverse=True) +help(stats_test_en) + +def stats_test_cn(y) + ''' + 封装统计中文单词词频的函数''' + j=y.split() + c=[] + q=',。*!-' + for u in j: + for p in q: + k=k.replace(p,'') + if len(u): + c.append(u) + n={} + c_set=set(c) + for v in c_set: + k[v]=c.count(v) + print(k) + print(sorted(k.items(),key=lambda x: x[1],reverse=True) \ No newline at end of file