teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

ちょっと修正

2015/06/02 14:44

投稿

frogman
frogman

スコア129

answer CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  ```lang-<ruby>
4
4
  #!/usr/bin/ruby
5
+ require 'pp'
5
6
 
6
- question_datas = [
7
+ question_dates = [
7
8
  [1,"一郎",43, "ア","イ","ウ","エ" ],
8
9
  [2,"二郎",44, "ア","イ","ウ","ア" ],
9
10
  [3,"三郎",45, "ア","イ","ア","エ" ],
@@ -22,7 +23,7 @@
22
23
 
23
24
  for i in 0..3
24
25
  for j in 3..6
25
- if( question_datas[i][j] == answer_datas[j])
26
+ if( question_dates[i][j] == answer_datas[j])
26
27
  correct_or_incorrect[i] << "○"
27
28
  else
28
29
  correct_or_incorrect[i] << "×"
@@ -31,8 +32,11 @@
31
32
 
32
33
  end
33
34
 
34
- p correct_or_incorrect
35
+ pp correct_or_incorrect
35
36
  ```
36
37
 
37
38
  結果
38
- [[1, "一郎", 43, "○", "○", "○", "○"], [2, "二郎", 44, "○", "○", "○", "×"], [3, "三郎", 45, "○", "○", "×", "○"], [4, "四郎", 46, "○", "○", "○", "○"]]
39
+ [[1, "一郎", 43, "○", "○", "○", "○"],
40
+ [2, "二郎", 44, "○", "○", "○", "×"],
41
+ [3, "三郎", 45, "○", "○", "×", "○"],
42
+ [4, "四郎", 46, "○", "○", "○", "○"]]

1

変数名変更

2015/06/02 14:44

投稿

frogman
frogman

スコア129

answer CHANGED
@@ -3,7 +3,7 @@
3
3
  ```lang-<ruby>
4
4
  #!/usr/bin/ruby
5
5
 
6
- question_dates = [
6
+ question_datas = [
7
7
  [1,"一郎",43, "ア","イ","ウ","エ" ],
8
8
  [2,"二郎",44, "ア","イ","ウ","ア" ],
9
9
  [3,"三郎",45, "ア","イ","ア","エ" ],
@@ -22,7 +22,7 @@
22
22
 
23
23
  for i in 0..3
24
24
  for j in 3..6
25
- if( question_dates[i][j] == answer_datas[j])
25
+ if( question_datas[i][j] == answer_datas[j])
26
26
  correct_or_incorrect[i] << "○"
27
27
  else
28
28
  correct_or_incorrect[i] << "×"