108HL11 - Strings Lecture 11, Week 4 February 2, 2011...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Strings Lecture 11, Week 4 February 2, 2011 CSC108H1S Velian Pandeliev 1 Wednesday, February 2, 2011
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Announcements 2 Quiz 2 is next Wednesday. It will cover what we'll learned up to the end of this week. Quiz 2 will start promptly at 10:15 and will last until 10:30. Anyone arriving after 10:20 will not be able to write the quiz and will receive 0 on it. Wednesday, February 2, 2011
Background image of page 2
3 Recap of Lecture 10 Wednesday, February 2, 2011
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
print vs return 4 print and return do very different things: print is used to display information to the user by outputting it to the screen. It can be used anywhere, as many times as is necessary, but it only gives information to the user. return is used to extract a value from a function for further use inside a program (in fact, it's the only way to extract a value from a function). It can only appear at the end of a function body and it passes information to other parts of the program, not to the user. Wednesday, February 2, 2011
Background image of page 4
Docstrings vs Comments 5 Docstrings are for external use. They are meant to synthesize what a function does so other programmers using it don't have to read through its code. Comments are for internal use. They explain how a function accomplishes a task. Their purpose is to make code easier to read by future programmers. Wednesday, February 2, 2011
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
__main__ 6 This will be useful to know when completing your assignment. You've written a function. You think it does what it's supposed to, but how can you be sure? You should test your function: try to call it with different values, and see if the result is what you expect it to be. The place for testing code is the
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/25/2011 for the course CSC 108 taught by Professor Gries during the Spring '08 term at University of Toronto.

Page1 / 25

108HL11 - Strings Lecture 11, Week 4 February 2, 2011...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online