Python, my first program
I picked up Python and build my first program in 2018. An online tutorial called Learn Python the Hard Way led the way. This contained 40 or so exercises about programming basics. Below you will find different short projects I have made in python. Some have real world applicability, others are just learning projects.
Python Console Projects
These console projects were inspired by working through "Automate the Boring Stuff with Python" by Al Sweitgart
Project | Description | Code |
---|---|---|
collatzSequence.py | Simple collatz sequence program. Enter an integer as input
Program will then output integers based on odd or even
If odd, the output is 3 * (odd number) + 1
If even, the output is (even number) // 2
This output will continue until the program reaches the integer: 1 |
Source Code |
xkcdWebScraper.py | XKCD web scraper will use multithreading to download 2200 XKCD comics using 22 threads
Saves all comic pages to the local directory.
uses modules: requests, os, bs4, threading |
Source Code |
logifyApp.py | logifyApp requires a logo.png image in the working director
Add images to the working directory to be modified to the existing image
Suggest using image copies into the working directory to avoid original image loss
logo.png is added to the lower right corner
Uses PIL module |
Source Code |
countdownAudio.py | Simple countdown program asks an integer from the user. The program counts down from integer and then plays
"finalCountdown.WAV" within python using the pyaudio module. Requires separate download of
finalCountdown.WAV for full functionality. Obviously changing audio file in local path will allow other .WAV files to play
after countdown
Uses time, subprocess, playsound, wave, pyaudio |
Source Code |
duesApp.py | duesApp takes data from the duesRecords excel file. Parces out which cells are 'unpaid' and then sends an email
notifying the name of the date/cell where there is a payment due. Requires user input of email and password.
App is scalable to the excel workbook
Uses Modules: openpyxl, smtplib, sys, datetime includes commented out code from failed attempts |
Source Code |
guessMyNumber.py | Simple guess my number game. Contains an troubleshooting number input: "99"
Minor ascii interface for a more interactive experience
Also, a little Beyonce thrown in too |
Source Code |
invitationCreator.py | invitationCreator will create individual invitations into a single Word document. Pulls names from the
"names.txt" file and then imports that data into a new word document page. In this instance 20 names will create 20 separate
invitations with a png picture. Download all assets to run the program without errors
Uses the docx module |
Source Code |
multiplicationTableCreator.py | multiplicationTableCreator creates a new excel workbook with the multiplication table set by the argv value
For example:
python multiplicationTableCreator.py 10
# user enters input for new file name
# creates an excel document with the new file name containing a 10 by 10 multiplication table
Uses modules: import sys, openpyxl |
Source Code |
pwLocker.py | This is an unsecure python script designed to take passwords from code and copy that password to
the clipboard. Reccomend securing the program before entering any sensitie information for automation
Uses the following modules:
sys
pyperclip
When running the program, enter the type of password you want to copy
For example: python pwLocker.py email # this will copy: "pw_for_email" # to the clipboard |
Source Code |
pwValidation.py | Python password authentication function
Password entered must meet the following parameters:
8 chars long
one uppercase char
one digit
one special char (!, ?, #, @. %)
Prints validation requirements if any requirement is missing
Program uses regex for validation |
Source Code |
songQuizGenerator.py | Song quiz generator will generate 5 different quizzes based on matching the song with the artist with 50 different multiple choice questions and save them as a songQuiz#.txt file and the number will increment with each quiz | Source Code |
justTextMeSomeWeather.py | justTextMeSomeWeather uses Twilio and requires a twilio accountSID, authToken and OpenWeatherMan API key to
function properly. Input Twilio and openweatherman api data and then use sys argv with your desired zip code
for example:
python justTextMeSomeWeather.py 72653
# follow user inputs for which phone number to send to
# sends weather data to the desired phone number
uses the following modules: json, requests, sys, time, math |
Source Code |
toDoList.py | Simple to do list program.
Program asks the user for a task, appends the task to a list and will keep asking until the user enters "done" Prints the list to the console upon completion |
Source Code |
weatherAPI.py | WeatherAPI requires an API key from openweathermap for full functionality (obviously not provided for Git Publishing)
Contains wind direction function, formats degrees to cardinal direction
Uses sys argv for city location, for example:
python weatherAPI.py 93446
#will pull weather data for the Northern San Luis Obispo County
Uses modules: json, requests, sys, time, math |
Source Code |
zipBackUp.py | zipBackUp program will take user input to identify the file to backup and then create a new compressed file into a new backup folder
First verifies if there is an existing backup folder from local directory
Then asks for the filename in local directory
Increments filename if more than one backup copy has been made (for larger projects) in local directory
Saves zipfile to local directory backup folder
uses the following modules: zipfile, os, shutil, pathlib |
Source Code |
Older Python Game Programs
Game | Description | Github |
---|---|---|
gridGame.py | Source code for an incomplete grid based game. Based on
"Tile-Based Game" by KidsCanCode YouTube Chanel.
Two years ago I was very happy to get this working. |
Source Code |
ticTacToe.py | ticTacToe game ran in console. Inspired by "Invent Your Own Computer Games with Python" by Al Sweitgart | Source Code |
bagel.py | bagel game ran in console. Inspired by "Invent Your Own Computer Games with Python" by Al Sweitgart | Source Code |