開発環境
- macOS High Sierra - Apple
- Emacs (Text Editor)
- Python 3.6 (プログラミング言語)
入門 Python 3 (Bill Lubanovic (著)、斎藤 康毅 (監修)、長尾 高弘 (翻訳)、オライリージャパン)の3章(Pyの具: リスト、タプル、辞書、集合)、3.8(復習問題)4、5、6、7.を取り組んでみる。
コード(Emacs)
Python 3
#!/usr/bin/env python3
print('3-4')
things = ['mozzarella', 'cinderella', 'salmonella']
print('3-5')
print(things[1].capitalize())
print(things)
print('3-6')
print(things[0].upper())
print('3-7')
things.remove('salmonella')
print(things)
入出力結果(Terminal, Jupyter(IPython))
$ ./sample2.py 3-4 3-5 Cinderella ['mozzarella', 'cinderella', 'salmonella'] 3-6 MOZZARELLA 3-7 ['mozzarella', 'cinderella'] $
0 コメント:
コメントを投稿