File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
src/components/OpenInColab Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import OpenInColab from "@site/src/components/OpenInColab/OpenInColab";
16
16
print (" Hello World!" )
17
17
```
18
18
19
- <OpenInColab path = " /docs/python/get-started /_samples/hello-world.ipynb" />
19
+ <OpenInColab path = " . /_samples/hello-world.ipynb" />
20
20
21
21
` Hello World! ` と表示されましたか。
22
22
@@ -32,7 +32,7 @@ print("Hello World!")
32
32
print (" Hello World!" ) # この部分もコメントです。
33
33
```
34
34
35
- <OpenInColab path = " /docs/python/get-started /_samples/comment.ipynb" />
35
+ <OpenInColab path = " . /_samples/comment.ipynb" />
36
36
37
37
## 算術演算子
38
38
@@ -42,7 +42,7 @@ Python で計算をしてみましょう。次のように書くと、演算を
42
42
1 + 1
43
43
```
44
44
45
- <OpenInColab path = " /docs/python/get-started /_samples/sum.ipynb" />
45
+ <OpenInColab path = " . /_samples/sum.ipynb" />
46
46
47
47
:::info
48
48
上のプログラムは、次のようにしても実行できます。それぞれには、少し違いがあるようですが気にしなくて大丈夫でしょう。
@@ -53,7 +53,7 @@ Google Colaboratory 以外で実行するときなど上のようなプログラ
53
53
print (1 + 1 )
54
54
```
55
55
56
- <OpenInColab path = " /docs/python/get-started /_samples/sum2.ipynb" />
56
+ <OpenInColab path = " . /_samples/sum2.ipynb" />
57
57
:::
58
58
59
59
Python では様々な計算ができます。
@@ -75,4 +75,4 @@ Python では様々な計算ができます。
75
75
(1 + 5 ** 0.5 )/ 2
76
76
```
77
77
78
- <OpenInColab path = " /docs/python/get-started /_samples/golden-ratio.ipynb" />
78
+ <OpenInColab path = " . /_samples/golden-ratio.ipynb" />
Original file line number Diff line number Diff line change 16
16
331.5 + 0.6 * 10
17
17
```
18
18
19
- <OpenInColab path = " /docs/python/variables /_samples/sound-velocity.ipynb" />
19
+ <OpenInColab path = " . /_samples/sound-velocity.ipynb" />
20
20
21
21
一応できましたが、 $t$ を変えようとすると、(これぐらいならすぐできますが)いちいちプログラムを全て読み直さないといけません。
22
22
27
27
331.5 + 0.6 * t
28
28
```
29
29
30
- <OpenInColab path = " /docs/python/variables /_samples/sound-velocity2.ipynb" />
30
+ <OpenInColab path = " . /_samples/sound-velocity2.ipynb" />
31
31
32
32
:::tip 定数(他の言語の学習者へ)
33
33
Python では定数は使えないようです。慣習的に定数は大文字のみの変数として表すようです。
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
+ import { useLocation } from "@docusaurus/router" ;
2
3
import styles from "./styles.module.css" ;
3
4
4
5
export default function OpenInColab ( { path } ) {
6
+ const pathname = useLocation ( ) . pathname . slice ( 22 ) ;
5
7
return (
6
8
< >
7
9
< div className = { styles . root } >
8
10
< a
9
- href = { `https://colab.research.google.com/github/chvmvd/sikepuri-of-algorithm/blob/main${ path } ` }
11
+ href = { `https://colab.research.google.com/github/chvmvd/sikepuri-of-algorithm/blob/main${ pathname } ${ path } ` }
10
12
target = "_blank"
11
13
rel = "noopener"
12
14
>
You can’t perform that action at this time.
0 commit comments