% A Byte of Python % Swaroop C H % $$date$$ # A Byte of Python # 'A Byte of Python' is a free book on programming using the Python language. It serves as a tutorial or guide to the Python language for a beginner audience. If all you know about computers is how to save text files, then this is the book for you. This book is written for the latest Python 3, even though Python 2 is the commonly found version of Python today (read more about it in [Python 2 versus 3 section](#python-2-versus-3)). ## Who Reads A Byte of Python? ## Here are what people are saying about the book: > This is the best beginner's tutorial I've ever seen! Thank you for > your effort. > -- _Walt Michalik_ (wmich50-at-theramp-dot-net) > The best thing i found was "A Byte of Python", which is simply a >brilliant book for a beginner. It's well written, the concepts are >well explained with self evident examples. > -- > [_Syed Talal_](http://littlepancakes.wordpress.com/2010/01/30/python) > You've made the best Python tutorial I've found on the Net. Great work. Thanks! > -- _Joshua Robin_ (joshrob-at-poczta-dot-onet-dot-pl) > Excellent gentle introduction to programming #Python for beginners > -- [Shan Rajasekaran](https://twitter.com/ShanRajasekaran/status/268910645842423809) > Hi, I'm from Dominican Republic. My name is Pavel, recently I read > your book 'A Byte of Python' and I consider it excellent!! :). I > learnt much from all the examples. Your book is of great help for > newbies like me... > -- _Pavel Simo_ (pavel-dot-simo-at-gmail-dot-com) > I recently finished reading Byte of Python, and I thought I really > ought to thank you. I was very sad to reach the final pages as I now > have to go back to dull, tedious oreilly or etc. manuals for > learning about python. Anyway, I really appreciate your book. > -- _Samuel Young_ (sy-one-three-seven-at-gmail-dot-com) > Dear Swaroop, I am taking a class from an instructor that has no > interest in teaching. We are using Learning Python, second edition, > by O'Reilly. It is not a text for beginner without any programming > knowledge, and an instructor that should be working in another > field. Thank you very much for your book, without it I would be > clueless about Python and programming. Thanks a million, you are > able to 'break the message down' to a level that beginners can > understand and not everyone can. > -- _Joseph Duarte_ (jduarte1-at-cfl-dot-rr-dot-com) > I love your book! It is the greatest Python tutorial ever, and a > very useful reference. Brilliant, a true masterpiece! Keep up the > good work! > -- _Chris-André Sommerseth_ > I'm just e-mailing you to thank you for writing Byte of Python > online. I had been attempting Python for a few months prior to > stumbling across your book, and although I made limited success with > pyGame, I never completed a program. > Thanks to your simplification of the categories, Python actually > seems a reachable goal. It seems like I have finally learned the > foundations and I can continue into my real goal, game development. > ... > Once again, thanks VERY much for placing such a structured and > helpful guide to basic programming on the web. It shoved me into > and out of OOP with an understanding where two text books had > failed. > -- _Matt Gallivan_ (m-underscore-gallivan12-at-hotmail-dot-com) > I would like to thank you for your book 'A byte of python' which i > myself find the best way to learn python. I am a 15 year old i live > in egypt my name is Ahmed. Python was my second programming language > i learn visual basic 6 at school but didn't enjoy it, however i > really enjoyed learning python. I made the addressbook program and i > was sucessful. i will try to start make more programs and read > python programs (if you could tell me source that would be > helpful). I will also start on learning java and if you can tell me > where to find a tutorial as good as yours for java that would help > me a lot. Thanx. > -- _Ahmed Mohammed_ (sedo-underscore-91-at-hotmail-dot-com) > A wonderful resource for beginners wanting to learn more about > Python is the 110-page PDF tutorial A Byte of Python by Swaroop C > H. It is well-written, easy to follow, and may be the best > introduction to Python programming available. > -- _Drew Ames_ in an article on > [Scripting Scribus](http://www.linux.com/feature/126522) published > on Linux.com > Yesterday I got through most of Byte of Python on my Nokia N800 and > it's the easiest and most concise introduction to Python I have yet > encountered. Highly recommended as a starting point for learning > Python. > -- _Jason Delport_ on his > [weblog](http://paxmodept.com/telesto/blogitem.htm?id=627) > Byte of Vim and Python by @swaroopch is by far the best works in > technical writing to me. Excellent reads #FeelGoodFactor > -- _Surendran_ says in a [tweet](http://twitter.com/suren/status/12840485454) > "Byte of python" best one by far man > (in response to the question "Can anyone suggest a good, inexpensive > resource for learning the basics of Python? ") > -- _Justin LoveTrue_ says in a > [Facebook community page](http://www.facebook.com/pythonlang/posts/406873916788) > "The Book Byte of python was very helpful ..Thanks bigtime :)" > -- [Chinmay](https://twitter.com/a_chinmay/status/258822633741762560) > Always been a fan of A Byte of Python - made for both new and > experienced programmers. > -- [Patrick Harrington, in a StackOverflow answer](http://stackoverflow.com/a/457785/4869) > i started learning python few days ago from your book..thanks for > such a nice book. it is so well written, you made my life easy..so > you found a new fan of yours..thats me :) tons of thanks > -- > [Gadadhari](https://twitter.com/Pagal_e_azam/statuses/242865516971163648) > [bheem](https://twitter.com/Pagal_e_azam/statuses/242865885256232960) > Hello Swaroop, > Thank you ever so much for this book!! > This book cleared up many questions I had about certain aspects of Python such as object oriented programming. > I do not feel like an expert at OO but I know this book helped me on a first step or two. > I have now written several python programs that actually do real things for me as a system administrator. > They are all procedural oriented but they are small by most peoples standards. > Again, thanks for this book. Thank you for having it on the web. > -- Bob > I wrote you back in 2011 and I was just getting into Python and > wanted to thank you for your tutorial "A Byte of Python". Without > it, I would have fallen by the wayside. Since then I have gone on > to program a number of functions in my organization with this > language with yet more on the horizon. I would not call myself an > advanced programmer by any stretch but I notice the occasional > request for assistance now from others since I started using it. I > discovered, while reading "Byte" why I had ceased studying C and C++ > and it was because the book given to me started out with an example > containing an augmented assignment. Of course, there was no > explanation for this arrangement of operators and I fell on my head > trying to make sense of what was on the written page. As I recall > it was a most frustrating exercise which I eventually abandoned. > Doesn't mean C or C++ is impossible to learn, or even that I am > stupid, but it does mean that the documentation I worked my way > through did not define the symbols and words which is an essential > part of any instruction. Just as computers will not be able to > understand a computer word or computer symbol that is outside the > syntax for the language being used, a student new to any field will > not grasp his subject if he encounters words or symbols for which > there are no definitions. You get a "blue screen" as it were in > either case. The solution is simple, though: find the word or > symbol and get the proper definition or symbol and lo and behold,the > computer or student can proceed. Your book was so well put together > that I found very little in it I couldn't grasp. So, thank you. I > encourage you to continue to include full definitions of terms. The > documentation with Python is good, once you know, (the examples are > its strength from what I see) but in many cases it seems that you > have to know in order to understand the documentation which to my > mind is not what should be. Third party tutorials express the need > for clarification of the documentation and their success largely > depends on the words that are used to describe the terminology. I > have recommended your book to many others. Some in Australia, some > in the Caribbean and yet others in the US. It fills a niche no > others do. I hope you are doing well and wish you all the success > in the future. > Best Regards, > -- Nick > hey, this is ankush(19). I was facing a great difficulty to start > with python. I tried a lot of books but all were bulkier and not > target oriented; and then i found this lovely one, which made me > love python in no time. Thanks a lot for this "beautiful piece of > book". > -- Ankush > I would like to thank you for your excellent guide on Python. I am a > molecular biologist (with little programming background) and for my > work I need to handle big datasets of DNA sequences and to analyse > microscope images. For both things, programming in python has been > useful, if not essential to complete and publish a 6-years project. > That such a guide is freely available is a clear sign that the > forces of evil are not yet ruling the world! :) > Thank you, > -- Luca > Since this is going to be the first language you learn, you should > use A Byte of Python. It really gives a proper introduction into > programming in Python and it is paced well enough for the average > beginner. The most important thing from then on will be actually > starting to practice making your own little programs. > -- > ["{Unregistered}"](http://www.overclock.net/t/1177951/want-to-learn-programming-where-do-i-start#post_15837176) > Just to say a loud and happy *thank you very much* for publishing "A > Byte of Python" and "A Byte of Vim". Those books were very useful to > me four or five years ago when I starting learning > programming. Right now I'm developing a project that was a dream for > a long, long time and just want to say *thank you*. > Keep walking. You are a source of motivation. > All the best. > -- Jocimar The book is even used by NASA! It is being used in their [Jet Propulsion Laboratory](http://dsnra.jpl.nasa.gov/software/Python/byte-of-python/output/byteofpython_html/) with their Deep Space Network project. ## Academic Courses ## This book is/was being used as instructional material in various educational institutions: - 'Principles of Programming Languages' course at [Vrije Universiteit, Amsterdam](http://www.few.vu.nl/~nsilvis/PPL/2007/index.html) - 'Basic Concepts of Computing' course at [University of California, Davis](http://www.cs.ucdavis.edu/courses/exp_course_desc/10.html) - 'Programming With Python' course at [Harvard University](http://www.people.fas.harvard.edu/~preshman/python_winter.html) - 'Introduction to Programming' course at [University of Leeds](http://www.comp.leeds.ac.uk/acom1900/) - 'Introduction to Application Programming' course at [Boston University](http://www.cs.bu.edu/courses/cs108/materials.html) - 'Information Technology Skills for Meteorology' course at [University of Oklahoma](http://gentry.metr.ou.edu/byteofpython/) - 'Geoprocessing' course at [Michigan State University](http://www.msu.edu/~ashton/classes/825/index.html) - 'Multi Agent Semantic Web Systems' course at the [University of Edinburgh](http://homepages.inf.ed.ac.uk/ewan/masws/) ## License ## This book is licensed under the [Creative Commons Attribution-Share Alike 3.0 Unported](http://creativecommons.org/licenses/by-sa/3.0/deed.en_US) license. This means: - You are free to Share i.e. to copy, distribute and transmit this book - You are free to Remix i.e. to adapt this book - You are free to use it for commercial purposes Please note: - Please do *not* sell electronic or printed copies of the book unless you have clearly and prominently mentioned in the description that these copies are *not* from the original author of this book. - Attribution *must* be shown in the introductory description and front page of the document by linking back to and clearly indicating that the original text can be fetched from this location. - All the code/scripts provided in this book is licensed under the [3-clause BSD License](http://www.opensource.org/licenses/bsd-license.php) unless otherwise noted. ## Read Now ## You can [read the book online](http://swaroopch.com/notes/Python_en-Preface). ## Buy the Book ## [A printed hardcopy of the book can be purchased](http://swaroopch.com/buybook) for your offline reading pleasure, and to support the continued development and improvement of this book. ## Download ## - [PDF](http://files.swaroopch.com/python/byte_of_python.pdf) for desktop viewing - [EPUB](http://files.swaroopch.com/python/byte_of_python.epub) for ebook readers - [Open source at GitHub](https://github.com/swaroopch/byte_of_python) for cloning the sources If you wish to support the continued development of this book, please consider [buying a hardcopy](http://swaroopch.com/buybook). ## Read the book in your native language ## If you are interested in reading or contributing translations of this book to other human languages, please see the [Translations page](#translations).