質問編集履歴
2
質問補足
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
|
4
4
|
単純に二つの関数(sayhelloとpostTaxPrice)で引数があるかないかの違いですが、呼び出し時に前者は関数名で呼び出しています。対して、後者のpostTaxPriceはprintで呼び出しています。この違いはなぜ起きるのでしょうか?
|
5
5
|
|
6
|
+
戻り値を含むときはprintを使うのでしょうか?
|
7
|
+
|
8
|
+
|
6
9
|
```python
|
7
10
|
def sayhello():
|
8
11
|
print("こんにちは")
|
1
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,27 +6,16 @@
|
|
6
6
|
```python
|
7
7
|
def sayhello():
|
8
8
|
print("こんにちは")
|
9
|
-
|
10
|
-
sayhello()
|
11
9
|
|
12
10
|
def postTaxPrice(price):
|
13
11
|
ans = price * 1.08
|
14
12
|
return ans
|
15
13
|
|
14
|
+
sayhello()
|
16
15
|
print(postTaxPrice(100),"円")
|
17
16
|
postTaxPrice(100)
|
18
|
-
def sayhello():
|
19
|
-
print("こんにちは")
|
20
17
|
|
21
|
-
sayhello()
|
22
|
-
|
23
|
-
def postTaxPrice(price):
|
24
|
-
ans = price * 1.08
|
25
|
-
return ans
|
26
18
|
|
27
|
-
print(postTaxPrice(100),"円")
|
28
|
-
postTaxPrice(100)
|
29
|
-
|
30
19
|
```
|
31
20
|
|
32
21
|
```terminal
|