CSC148H1 Lecture Notes - Eval, 1.-Class Torpedo Boat, Master Sergeant

32 views2 pages
11 Jan 2013
School
Course
Professor
katrinasavvy and 38715 others unlocked
CSC148H1 Full Course Notes
1
CSC148H1 Full Course Notes
Verified Note
1 document

Document Summary

((3 + 4) (7 1): simply (3 + 4) place all digits on stack * ( , 3", 4, once reach )", evaluate the expression. Int(v2) + int(v1) v1 = 4", op: +", v2 = 3". Stack implementation choices: ex. stack. py (constant time operation) vs. bad_stack. py (linear operation, bad_stack pushes item on a list at index 0, instead of stacking it at the end. Stck. pop() when stack. is_empty(: we wrote the stack class so that other programmers (including us) could use it, there are two kinds of people who are involved with every function and class: The implementers: the people writing that code. Stck. pop(): exceptions: as discussed in week 1, these two kinds of people think about the code very differently, implementers of a service: Have to worry about how the code works. Have no idea what the code is being used for. Don"t know what to do if they"re asked to do the impossible, so they raise an exception.

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