ashigirl96% python [~/Desktop]Python2.7.2 (default, Oct 11 2012, 20:14:37)[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> for i in range(3):... print i,'Hello World'...0 Hello World1 Hello World2 Hello WorldPython って入れてみ2913年4月26日金曜日
例えば、奇数の配列(リスト)作る。『for文で 整数 iを10回まわす、そのとき i%2(iを2で割った余)が ゼロでない場合の i だけリストに入れる』Pythonがどれぐらい英語っぽいか>>>print [i for i in range(10) if i%2 is not 0][1, 3, 5, 7, 9]>>>3313年4月26日金曜日
34.
続きもし 文字列に “kyuri”が入っていたら、配列(リスト)から取り除く。>>> LIST = ['kyuridenamida' , 'homodenamida' , 'kyuri ha sekai iti','homo ha sekai iti' , 'butyoukyuri' , 'tatarikun' , 'mossan' ]>>> print [i for i in LIST if 'kyuri' not in i]['homodenamida', 'homo ha sekai iti', 'tatarikun', 'mossan']>>>これ3413年4月26日金曜日