-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInClassChallenge1.2.rb
More file actions
1 lines (1 loc) · 1.18 KB
/
InClassChallenge1.2.rb
File metadata and controls
1 lines (1 loc) · 1.18 KB
1
stuf = [4, 2, 16, 5, 19, 5, 6, 2, 3, 5, 15, 4, 6, 10, 13, 1, 18, 6, 9, 10, 9, 12, 6, 9, 11, 18, 16, 18, 4, 9, 15, 7, 20, 12, 1, 4, 20, 17, 6, 12, 20, 19, 13, 10, 10, 7, 8, 2, 18, 20, 1, 7, 17, 3, 8, 10, 7, 1, 15, 7, 3, 13, 14, 12, 19, 13, 7, 17, 2, 14, 3, 17, 5, 12, 16, 6, 10, 15, 8, 2, 7, 1, 18, 16, 17, 12, 7, 14, 10, 17, 12, 19, 2, 20, 16, 7, 20, 16, 5, 7] def c (jumble, sumble, placeble) sumble += jumble[placeble] placeble += 1 if placeble < jumble.length() return c(jumble, sumble, placeble) end return sumble end def allOfTheThingsPutTogetherAndThenDividedByTheTotalNumberOfThings (jumble) sumble = c(jumble, 0, 0).to_f return sumble / jumble.length() end def shmeven(jumble) sumble = 0 for all in jumble if all % 2 != 0 sumble += 1 end end return sumble end def double_it_and_give_it_to_the_next_person(jumble) sumble = 0 placeble = 1 for all in jumble do if jumble[all] % 2 == 1 and jumble[all-1] % 2 == 1 sumble += 1 end end return sumble end awoeifjawe = c(stuf, 0, 0) boeirjoerng = allOfTheThingsPutTogetherAndThenDividedByTheTotalNumberOfThings(stuf) sropibowopnqewf = shmeven(stuf) eoin = double_it_and_give_it_to_the_next_person(stuf) puts(awoeifjawe + boeirjoerng + sropibowopnqewf + eoin)