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