2014年8月2日土曜日

開発環境

Learning Python (Mark Lutz (著)、Oreilly & Associates Inc)のPART Ⅱ.(Types and Operations)、Chapter 6.(The Dynamic Typing Interlude)、Test Your Knowledge: Quiz 3.を解いてみる。

その他参考書籍

Test Your Knowledge: Quiz 3.

コード(BBEdit)

sample3.py

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

A = ["spam"]

B = A

print(A, B)                             # ["spam"], ["spam"]

B[0] = "shrubbery"

print(A, B)                             # ["shrubbery"] ["shrubbery]

入出力結果(Terminal, IPython)

$ ./sample3.py
['spam'] ['spam']
['spam'] ['shrubbery']
['spam'] ['spam']
['spam'] ['shrubbery']
$

0 コメント:

コメントを投稿