background preloader

Learning Python Programming Language Through Video Lectures

Learning Python Programming Language Through Video Lectures
One of the upcoming projects I am doing (I will reveal it in one of the next blog posts.) is going to be written entirely in Python. I have a good understanding of Python but, same as I had with JavaScript, I have little experience doing projects from the ground up in it. Update: the project was redditriver.com, read designing redditriver.com (includes full source code). Before diving into the project I decided to take a look at a few Python video lectures to learn language idioms and features which I might have not heard of. Finding Python video lectures was pretty easy as I run a free video lecture blog. First Python Lecture: Python for Programmers Interesting moments in the lecture: [07:15] There are several Python implementations - CPython, PyPy, IronPython and Jython. Okay, this talk was a very basic talk and it really was an introduction for someone who never worked in Python. Second Python Lecture: Advanced Python or Understanding Python Question and answer session: PS.

PEP 8 -- Style Guide for Python Code Code should be written in a way that does not disadvantage other implementations of Python (PyPy, Jython, IronPython, Cython, Psyco, and such).For example, do not rely on CPython's efficient implementation of in-place string concatenation for statements in the form a += b or a = a + b. This optimization is fragile even in CPython (it only works for some types) and isn't present at all in implementations that don't use refcounting. In performance sensitive parts of the library, the ''.join() form should be used instead.

Learn Python The Hard Way This exercise has no code. It is simply the exercise you complete to get your computer to run Python. You should follow these instructions as exactly as possible. Go to with your browser, get the Notepad++ text editor, and install it. From now on, when I say "Terminal" or "shell" I mean PowerShell and that's what you should use. Warning Sometimes you install Python on Windows and it doesn't configure the path correctly. > python ActivePython 2.6.5.12 (ActiveState Software Inc.) based on Python 2.6.5 (r265:79063, Mar 20 2010, 14:22:52) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> quit()> mkdir mystuff > cd mystuff ... It is still correct if you see different information than mine, but yours should be similar. A major part of this book is learning to research programming topics online. Thanks to search engines such as Google you can easily find anything I tell you to find.

Invent Your Own Computer Games with Python - Learn how to program with a free ebook programming tutorial Chapter 1 Read online: Chapter 1 - Installing Python Videos: Chapter 2 Read online: Chapter 2 - The Interactive Shell Chapter 3 Read online: Chapter 3 - Strings Download source: hello.py Copy source to clipboard: Use the online diff tool to find typos in your code: hello.py Chapter 4 Read online: Chapter 4 - Guess the Number Download source: guess.py Use the online diff tool to find typos in your code: guess.py Chapter 5 Read online: Chapter 5 - Jokes Download source: jokes.py Use the online diff tool to find typos in your code: jokes.py Chapter 6 Read online: Chapter 6 - Dragon Realm Download source: dragon.py Use the online diff tool to find typos in your code: dragon.py Chapter 7 Read online: Chapter 7 - Using the Debugger Chapter 8 Read online: Chapter 8 - Flow Charts Chapter 9 Read online: Chapter 9 - Hangman Download source: hangman.py Use the online diff tool to find typos in your code: hangman.py Chapter 10 Read online: Chapter 10 - Tic Tac Toe Download source: tictactoe.py Chapter 11 Download source: bagels.py

2. Built-in Functions Open a file, returning an object of the file type described in section File Objects. If the file cannot be opened, IOError is raised. When opening a file, it’s preferable to use open() instead of invoking the file constructor directly. The first two arguments are the same as for stdio‘s fopen(): name is the file name to be opened, and mode is a string indicating how the file is to be opened. The most commonly-used values of mode are 'r' for reading, 'w' for writing (truncating the file if it already exists), and 'a' for appending (which on some Unix systems means that all writes append to the end of the file regardless of the current seek position). The optional buffering argument specifies the file’s desired buffer size: 0 means unbuffered, 1 means line buffered, any other positive value means use a buffer of (approximately) that size (in bytes). Modes 'r+', 'w+' and 'a+' open the file for updating (reading and writing); note that 'w+' truncates the file.

Tutorial - Learn Python in 10 minutes - Stavros' Stuff NOTE: If you would like some Python development done, my company, Stochastic Technologies, is available for consulting. This tutorial is available as a short ebook. The e-book features extra content from follow-up posts on various Python best practices, all in a convenient, self-contained format. Preliminary fluff So, you want to learn the Python programming language but can't find a concise and yet full-featured tutorial. Properties Python is strongly typed (i.e. types are enforced), dynamically, implicitly typed (i.e. you don't have to declare variables), case sensitive (i.e. var and VAR are two different variables) and object-oriented (i.e. everything is an object). Getting help Help in Python is always available right in the interpreter. >>> help(5)Help on int object:(etc etc) >>> dir(5)['__abs__', '__add__', ...] >>> abs. Syntax Python has no mandatory statement termination characters and blocks are specified by indentation. Data types You can access array ranges using a colon (:).

Cheatsheet - Python & R codes for common Machine Learning Algorithms In his famous book – Think and Grow Rich, Napolean Hill narrates story of Darby, who after digging for a gold vein for a few years walks away from it when he was three feet away from it! Now, I don’t know whether the story is true or false. But, I surely know of a few Data Darby around me. These people understand the purpose of machine learning, its execution and use just a set 2 – 3 algorithms on whatever problem they are working on. They don’t update themselves with better algorithms or techniques, because they are too tough or they are time consuming. Like Darby, they are surely missing from a lot of action after reaching this close! Today’s cheat sheet aims to change a few Data Darby’s to machine learning advocates. For the super lazy Data Darbies, we will make your life even easier. Keep this cheat sheet handy when you work on data sets. download the complete cheat sheet here: PDF Version Related Year in Review: Best of Analytics Vidhya from 2015 December 28, 2015 August 10, 2015

Understanding Python's "with" statement Fredrik Lundh | October 2006 | Originally posted to online.effbot.org Judging from comp.lang.python and other forums, Python 2.5’s new with statement (dead link) seems to be a bit confusing even for experienced Python programmers. As most other things in Python, the with statement is actually very simple, once you understand the problem it’s trying to solve. Consider this piece of code: set things up try: do something finally: tear things down Here, “set things up” could be opening a file, or acquiring some sort of external resource, and “tear things down” would then be closing the file, or releasing or removing the resource. If you do this a lot, it would be quite convenient if you could put the “set things up” and “tear things down” code in a library function, to make it easy to reuse. def controlled_execution(callback): set things up try: callback(thing) finally: tear things down def my_function(thing): do something controlled_execution(my_function) This wasn’t very difficult, was it?

How to Build a Crawler in Python Short Bytes: Web crawler is a program that browses the Internet (World Wide Web) in a predetermined, configurable and automated manner and performs given action on crawled content. Search engines like Google and Yahoo use spidering as a means of providing up-to-date data. Webhose.io, a company which provides direct access to live data from hundreds of thousands of forums, news and blogs, on Aug 12, 2015, posted the articles describing a tiny, multi-threaded web crawler written in python. This python web crawler is capable of crawling the entire web for you. Ran Geva, the author of this tiny python web crawler says that: I wrote as “Dirty”, “Iffy”, “Bad”, “Not very good”. The python based multi-threaded crawler is pretty simple and very fast. Save the above code with some name lets say “myPythonCrawler.py”. $ python myPythonCrawler.py Sit back and enjoy this web crawler in python. Become a Pro in Python With These Courses

Python from Scratch – Functions and Modules Welcome back to the Python from Scratch series. In the previous lesson, we learned how to use variables and control structures to store and manipulate data. Be sure to review it if you need a refresher! Video Tutorial Press the HD button for the clearest picture. Transcript In today's tutorial, we're going to be looking at functions - what they are, how they work, and how to make your own. Functions - Writing your Own Functions are an important step to cover, when introducing additional complexity into your programming. A function is a named container for a block of code. There are two types of functions: the ones that you write yourself and include in your code, and the ones that are included in Python natively, which carry out common procedures, such as converting an integer to a string, or finding the length of a string. We're going to look at writing a simple function now, and demonstrate how it can be useful in the real world code. A simple Example Arguments Argument Defaults str() len() os

Python Tools for Visual Studio 6 Free E-Books on Learning to Program with Python Python is an increasingly popular language, and it's also a favorite language teaching first time programmers. We've compiled a list of beginner's books to choose from. Just because they're free doesn't mean they aren't good. Some of the books listed here have been used in courses such as MIT's Introduction to Computer Science and Programming course and University of California, Davis' Basic Concepts of Programming course. A Byte of Python A Byte of Python is a beginner's book on Python by Swaroop C H. It's been used in several academic programs, such as the above mentioned UC Davis course, and by the NASA Jet Propulsion Laboratory. It's available for both Python 2.X and 3.0, but only the 3.0 version is still updated. Learn Python the Hard Way Learn Python the Hard Way is a beginner's programming book written by Zed Shaw. Shaw is known as the creator of the Mongrel and Mongrel2 Web servers, and more recently as the author of this lively manifesto. Non-Programmer's Tutorial for Python See Also

IronPython.net / PLEAC-Python Following the Perl Cookbook (by Tom Christiansen and Nathan Torkington, published by O'Reilly) spirit, the PLEAC Project aims to gather fans of programming, in order to implement the solutions in other programming languages. In this document, you'll find an implementation of the Solutions of the Perl Cookbook in the Python language. The latest version of Python is 2.4 but users of 2.3 and 2.2 (and in some cases earlier versions) can use the code herein. Users of 2.2 and 2.3 should install or copy code from utils.py ( [the first section provides compatability code with 2.4] Users of 2.2 should install optik ( [for optparse and textwrap] Where a 2.3 or 2.4 feature is unable to be replicated, an effort has been made to provide a backward-compatible version in addition to one using modern idioms.

Related: