I am trying to write a function that prints out a list of all courses with a passing grade but cant’t figure out how. How may I implement that? (The minimum passing grade is 5.)
courses = [Math, Geography, Chemistry]
grades = [7, 3, 5]
(the grades grade corresponds to the courses course and so on.)
Passed = Math, Chemistry.
What have you tried?
there are many possible ways… a loop,
I have tried using a filter but it didn’t work (though I was using it wrong since the filter parameter is not an index.)
It was something like courses.filter((x) => grades[x] >=5)
You should read more about
filter and what arguments are available to it.
x is not what you think it is.