Skip to content

Commit 878dcdd

Browse files
committed
WIP - first pass updating content to prepare for CityCampRDU
1 parent f9357c0 commit 878dcdd

File tree

10 files changed

+7385
-2
lines changed

10 files changed

+7385
-2
lines changed

citycamp/index.html

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
7+
<title>Intro to Python ~ Girl Develop It</title>
8+
9+
<meta name="description" content="This is the Girl Develop It Intro to Python course.">
10+
<meta name="author" content="Girl Develop It">
11+
12+
<meta name="apple-mobile-web-app-capable" content="yes" />
13+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
14+
15+
<link rel="stylesheet" href="../reveal/css/reveal.min.css">
16+
<link rel="stylesheet" href="../css/gdicool.css" id="theme">
17+
<!-- For syntax highlighting -->
18+
<link rel="stylesheet" href="../css/dark.css">
19+
20+
<!-- If use the PDF print sheet so students can print slides-->
21+
<link rel="stylesheet" href="../reveal/css/print/pdf.css" type="text/css" media="print">
22+
23+
</head>
24+
25+
<body>
26+
<div class="reveal">
27+
<div class="slides">
28+
<!-- load the markdown file for all of the slide content -->
29+
<section id="slide-content"
30+
data-separator="^@@@\n\n"
31+
data-vertical="^\n\n"
32+
data-notes="^Note:">
33+
</section>
34+
</div>
35+
<footer>
36+
<div class="copyright">
37+
Intro to Python ~ Girl Develop It ~
38+
<a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="../images/cc-license.png" /></a>
39+
</div>
40+
</footer>
41+
</div>
42+
43+
<script src="../reveal/lib/js/head.min.js"></script>
44+
<script src="../reveal/js/reveal.min.js"></script>
45+
46+
<script>
47+
// Utility function for parsing query params. (has some limitations
48+
// WRT multi-value params, but is sufficient for determining
49+
// the markdown file to use
50+
function get_query_param_by_name(name) {
51+
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
52+
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
53+
results = regex.exec(location.search);
54+
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
55+
}
56+
57+
(function() {
58+
// Determine Markdown file to use by the 'part' query param.
59+
var part = get_query_param_by_name('part');
60+
61+
if (part) {
62+
document.getElementById('slide-content').dataset.markdown = 'slides/' + part + '.md';
63+
} else {
64+
// Default to using the menu
65+
document.getElementById('slide-content').dataset.markdown = 'slides/menu.md';
66+
}
67+
// Initialize reveal
68+
// Full list of configuration options available here:
69+
// https://github.com/hakimel/reveal.js#configuration
70+
Reveal.initialize({
71+
controls: true,
72+
progress: true,
73+
history: true,
74+
center: true,
75+
slideNumber: true,
76+
77+
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
78+
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/none
79+
80+
// Optional libraries used to extend on reveal.js
81+
dependencies: [
82+
{ src: '../reveal/lib/js/classList.js', condition: function() { return !document.body.classList; } },
83+
{ src: '../reveal/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
84+
{ src: '../reveal/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
85+
{ src: '../reveal/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
86+
{ src: '../reveal/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
87+
{ src: '../reveal/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
88+
]
89+
});
90+
})();
91+
</script>
92+
</body>
93+
</html>

citycamp/slides/contents.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
####[Part 1](?part=part1) - Intro to programming in Python
2+
3+
What is programming? What is Python? We'll tackle these concepts, set up a development environment, and get started working in the Python shell.
4+
@@@
5+
6+
####[Part 2](?part=part2) - Structured programming: Functions, Loops, and conditionals
7+
8+
We'll be creating small programs in the text editor, implementing control flow and loading these programs into the shell.
9+
@@@
10+
11+
####[Part 3](?part=part3) - Python data structures and other essential built-ins
12+
13+
Lists, dictionaries and other built-in containers give the Python programmer tremendous power. We'll use these combined with other Python built-ins to process text files for information.
14+
@@@
15+
16+
####[Part 4](?part=part4) - Object oriented programming
17+
18+
What is Object-Oriented Programming and how can it help make programming easier? We'll also get started on some projects that you can do with your new Python skills.
19+
@@@
20+
21+
####[Exercises](?part=exercises) - Additional Exercises

citycamp/slides/exercises.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
![Girl Develop It Logo](../images/gdi_logo_badge.png)
2+
3+
###Intro to Python
4+
####Additional Exercises
5+
@@@
6+
7+
###Functions
8+
9+
* Write a program that uses at least one function to solve a geometry problem
10+
11+
* The program will generally have three steps:
12+
13+
* Obtain input
14+
* Call a function to calculate the answer
15+
* Display the answer
16+
17+
* Hint: You can take user input with raw_input() as before, or use the example
18+
below to take arguments from the command line
19+
* Download [geometry.py](http://calebsmith.github.io/gdi-intro-python/examples/geometry.py) and use it as an example
20+
21+
Note: Let's Develop It 15 Minutes
22+
23+
@@@
24+
25+
###Text processing
26+
27+
Write a program that opens a text file and does some processing.
28+
29+
* The program should take a word as input and determine if the word appears in the file
30+
31+
* The program should use at least one function to do its work and you should be able to import this function in a Python shell and call it with a word and filename
32+
33+
The next page lists the things you will need.
34+
35+
Note: Let's develop it: 15 minutes
36+
37+
@@@
38+
39+
###Text processing - Requirements
40+
41+
* Use the functions from [helpers.py](http://calebsmith.github.io/gdi-intro-python/examples/helpers.py) to help with reading in the lines and/or words of the file
42+
43+
* Download a plain text english dictionary like the following: [english.txt](http://calebsmith.github.io/gdi-intro-python/examples/english.txt) and put it into the same directory as your python file.
44+
45+
* Download a book in plain text from [Project Gutenburg](http://www.gutenberg.org/wiki/Main_Page) and put it into the same directory as your python file.
46+
47+
The next slide shows some code to help you get started.
48+
49+
@@@
50+
51+
###Text processing - Example Code
52+
53+
```python
54+
from helpers import generate_cleaned_lines
55+
56+
def is_word_in_file(word, filename):
57+
for line in generate_cleaned_lines(filename):
58+
# line will be a string of each line of the file in order
59+
# Your code goes here.
60+
# Your code should do something with the word and line variables and assign the value to a variable for returning
61+
input_word = raw_input("Enter a word to search for:")
62+
answer = is_word_in_file(input_word, 'pride.txt')
63+
# Display the answer in some meaningful way
64+
```
65+
66+
I have used [Pride and Prejudice](http://calebsmith.github.io/gdi-intro-python/examples/pride.txt) from Project Gutenburg with my example code. You can click this link and copy/paste the text into a new text file called 'pride.txt' and save it in the same folder as your code

citycamp/slides/menu.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<img src="../images/gdi_logo_badge.png" alt="Girl Develop It Logo" style="width: 300px;"/>
2+
3+
###Intro to Python
4+
####Menu
5+
6+
[Section 1](?part=part1)
7+
[Section 2](?part=part2)
8+
[Section 3](?part=part3)
9+
<div class="clearfix"> </div>
10+
[Additional Exercises](?part=exercises)
11+
[Contents](?part=contents)

citycamp/slides/part1.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
![Girl Develop It Logo](../images/gdi_logo_badge.png)
2+
3+
###Intro to Python
4+
####Section 1
5+
@@@
6+
7+
## Welcome
8+
Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.
9+
10+
Some rules
11+
12+
* We are here for you
13+
* Every question is important
14+
* Help each other
15+
* Have fun
16+
@@@
17+
18+
###What we will cover today
19+
20+
* Why Python? <!-- .element: class="fragment" -->
21+
* What is programming? <!-- .element: class="fragment" -->
22+
* Variables and arithmetic <!-- .element: class="fragment" -->
23+
* Statements and Error Messages <!-- .element: class="fragment" -->
24+
@@@
25+
26+
###Why Python?
27+
28+
* Suitable for beginners, yet used by professionals
29+
* Readable, maintainable code
30+
* Rapid rate of development
31+
* Few "magical" side-effects
32+
* Variety of applications
33+
Note: Block 1 begins - 25 minutes
34+
@@@
35+
36+
###What is Python used for?
37+
38+
* System Administration (Fabric, Salt, Ansible)
39+
* 3D animation and image editing (Maya, Blender, Gimp)
40+
* Scientific computing (numpy, scipy)
41+
* Web development (Django, Flask)
42+
* Game Development (Civilization 4, EVE Online)
43+
@@@
44+
45+
###Who is using Python?
46+
47+
* Disney
48+
* Dropbox
49+
* Canonical and Red Hat
50+
* Google
51+
* NASA
52+
* Caktus
53+
@@@
54+
55+
###What is programming?</h3>
56+
57+
* Teaching the computer to do a task
58+
* A program is made of one or more files of code, each of which solve part of the overall task
59+
* Programming code is human readable but also needs a form that the computer can run directly. This form is not human readable.
60+
* Don't focus on what's "under the hood" for now. We will "drive the car" first
61+
@@@
62+
63+
##Block 2
64+
Note: 30 minutes
65+
@@@
66+
67+
###Working in repl.it
68+
69+
Navigate to http://repl.it in a browser. Find "Python3" under languages
70+
71+
* Follow along with the examples in the slides. Type them in! <!-- .element class="fragment" -->
72+
* Feel free to explore as well. You will not accidentally break things <!-- .element class="fragment" -->
73+
74+
@@@
75+
76+
###Variables and Arithmetic
77+
```python
78+
> 3 + 4
79+
=> 7
80+
> 2 * 4
81+
=> 8
82+
> 6 - 2
83+
=> 4
84+
> 4 / 2
85+
=> 2
86+
```
87+
88+
```python
89+
> a = 2
90+
> b = 3
91+
> c = a + b
92+
> print(c)
93+
=> 5
94+
```
95+
```python
96+
> a = 0
97+
> a = a + .5
98+
> print(a)
99+
=> 0.5
100+
```
101+
@@@
102+
103+
###Strings
104+
```python
105+
> a = 'Hello '
106+
> b = 'World'
107+
> c = a + b
108+
> print(c)
109+
=> 'Hello World'
110+
```
111+
@@@
112+
113+
###Data types
114+
* Variables are a name for some data <!-- .element class="fragment" -->
115+
* Variables always have a "type" <!-- .element class="fragment" -->
116+
* The type defines what it can do <!-- .element class="fragment" -->
117+
* The type can be found using: type() <!-- .element class="fragment" -->
118+
119+
```python
120+
> print type(4)
121+
=> <type 'int'>
122+
> a = 4
123+
> print type(a)
124+
=> <type 'int'>
125+
> print type("But I don't like spam")
126+
=> <type 'str'>
127+
> print type(3.5)
128+
=> <type 'float'>
129+
```
130+
@@@
131+
132+
###Type Errors
133+
* Variables of a given type can be used with a set of operators <!-- .element class="fragment" -->
134+
* An int or float can be used with any of: +, -, \*, / <!-- .element class="fragment" -->
135+
* A string can be used with any of: +, \* <!-- .element class="fragment" -->
136+
* What happens if we try to use division or subtraction with a string? <!-- .element class="fragment" -->
137+
```python
138+
> print "Spam" / "eggs"
139+
Traceback (most recent call last):
140+
File "<stdin>", line 1, in <module>
141+
TypeError: unsupported operand type(s) for /: 'str' and 'str'
142+
```
143+
@@@
144+
145+
###Errors
146+
* An Exception gives us some information about the cause of the error <!-- .element class="fragment" -->
147+
* Some examples are SyntaxError, TypeError and NameError exceptions. <!-- .element class="fragment" -->
148+
@@@
149+
150+
###Errors - continued ...
151+
152+
* A \# is a code comment. These are not evaluated by Python
153+
154+
```python
155+
# SyntaxError - Doesn't conform to the rules of Python.
156+
# This statement isn't meaningful to the computer
157+
> 4spam)eggs(garbage) + 10
158+
159+
# NameError - Using a name that hasn't been defined yet.
160+
> a = 5
161+
> print b
162+
163+
# TypeError - Using an object in a way that its type does not support
164+
> 'string1' / 'string2'
165+
```
166+
@@@
167+
168+
###Let's Develop It
169+
* We'll practice what we've learned in the shell
170+
* Review the slides on your computer and practice entering anything you didn't fully understand before
171+
* Ask the teacher or a TA for any help
172+
Note: Let's develop it: 5 minutes.
173+
@@@
174+
175+
###User Input
176+
To obtain user input, use 'input()'. This will become a string
177+
178+
We use float() to make it a number
179+
180+
```python
181+
input_value = input("Enter a radius:")
182+
radius = float(input_value)
183+
area = 3.14159 * radius * radius
184+
print('The area of a circle with radius', input_value, 'is', area)
185+
```
186+
@@@
187+
188+
###Let's Develop It
189+
Write your own program that uses input and does something else with the value
190+
191+
You can use float() to treat the input as a number if you need a number, or you can use the input directly if you need a string
192+
193+
Note: Let's develop it: 10 minutes
194+
@@@
195+
196+
###Any Questions?

0 commit comments

Comments
 (0)