🚧 Currently a work in progress as we port our content to this [GitHub classroom textbook][text-work]. [text-work]: https://blog.skilstak.io/github-as-text-book-and-work-book-828ffada9542#.etr9ts7me
💬 This workbook goes with a textbook Students get their personal, private workbook after asking their instructor for an invite or clicking on one in their course chat room. We invite teachers and parents to read 🍎Welcome Teachers!
Welcome to Python! In this course you will learn the fundamentals of programming in Python. Concepts include variables, operators, blocks, logic, loops, data types, lists, dictionaries, functions, exceptions, unit testing, classes, files, json, web api consumption, and basic code organization. This course covers Python 3.5+, the most recent version of Python.
- Get the Workbook (
workbook
) - Open GitHub in Incognito
- Click on the Octocat
- Find and Click the Clone or Download Button
- Make Sure SSH
- Copy to Clipboard
- Pull Up a Terminal
- Change Into Your
repos
Directory - Enter the
git clone
Command - Checking the Python Docs (
docs
) - Make Sure Python3
💡docs.python.org
◦ Standard Documentation ◦ Python Versions - Pydoc
💡pydoc3
◦ Comments ◦|
◦ Pagers ◦ Pipes ◦| more
◦more
◦ UNIX Pipeline - Manual
man
Pages
💡 Man Pages ◦man
- Why Python? (
why
) - Easy
💡 Best First Language ◦ MIT ◦ghc
- Everywhere
- Powerful
💡 Python C Extensions ◦ Data Science ◦ Premature Optimization - Versatile
💡 One Best Way ◦ Beat Perl - Mature
💡 Python 2 v.s. 3 ◦ Libraries - When Not to Pick Python (
not
) - Concurrency
- Slow
- Not a Web Language
- Not for Graphical Games, No PyGame
- No Python IDLE?
- Short History of Python (
history
) - Guido's Christmas Present Named After Monty Python
- Whitespace Novelty
- Best First Language to Learn
- The Python Command Interface (
cli
) - Why CLI?
💡python3
- Easter Eggs
💡 Easter Eggs ◦ Zen of Python ◦ Python Longevity - Conclusion
- Hello World (
hello
) - History
- Touch and Chmod
💡touch
◦chmod +x
◦ Permissions ◦ Executable ◦ Runnable ◦ File ◦ Script - Printing Text to the Screen
💡print()
◦ Strings ◦ Quotes ◦vim
◦vi
◦ Code Birthday - Files and
PATH
💡 Files ◦$PATH
◦path
◦which
◦echo
◦ Full Path ◦ Fully ◦ Qualified Path ◦ Root Path ◦/
◦.
◦..
◦./
◦../
◦~
- Shuh to the Bang
💡 Shebang Line ◦#!
◦env
◦ File System ◦ Path - Color Things Up
💡import
◦colors
◦as
◦ Using Python Modules ◦ Terminal ◦ Escapes ◦c.random()
◦c.multi()
◦c.clear
- Spinning Emoji Earth Globe
💡 Unicode ◦ Code for the World ◦ Emojis ◦from
◦import
- Beads on a Necklace
💡 Strings ◦ Quotes ◦Join Operator
◦+
- Action
💡 Actions ◦ Functions ◦ Function Call - Paying for Air
💡 Arguments ◦ Parameters - Final Comment
💡 Comments ◦'''
◦"""
◦pydoc3
◦pydoc
- Do It Again
💡 Repetition ◦ Athletic Software Engineering - Conclusion
- Hi There! (
hi
) - The Usual
- Replacing World
💡 Variables ◦ Operators ◦=
◦ Constants - Teaching a Computer to Remember
- Prompting for Input
💡input()
- Where is Your Assignment?
💡 Assignment ◦ Assignment Operator ◦=
◦ Operator ◦ Operand - Difference Between Functions and Procedures
💡 Functions ◦ Procedures ◦ Side Effects ◦ Functional Programming Paradigm - Conclusion
💡 REPL ◦ Interactive Text Adventures ◦ Stories - Nyan, Nyan, STOP! (
nyan
) - Nyan What?
- The Usual
- True or False
💡 Booleans ◦ Types ◦True
◦False
- Loop It
💡while
◦ Infinite Loops ◦ End of the World - In Your Block
💡 Code Blocks ◦:
- Indenting with
vim
💡>>
◦<<
◦vim
- Spaces and Tabs that Matter
💡 Significant White Space - Make is STOP!
💡 Interrupts ◦KeyboardInterrupt
◦ctrl-c
◦ Exceptions ◦ctrl-z
◦ctrl-x
◦ Why NOnano
- Catching and Trapping Exceptions
💡 Exceptions ◦try:
◦except:
◦ Blue-Sky Scenario ◦exit()
- Printing to Same Line
💡print()
◦end=" "
◦Line Buffering
◦flush=True
◦ - But WHY?!
💡 Event Programming ◦ Event Loops - Conclusion
- Bonus Challenges
- Do You Like Waffles? (
waffles
) - An Ancient Meme?
- The Usual
💡 Boilerplate ◦bin
- Do you like waffles?
💡input()
- Logic is a Little Tweeting Bird
💡 Logic ◦if
◦else
◦ Conditions - The Difference Between Equality and Assignment
💡=
◦==
◦ Is Equal To ◦ Assign - A Big Nest
💡 Nested Code Blocks ◦ Shallow Nesting by Design - Trimming the Nest
💡 Refactoring ◦ Code Maintenance ◦ Code Organization ◦ Program Design ◦ Spaghetti Code ◦ Conditional Modifiers ◦not
◦ Checking for Good not Bad - Notice Any Patterns?
💡 Redundancy ◦ Variables ◦ Assertions ◦ The Dude - Defining Our First
ProcedureFunction
💡 Defining Functions ◦ Python Style Guidelines ◦ PEP-0008 - Handling the Other Exceptions
💡 Blue Sky Path ◦ Blue Sky Scenario ◦ Exceptional Path ◦ Exceptions - Speaking of Lists (and Tuples)
💡 Lists ◦ Tuples ◦[]
◦()
◦ Immutable - Exception: User Enters Variation of
yes
💡 Compound Conditions ◦or
◦and
◦ Logic Errors ◦.startswith()
◦.lower()
◦in
◦ Methods v.s. Functions ◦ String Methods ◦ Order of Operations ◦()
◦ Regular Expressions - Exception: User Includes Spaces
💡 Trimming Whitespace ◦.trim()
◦.ltrim()
◦.rtrim()
- Exception: User Interrupts with
ctrl-c
💡 Catching Multiple Exceptions ◦except
◦KeyboardError
◦else
◦finally
- Conclusion
- Bonus Challenges
- Badgers, Badgers, Badgers (
badgers
) - The Usual
- How many badgers is that again?
💡 Counting ◦ Infinite ◦ Finite ◦ Boolean ◦while
◦ Algorithms - Teaching Our Program to Count
💡 Addition Operator ◦+
◦ Augmented Assignment ◦+=
- But Mom, the Program Says Raise My Allowance
💡 Difference Between Join and Addition Operators ◦ Chores ◦ Allowance - Conclusion
- Bonus Challenges
- More Python3 Learning Resources (
more
) - Dive Into Python 3
- Warning
- 🍎 Welcome Teachers! (
teachers
) - Prerequisites
- Age
- Time
- Rubrics
- Resources
- Encrypted Solutions
- Other
- Next
- Contributing
- Copyright
[][cc-by-sa] [][skilstak] [cc-by-sa]: https://creativecommons.org/licenses/by-sa/4.0/ [skilstak]: http://skilstak.io