Exploring Python Basics
With chapters selected by Naomi Ceder
  • January 2019
  • ISBN 9781617296581
  • 181 pages
Let's face it. The only way to learn computer programming is to do it. Whether you want to skill up for your next job interview or just get a few pet projects done, programming can be an amazing tool. Python is an especially great tool for beginners, and it’s also a language that grows with you. You can use Python for everything from web development to data science by taking advantage of its huge array of frameworks and toolkits. Know the basics of Python, and you can go (nearly) anywhere in the programming world!

Exploring Python Basics is a collection of chapters from several different Manning books, blended together to give you a tour of everything Python. Hand-picked by Naomi Ceder, the founder of the Python Education Summit, these chapters will get you covering the basics of programming and the quirks and syntax of Python, coding with a Raspberry Pi, and even using Python to model your data to create accurate predictions! After you’re finished, you’ll have a real appreciation for Python, ready to continue your journey into this ever-useful language.
Table of Contents detailed table of contents

Learning how to program

Basic principles of learning a programming language

2.1 Programming as a skill

2.2 A parallel with baking

2.3 Think, code, test, debug, repeat

2.4 Writing readable code

Summary

3 Introducing Python: a programming language

3.1 Installing Python

3.1.1 What is Python?

3.1.2 Downloading Python version 3.5

3.1.3 Anaconda Python Distribution

3.1.4 Integrated development environments

3.2 Setting up your workspace

3.2.1 The IPython console

3.2.2 The file editor

Summary

4 Variables and expressions: giving names and values to things

4.1 Giving names to things

4.1.1 Math vs. programming

4.1.2 What the computer can and can’t do

4.2 Introducing variables

4.2.1 Objects are things that can be manipulated

4.2.2 Objects have names

4.2.3 What object names are allowed?

4.2.4 Creating a variable

4.2.5 Updating a variable

Summary

Object types and statements of code

5.1 Types of things

5.2 Basic type of objects in programming

5.2.1 Integers as whole numbers

5.2.2 Floating point as decimal numbers

5.2.3 Booleans as true/false data

5.2.4 Strings as sequences of characters

5.2.5 The absence of a value

5.3 Working with basic types of data values

5.3.1 Building blocks of expressions

5.3.2 Converting between different types

5.3.3 How arithmetic impacts object types

Summary

Capstone project: your first Python program—​convert hours to minutes

6.1 Think-code-test-debug-repeat

6.2 Divide your task

6.3 Implement the conversion formula

6.3.1 How many hours?

6.3.2 How many minutes?

6.4 Your first Python program: one solution

6.5 Your first Python program: another solution

Summary

Meet Raspberry Pi

Meet Raspberry Pi

Exploring your Raspberry Pi’s parts: hardware

Giving your Pi a cozy home: Pi cases

The brain of your Pi: system on a chip

Connecting a keyboard and mouse: USB ports

Storing memories: your Pi gets a memory card

Connecting a TV or monitor: HDMI port

Other ports and connections

Powering your Pi: microUSB power port

Getting your Pi running: software

Installing the Raspbian operating system

Configuring the operating system: making it yours

Saving your configuration and rebooting

Getting around: learning Raspbian

Finding and opening applications on your Raspberry Pi

Your files and folders

Writing code

Fruit Picker Extra: shopping at the Pi Store

Challenge

Scavenger hunt

Summary

Blinky Pi

Setting up your Pi for physical computing

GPIO pins

Breaking out the GPIO pins to a breadboard

Breadboard basics

Building the LED circuit

Step 1. Connect the jumper from GPIO pin 21

Step 2. Add the red LED

Step 3. Connect a resistor

Software: blinkLED program

Running the program

blinkLED: how it works

Adding more LEDs

Building the circuit

Multiple LEDs: program it!

Challenges

Wave pattern

Simon Says

Random blinking

Summary

Python—​Absolute Basics

4 The absolute basics

4.1 Indentation and block structuring

4.2 Differentiating comments

4.3 Variables and assignments

4.4 Expressions

4.5 Strings

4.6 Numbers

4.6.1 Built-in numeric functions

4.6.2 Advanced numeric functions

4.6.3 Numeric computation

4.6.4 Complex numbers

4.6.5 Advanced complex-number functions

4.7 The None value

4.8 Getting input from the user

4.9 Built-in operators

4.10 Basic Python style

Summary

Lists, tuples, and sets

5.1 Lists are like arrays

5.2 List indices

5.3 Modifying lists

5.4 Sorting lists

5.4.1 Custom sorting

5.4.2 The sorted() function

5.5 Other common list operations

5.5.1 List membership with the in operator

5.5.2 List concatenation with the + operator

5.5.3 List initialization with the * operator

5.5.4 List minimum or maximum with min and max

5.5.5 List search with index

5.5.6 List matches with count

5.5.7 Summary of list operations

5.6 Nested lists and deep copies

5.7 Tuples

5.7.1 Tuple basics

5.7.2 One-element tuples need a comma

5.7.3 Packing and unpacking tuples

5.7.4 Converting between lists and tuples

5.8 Sets

5.8.1 Set operations

5.8.2 Frozensets

Summary

Modeling and prediction

Modeling and prediction

3.1 Basic machine-learning modeling

3.1.1 Finding the relationship between input and target

3.1.2 The purpose of finding a good model

3.1.3 Types of modeling methods

3.1.4 Supervised versus unsupervised learning

3.2 Classification: predicting into buckets

3.2.1 Building a classifier and making predictions

3.2.2 Classifying complex, nonlinear data

3.2.3 Classifying with multiple classes

3.3 Regression: predicting numerical values

3.3.1 Building a regressor and making predictions

3.3.2 Performing regression on complex, nonlinear data

3.4 Summary

3.5 Terms from this chapter

What's inside

  • “Learning how to program” based on chapters from Get Programming: Learn to code with Python by Ana Bell
  • “Meet Raspberry Pi” based on chapters from Hello Raspberry Pi! by Ryan Heitz
  • “Python—Absolute Basics” based on chapters from The Quick Python Book, Third Edition by Naomi Ceder
  • “Modeling and prediction” based on chapters from Real-World Machine Learning by Henrik Brink, Joseph W. Richards, and Mark Fetherolf

About the author

Naomi Ceder is the founder of the Python Education Summit and fellow of the Python Software Foundation. She has been learning, using, and teaching Python since 2001.

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks