#!/usr/bin/env python
# -*- coding: utf-8 -*-

# 03. 円周率
# "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."
# という文を単語に分解し，各単語の（アルファベットの）文字数を先頭から出現順に並べたリストを作成せよ．

import sys

if sys.version_info.major < 3:
    # Python 2 の場合
    import string

text   = "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."
answer = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]

# Case 1
#########
def remove_comma_and_period(strings):
    if sys.version_info.major < 3:
        # Python 2 の場合
        s = strings.translate(None, ',.')
    else:
        # Python 3 の場合
        s = strings.translate(str.maketrans('', '', ',.'))
    return s

result = []
words  = remove_comma_and_period(text).split()

for word in words:
    result.append(len(word))

assert result == answer
print(result)
# => [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]


# Case 2
########
result = []
words  = text.split()

for word in words:
    result.append(len(word.rstrip(',.')))

assert result == answer
print(result)
# => [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]

@@ -219,77 +219,8 @@
 ys%0A%0A
-if sys.version_info.major %3C 3:%0A    # Python 2 %E3%81%AE%E5%A0%B4%E5%90%88%0A    import string%0A%0A
 text
@@ -395,16 +395,17 @@
 ########
+#
 %0Adef rem
@@ -489,24 +489,46 @@
 ython 2 %E3%81%AE%E5%A0%B4%E5%90%88%0A
+        import string%0A
         s = 
@@ -880,16 +880,18 @@
 ########
+##
 %0Aresult 

fix knock03: importの位置を修正. 地味にコメントを修正.