Welcome to the repository for Automate the Boring Stuff with Python by Al Sweigart! This repository contains notes, summaries, and exercise solutions to help you understand and apply the concepts presented in the book.
- Author: Al Sweigart
- Published: 2014
- Description: This book teaches practical programming for total beginners. It covers a range of tasks that can be automated using Python, from simple file handling to web scraping and automation of everyday tasks.
This section contains organized notes from the book, summarizing key concepts and important points.
- hello.py: A simple Python script that prints "Hello, world!" to the console.
- vampire.py: A Python script that demonstrates the use of flow control statements (if, elif, else).
- blocks.py: A Python script that shows how code blocks are defined using indentation.
- vampire2.py: A Python script that demonstrates the use of nested if statements.
- littlekid.py: A Python script that uses the
and
andor
operators in if statements. - yourName.py: A Python script that demonstrates the use of
while
loops. - yourName2.py: A Python script that uses the
break
statement to exit a loop. - howManyGuests.py: A Python script that uses the
continue
statement to skip an iteration in a loop. - helloJoe.py: A Python script that demonstrates the use of
for
loops. - fivetimesfor.py: A Python script that uses a
for
loop to print a message five times. - fivetimeswhile.py: A Python script that uses a
while
loop to print a message five times. - printrandom.py: A Python script that demonstrates the use of the
random
module. - guessTheNumber.py: A Python script that implements a simple number guessing game.
- rockPaperScissors.py: A Python script that implements a simple rock-paper-scissors game.
- helloFunc.py: A Python script that defines a simple function.
- helloFunc2.py: A Python script that demonstrates the use of function arguments.
- magic8Ball.py: A Python script that implements a magic 8-ball game using functions.
- abcdCallStack.py: A Python script that demonstrates the call stack when functions are called.
- otherlocalscopes.py: A Python script that shows how local scopes work in functions.
- readglobal.py: A Python script that demonstrates how global variables can be read from within a function.
- localGlobalSameName.py: A Python script that shows how local and global variables with the same name are treated.
- globalStatement.py: A Python script that demonstrates the use of the
global
statement. - sameNameLocalGlobal.py: A Python script that shows how local and global variables with the same name are treated when the
global
statement is used. - sameNameError.py: A Python script that demonstrates the error that occurs when a local and global variable have the same name and the
global
statement is not used. - zeroDivide.py: A Python script that demonstrates the error that occurs when dividing by zero.
- tryExceptZeroDivide.py: A Python script that uses a
try
andexcept
block to handle the error that occurs when dividing by zero. - zigzag.py: A Python script that implements a zigzag pattern using functions.
- allMyCats1.py: A Python script that demonstrates the use of lists.
- allMyCats2.py: A Python script that demonstrates the use of lists and loops.
- mypets.py: A Python script that demonstrates the use of lists and the
in
operator. - magic8ball2.py: A Python script that implements a magic 8-ball game using lists.
- passingReference.py: A Python script that demonstrates how lists are passed by reference.
- conway.py: A Python script that implements Conway's Game of Life using lists.
- commaCode.py: A Python script that converts a list to a comma-separated string.
- coinFlipStreaks.py: A Python script that simulates coin flips and checks for streaks.
- characterPictureGrid.py: A Python script that rotates a 2D list by 90 degrees.
- birthdays.py: A Python script that stores birthdays in a dictionary.
- characterCount.py: A Python script that counts the occurrences of characters in a string.
- prettyCharacterCount.py: A Python script that pretty-prints the character count.
- ticTacToe1.py: A Python script that implements a simple tic-tac-toe game.
- ticTacToe2.py: A Python script that implements a more advanced tic-tac-toe game.
- ticTacToe3.py: A Python script that implements a tic-tac-toe game with AI.
- guestpicnic.py: A Python script that demonstrates the use of dictionaries.
- chessDictionaryValidator.py: A Python script that validates a dictionary representing a chess board.
- fantasyGameInventory.py: A Python script that manages a player's inventory in a fantasy game.
- fantasyGameInventory2.py: A Python script that adds items to a player's inventory in a fantasy game.
- cutnapping.py: A Python script that demonstrates string concatenation.
- covertLowerCase.py: A Python script that converts a string to lowercase.
- validateInput.py: A Python script that validates user input.
- picnicTable.py: A Python script that prints a table of items.
- Project 1: Multi-Clipboard Automatic Messages: A Python script that implements a multi-clipboard for automatic messages.
- Project 2: Adding Bullets to Wiki Markup: A Python script that adds bullets to wiki markup.
- Project 3: A Short Program: Pig Latin: A Python script that converts English text to Pig Latin.
- Practice Project: Table Printer: A Python script that prints a table from a list of lists.
- Practice Project2: Zombie Dice Bots: A Python script that implements bots for the Zombie Dice game.
- isPhoneNumber.py: A Python script that checks if a string is a phone number.
- isPhoneNumberWithRegex.py: A Python script that checks if a string is a phone number using regular expressions.
- regularExpressionMatching.py: A Python script that demonstrates regular expression matching.
- groupingWithParentheses.py: A Python script that demonstrates grouping with parentheses in regular expressions.
- matchingMultipleGroupsWithThePipe.py: A Python script that demonstrates matching multiple groups with the pipe character.
- optionalMatchingWithTheQuestionMark.py: A Python script that demonstrates optional matching with the question mark.
- matchingZeroOrMoreWithTheStar.py: A Python script that demonstrates matching zero or more with the star.
- matchingOneOrMoreWithThePlus.py: A Python script that demonstrates matching one or more with the plus.
- matchingSpecificRepetitionsWithBrackets.py: A Python script that demonstrates matching specific repetitions with curly brackets.
- greedyNonGreedyMatching.py: A Python script that demonstrates greedy and nongreedy matching.
- findall.py: A Python script that demonstrates the
findall()
method. - characterClasses.py: A Python script that demonstrates character classes.
- makingYourOwnCharacterClasses.py: A Python script that demonstrates making your own character classes.
- caretDollarSignCharacters.py: A Python script that demonstrates the caret and dollar sign characters.
- wildcardCharacter.py: A Python script that demonstrates the wildcard character.
- matchingNewlinesWithDotCharacter.py: A Python script that demonstrates matching newlines with the dot character.
- caseInsensitiveMatching.py: A Python script that demonstrates case-insensitive matching.
- managingComplexRegexes.py: A Python script that demonstrates managing complex regular expressions.
- Project1: Phone Number and Email Address Extractor: A Python script that extracts phone numbers and email addresses from text.
- PracticeProject: Date Detection: A Python script that detects dates in different formats.
- PracticeProject2: Strong Password Detection: A Python script that checks the strength of a password.
- PracticeProject3: Regex Version of strip(): A Python script that implements a regex version of the
strip()
method.
- pyInputPlusModule.py: A Python script that demonstrates the use of the
pyinputplus
module for input validation. - minMaxGreaterThanLessThan.py: A Python script that demonstrates the use of the
min
,max
,greaterThan
, andlessThan
parameters in theinputInt()
function. - blankKeyword.py: A Python script that demonstrates the use of the
blank
keyword argument in theinputStr()
function. - limitTimeoutDefaultKeyword.py: A Python script that demonstrates the use of the
limit
,timeout
, anddefault
keyword arguments in theinputStr()
function. - allowRegexesBlockRegexesKeyword.py: A Python script that demonstrates the use of the
allowRegexes
andblockRegexes
keyword arguments in theinputStr()
function. - inputCustom.py: A Python script that demonstrates the use of custom validation functions with the
inputCustom()
function.
Project1: How to Keep an Idiot Busy for Hours: A Python script that implements a program to keep an idiot busy for hours. - PracticeProject: Multiplication Quiz: A Python script that implements a multiplication quiz program.
- PracticeProject1: Sandwich Maker: A Python script that implements a sandwich maker program.
- PracticeProject2: Write your own multiplication quiz: A Python script that implements a custom multiplication quiz program.
- Project1: Generating Random Quiz Files: A Python script that generates random quiz files.
- Project2: Updatable Multi-Clipboard: A Python script that implements an updatable multi-clipboard.
- PracticeProject1: Extending the Multi-Clipboard: A Python script that extends the multi-clipboard program.
- PracticeProject2: Mad Libs: A Python script that implements a Mad Libs game.
- PracticeProject3: Regex Search: A Python script that searches for a regex pattern in files.
- Project1: Renaming Files with American Style Dates to European-Style Dates: A Python script that renames files with American-style dates to European-style dates.
- Project2: Backing Up a Folder into a ZIP File: A Python script that backs up a folder into a ZIP file.
- PracticeProject1: Selective Copy: A Python script that copies files with a certain extension to a new folder.
- PracticeProject2: Deleting Unneeded Files: A Python script that deletes files with a certain extension and size.
- PracticeProject3: Filling in the Gaps: A Python script that renames files to fill in the gaps in numbering.
- boxPrint.py: A Python script that demonstrates debugging techniques.
- errorExample.py: A Python script that demonstrates error handling.
- traceback.py: A Python script that demonstrates the use of the
traceback
module. - assertion.py: A Python script that demonstrates the use of assertion.
- trafficLight.py: A Python script that demonstrates the use of assertions in a traffic light simulation.
- factorialLog.py: A Python script that demonstrates logging.
- loggingToAFile.py: A Python script that demonstrates logging to a file.
- buggingAddingProgram.py: A Python script that demonstrates debugging a program.
- Project1: Debugging Coin Toss: A Python script that debugs a coin toss program.
- Project1: MapIt: A Python script that opens a map in the browser using an address from the command line or clipboard.
- Project2: Example Program: A Python script that demonstrates web scraping with the Requests and BeautifulSoup modules.
- Project3: Searching Pypi.org with the Requests Module: A Python script that searches PyPI.org for packages.
- Project4: Product Searching on Amazon: A Python script that searches for products on Amazon.]
- Project5: Downloading XKCD Comics: A Python script that downloads XKCD comics.
- PracticeProject1: Command Line Emailer: A Python script that sends emails from the command line.
- PracticeProject2: Image Site Downloader: A Python script that downloads images from a website.
- PracticeProject3: 2048: A Python script that plays the 2048 game.
- PracticeProject4: Link Verification: A Python script that verifies links on a website.
- Chapter Notes
- Project 1: Read Census Excel
- Project 2: Update Producers Price
- PracticeProject1: Multiplication Table Maker
- PracticeProject2: Blank Row Inserter
- PracticeProject3: Spreadsheet Cell Inverter
- PracticeProject4: Text Files to Spreadsheet
- PracticeProject5: Spreadsheet to Text Files
- Chapter Notes
- Project 1: Combine PDFs
- PracticeProject1: Paranoia Text to PDF
- PracticeProject2: Custom Invitations as Word Documents
- PracticeProject3: Brute-Force PDF Password Breaker
- Chapter Notes
- Project 1: Removing the Header from CSV Files
- Project 2: Fetching Current Weather Data
- PracticeProject1: Excel to CSV
- Chapter Notes
- Project 1: Stop Watch
- Project 2: Multithreaded XKCD Downloader
- Project 3: Countdown Program
- PracticeProject1: Prettified Stopwatch
- Chapter Notes
- Project 1: Adding a Logo
- PracticeProject1: Extending and Fixing the Chapter Project
- PracticeProject2: Identifying Photo Folders on the Hard Drive
- PracticeProject3: Custom Seating Cards
This section includes solutions to exercises from the book, organized by chapter.
Contributions are welcome! If you have any additional notes, solutions, or resources to share, please create a pull request.
- Fork the repository.
- Create a new branch (e.g.,
addition
). - Make your changes.
- Submit a pull request.
This repository is licensed under the MIT License. See the LICENSE file for details.