background preloader

Non-Programmer's Tutorial for Python 3

Non-Programmer's Tutorial for Python 3
Authors Contributors to this book Front matter Initial remarks Intro Installing and using Python – where to get help Hello, World The famous first program – screen output – variables – numbers and calculations Who Goes There? Interactive input – strings Count to 10 while loops Decisions if statements Debugging Finding out what goes wrong Defining Functions Structuring programs with the use of functions Advanced Functions Example (Almost) mind-blowing example of how programmers can think Lists Variables containing more than one value For Loops A second kind of loop Boolean Expressions Computer logic – True and False – and and or – not Dictionaries Variables containing key/value pairs Using Modules Extensions to the standard set of functionality More on Lists Using elements or parts of lists Revenge of the Strings More advanced text manipulations File IO Reading from files and writing to files Dealing with the imperfect How to handle errors Recursion Recursive Functions Intro to Object Oriented Programming in Python 3 The End

SLAV WEE Project - home How to Think Like a Computer Scientist Learning with Python by Allen Downey, Jeff Elkner and Chris Meyers. This book is now available for sale at Hardcopies are no longer available from Green Tea Press. How to Think... is an introduction to programming using Python, one of the best languages for beginners. How to Think... is a Free Book available under the GNU Free Documentation License. Please send suggestions, corrections and comments about the book to feedback{at}thinkpython{dot}com. Download The book is available in a variety of electronic formats: Precompiled copies of the book are available in PDF and Postscript . Translations Here are some translations of the book into other (natural) languages: Spanish translation by Gregorio Inda. Other Free Books by Allen Downey are available from Green Tea Press. If you are using this book and would like to make a contribution to support my work, please consider making a donation toward my web hosting bill by clicking on the icon below.

Google's Python Class - Educational Materials Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. To get started, the Python sections are linked at the left -- Python Set Up to get Python installed on your machine, Python Introduction for an introduction to the language, and then Python Strings starts the coding material, leading to the first exercise. This material was created by Nick Parlante working in the engEDU group at Google. Tip: Check out the Python Google Code University Forum to ask and answer questions.

Non-Programmer's Tutorial for Python 3/Print version All example Python source code in this tutorial is granted to the public domain. Therefore you may modify it and relicense it under any license you please. Since you are expected to learn programming, the Creative Commons Attribution-ShareAlike license would require you to keep all programs that are derived from the source code in this tutorial under that license. This tutorial is more or less a conversion of Non-Programmer's Tutorial for Python 2.6. The Non-Programmers' Tutorial For Python 3 is a tutorial designed to be an introduction to the Python programming language. If you have programmed in other languages I recommend using Python Tutorial for Programmers written by Guido van Rossum. If you have any questions or comments please use the discussion pages or see Authors page for author contact information. Thanks go to James A. Other resources First things first So, you've never programmed before. ##Python is easy to learnprint("Hello, World!") Hello, World! Halt! Installing Python

Is Antivirus Software a Waste of Money? | Wired Enterprise Jeremiah Grossman is the kind of guy you’d expect to be super paranoid when it comes to computer security. He was on the front lines at Yahoo more than a decade ago when a hacker named MafiaBoy was abusing the site with DDoS attacks. Now Chief Technology Officer at security consultancy White Hat Security, Grossman spends his time fighting web intruders for his company’s clients. When it comes to computer security, he’s paranoid — and for good reason. He’s seen what the bad guys can do. As it turns out, many of his security-minded peers don’t use it either. Dan Guido, the CEO of security startup Trail of Bits also doesn’t use AV. It’s a story we heard again and again at RSA this week. “Ten years ago if you were to ask someone the question, ‘Do you need antivirus?’ The problem is that most criminals are smart enough to test their attacks against popular antivirus products. You Do and You Don’t The short answer is: yes they do. White Hat’s Grossman agrees.

A Python Book: Beginning Python, Advanced Python, and Python Exercises 2.2 Regular Expressions For more help on regular expressions, see: 2.2.1 Defining regular expressions A regular expression pattern is a sequence of characters that will match sequences of characters in a target. The patterns or regular expressions can be defined as follows: Literal characters must match exactly. Because of the use of backslashes in patterns, you are usually better off defining regular expressions with raw strings, e.g. r"abc". 2.2.2 Compiling regular expressions When a regular expression is to be used more than once, you should consider compiling it. import sys, re pat = re.compile('aa[bc]*dd') while 1: line = raw_input('Enter a line ("q" to quit):') if line == 'q': break if print 'matched:', line else: print 'no match:', line Comments: We import module re in order to use regular compiles a regular expression so that we can reuse the compiled regular expression without compiling it repeatedly. 2.2.3 Using regular expressions Notes:

How Can I Protect My Computers and Data When Someone Else Is Using My Network? Dear Lifehacker, After reading how easy it is for someone else to get onto my Wi-Fi network, and, similarly, thinking about how often I let my friends connect to my wireless network, I want to lock down the rest of my network so people connected to it can't go snooping around my computers—or at least secure my most super secret files and folders. What's the best way to go about this? P Thanks, Insecure About Network SecurityP Dear Insecure, We hear you. Set Permissions on Files or FoldersP You can password-protect important files or folders on your computer by editing the permissions settings, which control who can view or edit those items. In Windows, right-click the folder, go to Properties, and open the Security tab. Also don't forget to set up password protection on your network attached storage or any drives shared over the network on your computers.P Encrypt Your Drive or FoldersP The built-in Disk Utility in Mac also is a great tool for protecting folders. Hide your FilesP P.S.

Cloud Computing Topic Center Oracle identifies products affected by Heartbleed, but work remains on fixes Oracle has issued a comprehensive list of its software that may or may not be affected by the OpenSSL (secure sockets layer) vulnerability known as Heartbleed, while warning that no fixes are yet available for some likely affected products. Read more... Microsoft launches toolset for capturing 'ambient intelligence' Microsoft is targeting the growing volume of data being generated by both machines and humans: CEO Satya Nadella on Tuesday showed off tools that could help organizations better understand -- and profit from -- this trove of information. Google steps up competition with Amazon, expands Cloud Platform to Asia Google has expanded its Cloud Platform to include locally hosted computing capacity, storage and data bases for the Asia-Pacific region. Microsoft kicks off sales of lower-priced Office subscription in bid for iPad dollars Box patches Heartbleed flaw in its cloud servers Steven J.

Python In One Easy Lesson Nick Parlante Nov 2010 This is a one-hour introduction to Python used for Stanford's CS107. This material should work as an introduction for any experienced programmer. We'll look at some core Python features and get a feel for how it compares to other languages. For a longer introduction to Python by the same author with videos and exercises, see Google's Python Class. For online practice problems, see Python is a popular open source, cross-platform language in the "dynamic language" niche, like Javascript, Ruby, Lisp, and Perl. Unlike C/C++, Python defers almost everything until runtime. This is how Python works, in contrast to the C/C++ style of knowing the type of every variable and using that for compile time code generation. x = x + x In Python, x could be an int, or a string, or who knows what. Interpreter and Variables You can run the Python interpreter and type code directly in to it -- a good way to try little experiments. Strings Lists [ ], For Loop #! Sorting

Find Open Source Alternatives to commercial software