From d4546bc3ec0c7095aba8a71b09dae5e576271ec6 Mon Sep 17 00:00:00 2001 From: YangShaohan Date: Thu, 7 Nov 2019 22:28:51 +0800 Subject: [PATCH 1/3] Create 1001S02E02_hello_python.py --- 1901100207/1001S02E02_hello_python.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 1901100207/1001S02E02_hello_python.py diff --git a/1901100207/1001S02E02_hello_python.py b/1901100207/1001S02E02_hello_python.py new file mode 100644 index 000000000..00950d9ac --- /dev/null +++ b/1901100207/1001S02E02_hello_python.py @@ -0,0 +1 @@ +print('hello world') \ No newline at end of file From 389172dbef3f67d9209e0f5b83c489eee020a34c Mon Sep 17 00:00:00 2001 From: YangShaohan Date: Tue, 19 Nov 2019 09:06:53 +0800 Subject: [PATCH 2/3] Create 1001S02E03_calculator.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 加减乘除运算 --- 1901100207/1001S02E03_calculator.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 1901100207/1001S02E03_calculator.py diff --git a/1901100207/1001S02E03_calculator.py b/1901100207/1001S02E03_calculator.py new file mode 100644 index 000000000..68bb2463b --- /dev/null +++ b/1901100207/1001S02E03_calculator.py @@ -0,0 +1,19 @@ +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),type(a)) +print('second_number:',second_number,type(second_number),type(b)) +print('测试加法 str 加法:',first_number+second_number) +if operator=='+': + print(a,'+',b,'=',a+b) +else operator=='-': + print(a,'-',b,'=',a-b) +else operator=='*': + print(a,'*',b,'=',a*b) +else operator=='/': + print(a,'/',b,'=',a/b) +else: + print('无效的运算符') \ No newline at end of file From d44cc30471f39cd5386f1593bad4ef010036d79d Mon Sep 17 00:00:00 2001 From: YangShaohan Date: Thu, 21 Nov 2019 08:49:38 +0800 Subject: [PATCH 3/3] Create 1001S02E04_control_flow.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 九九乘法表程序 --- 1901100207/1001S02E04_control_flow.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 1901100207/1001S02E04_control_flow.py diff --git a/1901100207/1001S02E04_control_flow.py b/1901100207/1001S02E04_control_flow.py new file mode 100644 index 000000000..4435a1bfe --- /dev/null +++ b/1901100207/1001S02E04_control_flow.py @@ -0,0 +1,18 @@ +print('打印九九乘法表') +for i in range(1,10): + print('第%d行'%i,end='\t') + for j in range(1,i+1): + print(i,'*',j,'=',i*j,end='\t') + # print('{}*{}={}'.format(i,j,i*j),end='\t') + print() + +print('\n打印跳过偶数行的九九乘法表') +i=1 +while i<10: + if i%2==0: + print() + else: + for j in range(1,i+1): + print(i,'*',j,'=',i*j,end='\t') + # print('{}*{}={}'.format(i,j,i*j),end='\t') + i+=1 \ No newline at end of file