[e-learning] Google Python Class
Google's Python Class
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. next
Python Set Up
This page explains how to set up Python on a machine so you can run and edit Python programs, and links to the exercise code to download. next
Python Introduction
Welcome to Google's Python online tutorial. It is based on the introductory Python course offered internally. Originally created during the Python 2.4 days, we've tried to keep the content universal and exercises relevant, even for newer releases. next
Python Strings
Python has a built-in string class named "str" with many handy features (there is an older module named "string" which you should not use). next
Python Lists
Python has a great built-in list type named "list". List literals are written within square brackets [ ]. Lists work similarly to strings -- use the len() function and square brackets [ ] to access data, with the first element at index 0. (See the official python.org list docs.) next
Python Sorting
The easiest way to sort is with the sorted(list) function, which takes a list and returns a new list with those elements in sorted order. The original list is not changed.next
Python Dict and File
Python's efficient key/value hash table structure is called a "dict". The contents of a dict can be written as a series of key:value pairs within braces { }, e.g. dict = {key1:value1, key2:value2, ... }. The "empty dict" is just an empty pair of curly braces {}.next
Python Regular Expressions
Regular expressions are a powerful language for matching text patterns. This page gives a basic introduction to regular expressions themselves sufficient for our Python exercises and shows how regular expressions work in Python. The Python "re" module provides regular expression support.next
Python Utilities
In this section, we look at a few of Python's many standard utility modules to solve common problems.next
Lecture Videos
- Intoduction, String >> watch video
- Lists and sorting >> watch video
- Dicts and file >> watch video
- Regular and expr >> watch video
- Untilities urllib >> watch video
- Conclusions >> watch video
Basic Python Exercises
There are 3 exercises that go with the first sections of Google's Python class. They are located in the "basic" directory within the google-python-exercises directory. Download the google-python-exercises.zip if you have not already (see the Set-Up page for details). next
Baby Names Python Exercise
The Social Security administration has this neat data by year of what names are most popular for babies born that year in the USA (see social security baby names).next
Copy Special Python Exercise
The Copy Special exercise goes with the file-system and external commands material in the Python Utilitiessection. This exercise is in the "copyspecial" directory within google-python-exercises (download google-python-exercises.zip if you have not already, see Set Up for details). Add your code in copyspecial.py. next
Log Puzzle Python Exercise
For the Log Puzzle exercise, you'll use Python code to solve two puzzles. This exercise uses the urllib module, as shown in the Python Utilities section. The files for this exercise are in the "logpuzzle" directory inside google-python-exercises (download the google-python-exercises.zip if you have not already, see Set Up for details). Add your code to the "logpuzzle.py" file. next
Selamat Mencoba :)
Social Plugin