4,30 €
You're already a smart person, you don't need a 1000+ page book to get you started on the web's fastest growing programming platform. Instead, Learn Python in One Hour delivers on the promise of code literacy while saving your most precious commodity - time itself. Volkman's innovative programming-by-example approach means you focus on usage, not mindless detail. Based on the author's sold-out live seminars, you'll see Python's flexible coding technique in action as we refactor from script to procedural to object-oriented during actual problem solving.
In a twelve-lesson progression, you'll be exposed to this and more:
Take the One Hour challenge and see if you too can pick up 90% of syntax and semantics in less time than you probably spend commuting each day.
About the Author Victor R. Volkman graduated cum laude from Michigan Technological University with a BS in Computer Science in 1986. Since then, he has written for numerous publications, including The C Gazette, C++ Users Journal, Windows Developers Journal, and many others. He has taught college-level programming courses at Washtenaw Community College and has served on its Computer Information Science (CIS) Faculty Advisory Board for more than a decade. Volkman says Python helped him "rediscover the joy of programming again."
From Modern Software Press
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 59
Veröffentlichungsjahr: 2017
Learn Python in One Hour
Programming by Example
2nd Edition
Victor R. Volkman
Modern Software Press
Learn Python in One Hour: Programming by Example
Copyright © 2014, 2018 by Victor R. Volkman. All Rights Reserved.
2nd Edition -- January 2018
Library of Congress Cataloging-in-Publication Data
Volkman, Victor R.
Learn Python in one hour : programming by example / Victor R. Volkman.
pages cm
ISBN 978-1-61599-239-3 (pbk. : alk. paper) -- ISBN 978-1-61599-240-9 (ebook)
1. Python (Computer program language) 2. Object-oriented programming (Computer science) I. Title.
QA76.73.P98V65 2013
005.1'17--dc23
2014017288
From Modern Software Press, an imprint of
L.H. Press Inc.
5145 Pontiac Trail
Ann Arbor, MI 48105
www.LHPress.com
toll free USA/CAN: 888-761-6268
FAX: 734-663-6861
Contents
Why Python?
Why One Hour?
Where to Get Python?
Lessons Overview and Goals:
Preface to the 2nd Edition
Lesson One – Opening Arguments
Lesson Two – Using Your Words
Lesson Three – When Things Go Wrong
Lesson Four – What’s the Frequency, Kenneth?
Lesson Five – Fun with Functions
Lesson Six – A Dictionary of Lists
Lesson Seven – A Touch of Class
Lesson Eight – Keeping it Regular
Lesson Nine – Taking a REST
Lesson Ten - Untangling Threads
Lesson Eleven - Spin a Web
Lesson Twelve - No REST for the wicked
Python Pitfalls
Where Do We Go From Here?
Recommended Resources
About the Author
Dedicated to the Computer Information Science faculty atWashtenaw Community College, Ann Arbor, MI
Why Python?
In a world of ever-increasing scripting and language platforms, why choose Python, a legacy system that has been in development on-and-off for nearly two dozen years? Quite simply, it provides a design philosophy that emphasizes code readability without sacrificing a compact and powerful expression of ideas. Going back as far as 1959 with the introduction of COBOL, people have been trying to produce a programming system that is readable, which is to say it does not lend itself to obscuring details or requiring intense concentration to figure out the meaning of a line of code. As any student of computer science can tell you, the problem with COBOL was it couldn’t get out of its own way—it went too far down the path of simplicity and its lack of easy-to-use data structures hurt it the most. The remainder of third-generation languages, such as C, C++, Pascal, and I would even argue Java, were marred by the lack of a concise and powerful string handling system as well as tedious ways to manage collections (lists, dictionaries, sets, and so on).
It cannot be over-emphasized how important basic string handling is in developing modern programs that interface with the textual world of the web, especially unstyled documents (i.e. plain text). Simple things such as concatenation, regular expressions, and splitting and joining strings must be effortless or else they become onerous. Such was the appeal of Perl for many years. In fact, many people will speak of Perl-and-Python in a single breath since they so often occupy the same solution-space. However, the two languages diverge on a few key principles. Specifically, in Perl there are many ways to perform even the simplest operations due to its many operators and ability to nest them in ever-more-complex expressions. In Python, there is generally one way to do something, which means it is both easy to understand and manipulate.
Why harp on readability? Because in the past three decades, research has pointed out that the biggest piece of the pie in most information technology projects is not hardware but people time. Specifically, the productivity of developers sets the cost of implementation, even in many cloud-based apps that employ hundreds of servers. In cases where human activity doesn’t beat hardware costs, the costs of getting-to-market faster and, hence, collecting revenue argues for readability. Programmers who can read the code that they and others are writing produce a more reliable product in less time than otherwise.
Why One Hour?
It sounds ludicrous on the face of it: learn a new programming language in just an hour! I agree it is provocative, but its point is that any developer who is proficient in a few languages already, maybe Javascript and C++ for example, can pick up the basics in about an hour. Does that mean that Python is inherently a simple platform? Perhaps it is and perhaps it isn’t, but it is simple to learn, beyond a doubt. In terms of expressiveness, it reads a lot like pseudo-code, which is how people write algorithms in English before coding them. With Python, I feel as if I can instantly gain an understanding of code that someone has written in my first reading of it, which is something no one ever said about Perl.
In Java and C++, the program is no longer driven by logic but by an attempt to express relationships through classes. Hence the rise of many diagramming techniques in the past twenty years, including UML, where you are admonished to design fully before the first line of code is written. In this one-hour approach, I will even demonstrate how you can easily re-factor from script to procedural (function-based) to object-oriented without losing your train of thought and without getting mired in analysis-paralysis.
Lastly, I promise not to mire you down in details: we won’t look at every method in the string() class or exhaustively plod through the math library. Instead, my goal is to show you the shortest path to achieving success in your own applications.
Where to Get Python?
If you have a Linux distro, you may already have Python installed. In a window, type python -V to get the version number. This book is based on Python 3.x. You can use your usual Linux package install tool to upgrade or obtain Python 3.x.
If you have Mac or Windows, there are reputable packages available from:
• www.python.org/downloads/
• www.activestate.com/activepython/downloads
• www.cygwin.com/install.html (part of their Linux-on-Windows suite)
Tablet users: check your local appstore (iTunes or Google Play)
I used the IDLE developer tool to write these examples, but either Notepad++ or Vim make excellent Python development tools.
Lessons Overview and Goals:
1.Opening and using files (ex1.py) exercise: read in a text file and echo it out (interactive mode)
2.Change it to a word counting program (ex2.py) exercise: use split(), compute total, write amount at end
3.Planning for unplanned events: (ex3.py) exercise: add exception handling for opening file
4.Word frequency counter: (ex4.py) exercise: use collections. Counter to track the words
5.Subdivide into functions: (ex5.py) exercise: bust out the opening, reading, and printing operations into functions
6.A dictionary of lists with defaultdict: (ex6.py) exercise: use collections.defaultdict to build an "index" of the file by recording each occurrence of a word in a given line into a list
7.Constructing a class: (ex7.py) exercise: change a set of functions into a containing class
8.Understanding Regular Expressions (ex8.py) exercise: phone number pattern matching
9.Exploring the world of REST APIs (ex9.py) exercise: pull live weather data reports
10.Using threads for concurrent REST requests (ex10.py) exercise: expand previous weather reports to run on multiple threads
11.CGI-BIN web programming basics (weather.py)
