From e751bc98921b1dbf6d32a29338ed2806ddfa8823 Mon Sep 17 00:00:00 2001 From: katsuta Date: Sat, 19 Nov 2016 16:53:06 +0900 Subject: [PATCH 1/4] =?UTF-8?q?100=E6=9C=AC=E3=83=8E=E3=83=83=E3=82=AFp=5F?= =?UTF-8?q?07?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chap1/p_07.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 chap1/p_07.py diff --git a/chap1/p_07.py b/chap1/p_07.py new file mode 100644 index 0000000..2d54af4 --- /dev/null +++ b/chap1/p_07.py @@ -0,0 +1,7 @@ +# -*- coding: UTF-8 -*- +def Template(x,y,z): + print('{}の時の{}は{}'.format(x,y,z)) + return + +Template(12, "気温", 22.4) + From 8cfaefac4907c5035209182d0c29874254c44cd8 Mon Sep 17 00:00:00 2001 From: katsuta Date: Mon, 28 Nov 2016 19:10:27 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E9=96=A2=E6=95=B0=E5=90=8D=E3=81=AE?= =?UTF-8?q?=E8=A8=82=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chap1/p_07.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chap1/p_07.py b/chap1/p_07.py index 2d54af4..a139201 100644 --- a/chap1/p_07.py +++ b/chap1/p_07.py @@ -1,7 +1,6 @@ # -*- coding: UTF-8 -*- -def Template(x,y,z): +def template(x,y,z): print('{}の時の{}は{}'.format(x,y,z)) return -Template(12, "気温", 22.4) - +template(12, "気温", 22.4) From 66467ebde247f7a19fc5fb26b017edb14265cc4b Mon Sep 17 00:00:00 2001 From: katsuta Date: Mon, 28 Nov 2016 19:11:42 +0900 Subject: [PATCH 3/4] =?UTF-8?q?100=E6=9C=AC=E3=83=8E=E3=83=83=E3=82=AFp=5F?= =?UTF-8?q?08?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chap1/p_08.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 chap1/p_08.py diff --git a/chap1/p_08.py b/chap1/p_08.py new file mode 100644 index 0000000..2ab00ad --- /dev/null +++ b/chap1/p_08.py @@ -0,0 +1,10 @@ +# -*- coding: UTF-8 -*- + +def ciper(word): + + chars = [chr(219-ord(char)) if char.islower() else char for char in word] + return (''.join(chars)) + +english_message = "This is a message" +cryped_message = ciper(english_message) +print(english_message, cryped_message, ciper(cryped_message), sep=' -> ') From 9ad844e021f57cc52c006cafd31868bcee347612 Mon Sep 17 00:00:00 2001 From: katsuta Date: Mon, 28 Nov 2016 19:33:02 +0900 Subject: [PATCH 4/4] =?UTF-8?q?100=E6=9C=AC=E3=83=8E=E3=83=83=E3=82=AFp=5F?= =?UTF-8?q?09?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chap1/p_09.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 chap1/p_09.py diff --git a/chap1/p_09.py b/chap1/p_09.py new file mode 100644 index 0000000..b7ac1e5 --- /dev/null +++ b/chap1/p_09.py @@ -0,0 +1,22 @@ +# -*- coding: UTF-8 -*- +import random + +def typoglycemia(sentence): + words = sentence.split() + return " ".join(map(random_sort_inner, words)) + + +def random_sort_inner(word): + if len(word) <= 4: + return word + char_inner = list(word[1:-1]) + random.shuffle(char_inner) + return word[0] + "".join(char_inner) + word[-1] + + +sentence = """\ +I couldn't believe that I could actually understand \ +what I was reading : the phenomenal power of the human mind .\ +""" + +print(typoglycemia(sentence))