Muutke küpsiste eelistusi

Begin to Code with Python [Pehme köide]

  • Formaat: Paperback / softback, 528 pages, kõrgus x laius x paksus: 230x190x22 mm, kaal: 840 g
  • Ilmumisaeg: 15-Mar-2018
  • Kirjastus: Microsoft Press
  • ISBN-10: 1509304525
  • ISBN-13: 9781509304523
Teised raamatud teemal:
  • Formaat: Paperback / softback, 528 pages, kõrgus x laius x paksus: 230x190x22 mm, kaal: 840 g
  • Ilmumisaeg: 15-Mar-2018
  • Kirjastus: Microsoft Press
  • ISBN-10: 1509304525
  • ISBN-13: 9781509304523
Teised raamatud teemal:

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

Introduction xviii
Part 1: Programming fundamentals
1 Starting with Python
2(14)
What is Python?
4(2)
Python origins
5(1)
Python versions
5(1)
Build a place to work with Python
6(4)
Get the tools
6(1)
Python for Windows PC
7(3)
Start Python
10(4)
What you have learned
14(2)
2 Python and Programming
16(28)
What makes a programmer
18(4)
Programming and party planning
18(1)
Programming and problems
19(2)
Programmers and people
21(1)
Computers as data processors
22(9)
Machines and computers and us
22(2)
Programs as data processors
24(1)
Python as a data processor
25(6)
Data and information
31(5)
Work with Python functions
36(5)
The ord function
36(2)
The chr function
38(1)
Investigate data storage using bin
39(2)
What you have learned
41(3)
3 Python program structure
44(28)
Write your first Python program
46(11)
Run Python programs using IDLE
46(5)
Get program output using the print function
51(6)
Use Python libraries
57(4)
The random library
57(3)
The time library
60(1)
Python comments
61(2)
Code samples and comments
62(1)
Run Python from the desktop
63(1)
Delay the end of the program
64(1)
Adding some snaps
64(6)
Adding the Pygame library
65(1)
Snaps functions
66(4)
What you have learned
70(2)
4 Working with variables
72(32)
Variables in Python
74(5)
Python names
76(3)
Working with text
79(8)
Marking the start and end of strings
81(1)
Escape characters in text
82(2)
Read in text using the input function
84(3)
Working with numbers
87(14)
Convert strings into integer values
87(2)
Whole numbers and real numbers
89(1)
Real numbers and floating-point numbers
90(5)
Convert strings into floating-point values
95(1)
Perform calculations
96(2)
Convert between float and int
98(3)
Weather snaps
101(1)
What you have learned
102(2)
5 Making decisions in programs
104(36)
Boolean data
106(12)
Create Boolean variables
106(3)
Boolean expressions
109(2)
Comparing values
111(3)
Boolean operations
114(4)
The if construction
118(11)
Nesting if conditions
127(1)
Working with logic
128(1)
Use decisions to make an application
129(5)
Design the user interface
129(1)
Implement a user interface
130(2)
Testing user input
132(1)
Complete the program
133(1)
Input snaps
134(4)
What you have learned
138(2)
6 Repeating actions with loops
140(30)
The while construction
142(20)
Repeat a sequence of statements using while
142(5)
Handling invalid user entry
147(5)
Detect invalid number entry using exceptions
152(2)
Exceptions and number reading
154(2)
Handling multiple exceptions
156(1)
Break out of loops
157(1)
Return to the top of a loop with continue
158(1)
Count a repeating loop
159(3)
The for loop construction
162(5)
Make a digital clock using snaps
167(1)
What you have learned
168(2)
7 Using functions to simplify programs
170(40)
What makes a function?
172(21)
Give information to functions using parameters
176(9)
Return values from function calls
185(8)
Build reusable functions
193(15)
Create a text input function
193(2)
Add help information to functions
195(2)
Create a number input function
197(4)
Convert our functions into a Python module
201(1)
Use the IDLE debugger
202(6)
What you have learned
208(2)
8 Storing collections of data
210(54)
Lists and tracking sales
212(9)
Limitations of individual variables
214(1)
Lists in Python
215(3)
Read in a list
218(1)
Display a list using a for loop
219(2)
Refactor programs into functions
221(6)
Create placeholder functions
224(1)
Create a user menu
225(2)
Sort using bubble sort
227(11)
Initialize a list with test data
228(1)
Sort a list from high to low
228(6)
Sort a list from low to high
234(1)
Find the highest and lowest sales values
235(1)
Evaluate total and average sales
236(1)
Complete the program
237(1)
Store data in a file
238(13)
Write into a file
239(3)
Write the sales figures
242(2)
Read from a file
244(2)
Read the sales figures
246(1)
Deal with file errors
247(4)
Store tables of data
251(4)
Use loops to work with tables
253(2)
Use lists as lookup tables
255(1)
Tuples
256(3)
What you have learned
259(5)
Part 2: Advanced programming
9 Use classes to store data
264(44)
Make a tiny contacts app
266(34)
Make a prototype
267(2)
Store contact details in separate lists
269(3)
Use a class to store contact details
272(3)
Use the Contact class in the Tiny Contacts program
275(3)
Edit contacts
278(11)
Save contacts in a file using pickle
289(3)
Load contacts from a file using pickle
292(1)
Add save and load to Tiny Contacts
293(1)
Set up class instances
294(6)
Dictionaries
300(5)
Create a dictionary
300(2)
Dictionary management
302(1)
Return a dictionary from a function
303(1)
Use a dictionary to store contacts
303(2)
What you have learned
305(3)
10 Use classes to create active objects
308(64)
Create a Time Tracker
310(22)
Add a data attribute to a class
311(1)
Create a cohesive object
312(2)
Create method attributes for a class
314(2)
Add validation to methods
316(12)
Protect a data attribute against damage
328(3)
Protected methods
331(1)
Create class properties
332(5)
Evolve class design
337(9)
Manage class versions
340(6)
The _str_ method in a class
346(4)
Python string formatting
348(2)
Session tracking in Time Tracker
350(13)
The Python map function
355(6)
The Python join method
361(2)
Make music with Snaps
363(5)
What you have learned
368(4)
11 Object-based solution design
372(66)
Fashion Shop application
374(36)
Application data design
376(1)
Object-oriented design
376(3)
Creating superclasses and subclasses
379(17)
Data design recap
396(9)
Implement application behaviors
405(4)
Objects as components
409(1)
Create a FashionShop component
410(11)
Create a user interface component
417(4)
Design with classes
421(1)
Python sets
422(12)
Sets and tags
426(5)
Sets versus class hierarchies
431(3)
What you have learned
434(4)
12 Python applications
438(48)
Advanced functions
440(20)
References to functions
440(6)
Use lambda expressions
446(5)
Iterator functions and the yield statement
451(6)
Functions with an arbitrary number of arguments
457(3)
Modules and packages
460(10)
Python modules
460(1)
Add a readme function to BTCInput
461(1)
Run a module as a program
462(1)
Detect whether a module is executed as a program
463(1)
Create a Python package
464(2)
Import modules from packages
466(4)
Program testing
470(8)
The Python assert statement
471(1)
The Python unittest module
472(4)
Create tests
476(2)
View program documentation
478(5)
What you have learned
483(3)
Index
486(2)
Part 3: Useful Python (Digital-only)
The chapter PDF files for this Part are available at https://aka.ms/BeginCodePython/downloads.
13 Python and Graphical User Interfaces
488(60)
Visual Studio Code
490(9)
Install Visual Studio Code
490(1)
Install the Python Extension in Visual Studio Code
491(1)
Create a project folder
492(1)
Create a program file
493(1)
Debug a program
494(5)
Other Python editors
499(1)
Create a Graphical User Interface with Tkinter
499(47)
Create a graphical application
506(1)
Lay out a grid
507(3)
Create an event handler function
510(1)
Create a mainloop
511(1)
Handle errors in a graphical user interface
512(2)
Display a message box
514(4)
Draw on a Canvas
518(4)
Tkinter events
522(1)
Create a drawing program
523(3)
Enter multi-line text
526(2)
Group display elements in frames
528(1)
Create an editable StockItem using a GUI
529(8)
Create a Listbox selector
537(7)
An application with a graphical user interface
544(2)
What you have learned
546(2)
14 Python programs as network clients
548(22)
Computer networking
550(12)
Consume the web from Python
562(5)
Read a webpage
562(1)
Use web-based data
562(5)
What you have learned
567(3)
15 Python programs as network servers
570(22)
Create a web server in Python
572(18)
A tiny socket-based server
572(5)
Python web server
577(2)
Serve webpages from files
579(5)
Get information from web users
584(6)
Host Python applications on the web
590(1)
What you have learned
590(2)
16 Create games with Pygame
592
Getting started with pygame
594(7)
Draw images with pygame
601(5)
Image file types
601(1)
Load an image into a game
602(2)
Make an image move
604(2)
Get user input from pygame
606(3)
Create game sprites
609(20)
Add a player sprite
614(3)
Control the player sprite
617(1)
Add a Cracker sprite
618(1)
Add lots of sprite instances
619(1)
Catch the crackers
620(5)
Add a killer tomato
625(4)
Complete the game
629(7)
Add a start screen
629(5)
End the game
634(1)
Score the game
635(1)
What you have learned
636
Rob Miles has taught computer programming for over 30 years. A Microsoft MVP for Windows Development, Rob enjoys inspiring programmers at all levels. He writes his own games, programs, and poetry, has consulted on many commercial software projects, and is the author of Begin to Code with C#.