CSC148H1 Study Guide - Midterm Guide: Great News, If And Only If, Binary Tree

67 views18 pages
25 Oct 2018
School
Course
Professor
katrinasavvy and 38715 others unlocked
CSC148H1 Full Course Notes
1
CSC148H1 Full Course Notes
Verified Note
1 document

Document Summary

Lab quiz 1 objects and classes: what is a bene t of marking a class attribute as private, suppose we have imported a class boat and have the following code: def load_boat(boat, items): @rtype: none for item in items: boat. load(item) print("loaded item: " + str(item)) Explain the source of the error, and how you could x it: we have already discussed that classes may represent entities which are not physical objects, like a recommendation or recording system. Lab quiz 1 objects and classes: suppose we did this, >>> names = ["bill", "george", "barack", >>> names. append("hillary", >>> names, ["bill", "george", "barack", "hillary"] On line 2, we pass "hillary" to append. How does python know what list it should append to: suppose we have imported a class boat and bellow it we have the following code: def load_collection(boat, items): """put a collection of items on a boat. @rtype: none for item in items: boat. load_one(item) print("loaded item: " + str(item))

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

Related Documents