Computer Science with Applications
Preface
1. Getting Started
1.1. Computational Thinking
1.2. Programming Basics
1.3. Control Flow Statements
1.4. Introduction to Functions
1.5. Basics of Code Organization
1.6. Understanding Errors and Catching Exceptions
1.7. Example: A Game of Chance
2. Data Structures
3. Functional Programming and Recursion
4. Working with Data
Computer Science with Applications
»
1.
Getting Started
View page source
1.
Getting Started
1.1. Computational Thinking
1.1.1. Decomposition and abstraction
1.1.2. Modeling
1.1.3. Algorithms
1.1.4. Complexity
1.2. Programming Basics
1.2.1. Tools
1.2.2. Your First Program
1.2.3. The Basics
1.2.4. Variables
1.2.5. Types
1.2.6. Expressions
1.2.7. Casting
1.2.8. Dynamic Typing Revisited
1.2.9. Code Comments
1.3. Control Flow Statements
1.3.1. Conditional Statements
1.3.2.
for
Loops
1.3.3.
while
loops
1.3.4. Putting it all together
1.3.5. Practice Problem Solutions
1.4. Introduction to Functions
1.4.1. Anatomy of a function
1.4.2. Encapsulating primality testing
1.4.3. Return statements
1.4.4. Advantages of using functions
1.4.5. Variable scope
1.4.6. Parameters
1.4.7. Global variables
1.4.8. The function call stack
1.4.9. Practice Problem Solutions
1.5. Basics of Code Organization
1.5.1. Python modules
1.5.2. Running vs importing a module
1.5.3. Computer programs revisited
1.5.4. The Python Standard Library
1.6. Understanding Errors and Catching Exceptions
1.6.1. Catching exceptions
1.6.2. Practice Problems
1.6.3. Practice Problem Solutions
1.7. Example: A Game of Chance
1.7.1. Rolling dice
1.7.2. Playing a round
1.7.3. Simulating a player
1.7.4. Estimating win rate
1.7.5. Main block
1.7.6. Final Program