CSC108H5 Lecture Notes - Lecture 9: If And Only If

18 views2 pages
School
Course
897wjface and 39475 others unlocked
CSC108H5 Full Course Notes
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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents