File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
workshop_registration_infakt_cracow/ex1 Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ ### Group students into passed and failed.
2
+
3
+ ---
4
+
5
+ Write a function that returns hash of failed and passed students.
6
+
7
+ ** Requirements:**
8
+ * function takes 2 arguments:
9
+ * first argument is a hash of students and their grades
10
+ * second argument is a threshold that divides students between
11
+ those who passed and those who failed
12
+ * function returns hash with two keys - ` :failed ` and ` :passed ` , each containing
13
+ hash with failed and passed students
14
+ * function should work flawlessly even when second argument is a string
15
+
16
+ ** Example usage:**
17
+ ``` ruby
18
+ hash = {" Mark" => 10 , " Ellen" => 65 , " Roger" => 20 , " Mike" => 70 }
19
+ passed_or_failed(hash, " 65" )
20
+ ```
21
+
22
+ __ Output__ :
23
+ ``` ruby
24
+ => { passed: { " Ellen" => 65 , " Mike" => 70 }, failed: { " Mark" => 10 , " Roger" => 20 } }
25
+ ```
You can’t perform that action at this time.
0 commit comments