Franklin

Python Crash Course : A Hands-On, Project-Based Introduction to Programming.

Author/Creator:
Matthes, Eric.
Publication:
San Francisco : No Starch Press, Incorporated, 2015.
Format/Description:
Book
1 online resource (562 pages)
Edition:
1st ed.
Status/Location:
Loading...

Options
Location Notes Your Loan Policy

Details

Other records:
Subjects:
Python (Computer program language).
Form/Genre:
Electronic books.
Summary:
Python Crash Course is a quick, no-nonsense guide to programming in Python.
Contents:
Intro
About the Author
About the Technical Reviewer
Brief Contents
Contents in Detail
Acknowledgments
Introduction
Who Is This Book For?
What Can You Expect to Learn?
Why Python?
Part I: Basics
Chapter 1: Getting Started
Setting Up Your Programming Environment
Python 2 and Python 3
Running Snippets of Python Code
Hello World!
Python on Different Operating Systems
Python on Linux
Python on OS X
Python on Windows
Troubleshooting Installation Issues
Running Python Programs from a Terminal
On Linux and OS X
On Windows
Exercise 1-1: python.org
Exercise 1-2: Hello World Typos
Exercsie 1-3: Infinite Skills
Summary
Chapter 2: Variables and Simple Data Types
What Really Happens When You Run hello_world.py
Variables
Naming and Using Variables
Avoiding Name Errors When Using Variables
Exercise 2-1: Simple Message
Exercise 2-2: Simple Messages
Strings
Changing Case in a String with Methods
Combining or Concatenating Strings
Adding Whitespace to Strings with Tabs or Newlines
Stripping Whitespace
Avoiding Syntax Errors with Strings
Printing in Python 2
Exercise 2-3: Personal Message
Exercise 2-4: Name Cases
Exercise 2-5: Famous Quotes
Exercise 2-6: Famous Quote 2
Exercise 2-7: Stripping Names
Numbers
Integers
Floats
Avoiding Type Errors with the str() Function
Integers in Python 2
Exercise 2-8: Number Eight
Exercise 2-9: Favorite Number
Comments
How Do You Write Comments?
What Kind of Comments Should You Write?
Exercise 2-10: Adding Comments
The Zen of Python
Exercise 2-11: Zen of Python
Summary
Chapter 3: Introducing Lists
What Is a List?
Accessing Elements in a List
Index Positions Start at 0, Not 1
Using Individual Values from a List
Exercise 3-1: Names.
Exercise 3-2: Greetings
Exercise 3-3: Your Own List
Changing, Adding, and Removing Elements
Modifying Elements in a List
Adding Elements to a List
Removing Elements from a List
Exercise 3-4: Guest List
Exercise 3-5: Changing Guest List
Exercise 3-6: More Guests
Exercsie 3-7: Shrinking Guest List
Organizing a List
Sorting a List Permanently with the sort() Method
Sorting a List Temporarily with the sorted() Function
Printing a List in Reverse Order
Finding the Length of a List
Exercise 3-8: Seeing the World
Exercise 3-9: Dinner Guests
Exercise 3-10: Every Function
Avoiding Index Errors When Working with Lists
Exercise 3-11: Intentional Error
Summary
Chapter 4: Working with Lists
Looping Through an Entire List
A Closer Look at Looping
Doing More Work Within a for Loop
Doing Something After a for Loop
Avoiding Indentation Errors
Forgetting to Indent
Forgetting to Indent Additional Lines
Indenting Unnecessarily
Indenting Unnecessarily After the Loop
Forgetting the Colon
Exercise 4-1: Pizzas
Exercise 4-2: Animals
Making Numerical Lists
Using the range() Function
Using range() to Make a List of Numbers
Simple Statistics with a List of Numbers
List Comprehensions
Exercise 4-3: Counting to Twenty
Exercise 4-4: One Million
Exercise 4-5: Summing a Million
Exercise 4-6: Odd Numbers
Exercise 4-7: Threes
Exercise 4-8: Cubes
Exercise 4-9: Cube Comprehension
Working with Part of a List
Slicing a List
Looping Through a Slice
Copying a List
Exercise 4-10: Slices
Exercise 4-11: My Pizzas, Your Pizzas
Exercise 4-12: More Loops
Tuples
Defining a Tuple
Looping Through All Values in a Tuple
Writing over a Tuple
Exercise 4-13: Buffet
Styling Your Code
The Style Guide
Indentation
Line Length.
Blank Lines
Other Style Guidelines
Exercise 4-14: PEP 8
Exercise 4-15: Code Review
Summary
Chapter 5: if Statements
A Simple Example
Conditional Tests
Checking for Equality
Ignoring Case When Checking for Equality
Checking for Inequality
Numerical Comparisons
Checking Multiple Conditions
Checking Whether a Value Is in a List
Checking Whether a Value Is Not in a List
Boolean Expressions
Exercise 5-1: Conditional Tests
Exercise 5-2: More Conditional Tests
if Statements
Simple if Statements
if-else Statements
The if-elif-else Chain
Using Multiple elif Blocks
Omitting the else Block
Testing Multiple Conditions
Exercise 5-3: Alien Colors #1
Exercise 5-4: Alien Colors #2
Exercise 5-5: Alien Colors #3
Exercise 5-6: Stages of Life
Exercise 5-7: Favorite Fruit
Using if Statements with Lists
Checking for Special Items
Checking That a List Is Not Empty
Using Multiple Lists
Exercise 5-8: Hello Admin
Exercise 5-9: No Users
Exercise 5-10: Checking Usernames
Exercise 5-11: Ordinal Numbers
Styling Your if Statements
Exercise 5-12: Styling if statements
Exercise 5-13: Your Ideas
Summary
Chapter 6: Dictionaries
A Simple Dictionary
Working with Dictionaries
Accessing Values in a Dictionary
Adding New Key-Value Pairs
Starting with an Empty Dictionary
Modifying Values in a Dictionary
Removing Key-Value Pairs
A Dictionary of Similar Objects
Exercise 6-1: Person
Exercise 6-2: Favorite Numbers
Exercise 6-3: Glossary
Looping Through a Dictionary
Looping Through All Key-Value Pairs
Looping Through All the Keys in a Dictionary
Looping Through a Dictionary's Keys in Order
Looping Through All Values in a Dictionary
Exercise 6-4: Glossary 2
Exercise 6-5: Rivers
Exercise 6-6: Polling
Nesting.
A List of Dictionaries
A List in a Dictionary
A Dictionary in a Dictionary
Exercise 6-7: People
Exercise 6-8: Pets
Exercise 6-9: Favorite Places
Exercise 6-10: Favorite Numbers
Exercise 6-11: Cities
Exercise 6-12: Extensions
Summary
Chapter 7: User Input and while Loops
How the input() Function Works
Writing Clear Prompts
Using int() to Accept Numerical Input
The Modulo Operator
Accepting Input in Python 2.7
Exercise 7-1: Rental Car
Exercise 7-2: Restaurant Seating
Exercise 7-3: Multiples of Ten
Introducing while Loops
The while Loop in Action
Letting the User Choose When to Quit
Using a Flag
Using break to Exit a Loop
Using continue in a Loop
Avoiding Infinite Loops
Exercise 7-4: Pizza Toppings
Exercise 7-5: Movie Tickets
Exercise 7-6: Three Exits
Exercise 7-7: Infinity
Using a while Loop with Lists and Dictionaries
Moving Items from One List to Another
Removing All Instances of Specific Values from a List
Filing a Dictionary with User Input
Exercise 7-8: Deli
Exercise 7-9: No Pastrami
Exercise 7-10: Dream Vacation
Summary
Chapter 8: Functions
Defining a Function
Passing Information to a Function
Arguments and Parameters
Exercise 8-1: Message
Exercise 8-2: Favorite Book
Passing Arguments
Positional Arguments
Keyword Arguments
Default Values
Equivalent Function Calls
Avoiding Argument Errors
Exercise 8-3: T-Shirt
Exercise 8-4: Large Shirts
Exercise 8-5: Cities
Return Values
Returning a Simple Value
Making an Argument Optional
Returning a Dictionary
Using a Function with a while Loop
Exercise 8-6: City Names
Exercise 8-7: Album
Exercise 8-8: User Albums
Passing a List
Modifying a List in a Function
Preventing a Function from Modifying a List.
Exercise 8-9: Magicians
Exercise 8-10: Great Magicians
Exercise 8-11: Unchanged Magicians
Passing an Arbitrary Number of Arguments
Mixing Positional and Arbitrary Arguments
Using Arbitrary Keyword Arguments
Exercise 8-12: Sandwiches
Exercise 8-13: User Profile
Exercise 8-14: Cars
Storing Your Functions in Modules
Importing an Entire Module
Importing Specific Functions
Using as to Give a Function an Alias
Using as to Give a Module an Alias
Importing All Functions in a Module
Styling Functions
Exercise 8-15: Printing Models
Exercise 8-16: Imports
Exercise 8-17: Styling Functions
Summary
Chapter 9: Classes
Creating and Using a Class
Creating the Dog Class
Making an Instance from a Class
Exercise 9-1: Restaurant
Exercise 9-2: Three Restaurants
Exercise 9-3: Users
Working with Classes and Instances
The Car Class
Setting a Default Value for an Attribute
Modifying Attribute Values
Exercise 9-4: Number Served
Exercise 9-5: Login Attempts
Inheritance
The __init__() method for a Child Class
Inheritance in Python 2.7
Defining Attributes and Methods for the Child Class
Overriding Methods from the Parent Class
Instances as Attributes
Modeling Real-World Objects
Exercise 9-6: Ice Cream Stand
Exercise 9-7: Admin
Exercise 9-8: Privileges
Exercise 9-9: Battery Upgrade
Importing Classes
Importing a Single Class
Storing Multiple Classes in a Module
Importing Multiple Classes from a Module
Importing an Entire Module
Importing All Classes from a Module
Importing a Module into a Module
Finding Your Own Workflow
Exercise 9-10: Imported Restaurant
Exercise 9-11: Imported Admin
Exercise 9-12: Multiple Modules
The Python Standard Library
Exercise 9-13: OrderedDict Rewrite
Exercise 9-14: Dice.
Exercise 9-15: Python Module of the Week.
Notes:
Description based on publisher supplied metadata and other sources.
Local notes:
Electronic reproduction. Ann Arbor, Michigan : ProQuest Ebook Central, 2021. Available via World Wide Web. Access may be limited to ProQuest Ebook Central affiliated libraries.
Other format:
Print version: Matthes, Eric Python Crash Course
ISBN:
9781593277390
9781593276034
OCLC:
946889608