質問編集履歴
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
game_level = level_selection()
|
35
|
+
game_level = level_selection() #ここのgame_levelがNoneになっています。
|
36
36
|
|
37
37
|
print ("game_level " + str(game_level))
|
38
38
|
|
1
コードをテキストに変えました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,42 @@
|
|
1
|
+
```ここに言語を入力
|
2
|
+
|
3
|
+
def level_selection():
|
4
|
+
|
5
|
+
user_input = raw_input("Choose the difficulty of quize in number or string: (1.Easy 2.Medium 3.Hard)").lower()
|
6
|
+
|
7
|
+
game_level = ["easy","medium","hard"]
|
8
|
+
|
9
|
+
max = 4
|
10
|
+
|
11
|
+
if user_input in game_level:
|
12
|
+
|
13
|
+
print ("Debug user_input = " + user_input) #debug
|
14
|
+
|
15
|
+
return user_input
|
16
|
+
|
17
|
+
elif user_input in str(range(max)):
|
18
|
+
|
19
|
+
return game_level[int(user_input) - 1]
|
20
|
+
|
21
|
+
else:
|
22
|
+
|
1
|
-
|
23
|
+
print("Incorrect level! Try again!")
|
24
|
+
|
25
|
+
print ("Debug user_input = " + user_input) #debug
|
26
|
+
|
27
|
+
level_selection()
|
28
|
+
|
29
|
+
#chosse the difficulty of game level_answer
|
30
|
+
|
31
|
+
#output:the list of questions and answers of selected level
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
game_level = level_selection()
|
36
|
+
|
37
|
+
print ("game_level " + str(game_level))
|
38
|
+
|
39
|
+
```
|
2
40
|
|
3
41
|
|
4
42
|
|
@@ -28,7 +66,45 @@
|
|
28
66
|
|
29
67
|
|
30
68
|
|
69
|
+
```ここに言語を入力
|
70
|
+
|
71
|
+
def level_selection():
|
72
|
+
|
73
|
+
user_input = raw_input("Choose the difficulty of quize in number or string: (1.Easy 2.Medium 3.Hard)").lower()
|
74
|
+
|
75
|
+
game_level = ["easy","medium","hard"]
|
76
|
+
|
77
|
+
max = 4
|
78
|
+
|
79
|
+
if user_input in game_level:
|
80
|
+
|
81
|
+
print ("Debug user_input = " + user_input) #debug
|
82
|
+
|
83
|
+
return user_input
|
84
|
+
|
85
|
+
elif user_input in str(range(max)):
|
86
|
+
|
87
|
+
return game_level[int(user_input) - 1]
|
88
|
+
|
89
|
+
else:
|
90
|
+
|
31
|
-
!
|
91
|
+
print("Incorrect level! Try again!")
|
92
|
+
|
93
|
+
print ("Debug user_input = " + user_input) #debug
|
94
|
+
|
95
|
+
level_selection()
|
96
|
+
|
97
|
+
#chosse the difficulty of game level_answer
|
98
|
+
|
99
|
+
#output:the list of questions and answers of selected level
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
game_level = level_selection()
|
104
|
+
|
105
|
+
print ("game_level " + game_level) #str()を取りました。
|
106
|
+
|
107
|
+
```
|
32
108
|
|
33
109
|
**↓**
|
34
110
|
|