cmpt120 guide

cmpt120 guide - Computing Science 120 Study Guide...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Computing Science 120 Study Guide Introduction to Computing Science and Programming I Fall 2007 Edition by Greg Baker Faculty of Applied Sciences Simon Fraser University c circlecopyrt Greg Baker, 20042007 2 Copyright c circlecopyrt 20042007 Greg Baker. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sec- tions being About the Author and GNU Free Documentation License, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License. All code examples in this document are under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Contents Course Introduction 11 Learning Resources . . . . . . . . . . . . . . . . . . . . . . 12 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 13 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 About the Author . . . . . . . . . . . . . . . . . . . . . . . 15 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 I Computer Science and Programming 17 1 Computing Science Basics 19 1.1 What is an Algorithm? . . . . . . . . . . . . . . . . . . . . 19 1.2 What is Computing Science? . . . . . . . . . . . . . . . . . 22 1.3 What is Programming? . . . . . . . . . . . . . . . . . . . . 25 1.4 Pseudocode . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2 Programming Basics 29 2.1 Starting with Python . . . . . . . . . . . . . . . . . . . . . 29 2.2 Doing Calculations . . . . . . . . . . . . . . . . . . . . . . 32 2.3 Storing Information . . . . . . . . . . . . . . . . . . . . . . 35 2.4 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.5 User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.6 How Computers Represent Information . . . . . . . . . . . 41 2.7 Example Problem Solving: Feet and Inches . . . . . . . . . 48 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 3 4 CONTENTS 3 Control Structures 55 3.1 Making Decisions . . . . . . . . . . . . . . . . . . . . . . . 55 3.2 Definite Iteration: for loops . . . . . . . . . . . . . . . . . 59 3.3 Indefinite Iteration: while loops . . . . . . . . . . . . . . . 62 3.4 Choosing Control Structures . . . . . . . . . . . . . . . . . 63 3.5 Example Problem Solving: Guessing Game . . . . . . . . . 65 3.6 Running Time . . . . . . . . . . . . . . . . . . . . . . . . . 70 3.7 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 3.8 Coding Style . . . . . . . . . . . . . . . . . . . . . . . . . . 80 3.9 More About Algorithms . . . . . . . . . . . . . . . . . . . 84 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 4 Functions and Decomposition...
View Full Document

Page1 / 188

cmpt120 guide - Computing Science 120 Study Guide...

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

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