Skip to content

Commit ab2fc94

Browse files
committed
.
1 parent 14353df commit ab2fc94

File tree

8 files changed

+81
-13
lines changed

8 files changed

+81
-13
lines changed

Diff for: .vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.formatting.provider": "black"
3+
}

Diff for: README.md

+22
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,25 @@
55
```sh
66
brew install python3
77
```
8+
9+
## Formatter の設定
10+
11+
`setting.json`
12+
13+
```json
14+
"[python]": {
15+
"editor.defaultFormatter": null
16+
},
17+
```
18+
19+
[ここらへん](https://qiita.com/sin9270/items/85e2dab4c0144c79987d#autopep8)から自由に選択
20+
21+
```json
22+
"python.formatting.provider": "black",
23+
```
24+
25+
私は black を選択した
26+
27+
## Reference
28+
29+
- https://qiita.com/Fendo181/items/a934e4f94021115efb2e

Diff for: lesson01.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# コメントアウト
22

3-
'''
3+
"""
44
複数行コメントアウト
5-
'''
5+
"""
66

77
"""
88
複数行コメントアウト
99
"""
1010

1111
# Consoleに出力
1212
print("Hello world!")
13-
print("Hello", "world!") #spaceあり
14-
print("Hello" + "world!") # spaceなし
15-
print("Hello" * 3) # 3回繰り返す
16-
print("Hello" * 3, "world!") # 3回繰り返す
13+
print("Hello", "world!") # spaceあり
14+
print("Hello" + "world!") # spaceなし
15+
print("Hello" * 3) # 3回繰り返す
16+
print("Hello" * 3, "world!") # 3回繰り返す
1717

1818
# Scriptを実行 $ python3 lesson01.py

Diff for: lesson02.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
# 変数の埋め込み
2121
name = "nob"
2222
score = 31.6
23-
print("name:{0} score:{1}".format(name,score))
23+
print("name:{0} score:{1}".format(name, score))

Diff for: lesson03.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
print(x - 2)
77
print(x * 2)
88
print(x / 2)
9-
print(x // 2) # 商
10-
print(x % 2) # 余り
11-
print(x ** 2)
9+
print(x // 2) # 商
10+
print(x % 2) # 余り
11+
print(x**2)
1212

13-
x+=100
13+
x += 100
1414
print(x)
1515

1616
# 論理演算子

Diff for: lesson04.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Scriptを実行 $ python3 lesson04.py
22

33
# if文
4-
score=int(input("score ? "))
4+
score = int(input("score ? "))
55
if score > 80:
66
print("Great!")
77
elif score > 60:
@@ -10,4 +10,4 @@
1010
print("So So!")
1111

1212
# 条件演算子
13-
print("Great!" if score > 80 else "so so! ..")
13+
print("Great!" if score > 80 else "so so! ..")

Diff for: lesson05.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Scriptを実行 $ python3 lesson05.py
2+
3+
# while文
4+
i = 0
5+
name = "Taro"
6+
7+
while i < 10:
8+
if i == 5:
9+
break
10+
print("{0:}:{1:}".format(i, name))
11+
print("%d:%s" % (i, name))
12+
i += 1
13+
else:
14+
print("finish!")
15+
16+
17+
# for文
18+
for i in range(0, 10):
19+
if i == 5:
20+
# break
21+
# iが5の時にスキップする。
22+
continue
23+
print(i)
24+
# 終了後の処理
25+
else:
26+
print("Finish!")

Diff for: lesson06.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Scriptを実行 $ python3 lesson06.py
2+
3+
# 関数
4+
def say_hi(age, name="no_name"):
5+
print("Hi! {0} age({1})".format(name, age))
6+
7+
8+
# 呼び出し
9+
say_hi("tom", 23)
10+
say_hi("Bob", 24)
11+
12+
# 戻り値
13+
def add(a, b):
14+
return a + b
15+
16+
17+
add(1, 2)

0 commit comments

Comments
 (0)