Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Python やアルゴリズムについて簡単にまとめていこうかなと

誤植や要望などがありましたら、どんな些細なことでも気軽に連絡してください。

特に誤植などは見つけたら、ぜひ教えてください。(その場ですぐに直せるので)
特に誤植などは見つけたら、ぜひ教えてください。(その場ですぐに直せるようにしたので)
3 changes: 2 additions & 1 deletion docs/python/get-started/_samples/comment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
}
],
"source": [
"# この部分はコメントです。\n",
"# この部分はコメントです。次の行も実行されません。\n",
"# print(\"Hello World!\") \n",
"print(\"Hello World!\") # この部分もコメントです。"
]
}
Expand Down
51 changes: 51 additions & 0 deletions docs/python/get-started/_samples/div.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.0"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"4/2"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
51 changes: 51 additions & 0 deletions docs/python/get-started/_samples/exp.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2**3"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
51 changes: 51 additions & 0 deletions docs/python/get-started/_samples/multi.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2*2"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
51 changes: 51 additions & 0 deletions docs/python/get-started/_samples/quotient.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5//2"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
51 changes: 51 additions & 0 deletions docs/python/get-started/_samples/remainder.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5%2"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
51 changes: 51 additions & 0 deletions docs/python/get-started/_samples/sub.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2-1"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
28 changes: 16 additions & 12 deletions docs/python/get-started/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 1
sidebar_position: 2
---

import ViewSource from "@site/src/components/ViewSource/ViewSource";
Expand Down Expand Up @@ -41,17 +41,21 @@ Google Colaboratory 以外で実行するときなど上のようなプログラ

Python では様々な計算ができます。

| 演算子 | 説明 | 例 |
| ------ | ------ | ---------- |
| `+` | 足す | `1+1` =>2 |
| `-` | 引く | `2-1` =>1 |
| `*` | 掛ける | `2*2` =>4 |
| `/` | 割る | `4/2` =>2 |
| `**` | べき乗 | `2**3` =>8 |
| `//` | 商 | `5//2` =>2 |
| `%` | 余り | `5%2` =>1 |

`(`、`)` を用いて、複雑な計算もできます。
| 演算子 | 説明 | 例 |
| ------ | ------ | ---------------------------------------------- |
| `+` | 足す | <ViewSource path="_samples/sum.ipynb" /> |
| `-` | 引く | <ViewSource path="_samples/sub.ipynb" /> |
| `*` | 掛ける | <ViewSource path="_samples/multi.ipynb" /> |
| `/` | 割る | <ViewSource path="_samples/div.ipynb" /> |
| `**` | べき乗 | <ViewSource path="_samples/exp.ipynb" /> |
| `//` | 商 | <ViewSource path="_samples/quotient.ipynb" /> |
| `%` | 余り | <ViewSource path="_samples/remainder.ipynb" /> |

括弧`(`、`)` を用いて、複雑な計算もできます。
黄金比 $\frac{1+\sqrt{5}}{2}$ を計算してみましょう。

<ViewSource path="_samples/golden-ratio.ipynb" />

:::note
平方根は 0.5 乗とします。
:::
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/python/google-colaboratory/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
sidebar_position: 1
---

# 環境構築(Google Colaboratory)

Google アカウントを用意してログインしておいてください。

ログインした状態でウェブブラウザで [https://colab.research.google.com/](https://colab.research.google.com/) にアクセスすると、次のような画面が表示されるはずです。

`ノートブックを新規作成` をクリックします。

![Google Colaboratory へようこそ](./getting-started.jpg)

新しいファイルが開いたら、コードを書くことができます。

![新規ファイル](./new-file.jpg)

セルの中に `print("Hello World!")` のように書いて、`Ctrlキー` と `Enterキー` を同時に押すと、実行させることができます。

![実行後](./run.jpg)
Binary file added docs/python/google-colaboratory/new-file.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/python/google-colaboratory/run.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading