Slither Into Python
An Introduction to Python for Beginners
π Just scroll down to the table of contents to start reading! π
This book is free to read online! PDF versions are available for $6.99 to help support me and the site from E-Junkie. Thank you, and I hope you enjoy the book!
This work is free to read under a Creative Commons License.
π Introduction
Slither into Python is an introduction to Python 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.
π£ Join the Discord!
A couple of folks from reddit who were using this book to learn Python have set up a discord. They reached out to me and I joined. The group is beginning to grow quite rapidly and theyβre looking for new members. I encourage you to join if youβre looking to find people who are also learning. Iβm also quite active in it, so if you have any questions you can easily reach me there but Iβm sure youβll find someone who has an answer to your question!
π Thank you to all 65,271 of you!
Slither into Python has been read by 65,271 people as of October, 2020, just four months since the book was completed! Finally, Iβve had the chance to get around to writing the solutions and they are now available for free also! You can find them in chapter 23!
βThis is great! I love the way you explain some of these concepts. Itβs very clear and concise.β
βIβm reading 1.2, and I can already say I love how easy it is to understand so far. Itβs a lot more comprehensive than other sites Iβve looked at, which is great for a beginner like me.β
βIβve only just read through a couple of pages but this is hands down one of the cleanest introductions Iβve come accross so far. Massive shout-out to you for putting in online for free!β
π The Ultimate Python Roadmap for 2020
To complement this book, Iβve also laid out a roadmap for you to follow to take you from beginner to advanced, in a field of computer science that interests you! Check it out here: The Ultimate Python Roadmap for 2020
π Contact me
Iβm always open to improvements! Email me here: slitherintopython@gmail.com
π NEW BOOK β Slither into Data Structures and Algorithms!
I have been working on a new book for the past couple of months β Slither into Data Structures and Algorithms β The concise guide to the backbone of the digital world through Python. Use discount code βBETTER21β at the checkout for 50% off: Slither into Data Structures and Algorithms
Support me by purchasing a PDF copy of the book!
PDF copies of the book are available from E-Junkie for $6.99. Get yours below!
Table of Contents
- 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 file & 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 and Operator Overloading
- 18.1 β The __init__() method
- 18.2 β The __str__() method
- 18.3 β The __len__() method
- 18.4 β Operator Overloading
- 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: Inheritance
- 20.1 β What is inheritance?
- 20.2 β Parent & child classes
- 20.3 β Multiple inheritance
- 20.4 β Exercises
- Chapter 21 β Basic data structures
- 21.1 β Stacks
- 21.2 β Queues
- 21.3 β Examples
- 21.4 β Exercises
- Chapter 22 β More Advanced Data Structures
- 22.1 β Linked Lists
- 22.2 β Trees (Binary Search Trees)
- 22.3 β Exercises
- Solutions
- Solutions to all questions
- Solutions to projects not included