CSC108H5 Lecture Notes - Lecture 9: If And Only If
897wjface and 39475 others unlocked
12
CSC108H5 Full Course Notes
Verified Note
12 documents
Document Summary
They are in year 2 or year 3, And they are registered full-time. def is_pey_eligible_bad1(cgpa, yost, full_time): Given a cgpa, year, and whether they are full-time, return true iff the student is eligible for pey. # nested if statements here are not needed if cgpa >= 2. 0: if (yost == 2 or yost == 3): if full_time == true: return true. # error: never returns false def is_pey_eligible_bad2(cgpa, yost, full_time): Given a cgpa, year, and whether they are full-time, return true iff the student is eligible for pey. if cgpa >= 2. 0 and (yost == 2 or yost == 3) and full_time == true: return true else: return false. Note on simplifying booleans def test(x): if x > 4: # redundant -- like saying if (true): return true, else: return false return true else: return false def test2(x): return x > 4. Return true iff the student"s cgpa, year of study, and program of study make them eligible for pey.