2012年3月29日木曜日

開発環境

『初めてのPython 第3版』(Mark Lutz 著、夏目 大 訳、オライリー・ジャパン、2009年、ISBN978-4-87311-393-7) のIII部(ステートメント)のまとめ演習2(バックスラッシュ)を解いてみる。

2.

%dにはiの値(整数、range(50)ということで0から49まで)、\nは改行、\aはビープ音。

確認。

入出力結果(Terminal)

$ python
Python 2.7.2 (default, Feb 12 2012, 23:50:38) 
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> for i in range(50):
...     print 'hello %d\n\a' % i
... 
hello 0

hello 1

hello 2

hello 3

hello 4

hello 5

hello 6

hello 7

hello 8

hello 9

hello 10

hello 11

hello 12

hello 13

hello 14

hello 15

hello 16

hello 17

hello 18

hello 19

hello 20

hello 21

hello 22

hello 23

hello 24

hello 25

hello 26

hello 27

hello 28

hello 29

hello 30

hello 31

hello 32

hello 33

hello 34

hello 35

hello 36

hello 37

hello 38

hello 39

hello 40

hello 41

hello 42

hello 43

hello 44

hello 45

hello 46

hello 47

hello 48

hello 49

>>> quit()
$

0 コメント:

コメントを投稿