2018年3月16日金曜日

開発環境

入門 自然言語処理 (Steven Bird (著)、Ewan Klein (著)、Edward Loper (著)、萩原 正人 (翻訳)、中山 敬広 (翻訳)、水野 貴明 (翻訳)、オライリージャパン)の1章(言語処理とPython)、1.8(演習問題)1、2、3を取り組んでみる。

コード(Emacs)

Python 3

#!/usr/bin/env python3

print('1.')
print(12 / (4 + 1))
print(12 // (4 + 1))

print('2.')
print(26 ** 10)
print(26 ** 100)

print('3.')
sent1 = ['Call', 'me', 'Ishmael', '.']
print(['Monty', 'Python'] * 20)
print(3 * sent1)

入出力結果(Terminal, Jupyter(IPython))

$ ./sample1.py
1.
2.4
2
2.
141167095653376
3142930641582938830174357788501626427282669988762475256374173175398995908420104023465432599069702289330964075081611719197835869803511992549376
3.
['Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python', 'Monty', 'Python']
['Call', 'me', 'Ishmael', '.', 'Call', 'me', 'Ishmael', '.', 'Call', 'me', 'Ishmael', '.']
$

0 コメント:

コメントを投稿