About this book

Last release: Chapter 17 - 8 Apr. 2019

Slither into Python is an introduction to the Python programming language for complete beginners. No prior programming experience or computer science background is necessary. Unlike any other Python resources I have found (not that they're not out there), they don't explain important computer science concepts such as memory or "how computers work". In this book I will cover the fundamentals of the Python language and also introduce these important concepts.

Put simply, coding or computer programming is about making computers do what you want, Computer Science is about how computers do it. Each go hand-in-hand, help you learn faster and improve your overall understanding of a language! This book aims to do exactly that through Python.


Contact

I'm always open to improvements!

Email me here: slitherintopython@gmail.com



This book is free to read online! You can also donate to help support me and help maintain this book. It is also available as a PDF or E-book for $15 (Not available yet).

Please note: The online version of this book may be ahead of the currently available PDF and E-book versions.
slither into python book cover

This book is broken into 3 parts.
Part 1 is Python fundamentals and basic algorithms (Chapters 1 - 16).
Part 2 is Object Oriented Programming and basic data structures (Chapters 17-23).
Part 3 is Introduction to Computer Science (Chapter 24).
At the time of publishing this site, the book will not be complete. I will add, at minimum, 1 chapter per week.
I also plan to add to this list (Data structures & Algorithms) in the future!

Help support the author by donating or purchasing a copy of the book (not available yet)



Table of Contents

Last release: Chapter 17 - 8 Apr. 2019
  • Chapter 1 - Introduction
    • 1.1 - Who is this book for?
    • 1.2 - Learning outcomes
    • 1.3 - A bit about Python
    • 1.4 - Our first program
  • Chapter 2 - Integers, Operators and Syntax
    • 2.1 - Integers
    • 2.2 - Operator precedence
    • 2.3 - Syntax
    • 2.4 - Exercises
  • Chapter 3 - Variables, Floats, Input and Printing
    • 3.1 - Variable assignment
    • 3.2 - Floating-point types
    • 3.3 - Getting user input
    • 3.4 - The print function
    • 3.5 - Exercises
  • Chapter 4 - Control Flow
    • 4.1 - Booleans
    • 4.2 - The if statement
    • 4.3 - if/else statements
    • 4.4 - elif statement
    • 4.5 - Nested conditional statements
    • 4.6 - Exercises
  • Chapter 5 - Looping & Iterations
    • 5.1 - while loops
    • 5.2 - Looping patterns
    • 5.3 - break and continue
    • 5.4 - while loop examples
    • 5.5 - Exercises
  • Chapter 6 - Strings
    • 6.1 - String literals
    • 6.2 - String methods
    • 6.3 - String indexing
    • 6.4 - Immutability
    • 6.5 - String operations
    • 6.6 - String slicing
    • 6.7 - Printing & formatting
    • 6.8 - Exercises
  • Chapter 7 - Linear Search
    • 7.1 - What is linear search
    • 7.2 - Linear-search using while
    • 7.3 - Examples
    • 7.4 - Exercises
  • Chapter 8 - Lists
    • 8.1 - List literals
    • 8.2 - List methods
    • 8.3 - List indexing
    • 8.4 - Mutability
    • 8.5 - List operations
    • 8.6 - List slicing
    • 8.7 - Exercises
  • Chapter 9 - Basic Sorting Algorithms
    • 9.1 - What is sorting?
    • 9.2 - Selection Sort
    • 9.3 - Insertion Sort
    • 9.4 - Comparison of Selction sort and Insertion sort
    • 9.5 - Exercises
  • Chapter 10 - Input, File & Text processing
    • 10.1 - What is filee & text processing?
    • 10.2 - The Sys module
    • 10.3 - Reading from standard input
    • 10.4 - Writing to standard output
    • 10.5 - Standard error
    • 10.6 - Opening & reading files
    • 10.7 - Writing to files & closing files
    • 10.8 - Putting it all together
    • 10.9 - Exercises
  • Chapter 11 - For Loops & Dictionaries
    • 11.1 - for loops
    • 11.2 - Dictionaries
    • 11.3 - Dictionary accessing
    • 11.4 - Adding and removing entries
    • 11.5 - Dictionary operators & methods
    • 11.6 - Sorting dictionaries
    • 11.7 - Exercises
  • Chapter 12 - Functions & Modules
    • 12.1 - What are functions?
    • 12.2 - Defining our own functions
    • 12.3 - Arguments & parameters
    • 12.4 - Variable scope
    • 12.5 - Default mutable argument trap
    • 12.6 - What are modules?
    • 12.7 - Creating our own modules
    • 12.8 - Exercises
  • Chapter 13 - Binary Search
    • 13.1 - Improving our number guessing game
    • 13.2 - Binary Search
    • 13.3 - Implementing Binary Search
    • 13.4 - Exercises
  • Chapter 14 - Error Handling
    • 14.1 - Raising exceptions
    • 14.2 - Assertions
    • 14.3 - try & except
    • 14.4 - finally
    • 14.5 - Exercises
  • Chapter 15 - More On Data Types
    • 15.1 - Tuples
    • 15.2 - Sets
    • 15.3 - Lists & List Comprehensions
    • 15.4 - Exercises
  • Chapter 16 - Recursion & Quicksort
    • 16.1 - What is recursion?
    • 16.2 - Examples of recursion
    • 16.3 - Quicksort part 1
    • 16.4 - Quicksort part 2
  • Chapter 17 - Object Oriented Programming (OOP)
    • 17.1 - Classes & Objects
    • 17.2 - Defining a new type
    • 17.3 - The self variable
    • 17.4 - Exercises
  • Chapter 18 - OOP: Special Methods
    • 18.1 - The __init__() method
    • 18.2 - The __str__() method
    • 18.3 - The __len__() method
    • 18.4 - The __iter__() method
    • 18.5 - Exercises
  • Chapter 19 - OOP: Method Types & Access Modifiers
    • 19.1 - What are instance methods?
    • 19.2 - What are class methods?
    • 19.3 - What are static methods?
    • 19.4 - Public, Private & Protected attributes
    • 19.5 - Exercises
  • Chapter 20 - OOP: Inheritence
    • 20.1 - What is inheritance?
    • 20.2 - Super & sub classes
    • 20.3 - The super() method
    • 20.4 - Examples
    • 20.5 - Exercises
  • Chapter 21 - OOP: Polymorphism
    • 21.1 - What is polymorphism?
    • 21.2 - Polymorphism with functions
    • 21.3 - Polymorphism with abstract classes
    • 21.4 - Examples
    • 21.5 - Exercises
  • Chapter 22 - Basic data structures
    • 22.1 - Stacks
    • 22.2 - Queues
    • 22.3 - Examples
    • 23.4 - Exercises
  • Chapter 23 - More Advanced Data Structures
    • 22.1 - Linked Lists
    • 22.2 - Trees (Binary Search Trees)
    • 22.3 - Examples
    • 23.4 - Exercises
  • Chapter 24 - Introduction to Computer Science
    • 24.1 - Logic - AND, OR and NOT.
    • 24.2 - Bits and Bytes - How numbers are represented within the computer.
    • 24.3 - Memory - How the computer stores your data.
    • 24.4 - The CPU - How the computer manipulates your data.
    • 24.5 - Algorithmic Complexity - How is your program performing?