O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Begin to Code with Python

Book Description

Become a Python programmer–and have fun doing it!

Start writing software that solves real problems, even if you have absolutely no programming experience! This friendly, easy, full-color book puts you in total control of your own learning, empowering you to build unique and useful programs. Microsoft has completely reinvented the beginning programmer’s tutorial, reflecting deep research into how today’s beginners learn, and why other books fall short. Begin to Code with Python is packed with innovations, from its “Snaps” prebuilt operations to its “Make Something Happen” projects. Whether you’re a total beginner or you’ve tried before, this guide will put the power, excitement, and fun of programming where it belongs: in your hands!

 

Easy, friendly, and you’re in control! Learn how to…

 

  • Get, install, and use powerful free tools to create modern Python programs
  • Learn key concepts from 170 sample programs, and use them to jumpstart your own
  • Discover exactly what happens when a program runs
  • Approach program development with a professional perspective
  • Learn the core elements of the Python language
  • Build more complex software with classes, methods, and objects
  • Organize programs so they’re easy to build and improve
  • Capture and respond to user input
  • Store and manipulate many types of real-world data
  • Define custom data types to solve specific problems
  • Create interactive games that are fun to play
  • Build modern web and cloud-based applications
  • Use pre-built libraries to quickly create powerful software 

 

 

Get code samples, including complete apps, at:

https://aka.ms/BegintoCodePython/downloads

 

About This Book

 

  • For absolute beginners who’ve never written a line of code
  • For anyone who’s been frustrated with other beginning programming books or courses
  • For people who’ve started out with other languages and now want to learn Python
  • Works with Windows PC, Apple Mac, Linux PC, or Raspberry Pi
  • Includes mapping of MTA exam objectives that are covered in this book, as well as an appendix with further explanation of some of the topics on the exam

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. About the author
  6. Contents
  7. Introduction
  8. Part 1: Programming fundamentals
    1. 1 Starting with Python
      1. What is Python?
      2. Build a place to work with Python
      3. Start Python
      4. What you have learned
    2. 2 Python and Programming
      1. What makes a programmer
      2. Computers as data processors
      3. Data and information
      4. Work with Python functions
      5. What you have learned
    3. 3 Python program structure
      1. Write your first Python program
      2. Use Python libraries
      3. Python comments
      4. Run Python from the desktop
      5. Adding some snaps
      6. What you have learned
    4. 4 Working with variables
      1. Variables in Python
      2. Working with text
      3. Working with numbers
      4. Weather snaps
      5. What you have learned
    5. 5 Making decisions in programs
      1. Boolean data
      2. The if construction
      3. Use decisions to make an application
      4. Input snaps
      5. What you have learned
    6. 6 Repeating actions with loops
      1. The while construction
      2. The for loop construction
      3. Make a digital clock using snaps
      4. What you have learned
    7. 7 Using functions to simplify programs
      1. What makes a function?
      2. Build reusable functions
      3. What you have learned
    8. 8 Storing collections of data
      1. Lists and tracking sales
      2. Refactor programs into functions
      3. Sort using bubble sort
      4. Store data in a file
      5. Store tables of data
      6. Use lists as lookup tables
      7. Tuples
      8. What you have learned
  9. Part 2: Advanced programming
    1. 9 Use classes to store data
      1. Make a tiny contacts app
      2. Dictionaries
      3. What you have learned
    2. 10 Use classes to create active objects
      1. Create a Time Tracker
      2. Create class properties
      3. Evolve class design
      4. The __str__ method in a class
      5. Session tracking in Time Tracker
      6. Make music with Snaps
      7. What you have learned
    3. 11 Object-based solutiondesign
      1. Fashion Shop application
      2. Create a FashionShop component
      3. Design with classes
      4. Python sets
      5. What you have learned
    4. 12 Python applications
      1. Advanced functions
      2. Modules and packages
      3. Program testing
      4. View program documentation
      5. What you have learned
  10. Part 3: Useful Python (Digital-only)
    1. 13 Python and Graphical User Interfaces
      1. Visual Studio Code
      2. Create a Graphical User Interface with Tkinter
      3. What you have learned
    2. 14 Python programs as network clients
      1. Computer networking
      2. Consume the web from Python
      3. What you have learned
    3. 15 Python programs as network servers
      1. Create a web server in Python
      2. Host Python applications on the web
      3. What you have learned
    4. 16 Create games with Pygame
      1. Getting started with pygame
      2. Draw images with pygame
      3. Get user input from pygame
      4. Create game sprites
      5. Complete the game
      6. What you have learned
  11. Index
  12. Code Snippets