Skip to content

Commit

Permalink
deploy: 9d73859
Browse files Browse the repository at this point in the history
  • Loading branch information
spring-haru committed Jun 14, 2024
1 parent 5f1f3e7 commit 04d0501
Show file tree
Hide file tree
Showing 114 changed files with 498 additions and 496 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 04211460fcb896227dfb1e5502f24613
config: 723ea0ed64bf0269078ce7a19b50da3c
tags: 645f666f9bcd5a90fca523b33c5a78b7
4 changes: 2 additions & 2 deletions 1_Basics_I.html
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ <h3>半角と全角<a class="headerlink" href="#id3" title="Link to this heading
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span> <span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">line</span> <span class="mi">1</span>
<span class="g g-Whitespace"> </span><span class="mi">10</span>
<span class="o">^</span>
<span class="ne">SyntaxError</span>: invalid decimal literal
<span class="o">^</span>
<span class="ne">SyntaxError</span>: invalid non-printable character U+3000
</pre></div>
</div>
</div>
Expand Down
21 changes: 12 additions & 9 deletions 1_Basics_III.html
Original file line number Diff line number Diff line change
Expand Up @@ -877,15 +877,17 @@ <h2>ヘルプ<a class="headerlink" href="#id4" title="Link to this heading">#</a
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Help on built-in function print in module builtins:

print(...)
print(value, ..., sep=&#39; &#39;, end=&#39;\n&#39;, file=sys.stdout, flush=False)

print(*args, sep=&#39; &#39;, end=&#39;\n&#39;, file=None, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.

sep
string inserted between values, default a space.
end
string appended after the last value, default a newline.
file
a file-like object (stream); defaults to the current sys.stdout.
flush
whether to forcibly flush the stream.
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -1456,6 +1458,7 @@ <h3>属性について<a class="headerlink" href="#id17" title="Link to this hea
&#39;__getattribute__&#39;,
&#39;__getformat__&#39;,
&#39;__getnewargs__&#39;,
&#39;__getstate__&#39;,
&#39;__gt__&#39;,
&#39;__hash__&#39;,
&#39;__init__&#39;,
Expand Down Expand Up @@ -1483,7 +1486,6 @@ <h3>属性について<a class="headerlink" href="#id17" title="Link to this hea
&#39;__rsub__&#39;,
&#39;__rtruediv__&#39;,
&#39;__setattr__&#39;,
&#39;__setformat__&#39;,
&#39;__sizeof__&#39;,
&#39;__str__&#39;,
&#39;__sub__&#39;,
Expand Down Expand Up @@ -1538,6 +1540,7 @@ <h3>属性について<a class="headerlink" href="#id17" title="Link to this hea
&#39;__ge__&#39;,
&#39;__getattribute__&#39;,
&#39;__getitem__&#39;,
&#39;__getstate__&#39;,
&#39;__gt__&#39;,
&#39;__hash__&#39;,
&#39;__iadd__&#39;,
Expand Down
30 changes: 15 additions & 15 deletions 1_Basics_IV.html
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ <h2>フローチャート<a class="headerlink" href="#id2" title="Link to this h
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Matplotlib is building the font cache; this may take a moment.
</pre></div>
</div>
<img alt="_images/5eedb091c240e02904953159001006110950ff5c33c3ff057f252c733c8017d1.svg" src="_images/5eedb091c240e02904953159001006110950ff5c33c3ff057f252c733c8017d1.svg" /></div>
<img alt="_images/df50be003c707fbf7a4a85164e0cf834e8b6d4f7dc43a4a9b817d8dc4b6cd354.svg" src="_images/df50be003c707fbf7a4a85164e0cf834e8b6d4f7dc43a4a9b817d8dc4b6cd354.svg" /></div>
</div>
<p>一番最初と最後の楕円は,プログラムの始まり(<code class="docutils literal notranslate"><span class="pre">START</span></code>)と終わり(<code class="docutils literal notranslate"><span class="pre">END</span></code>)を表す。長方形はコードの処理,そして,矢印はプログラムの実行の順番(フロー)を意味する。単純な例なので,上から下に一直線の実行フローとなっている。より複雑なコードの場合,矢印が横向きや上向きになったりもし,枠も様々な形を使い実行フローを表現することになる。以下では,枠は次の3種類だけを使い制御フローをシンプルな形で表すことにする。</p>
<ul class="simple">
Expand Down Expand Up @@ -644,7 +644,7 @@ <h3>説明と簡単な例<a class="headerlink" href="#id3" title="Link to this h
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/0430d1e809619aaaef6f2279000aed375c75b328ee636a168b8a4930c379f89d.svg" src="_images/0430d1e809619aaaef6f2279000aed375c75b328ee636a168b8a4930c379f89d.svg" /></div>
<img alt="_images/7f1f7fe3734279c9e2f7e755eefcd4385316aa7e072d2ba045c3af6e55cb84c2.svg" src="_images/7f1f7fe3734279c9e2f7e755eefcd4385316aa7e072d2ba045c3af6e55cb84c2.svg" /></div>
</div>
<p>菱形枠中の<code class="docutils literal notranslate"><span class="pre"></span></code>は「判断」を意味するが,上のコードの<code class="docutils literal notranslate"><span class="pre">#2</span></code>に対応している。<code class="docutils literal notranslate"><span class="pre">x=10</span></code><code class="docutils literal notranslate"><span class="pre">True</span></code>なので,菱形枠から右に移動して<code class="docutils literal notranslate"><span class="pre">条件はTrueです</span></code>が表示されることになる。</p>
<p>次の例は上の例と似ているが少しだけ異なる。</p>
Expand Down Expand Up @@ -696,7 +696,7 @@ <h3>説明と簡単な例<a class="headerlink" href="#id3" title="Link to this h
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/c3ef75fbcd1af5837588047716f72299fa4eabf43d2b48750e1c31077018a690.svg" src="_images/c3ef75fbcd1af5837588047716f72299fa4eabf43d2b48750e1c31077018a690.svg" /></div>
<img alt="_images/2024eb1c09b7561d8023ed52d8ed0ee1d34e3f667109c9ace2b7efd1f8ec9afa.svg" src="_images/2024eb1c09b7561d8023ed52d8ed0ee1d34e3f667109c9ace2b7efd1f8ec9afa.svg" /></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">False</span></code>と判断されると,直ぐに<code class="docutils literal notranslate"><span class="pre">END</span></code>となっている。</p>
</section>
Expand Down Expand Up @@ -747,7 +747,7 @@ <h3>複数条件<a class="headerlink" href="#id4" title="Link to this heading">#
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/ba669cb82fc459e1542ebc0c84a5510a96eb667be47f31c4191642df42f38388.svg" src="_images/ba669cb82fc459e1542ebc0c84a5510a96eb667be47f31c4191642df42f38388.svg" /></div>
<img alt="_images/5bb730248b136ba0bec1f181ceeac92513c54aa0bb45c3c13bb10ff16dd9192d.svg" src="_images/5bb730248b136ba0bec1f181ceeac92513c54aa0bb45c3c13bb10ff16dd9192d.svg" /></div>
</div>
<p>このフローチャートをコードに落とし込むと次のようになる。</p>
<div class="cell docutils container">
Expand Down Expand Up @@ -1019,7 +1019,7 @@ <h3>数値を返す例<a class="headerlink" href="#id7" title="Link to this head
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/8705fe6a99151bfc7bd84fde7a1a52e4c3de9beee1c5431a19c2992308c985ae.svg" src="_images/8705fe6a99151bfc7bd84fde7a1a52e4c3de9beee1c5431a19c2992308c985ae.svg" /></div>
<img alt="_images/4df4dc47e4926ef159826eeec053a328080318ee28761adab6d0880e7ab19e96.svg" src="_images/4df4dc47e4926ef159826eeec053a328080318ee28761adab6d0880e7ab19e96.svg" /></div>
</div>
<p>ここでは,まず <span class="math notranslate nohighlight">\(x=0\)</span><code class="docutils literal notranslate"><span class="pre">True</span></code><code class="docutils literal notranslate"><span class="pre">False</span></code>かを判断し,次に <span class="math notranslate nohighlight">\(x&gt;0\)</span><code class="docutils literal notranslate"><span class="pre">True</span></code><code class="docutils literal notranslate"><span class="pre">False</span></code>かを判定している。しかし,図から分かるように,この2つの判断は,非常に似ており,次のように1つにまとめることができる。</p>
<div class="cell tag_hide-input docutils container">
Expand Down Expand Up @@ -1050,7 +1050,7 @@ <h3>数値を返す例<a class="headerlink" href="#id7" title="Link to this head
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/e408926cfc7df58cde58cba06a8bed0e9b516e706b44f6fcc8da13f41035de68.svg" src="_images/e408926cfc7df58cde58cba06a8bed0e9b516e706b44f6fcc8da13f41035de68.svg" /></div>
<img alt="_images/0e435dec51ba204112f82eb7ec6b5349d913833d246f4709760c5f1c4cab4c4c.svg" src="_images/0e435dec51ba204112f82eb7ec6b5349d913833d246f4709760c5f1c4cab4c4c.svg" /></div>
</div>
<p>このフローチャートに従って,<code class="docutils literal notranslate"><span class="pre">if</span></code>文を使いコードを書いてみよう。</p>
<div class="cell docutils container">
Expand Down Expand Up @@ -1311,7 +1311,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">print()</span><
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/c930497432d95ba5a8cb81807caf43781ea07d823e39f6dec4430dfd371c7776.svg" src="_images/c930497432d95ba5a8cb81807caf43781ea07d823e39f6dec4430dfd371c7776.svg" /></div>
<img alt="_images/d8cddac0bb317fa464e5fcbf7b54f09ab0311a09e9062c6dd3526853bd2accc0.svg" src="_images/d8cddac0bb317fa464e5fcbf7b54f09ab0311a09e9062c6dd3526853bd2accc0.svg" /></div>
</div>
<p>この図から,<code class="docutils literal notranslate"><span class="pre">for</span></code>ループの裏では菱形の判断,即ち,<code class="docutils literal notranslate"><span class="pre">if</span></code>文が動いていることが分かる。<code class="docutils literal notranslate"><span class="pre">gdp_components</span></code>の最後の要素のループ処理が終わったかどうかを判断している。</p>
<div class="admonition hint">
Expand Down Expand Up @@ -2137,7 +2137,7 @@ <h3>説明と簡単な例<a class="headerlink" href="#id12" title="Link to this
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/0f07f74f8a08f63381ae2b57ffeac59416103b31670b61133230c60e91e6aa7c.svg" src="_images/0f07f74f8a08f63381ae2b57ffeac59416103b31670b61133230c60e91e6aa7c.svg" /></div>
<img alt="_images/70a8e5973e4b553ede6393db28edb3732c3a182ab634ea7c5d15628fb3642ca1.svg" src="_images/70a8e5973e4b553ede6393db28edb3732c3a182ab634ea7c5d15628fb3642ca1.svg" /></div>
</div>
<p>この図から,最後の<code class="docutils literal notranslate"><span class="pre">counter+=1</span></code>がなければ無限ループに陥ってしまうことが分かると思う。また,<code class="docutils literal notranslate"><span class="pre">for</span></code>ループ同様,菱形で<code class="docutils literal notranslate"><span class="pre">if</span></code>文が裏で働いていることが分かる。一方で,<code class="docutils literal notranslate"><span class="pre">if</span></code>文の判断で次の点で異なる。</p>
<ul class="simple">
Expand Down Expand Up @@ -2207,7 +2207,7 @@ <h3>説明と簡単な例<a class="headerlink" href="#id12" title="Link to this
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/fd27bdf4d10f793687746463af8e06f1039ef9cc6c54290fb0658881a6591706.svg" src="_images/fd27bdf4d10f793687746463af8e06f1039ef9cc6c54290fb0658881a6591706.svg" /></div>
<img alt="_images/7fabf100608540786122cbaf464c6d0d8c60c360256822eb22f62fdda0b59f7b.svg" src="_images/7fabf100608540786122cbaf464c6d0d8c60c360256822eb22f62fdda0b59f7b.svg" /></div>
</div>
<p>上のフローチャートと比べると,菱形枠と<code class="docutils literal notranslate"><span class="pre">END</span></code>の間に<code class="docutils literal notranslate"><span class="pre">print('無事終了(^^)')</span></code>が追加されている。</p>
</section>
Expand Down Expand Up @@ -2449,7 +2449,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">if</span></code
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/43ae087272298f204050ad02e36f3bcd0c2e7f928f9f1a0c83b472308aa40b7b.svg" src="_images/43ae087272298f204050ad02e36f3bcd0c2e7f928f9f1a0c83b472308aa40b7b.svg" /></div>
<img alt="_images/b6360425701dd09c1138017535392bdd8756a461a360ff521de8ce48ac65bd94.svg" src="_images/b6360425701dd09c1138017535392bdd8756a461a360ff521de8ce48ac65bd94.svg" /></div>
</div>
<p>この例に基づいて,<code class="docutils literal notranslate"><span class="pre">1</span></code>から<code class="docutils literal notranslate"><span class="pre">5</span></code>までの数字を<code class="docutils literal notranslate"><span class="pre">3</span></code>を飛ばして<code class="docutils literal notranslate"><span class="pre">1</span></code><code class="docutils literal notranslate"><span class="pre">2</span></code><code class="docutils literal notranslate"><span class="pre">4</span></code><code class="docutils literal notranslate"><span class="pre">5</span></code>を表示するとしよう。その場合に重宝するのが<code class="docutils literal notranslate"><span class="pre">if</span></code>文と<code class="docutils literal notranslate"><span class="pre">continue</span></code>(対象コードの実行を飛ばすコード)の組み合わせである。まず,フローチャートで表してみよう。</p>
<div class="cell tag_hide-input docutils container">
Expand Down Expand Up @@ -2488,7 +2488,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">if</span></code
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/1897abb68c10cf47c0179b3af11aa67c897395f41d542300bf2db092f4fef70d.svg" src="_images/1897abb68c10cf47c0179b3af11aa67c897395f41d542300bf2db092f4fef70d.svg" /></div>
<img alt="_images/a2a26c71d9911b50e26becbaa50259005fbf14af60c2183ddacdb1474fc6efc0.svg" src="_images/a2a26c71d9911b50e26becbaa50259005fbf14af60c2183ddacdb1474fc6efc0.svg" /></div>
</div>
<p>上のフローチャートと異なる点は,下の菱形が追加されていることだけであり,その菱形を<code class="docutils literal notranslate"><span class="pre">if</span></code>文で捉えることができる。更に,下の菱形から上の菱形への矢印(<code class="docutils literal notranslate"><span class="pre">3</span></code>の表示を飛ばす)を<code class="docutils literal notranslate"><span class="pre">continue</span></code>で実行することになる。コードを書いてみよう。</p>
<div class="cell docutils container">
Expand Down Expand Up @@ -2572,7 +2572,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">if</span></code
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/6250e70dd4032aaba79a0615ff90c17542fa08601af94df115eb3ab27f72f574.svg" src="_images/6250e70dd4032aaba79a0615ff90c17542fa08601af94df115eb3ab27f72f574.svg" /></div>
<img alt="_images/2453e4c18be426dd0b6b09a9619f6499b658cd954a6929c3434eac971dd0fc32.svg" src="_images/2453e4c18be426dd0b6b09a9619f6499b658cd954a6929c3434eac971dd0fc32.svg" /></div>
</div>
<p>菱形の中は<code class="docutils literal notranslate"><span class="pre">True</span></code>なので,必ず<code class="docutils literal notranslate"><span class="pre">True</span></code>の矢印の方向に沿ってコードは実行される。<code class="docutils literal notranslate"><span class="pre">False</span></code>も書いてあるが,そちらの矢印に決して進むことはない。</p>
<p>一方で,<code class="docutils literal notranslate"><span class="pre">while</span> <span class="pre">True:</span></code>と書く<code class="docutils literal notranslate"><span class="pre">while</span></code>ループでも,途中で処理を終了させる方法がある。それが<code class="docutils literal notranslate"><span class="pre">if</span></code>文と<code class="docutils literal notranslate"><span class="pre">break</span></code>(ループを中断するコード)を組み合わせる方法である。フローチャートでは次のようになる。</p>
Expand Down Expand Up @@ -2609,7 +2609,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">if</span></code
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/b9ed0e93012291c4cd041b8f7a92eae9bb3dc6cd40e8a62179880a364fd732c2.svg" src="_images/b9ed0e93012291c4cd041b8f7a92eae9bb3dc6cd40e8a62179880a364fd732c2.svg" /></div>
<img alt="_images/e338bb5cea88cb0e45e47b9df54b65ebd44cb90daa2c3139e1b57d715b135663.svg" src="_images/e338bb5cea88cb0e45e47b9df54b65ebd44cb90daa2c3139e1b57d715b135663.svg" /></div>
</div>
<p>上のフローチャートと異なるのは,下の菱形(<code class="docutils literal notranslate"><span class="pre">条件?</span></code>)を追加することにより,<code class="docutils literal notranslate"><span class="pre">while</span></code>ループは維持するとともに<code class="docutils literal notranslate"><span class="pre">END</span></code>への矢印を追加した点である。</p>
<p>例を使って,この考えをコードに落とし込んでみよう。</p>
Expand Down Expand Up @@ -2691,7 +2691,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">if</span></code
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/42a41f9d8aace751827cd39082666cd4bda7768d0db2b328c425a239345d013d.svg" src="_images/42a41f9d8aace751827cd39082666cd4bda7768d0db2b328c425a239345d013d.svg" /></div>
<img alt="_images/98ad6b1ad9971275395ed7f8c54a1692c3a876e7e8bebcbb16865c603320120d.svg" src="_images/98ad6b1ad9971275395ed7f8c54a1692c3a876e7e8bebcbb16865c603320120d.svg" /></div>
</div>
<p>上のコードの<code class="docutils literal notranslate"><span class="pre">#4</span></code><code class="docutils literal notranslate"><span class="pre">#6</span></code>を少し書き換えて,次のようにしても同じ結果が返される。</p>
<div class="cell docutils container">
Expand Down Expand Up @@ -2823,7 +2823,7 @@ <h3><code class="docutils literal notranslate"><span class="pre">continue</span>
</div>
</details>
<div class="cell_output docutils container">
<img alt="_images/613f1db47010f93904ba13788cbefb09c6272014e182c1367d502d76d9a20f40.svg" src="_images/613f1db47010f93904ba13788cbefb09c6272014e182c1367d502d76d9a20f40.svg" /></div>
<img alt="_images/4a820964830763fa5f5602bb14db17e06da756b2889eb7d78770a1c95df4b49d.svg" src="_images/4a820964830763fa5f5602bb14db17e06da756b2889eb7d78770a1c95df4b49d.svg" /></div>
</div>
</section>
</section>
Expand Down
Loading

0 comments on commit 04d0501

Please sign in to comment.