From 86b8b3f43cd4e34cfc79d01518b158c2c7103c93 Mon Sep 17 00:00:00 2001 From: shiho629 Date: Thu, 27 Feb 2025 23:21:37 +0900 Subject: [PATCH 1/2] python_intro --- pi.py | 9 +++++++++ quadratic_formula.py | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pi.py b/pi.py index a84e760..fdcc540 100644 --- a/pi.py +++ b/pi.py @@ -4,4 +4,13 @@ """ # TODO +#list(map(len,["a","bc","def"])) +cleantext = text.replace(",","") +cleantext = cleantext.replace(".","") +words = cleantext.split() +wordscountlist=list(map(len,list(words))) +result=''.join(map(str,wordscountlist)) +print(result) + + diff --git a/quadratic_formula.py b/quadratic_formula.py index 96a37e7..42e5932 100644 --- a/quadratic_formula.py +++ b/quadratic_formula.py @@ -3,7 +3,9 @@ c = 9 # TODO -x1 = ... -x2 = ... - -print(x1, x2) +x1 = (-b-(b**2-4*a*c)**0.5)/(2*a) +x2 = (-b+(b**2-4*a*c)**0.5)/(2*a) +if x1 != x2: + print(x1,x2) +else: + print(x1) From 7f6921bdf59932bcea994ecdd77fedb58120cb06 Mon Sep 17 00:00:00 2001 From: shiho629 Date: Fri, 28 Feb 2025 14:11:34 +0900 Subject: [PATCH 2/2] =?UTF-8?q?python=E5=85=A5=E9=96=80=E3=81=AE=E8=A7=A3?= =?UTF-8?q?=E7=AD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pi.py | 5 ++--- quadratic_formula.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pi.py b/pi.py index fdcc540..b3445d8 100644 --- a/pi.py +++ b/pi.py @@ -4,12 +4,11 @@ """ # TODO -#list(map(len,["a","bc","def"])) cleantext = text.replace(",","") cleantext = cleantext.replace(".","") words = cleantext.split() -wordscountlist=list(map(len,list(words))) -result=''.join(map(str,wordscountlist)) +wordscount=list(map(len,list(words))) +result=''.join(map(str,wordscount)) print(result) diff --git a/quadratic_formula.py b/quadratic_formula.py index 42e5932..a0d014c 100644 --- a/quadratic_formula.py +++ b/quadratic_formula.py @@ -1,6 +1,6 @@ a = 1 -b = -6 -c = 9 +b = 0 +c = 1 # TODO x1 = (-b-(b**2-4*a*c)**0.5)/(2*a)