diff --git a/exercises/1901010088/1001S02E01_helloworld.txt b/exercises/1901010088/1001S02E01_helloworld.txt new file mode 100644 index 000000000..c97954c3d --- /dev/null +++ b/exercises/1901010088/1001S02E01_helloworld.txt @@ -0,0 +1,2 @@ +1. It's a nice day ,today! +2.听了笑来老师分享的”长期“概念,再也不是遥遥无期很漫长的感觉。 \ No newline at end of file diff --git a/exercises/1901010088/1001S02E01_helloworld.txt.txt b/exercises/1901010088/1001S02E01_helloworld.txt.txt deleted file mode 100644 index 362d2b055..000000000 --- a/exercises/1901010088/1001S02E01_helloworld.txt.txt +++ /dev/null @@ -1 +0,0 @@ -1. It's a nice day ,today! \ No newline at end of file diff --git a/exercises/1901010088/1001S02E02_hello_python.py b/exercises/1901010088/1001S02E02_hello_python.py new file mode 100644 index 000000000..3595daf2b --- /dev/null +++ b/exercises/1901010088/1001S02E02_hello_python.py @@ -0,0 +1,4 @@ +msg="Hello World" +print(msg) + +msg.capitalize \ No newline at end of file diff --git a/exercises/1901010088/1001S02E03_calculator.py b/exercises/1901010088/1001S02E03_calculator.py new file mode 100644 index 000000000..ef350e290 --- /dev/null +++ b/exercises/1901010088/1001S02E03_calculator.py @@ -0,0 +1,46 @@ +#定义函数 +def add(x, y): + """相加""" + + return x + y + +def abstract(x. y): + """相减""" + + return x - y + +def multipy(x, y): + """相乘""" + + return x * y + +def divide(x, y): + """相除""" + + return x / y + +# 用户输入 +print("选择运算:") +print("1、相加") +print("2、相减") +print("3、相乘") +print("4、相除") + +choice=input("输入你选择的(1/2/3/4):") + +num1=int(input("输入第一个数字: ")) +num2=int(input("输入第二个数字: ")) + +if choice == "1": + print(num1,"+",num2,"=",add(num1,num2)) + +elif choice == "2": + print(num1,"-",num2,"=",subtract(num1,num2)) + +elif choice == "3": + print(num1,"*",num2,"=",multiple(num1,num2)) + +elif choice =="3": + print(num1,"/",num2,"=",divide(num1,num2)) +else: + print("非法输入") \ No newline at end of file diff --git a/exercises/1901010088/1001S02E04_control_flow.py b/exercises/1901010088/1001S02E04_control_flow.py new file mode 100644 index 000000000..52c20a9b8 --- /dev/null +++ b/exercises/1901010088/1001S02E04_control_flow.py @@ -0,0 +1,24 @@ +print() +print("1. 使用for…in循环打印九九乘法表,输出") + +print() +for i in range(1,10): + for j in range (1,i+1): + print(i,"*",j,"=",i*j,end="\t") + print() + + +print() + +print("2. 使用fwhile循环打印九九乘法表并用条件判断把偶数行删除,输出") +print() +i=1 +while i<10: + if i%2==1: + j=1 + while j<=i: + print('%d * %d = %-2d'%(i,j,i*j),end='\t') + j=j+1 + print() + i=i+1 + diff --git a/exercises/1901010088/README.md.txt b/exercises/1901010088/README.md similarity index 100% rename from exercises/1901010088/README.md.txt rename to exercises/1901010088/README.md