Premier press python programming for the absolute beginner

673 103 0
Premier press python programming for the absolute beginner

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Python Programming for the Absolute Beginner ISBN:1592000738 by Michael Dawson Premier Press © 2003 With this text, you will acquire the skills that you need for more practical Python programming applications, and learn how these skills can be put to use in real-world scenarios Table of Contents Python Programming for the Absolute Beginner Introduction Chapter 1 - Getting Started: The Game over Program Types, Variables, and Simple I/O: The Chapter 2 Useless Trivia Program Branching, while Loops, and Program Chapter 3 Planning: The Guess My Number Game for Loops, Strings, and Tuples: The Word Chapter 4 Jumble Game Lists and Dictionaries: The Hangman Chapter 5 Game Chapter 6 - Functions: The Tic-Tac-Toe Game Files and Exceptions: The Trivia Challenge Chapter 7 Game Software Objects: The Critter Caretaker Chapter 8 Program Object-Oriented Programming: The Chapter 9 - Blackjack Game Chapter 10 - GUI Development: The Mad Lib Program Chapter 11 - Graphics: The Pizza Panic Game Sound, Animation, and Program Chapter 12 Development: The Astrocrash Game Appendix A - LiveWires Reference Index List of Figures List of Tables List of Sidebars CD Content Back Cover If you are new to programming with Python and are looking for a solid introduction, this is the book for you Developed by computer science instructors, books in the for the absolute beginner series teach the principles of programming through simple game creation You will acquire the skills that you need for more practical Python programming applications and you will learn how these skills can be put to use in real-world scenarios Best of all, by the time you finish this book you will be able to apply the basic principles you’ve learned to the next programming language you tackle With the instructions in this book, you’ll learn to: Build, slice, and index strings Read from, and write to, text files Create and manipulate sprites Tackle object-oriented programming Create a GUI Work with sound and music and create animation About the Author Michael Dawson is a writer who has worked as both a programme He has written for several television shows, including a sitcom and an animated series Michael earned his bachelor's degree in Computer Science from the University of Southern Californai Python Programming for the Absolute Beginner MICHAEL DAWSON Copyright © 2003 by Premier Press, a division of Course Technology All rights reserved No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system without written permission from Premier Press, except for the inclusion of brief quotations in a review The Premier Press logo and related trade dress are trademarks of Premier Press and may not be used without written permission All trademarks are the property of their respective owners Important: Premier Press cannot provide software support Please contact the appropriate software manufacturer 's technical support line or Web site for assistance Premier Press and the author have attempted through-out this book to distinguish proprietary trademarks from descriptive terms by following the capitalization style used by the manufacturer Information contained in this book has been obtained by Premier Press from sources believed to be reliable However, because of the possibility of human or mechanical error by our sources, Premier Press, or others, the Publisher does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from use of such information Readers should be particularly aware of the fact that the Internet is an everchanging entity Some facts may have changed since this book went to press ISBN: 1-59200-073-8 Library of Congress Catalog Card Number: 2003104024 Printed in the United States of America 03 04 05 06 07 BH 10 9 8 7 6 5 4 3 2 1 Premier Press, a division of Course Technology 25 Thomson Place Boston, MA 02210 SVP, Retail and Strategic Market Group: Andy Shafran Publisher: Stacy L Hiquet Senior Marketing Manager: Sarah O 'Donnell Marketing Manager: Heather Hurley Manager of Editorial Services: Heather Talbot Acquisitions Editor: Todd Jensen Associate Marketing Manager: Kristin Eisenzopf Technical Reviewer: Greg Perry Retail Market Coordinator: Sarah Dubois Copy Editor: William McManus Interior Layout: Argosy Publishing Cover Design: Mike Tanamachi CD-ROM Producer: Keith Davenport Indexer: Sharon Shock Proofreader: Darla Bruno To my parents, who have read everything I've ever written Acknowledgments Writing a book is like giving birth—and I have the stretch marks of the brain to prove it So, I want to thank all the people who helped me bring my little bundle of joy into this world Thanks to Todd Jensen for being such a terrific editor I appreciated your patience, encouragement, and understanding Thanks to Edalin Michael for leading the team at Argosy Publishing I appreciated all of your efforts—especially as we got down to the wire Thanks to Bill McManus for his copyediting I always appreciated your suggestions and your eagle eye Thanks to Greg Perry for his technical editing (and for your non-technical suggestions too) Thanks to Andy Harris for setting such a fine example with this book series I hope I lived up to the standards I also want to thank Pete Shinners, author of Pygame, and all the folks who contributed to LiveWires Because of all of you, writing multimedia programs (especially games!) is now within reach of a new Python programmer Last, and certainly not least, I want to thank Matt for his audio expertise, Chris for his musical expertise, and Dave for wearing a chef's hat About the Author Michael Dawson is a writer who has worked as both a programmer and a computer game designer He has written for several different television shows, including a sitcom and an animated series Michael earned his bachelor's degree in Computer Science from the University of Southern California This is his first book Introduction Staring back at me on the screen was an image I recognized: a face—my face Grainy and pixilated, it was still me I watched with detached curiosity as my expression twisted and contorted beyond human limits until finally, an alien embryo burst from my skull A voice behind me said, "You wanna see it again?" No, this wasn't some horrible dream, it was my job I worked at a company producing and designing computer games I also got to "star" in our first release, an adventure game where the player clicks me around the screen And if the player fails to solve the game in time well, I think you know how that turns out I've also worked as a programmer for a major Internet services company, traveling to sites around the country And while those two lines of work may seem quite different, the basic skills necessary to succeed in each started to take shape while I wrote simple games on my home computer as a kid The goal of this book is to teach you the Python programming language, learning to program the same way I did: by creating simple games There's something more exciting about learning to program by writing software that's fun And even though the examples are entertaining, you'll still see some serious programming I cover all of the fundamental topics you'd expect from an introductory text and then some In addition, I point out concepts and techniques that you can apply to more mainstream projects If you're new to programming, you've made the right choice Python is the perfect beginners' language It has a clear and simple syntax that will get you writing useful programs in short order Python even has an interpreted mode, which offers immediate feedback, allowing you to test out new ideas almost instantly If you've done some programming before, you've still made the right choice Python has all the power and flexibility you'd expect from a modern, object-oriented programming language But even with all of its power, you may be surprised how quickly you can build programs In fact, ideas translate so quickly to the computer, Python has been called "programming at the speed of thought." Like any good book, this one starts at the beginning The first thing I cover is installing Python under Windows Then, I move through concepts, one step at a time, by writing small programs to demonstrate each step By the end of the book, I'll have covered such fancy-sounding topics as data structures, file handling, exceptions, object-oriented design, and GUI and multimedia programming I also hope to show you how to design as well as program You'll learn how to organize your work, break problems down into manageable chunks, and refine your code You'll be challenged at times, but never overwhelmed Most of all, you'll have fun while learning And in the process, you'll create some small, but cool computer games Throughout the book, I'll throw in a few other tidbits, notably the following: HINT These are good ideas that experienced programmers like to pass on TRAP There are a few areas where it's easy to make a mistake I'll point them out to you as we go TRICK These will suggest techniques and shortcuts that will make your life as a programmer easier IN THE REAL WORLD As you examine the games in this book, I'll show you how the concepts are used for purposes beyond game development Challenges At the end of each chapter, I'll suggest some programs that you can write with the skills you've learned so far This should help you start writing your own programs Appendix A: LiveWires Reference Table A.1: Screen ATTRIBUTES Table A.2: Screen METHODS Table A.3: Games_Object'S CONSTRUCTOR PARAMETERS Table A.4: Games_Object METHODS Table A.5: Text ATTRIBUTES Table A.6: Text METHODS Table A.7: Message ATTRIBUTES Table A.8: Animation ATTRIBUTES Table A.9: games FUNCTIONS Table A.10: SOUND OBJECT METHODS Table A.11: games KEY CONSTANTS List of Sidebars Introduction IN THE REAL WORLD Chapter 1: Getting Started: The Game over Program IN THE REAL WORLD IN THE REAL WORLD Chapter 2: Types, Variables, and Simple I/O: The Useless Trivia Program IN THE REAL WORLD IN THE REAL WORLD IN THE REAL WORLD Chapter 3: Branching, while Loops, and Program Planning: The Guess My Number Game IN THE REAL WORLD IN THE REAL WORLD Chapter 4: for Loops, Strings, and Tuples: The Word Jumble Game IN THE REAL WORLD IN THE REAL WORLD IN THE REAL WORLD Chapter 6: Functions: The Tic-Tac-Toe Game IN THE REAL WORLD IN THE REAL WORLD Chapter 7: Files and Exceptions: The Trivia Challenge Game IN THE REAL WORLD IN THE REAL WORLD Chapter 9: Object-Oriented Programming: The Blackjack Game IN THE REAL WORLD Chapter 10: GUI Development: The Mad Lib Program IN THE REAL WORLD Chapter 11: Graphics: The Pizza Panic Game IN THE REAL WORLD IN THE REAL WORLD CD Content Following are select files from this book's Companion CD-ROM These files are copyright protected by the publisher, author, and/or other third parties Unauthorized use, reproduction, or distribution is strictly prohibited File Description Python Programming for the Absolute All CD Content Beginner Size 1,247,608 Chapter 1: Getting Started: The Game over Program Chapter 2: Types, Variables, and Simple I/O: The Useless Trivia Program 5,563 Chapter 3: Branching, while Loops, and Program Planning: The Guess My Number Game 4,811 Chapter 4: for Loops, Strings, and Tuples: The Word Jumble Game 4,457 Chapter 5: Lists and Dictionaries: The Hangman Game 4,379 Chapter 6: Functions: The Tic-Tac-Toe Game 4,314 Chapter 7: Files and Exceptions: The Trivia Challenge Game 4,266 Chapter 8: Software Objects: The Critter Caretaker Program 4,019 Chapter 9: Object-Oriented Programming: The Blackjack Game 6,900 Chapter 10: GUI Development: The Mad Lib Program Chapter 11: Graphics: The Pizza Panic Game Chapter 12: Sound, Animation, and Program Development: The Astrocrash Game 423 6,493 98,465 158,569 Html 831,559 Livewires 86,745 Livewiresbuild 17,482 ... If you are new to programming with Python and are looking for a solid introduction, this is the book for you Developed by computer science instructors, books in the for the absolute beginner series teach the. .. Michael earned his bachelor's degree in Computer Science from the University of Southern Californai Python Programming for the Absolute Beginner MICHAEL DAWSON Copyright © 2003 by Premier Press, a division of Course Technology... with a bunch of goodies, but first and foremost, it has Python on it Run the Python Windows Installer You can find the Python Windows installer, Python- 2.2.3.exe, on the CD-ROM, under the Software section Click on the Install Python

Ngày đăng: 26/03/2019, 17:07

Mục lục

    Python Programming for the Absolute Beginner

    Chapter 1: Getting Started: The Game over Program

    Examining the Game Over Program

    Setting Up Python on Windows

    Setting Up Python on Other Operating Systems

    Introducing the Python IDLE

    Back to the Game Over Program

    Chapter 2: Types, Variables, and Simple I/O: The Useless Trivia Program

    Introducing the Useless Trivia Program

    Using Quotes with Strings

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan