hacdc-wiki/Old Wiki/Intro_to_Programming.md
2024-06-13 15:21:56 -04:00

99 lines
4.3 KiB
Markdown
Executable File

Very basic introduction to programming class meant for those who've
never programed before in their lives. Our external P2PU site is
[here](http://new.p2pu.org/en/groups/python-101-with-pygame/). Please
make sure to add yourself to the mailing list
[here](https://groups.google.com/a/hacdc.org/group/prog101).
## Pre class HW
For the class we will be using python and pygame. Instructions on how to
install them on your operating system of choice can be found below.
- [Installing Python and
Pygame](Installing_Python_and_Pygame "wikilink")
**Git and Github**
We would like those taking the class to keep a source repository to
store workshop and homework code so that: 1. they can modify without
fear of messing it up beyond repair 2. they can share code and, thus,
assist each other
To that end, we have some resources below to get git installed, open a
github account, and the main git commands you will need to get started.
[Setting up git on Windows](http://help.github.com/win-set-up-git/)
[Setting up git on OS X](http://help.github.com/mac-set-up-git/)
[Setting up git on Linux](http://help.github.com/linux-set-up-git/) (you
may choose to use your package manager (apt, yum, pacman, etc.) to
install the git-core package)
If you can go through this before the class 0, great! you will have more
time to write some code during the workshop. Otherwise, we will be
available to assist anyone who may need help getting things started.
You can get the presentation slides, code, and other material from this
wiki OR live from the [class
repository](https://github.com/3lawsafe/HacDC-Intro-to-Programming)
## Class 0
**Covers**: Some history. IDLE and Python. Primitive data types.
Statements and expressions. Hello World! Turtle Graphics **Slides**:
![<File:Class_0.pdf>](Class_0.pdf "File:Class_0.pdf") **Workshop**: Get
things working! **Demo code**:
![<File:Turtle_demo.py>](Turtle_demo.py "File:Turtle_demo.py")
![<File:Wrapper_turtle.py>](Wrapper_turtle.py "File:Wrapper_turtle.py")
**Homework**: Draw a pretty picture using the turtle graphics.
## Class 1
**Covers**: Program control. If statements. For loops. While loops.
Pygame drawing. **Slides**:
![<File:Class_1.pdf>](Class_1.pdf "File:Class_1.pdf") **Workshop**:
Pygame picture time! **Demo code**:
![<File:pygame_pretty_picture.py>](pygame_pretty_picture.py "File:pygame_pretty_picture.py")
![<File:pong_paddle_hit.py>](pong_paddle_hit.py "File:pong_paddle_hit.py")
**Homework**: Make an animation using your new looping and pygame
drawing skills. Sign up for the email list, and introduce your self.
Include a link to your GitHub repository.
## Class 2
**Covers**: Functions. Common data structures. Pygame events.
**Slides**: ![<File:Class_2.pdf>](Class_2.pdf "File:Class_2.pdf")
**Workshop**: Pong code with functions! Quick event demo. **Demo code**:
Check the repo! **Homework**: Email list, do it! Share your repo and
code! Make that animation you had interactive using the new event or I/O
stuff. Try and make your previous code use functions.
## Class 3
**Covers**: Classes. Modules and Packages. **Slides**:
![<File:Class_3.pdf>](Class_3.pdf "File:Class_3.pdf") **Workshop**:
Sprite demo! Pong with classes! (And probably prettier than the original
one) **Demo code**: Check the repo! **Homework**: Package some of your
existing code into a module. Try making a few objects for your
interactive animation. Extend the sprite so there's more than one sprite
on screen and they're keyboard controlled.
## Class 4
**Covers**: Some stuff from the standard library. Pyserial too!
**Slides**: ![<File:Class_4.pdf>](Class_4.pdf "File:Class_4.pdf")
**Workshop**: A bunch of little programs! **Demo code**: Check the repo!
**Homework**: Use at least one of the libraries presented in class in
your own code. Two different datasets are being provided, try and
visualize the data using pygame.
## Class 5
**Covers**: Tidbits we didn't cover during the other classes. Exceptions
handling. List/dict comprehensions. Lambdas, filters, maps and reduce.
**Slides**: ![<File:Class_5.pdf>](Class_5.pdf "File:Class_5.pdf")
**Workshop**: Some packaging stuff! **Demo Code**: Check the repo!
**Homework**: Keep coding and showing up to HacDC!
<noinclude> </noinclude>
[Category:Intro_to_Programming](Category:Intro_to_Programming "wikilink")