From b26eb299d97c8c456d861eef472e35cfa8ef5ee5 Mon Sep 17 00:00:00 2001 From: Gumy Date: Mon, 14 Aug 2023 19:07:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..f048c62 --- /dev/null +++ b/main.py @@ -0,0 +1,4 @@ +if __name__ == '__main__': + a = ['a', 'b', 'c'] + b = ['A', 'B', 'C'] + print(a + b) -- Gitee From fecd7b26105fe3c7dd287ced93a1d7fe2bef60c1 Mon Sep 17 00:00:00 2001 From: Gumy Date: Mon, 14 Aug 2023 19:09:09 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py => lesson2/main.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main.py => lesson2/main.py (100%) diff --git a/main.py b/lesson2/main.py similarity index 100% rename from main.py rename to lesson2/main.py -- Gitee From 8f298d477852579325200c259c9cf919b1e14d92 Mon Sep 17 00:00:00 2001 From: Gumy Date: Fri, 8 Sep 2023 16:01:09 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lesson3/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lesson3/main.py diff --git a/lesson3/main.py b/lesson3/main.py new file mode 100644 index 0000000..0591868 --- /dev/null +++ b/lesson3/main.py @@ -0,0 +1,8 @@ +for i in range(1, 5): + for j in range(1, 5): + if i == j: + continue + for k in range(1, 5): + if k == i or k == j: + continue + print(i * 100 + j * 10 + k) -- Gitee From 59f0dca7b01a3cac4e219cbb52b04cea69d8797b Mon Sep 17 00:00:00 2001 From: Gumy Date: Fri, 15 Sep 2023 13:47:28 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E7=AC=AC=E5=9B=9B=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lesson4/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lesson4/main.py diff --git a/lesson4/main.py b/lesson4/main.py new file mode 100644 index 0000000..bafced4 --- /dev/null +++ b/lesson4/main.py @@ -0,0 +1,10 @@ +def fib(n): + if n == 0: + return 0 + if n == 1 or n == 2: + return 1 + return fib(n - 1) + fib(n - 2) + +if __name__ == '__main__': + for i in range(0, 10): + print(fib(i)) -- Gitee From 1236007dadcf15c09b8cd7d1e27b7dc9753cfb2b Mon Sep 17 00:00:00 2001 From: Gumy Date: Fri, 22 Sep 2023 14:45:13 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=AC=AC=E4=BA=94=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lesson5/A | 1 + lesson5/B | 1 + lesson5/C | 1 + lesson5/main.py | 27 +++++++++++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 lesson5/A create mode 100644 lesson5/B create mode 100644 lesson5/C create mode 100644 lesson5/main.py diff --git a/lesson5/A b/lesson5/A new file mode 100644 index 0000000..54bf7ed --- /dev/null +++ b/lesson5/A @@ -0,0 +1 @@ +Hello \ No newline at end of file diff --git a/lesson5/B b/lesson5/B new file mode 100644 index 0000000..beef906 --- /dev/null +++ b/lesson5/B @@ -0,0 +1 @@ +World \ No newline at end of file diff --git a/lesson5/C b/lesson5/C new file mode 100644 index 0000000..5e1c309 --- /dev/null +++ b/lesson5/C @@ -0,0 +1 @@ +Hello World \ No newline at end of file diff --git a/lesson5/main.py b/lesson5/main.py new file mode 100644 index 0000000..a58e746 --- /dev/null +++ b/lesson5/main.py @@ -0,0 +1,27 @@ +import os + +A_PATH = './lesson5/A' +B_PATH = './lesson5/B' +C_PATH = './lesson5/C' + + +def check_file(path): + if os.path.isfile(path): + print(f'{path} is a file') + else: + print(f'{path} is not a file') + exit() + + +if __name__ == '__main__': + check_file(A_PATH) + check_file(B_PATH) + + with open(A_PATH, "r") as file_object: + a = file_object.read() + + with open(B_PATH,"r") as file_object: + a = a + file_object.read() + + with open(C_PATH, "w") as file_object: + file_object.write(a) -- Gitee From d0f7bca338ee5a7aad6e3efebd1b9467124630fa Mon Sep 17 00:00:00 2001 From: Gumy Date: Thu, 28 Sep 2023 15:20:46 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=AC=AC=E5=85=AD?= =?UTF-8?q?=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lesson6/main.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lesson6/main.py diff --git a/lesson6/main.py b/lesson6/main.py new file mode 100644 index 0000000..d80fbf5 --- /dev/null +++ b/lesson6/main.py @@ -0,0 +1,30 @@ +class Person: + + def __init__(self, name, age, sex): + self.name = name + self.age = age + self.sex = sex + + def eat(self): + print( + f'Hello, my name is {self.name} and I\'m {self.age} years old, I\'m eating' + ) + + def sleep(self): + print(f'Hello, my name is {self.name} and I\'m {self.age} years old', + 'I\'m sleeping') + + +class Student(Person): + + def __init__(self, name, age, sex, school=None): + self.school = school + super().__init__(name, age, sex) + + def sleep(self): + print(f'I\'m sleeping, but I\'m a student, school is {self.school}') + super().sleep() + + +student = Student('gumy', 24, 'male', 'sumec') +student.sleep() -- Gitee