{"id":802,"date":"2018-08-18T22:24:40","date_gmt":"2018-08-18T13:24:40","guid":{"rendered":"https:\/\/python-introduction.com\/?p=802"},"modified":"2018-08-18T22:26:51","modified_gmt":"2018-08-18T13:26:51","slug":"%e3%80%90python%e5%85%a5%e9%96%80%e3%80%91%e3%83%ab%e3%83%bc%e3%83%97%e5%87%a6%e7%90%86%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%82%8f%e3%81%8b%e3%82%8a%e3%82%84%e3%81%99%e3%81%8f%e8%a7%a3%e8%aa%ac","status":"publish","type":"post","link":"https:\/\/python-introduction.com\/?p=802","title":{"rendered":"\u3010Python\u5165\u9580\u3011\u30eb\u30fc\u30d7\u51e6\u7406\u306b\u3064\u3044\u3066\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac"},"content":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u3067\u306fPython\u3067if\u6587\u3068while\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u308a<br \/>\nif\u6587\u3068for\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30eb\u30fc\u30d7\u51e6\u7406\u306b\u3064\u3044\u3066\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>if\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3044\u306a\u3044\u5358\u7d14\u306a\u30eb\u30fc\u30d7\u51e6\u7406\u306b\u3064\u3044\u3066\u306f<br \/>\n\u3053\u3061\u3089\u306e\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u306e\u3067<br \/>\n\u3042\u308f\u305b\u3066\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=768\" target=\"blank\">\u3010Python\u3011for\u6587\u306e\u66f8\u304d\u65b9\u3092\u8ab0\u3067\u3082\u308f\u304b\u308b\u3088\u3046\u306b\u89e3\u8aac<\/a><br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=783\" target=\"blank\">\u3010Python\u3011while\u30eb\u30fc\u30d7\u306b\u3064\u3044\u3066\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac<\/a><\/p>\n<h2>\u3010Python\u5165\u9580\u3011if\u6587\u3068for\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30eb\u30fc\u30d7\u51e6\u7406<\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/08\/pcsarari816.jpg\" alt=\"for\u6587\u306e\u30eb\u30fc\u30d7\u51e6\u7406\" width=\"621\" height=\"408\" class=\"alignnone size-full wp-image-730\" srcset=\"https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/08\/pcsarari816.jpg 621w, https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/08\/pcsarari816-300x197.jpg 300w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><\/p>\n<p>for\u6587\u306f\u51e6\u7406\u56de\u6570\u304c\u306f\u3063\u304d\u308a\u3057\u3066\u3044\u308b\u5834\u5408\u306b<br \/>\n\u4f7f\u7528\u3067\u304d\u308b\u30eb\u30fc\u30d7\u51e6\u7406\u3067\u3057\u305f\u306d\u3002<br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=768\" target=\"blank\">\u3010Python\u3011for\u6587\u306e\u66f8\u304d\u65b9\u3092\u8ab0\u3067\u3082\u308f\u304b\u308b\u3088\u3046\u306b\u89e3\u8aac<\/a><\/p>\n<p>\u3053\u306efor\u6587\u306b\u5bfe\u3057\u3066\u3055\u3089\u306bif\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067<br \/>\n\u3055\u3089\u306b\u9ad8\u5ea6\u306a\u30eb\u30fc\u30d7\u51e6\u7406\u3092\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u4f8b\u984c1\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#\u4f8b\u984c1\r\n\r\na = [3,6,7,10,21,35]\r\nfor b in a:\r\n    if b%3 == 1:\r\n        print(b)<\/pre>\n<p>\u4f8b\u984c1\u3067\u306f\u307e\u305a<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">a = [3,6,7,10,21,35]<\/pre>\n<p>\u30ea\u30b9\u30c8\u3068\u3057\u3066<br \/>\n3,6,7,10,21,35<br \/>\n\u3068\u3044\u3046\u6570\u5b57\u3092a\u306b\u4ee3\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">for b in a:<\/pre>\n<p>for\u6587\u30eb\u30fc\u30d7\u3092\u4f7f\u3063\u3066<br \/>\na\u306e\u305d\u308c\u305e\u308c\u306e\u8981\u7d20\u306b\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u7d9a\u3044\u3066<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">    if b%3 == 1:<\/pre>\n<p>\u3068\u3059\u308b\u3053\u3068\u3067\u3001<br \/>\na\u304b\u3089b\u306b\u3046\u3064\u3063\u305f\u5404\u8981\u7d20\u30923\u3067\u5272\u308a<br \/>\n\u4f59\u308a\u304c1\u306b\u306a\u3063\u305f\u5834\u5408\u306b\u3060\u3051\u3001<br \/>\nprint(b)\u304c\u5b9f\u884c\u3055\u308c\u3001\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>3,6,7,10,21,35<br \/>\n\u306e\u4e2d\u30673\u3067\u5272\u3063\u305f\u30891\u4f59\u308b\u306e\u306f<br \/>\n7\u306810\u3060\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>\u3057\u305f\u304c\u3063\u3066\u4f8b\u984c1\u3092\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/08\/forif818.jpg\" alt=\"\u30eb\u30fc\u30d7\u51e6\u7406\" width=\"187\" height=\"166\" class=\"alignnone size-full wp-image-805\" \/><\/p>\n<p>7\u306810\u304c\u8868\u793a\u3055\u308c\u308b\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067<span class=\"yellowbg\">for\u6587\u306b\u3088\u308b\u30eb\u30fc\u30d7\u51e6\u7406\u306e\u4e2d\u306b<br \/>\nif\u6587\u3092\u4f7f\u3063\u3066\u6761\u4ef6\u5206\u5c90\u3055\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059<\/span>\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\uff05\u306e\u8a08\u7b97\u306f\u6f14\u7b97\u5b50\u306e\u3068\u3053\u308d\u3067<br \/>\n\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6c17\u306b\u306a\u308b\u65b9\u306f\u3053\u3061\u3089\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=536\" target=\"blank\">\u3010Python\u3011\u6f14\u7b97\u5b50\u307e\u3068\u3081<\/a><\/p>\n<h2>\u3010Python\u5165\u9580\u3011if\u6587\u3068while\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30eb\u30fc\u30d7\u51e6\u7406<\/h2>\n<p>while\u6587\u3092\u4f7f\u3063\u3066\u3082for\u6587\u3068\u540c\u3058\u51e6\u7406\u3092<br \/>\n\u5b9f\u884c\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u984c2\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#\u4f8b\u984c2\r\na = [3,6,7,10,21,35]\r\nb = 0\r\n\r\nwhile b &lt; len(a):\r\n    c = a[b]\r\n    if c%3  == 1:\r\n        print(c)\r\n    b += 1<\/pre>\n<p>\u4f8b\u984c2\u3092\u5b9f\u884c\u3059\u308b\u3068<br \/>\n\u4f8b\u984c1\u3068\u540c\u3058\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u984c2\u306e\u69cb\u9020\u3092\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u306d\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">a = [3,6,7,10,21,35]\r\nb = 0<\/pre>\n<p>\u3067\u3001<br \/>\n\u5909\u6570a\u306b\u30ea\u30b9\u30c8[3,6,7,10,21,35]\u3092\u4ee3\u5165\u3057<br \/>\n\u5909\u6570b\u306b0\u3092\u4ee3\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u6b21\u3001<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">while b &lt; len(a):<\/pre>\n<p>len\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u306f\u3053\u3061\u3089\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<br \/>\n\u21d2<a href=\"https:\/\/python-introduction.com\/?p=296\" target=\"blank\">python\u306elen\u95a2\u6570\u3092\u4f7f\u3063\u3066\u6587\u5b57\u5217\u306e\u9577\u3055\u3092\u8abf\u3079\u308b<\/a><\/p>\n<p>\u3053\u3053\u3067\u306f\u7c21\u5358\u306blen\u95a2\u6570\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u3066\u304a\u304d\u307e\u3059\u306d\u3002<br \/>\nlen\u306b\u3088\u3063\u3066\u8981\u7d20\u6570\u3092\u8abf\u3079\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u306a\u306e\u3067len(a\uff09\u3068\u306a\u3063\u3066\u3044\u308b\u306e\u3067<br \/>\n\u30ea\u30b9\u30c8a\u306e\u8981\u7d20\u6570\u3001\u3053\u3053\u3067\u306f3,6,7,10,21,35\u3068<span class=\"yellowbg\">6\u500b\u3068\u3044\u3046\u610f\u5473<\/span>\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u306a\u306e\u3067\u3002\u5909\u6570b\u304ca\u306e\u8981\u7d20\u65706\u3088\u308a\u5c0f\u3055\u3044\u9593\u3001<br \/>\n\u305d\u308c\u3088\u308a\u3082\u4e0b\u306e\u51e6\u7406\u304c\u884c\u308f\u308c\u308b\u3053\u3068\u306b\u306a\u308b\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u6b21\u306b<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">c = a[b]<\/pre>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u3001<br \/>\nb = 0<br \/>\n\u3068\u6700\u521d\u306b\u3057\u3066\u3044\u307e\u3057\u305f\u306d\u3002<\/p>\n<p>\u3057\u305f\u304c\u3063\u3066<br \/>\nc = a[b]<br \/>\n\u306f<br \/>\nc = a[0]\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">a = [3,6,7,10,21,35]<\/pre>\n<p><span class=\"yellowbg\">a\u306e0\u756a\u76ee\u306e\u8981\u7d20\u3067\u3042\u308b3\u304cc\u306b\u4ee3\u5165\u3055\u308c\u308b\u308f\u3051\u3067\u3059\u3002<\/span><\/p>\n<p>\u3061\u306a\u307f\u306b3\u30920\u756a\u76ee\u30016\u30921\u756a\u76ee\u30017\u30922\u756a\u76ee\u3068\u30ab\u30a6\u30f3\u30c8\u3057\u3066\u3044\u304f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u306d\u3002<\/p>\n<p>\u305d\u3057\u3066<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">if c%3  == 1:\r\n        print(c)\r\n    b += 1<\/pre>\n<p>\u5148\u307b\u30693\u304cc\u306b\u4ee3\u5165\u3055\u308c\u307e\u3057\u305f\u306d\u3002<br \/>\n3\u30923\u3067\u5272\u3063\u305f\u4f59\u308a\uff08\u3053\u3053\u3067\u306f0\uff09\u304c1\u3068\u540c\u3058\u6570\u5b57\u306a\u3089<br \/>\nprint(c)\u3067\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3067\u3082\u30013\u00f73\u306e\u3042\u307e\u308a\u306f0\u306a\u306e\u3067\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<br \/>\n\u3067\u3001\u305d\u306e\u4e0b\u306eb += 1\u306b\u3088\u3063\u3066<br \/>\nb\u306e\u5024\u304c0+1\uff1d1\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">c = a[b]<\/pre>\n<p>\u3067\u30011\u306fa\u306e2\u756a\u76ee\u306e\u6570\u5b576\u304c\u307e\u305fc\u306b\u4ee3\u5165\u3055\u308c<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">if c%3  == 1:\r\n        print(c)\r\n    b += 1<\/pre>\n<p>\u3067\u30016\u00f73\uff1d2\u3042\u307e\u308a0<\/p>\n<p>\u307e\u305f\u3042\u307e\u308a\u304c0\u306a\u306e\u3067\u4f55\u3082\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u308c\u304b\u3089<br \/>\nb += 1<br \/>\n\u306b\u3088\u3063\u3066\u30011+1=2\u3068\u306a\u308a<\/p>\n<p>a\u306e3\u756a\u76ee\u306e\u6570\u5b577\u304cc\u306b\u4ee3\u5165\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">c = a[b]<\/pre>\n<p>\u305d\u3057\u3066\u3001<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">if c%3  == 1:\r\n        print(c)\r\n    b += 1<\/pre>\n<p>\u30677\u00f73\uff1d2\u3042\u307e\u308a1\u3067<br \/>\n\u3053\u3053\u3067\u3042\u307e\u308a\u304c1\u306b\u306a\u3063\u305f\u306e\u3067<br \/>\nprint(c)\u306b\u3088\u3063\u3066\u3001\u6570\u5b57\u306e7\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u307e\u3060<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">while b &lt; len(a):<\/pre>\n<p>\u306b\u3088\u308a\u3001a\u306e\u8981\u7d20\u6570\u306e\u65b9\u304cb\u3088\u308a\u5927\u304d\u3044\u306e\u3067<br \/>\nwhile\u6587\u304c\u7e70\u308a\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u304ca\u306e\u8981\u7d20\u6570\u304c\u5b58\u5728\u3059\u308b\u9650\u308a\u7d9a\u3051\u3089\u308c\u3066<br \/>\n\u7d50\u5c40\u3001<br \/>\n<img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/python-introduction.com\/wp-content\/uploads\/2018\/08\/yosuuuuuoo818.jpg\" alt=\"while\u6587\" width=\"264\" height=\"228\" class=\"alignnone size-full wp-image-808\" \/><\/p>\n<p>\u3068\u306a\u308a\u3001\u5b9f\u884c\u3059\u308b\u3068\u3001<br \/>\n\u300e7\u300f\u3068\u300e10\u300f\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2\u3010Python\u5165\u9580\u3011\u30eb\u30fc\u30d7\u51e6\u7406\u307e\u3068\u3081<\/h2>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067for\u6587\u3067\u3042\u3063\u305f\u308awhile\u6587\u3068if\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067<br \/>\n\u3088\u308a\u8907\u96d1\u306a\u30eb\u30fc\u30d7\u51e6\u7406\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u3053\u306e\u8a18\u4e8b\u3067\u306fPython\u3067if\u6587\u3068while\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u308a if\u6587\u3068for\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30eb\u30fc\u30d7\u51e6\u7406\u306b\u3064\u3044\u3066\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002 if\u6587\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3044\u306a\u3044\u5358\u7d14\u306a\u30eb\u30fc\u30d7\u51e6\u7406\u306b\u3064\u3044\u3066\u306f \u3053\u3061\u3089\u306e\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u89e3 [&hellip;]","protected":false},"author":1,"featured_media":786,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,61],"tags":[3,63],"_links":{"self":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/802"}],"collection":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=802"}],"version-history":[{"count":6,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/802\/revisions"}],"predecessor-version":[{"id":810,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/posts\/802\/revisions\/810"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=\/wp\/v2\/media\/786"}],"wp:attachment":[{"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/python-introduction.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}