質問編集履歴
3
強調表示の削除、error発生部分の強調
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,10 +7,33 @@
|
|
7
7
|
IndentationError: unexpected indent
|
8
8
|
|
9
9
|
|
10
|
-
----ソースコード----
|
10
|
+
----error発生部分ソースコード----
|
11
11
|
```
|
12
12
|
class Blackjack(self, deck.self):
|
13
13
|
|
14
|
+
|
15
|
+
##Point method
|
16
|
+
def Point(self):
|
17
|
+
sum = 0
|
18
|
+
sorted((deck.self), reverse = True)
|
19
|
+
for i in range(len(deck.self)):
|
20
|
+
if deck.self == 11 or 12 or 13:
|
21
|
+
sum += 10
|
22
|
+
elif deck.self == 1:
|
23
|
+
sum += 11
|
24
|
+
##error部分 if sum >= 21:
|
25
|
+
sum -=10
|
26
|
+
else:
|
27
|
+
sum += deck.self
|
28
|
+
|
29
|
+
|
30
|
+
```
|
31
|
+
|
32
|
+
|
33
|
+
----ソースコード全体----
|
34
|
+
```
|
35
|
+
class Blackjack(self, deck.self):
|
36
|
+
|
14
37
|
###init method
|
15
38
|
def __init__(self,deck):
|
16
39
|
deck.self = deck
|
@@ -31,7 +54,7 @@
|
|
31
54
|
sum += 10
|
32
55
|
elif deck.self == 1:
|
33
56
|
sum += 11
|
34
|
-
|
57
|
+
if sum >= 21:
|
35
58
|
sum -=10
|
36
59
|
else:
|
37
60
|
sum += deck.self
|
@@ -44,6 +67,4 @@
|
|
44
67
|
pass
|
45
68
|
|
46
69
|
|
47
|
-
return sum
|
70
|
+
return sum
|
48
|
-
|
49
|
-
```
|
2
error内容の詳細を追記しました。よろしくお願いいたします。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
Pointメソッド中のif文(line21)にIndentation error(Unexpected indent)が表示され、先頭の位置を変えてみたのですが、errorが消えません。対処法と可能であれば原因をご教示頂けますと幸いです。
|
2
2
|
|
3
|
+
-----errorの内容-----
|
4
|
+
|
5
|
+
if sum >= 21:
|
6
|
+
^
|
7
|
+
IndentationError: unexpected indent
|
8
|
+
|
9
|
+
|
10
|
+
----ソースコード----
|
3
11
|
```
|
4
12
|
class Blackjack(self, deck.self):
|
5
13
|
|
1
ご指摘ありがとうございます。バッククォートとコメントを追記いたしました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,17 +1,20 @@
|
|
1
|
-
Pointメソッド中のif文(line21)にIndentation errorが表示され、先頭の位置を変えてみたのですが、errorが消えません。対処法と可能であれば原因をご教示頂けますと幸いです。
|
1
|
+
Pointメソッド中のif文(line21)にIndentation error(Unexpected indent)が表示され、先頭の位置を変えてみたのですが、errorが消えません。対処法と可能であれば原因をご教示頂けますと幸いです。
|
2
2
|
|
3
|
+
```
|
3
4
|
class Blackjack(self, deck.self):
|
4
5
|
|
5
|
-
|
6
|
+
###init method
|
6
7
|
def __init__(self,deck):
|
7
8
|
deck.self = deck
|
8
9
|
|
9
|
-
|
10
|
+
###HIt method
|
10
11
|
def HIt(self):
|
11
12
|
return random.randint(1,13)
|
13
|
+
|
12
|
-
|
14
|
+
###Dealer method
|
13
15
|
def Dealer(self):
|
14
16
|
|
17
|
+
##Point method
|
15
18
|
def Point(self):
|
16
19
|
sum = 0
|
17
20
|
sorted((deck.self), reverse = True)
|
@@ -24,7 +27,8 @@
|
|
24
27
|
sum -=10
|
25
28
|
else:
|
26
29
|
sum += deck.self
|
30
|
+
|
27
|
-
|
31
|
+
###Hit_or_Stand method
|
28
32
|
def Hit_or_stand(self, Point, Hit):
|
29
33
|
if Point <=16:
|
30
34
|
deck.self.append(Hit)
|
@@ -32,4 +36,6 @@
|
|
32
36
|
pass
|
33
37
|
|
34
38
|
|
35
|
-
return sum
|
39
|
+
return sum
|
40
|
+
|
41
|
+
```
|