From 7ad08e698003bcf7551cc66bafe0491e21272abd Mon Sep 17 00:00:00 2001 From: githubcage Date: Tue, 14 Jan 2020 17:25:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=8F=90=E4=BA=A4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/encodings.xml | 4 ++++ .idea/fizzbuzz-python-tdd-scaffold.iml | 12 ++++++++++++ .idea/misc.xml | 7 +++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ helloword.py | 8 ++++++++ helloword_test.py | 6 ++++++ 7 files changed, 51 insertions(+) create mode 100644 .idea/encodings.xml create mode 100644 .idea/fizzbuzz-python-tdd-scaffold.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 helloword.py create mode 100644 helloword_test.py diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/fizzbuzz-python-tdd-scaffold.iml b/.idea/fizzbuzz-python-tdd-scaffold.iml new file mode 100644 index 0000000..7c9d48f --- /dev/null +++ b/.idea/fizzbuzz-python-tdd-scaffold.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8656114 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..890fc34 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/helloword.py b/helloword.py new file mode 100644 index 0000000..6a44bd0 --- /dev/null +++ b/helloword.py @@ -0,0 +1,8 @@ +def fb(n): + if n % 15 == 0: + return "fizzbuzz" + if n % 3 == 0: + return "fizz" + if n % 5 == 0: + return "buzz" + return n diff --git a/helloword_test.py b/helloword_test.py new file mode 100644 index 0000000..36599c3 --- /dev/null +++ b/helloword_test.py @@ -0,0 +1,6 @@ +from helloword import fb + +a = [1, 3, 5, 15] +b = [1, "fizz", "buzz", "fizzbuzz"] +for i in range(len(a)): + assert (fb(a[i]) == b[i])