開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python (プログラミング言語)
Learning Python (Mark Lutz (著)、Oreilly & Associates Inc)のPART III.(Functions and Generators)、Test Your Knowledge: Part IV Exercises 、7.(More argument-matching examples)を解いてみる。
その他参考書籍
7.(More argument-matching examples)
入出力結果(Terminal)
$ python3 Python 3.3.5 (default, Mar 15 2014, 14:51:54) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from sample import * >>> f1(1, 2) # 1 2 1 2 >>> f1(b=2, a=1) # 1 2 1 2 >>> f2(1, 2, 3) # 1 (2, 3) 1 (2, 3) >>> f3(1, x=2, y=3) # 1 {'x':2, 'y':3} 1 {'x': 2, 'y': 3} >>> f4(1, 2, 3, x=2, y=3) # 1 (2, 3) {'x':2, 'y':3} 1 (2, 3) {'x': 2, 'y': 3} >>> f5(1) # 1 2 3 1 2 3 >>> f5(1, 4) # 1 4 3 1 4 3 >>> f6(1) # 1 2 () 1 2 () >>> f6(1, 3, 4) # 1 3 (4,) 1 3 (4,) >>> quit() $
0 コメント:
コメントを投稿