This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see http://bit.ly/mmpython2 for the quiz | |
# compare the way this runs to the way argv_test2.py runs | |
# to run: | |
# python argv_test1.py first.txt | |
from sys import argv | |
script, filename = argv | |
txt = open(filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is the answer to questions 16 and 17 in Practice with Python, Part 2 - Self-Quiz | |
# see http://bit.ly/mmpython2 for the quiz | |
def myname(): | |
print 'Mindy' | |
print 'McAdams' | |
def anyname(a, b): | |
print a | |
print b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exercise 43: Basic Object-Oriented Analysis and Design | |
# http://learnpythonthehardway.org/book/ex43.html | |
# STAGE 1 - this works | |
# only classes Map and Engine are really built | |
# each Scene child-class can be run | |
# start w/ skeleton from Zed, then build it out | |
class Scene(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# alien example - if-elif-else, and while loop | |
from random import randint # allows you to generate a random number | |
# variables for the alien | |
alive = True | |
stamina = 10 | |
# this function runs each time you attack the alien | |
def report(s): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stuff = "Alex Randy Mandy" | |
other = "Jack Fletcher Isaac Bobby Susie Joey Manny Moe Jack" | |
apples = stuff.split(' ') | |
salad = other.split(' ') | |
basket = len(apples) | |
print basket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fun with turtle, a Python module | |
# draw 100 circles of many colors | |
# http://docs.python.org/3.1/library/turtle.html | |
# http://static.michael0x2a.com/turtle_examples.html | |
# http://www.eg.bucknell.edu/~hyde/Python3/TurtleDirections.html | |
import random | |
import time | |
import turtle | |
t = turtle.Pen() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>PointRider</title> | |
<!-- Bootstrap --> | |
<!-- changed order so table comes after Bootstrap --> | |
<link href="bootstrap3/css/bootstrap.css" rel="stylesheet"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Simple Lightbox</title> | |
<style> | |
/* overlay dims screen for simple lightbox */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name=viewport content="width=device-width, initial-scale=1"> | |
<title> My Shoutbox Project </title> | |
<link rel="stylesheet" href="css/main.css"> | |
</head> | |
<body> | |
<div id="container"> |