Intro to Python; Fall 2016
latest
Getting Started
Course Information
Installing Python
Installing Minecraft
Installing PyGame
General Resources
Course Contents
[Week 1] Hello World
[Week 2]: Strings and Input
[Week 3]: Booleans, If-Elif-Else, For
[Week 4]: Turtles and For Loops
[Week 5]: Collections and Loops
[Week 6]: Basic Functions
[Week 7] Advanced collections and functions
[Week 8] Classes and Projects
[Week 9] Project Discussions
Tutorials
Tutorials
Heroes Cookbook
Classes Cookbook
Cookbook
Cookbook
Animation
Interactive Stories
Minecraft Architect Tutorial
Data Analysis Tutorial
Turtle Artist
Chatbot Tutorial
Intro to Python; Fall 2016
Docs
»
Tutorials
Edit on GitHub
Tutorials
ΒΆ
Heroes Cookbook
Numbers
Integers
Floats
Basic math operations
Advanced math operations
Use the math library
Strings
Add two strings together
Repeat a string
Index into a string
Slice a string
String’s inner functions
Built-in Functions
Boolean algebra
Create a literal boolean variable
Create a boolean variable from comparisons
Combine two boolean variables with ‘and’ and ‘or’
If, elif, and else
Use an if to test for something
Create conditional logic
Nest one if inside another if
Lists
Create an empty list
Create a list with items
Add onto a list
Index into a list
Slice a list into a new list
Test if a value is inside a list
Sets
Create a set or convert a list to a set
Add an item to a set
Using sets to enforce uniqueness
For Loops
Write a for loop
Use the for loop’s loop variable
Use range inside a for loop
Use a list inside a for loop
Nest one for loop inside another for loop
While Loops
Use a comparison
Use a boolean variable
Loop forever
Special Loop Commands
Skip the rest of the current cycle in the loop
Break out of the loop entirely
Functions
No arguments and returns nothing
Takes one argument
Returns a value
Takes two arguments
Takes keyword arguments
Time module
Using time.time() to count how long something takes
Using time.sleep(n) to wait for n seconds
Random Module
Generate a random number between 0 and 1
Generate a random number between two integers
Select a random item from a list
Classes Cookbook
Defining a class
Instantiating an object
Writing a method
Using the self variable
Using the property decorator
Inheriting properties and methods
Using the classmethod decorator
Cookbook
Game Loop
Drawing
Using Rect to draw
Bouncing off obstacles
Basic collision detection with screen boundaries
Changing direction based on screen boundary collision
Colliding with another Rect
Cookbook
Game Loop
Basic Sprites
Basic Sprite
Adding the drawing function to the basic sprite
Moving a sprite
Colliding with one other sprite
Using Groups of sprites
Colliding with many sprites
Adding an image to your sprite
Adding event handling to your sprite
Making an animated sprite
Basic Game Physics
Handling Keyboard Input
Scoreboards
Menus
Animation
PyGame
Game Loop
Drawing Objects
Keeping track of state
The core elements of the game loop
Where you should go from here
Interactive Stories
Flow charts and structure
Ovals are start/end points
Rectangles/Boxes are processing points
Diamonds are decision points
Other shapes
Understanding State
The Story Loop
Breaking up your code
More complex states
Optional: Using functional programming
Optional: Use classes to handle state
Minecraft Architect Tutorial
Information: User-Centric Positioning
Information: Placing Blocks
Single Blocks
Multiple Blocks
Technique: Layers
Technique: Negative Space
Technique: Block Collections
Technique: Circles
Data Analysis Tutorial
More datasets
Overview
Getting the Data
Using Pandas and Matplotlib
Some example tutorials
Some simple operations
Seaborn
Science
Some terminology
Questions you can ask
Additional setup
Turtle Artist
Chatbot Tutorial
Reflex-Response Agents
Interace
Brain
Finite State Automata
Read the Docs
v: latest
Versions
latest
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds
Free document hosting provided by
Read the Docs
.