Original code:
module StudentRecords # @param [Array
] students # Array of student records (array of hashes) # @param [Array
] filters # Zero or more filters to apply - each filter is a lambda returning a boolean # # @return [Array
] # An array of students who pass ALL provided filters def self.filter(students, *filters) # Write your code here return nil end end students = [ { name: 'Thomas Edison', gpa: 3.45 }, { name: 'Grace Hopper', gpa: 3.99 }, { name: 'Leonardo DaVinci', gpa: 2.78 } ] honor_roll = ->(record) { record[:gpa] > 3.0 } honor_roll_members = StudentRecords.filter(students, honor_roll) puts honor_roll_members # it should print # {:name=>"Thomas Edison", :gpa=>3.45} # {:name=>"Grace Hopper", :gpa=>3.99}
Dashboard
Start Trial
Sign In
Home
Product
Features
Use Cases
Customers
ROI Calculator
Integrations
Assessments
Tests
Questions
Pricing
Resources
Book: Evidence-Based Hiring
Blog
Support
Contact Us
Legal
For Jobseekers
© TestDome, 2024.