Pyhthon ef in_grade_interval(mark, grade_interval): \'\'\'(float, str)->bool Giv
ID: 3669994 • Letter: P
Question
Pyhthon
ef in_grade_interval(mark, grade_interval): '''(float, str)->bool
Given a course mark and a grade point value interval, return True or False depending on whether the mark falls in the interval or not. The grade point interval is given as a string with the format 'lower_bound,upper_bound,grade_point_value' Hint: you can use the provided helper functions >>> in_grade_interval(34,'0,49.5,0') True >>> in_grade_interval(34,'49.5,52.5,0.7') False >>> in_grade_interval(62.5,'59.5,62.5,1.7') False '''
Explanation / Answer
I have implemented the function in_grade_interval.
If you have any questions comment on the answer
Function definition for in_grade_interval
def in_grade_interval(mark,grade_interval):
x=grade_interval.split(",");
lower_bound=float(x[0]);
upper_bound=float(x[1]);
if mark>lower_bound and mark<upper_bound:
return True;
return False;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.