File tree 2 files changed +41
-2
lines changed
2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'csv'
4
+ require 'pry'
5
+
6
+ proverbs = File . read ( 'imigani.txt' ) . split ( "\r \n " )
7
+
8
+ count = 1
9
+ result = { }
10
+ proverbs . each do |proverb |
11
+ words = proverb . downcase . scan ( /[a-z]*/ )
12
+ guesses = [ ]
13
+ words . each do |word |
14
+ guesses << word if word . length == 5
15
+ end
16
+
17
+ next unless guesses . length . positive?
18
+
19
+ guesses . each do |guess |
20
+ puts "#{ count } #{ guess } #{ proverb } "
21
+ count += 1
22
+ if result . key? ( guess )
23
+ result [ guess ] << proverb
24
+ else
25
+ result [ guess ] = [ proverb ]
26
+ end
27
+ end
28
+ end
29
+
30
+ binding . pry
31
+
32
+
33
+ # puts count
34
+ # if one of the words is made of 5 letters print the proverb
35
+ # if words.any? { |word| word.length == 5 }
36
+ # puts "#{count} #{proverb}"
37
+ # count += 1
38
+ # end
39
+ # p words
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ Ibuye riserutse ntirihongora isuka
97
97
Ico Imana ikuyeko amaboko ntigisongorerwa
98
98
Ico imbwa yanse ushira aho iraba
99
99
Ico uhawe n'ugutora ucakwa n'ugutakaza
100
- Ico umuntu atarabona acerekwa no kumara kabiri
100
+ Ico umuntu atarabona acerekwa no kumara kabiri
101
101
Ico utariye uba wibikiye
102
102
Icurire Risumba indagu
103
103
Ico utarabona ugisanga imbere
@@ -271,7 +271,7 @@ Nta udakura inkumi
271
271
Ntarataze aruta Mpebezirye
272
272
Nta wanka ivya gusa
273
273
Nta wanka uwamuhaye
274
- Nta wiyia aba yiyibagiye
274
+ Nta wiyima aba yiyibagiye
275
275
Nta wubaga ngw'abangurire
276
276
Nta wubandwa abangikanije
277
277
Nta wuhabwa impera atababaye
You can’t perform that action at this time.
0 commit comments