Practicing Python | Think Python: Case study: interface design – Exercise 4.3

Make a more general version of circle called arc that takes an additional parameter
angle, which determines what fraction of a circle to draw

Python 4 Beginners: how to generate a list of random values

I recently just learned how to do this without using loops: import random x = [0 for _ in range(10)] #underscore used when you do not need the value from the list. So here 0 replaces the value from range(10) #expected output [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] y = [random.random() […]

Python: Matplotlib – How to use csv and subplots for beginners

So how do I use subplots? 08/26/2018 The code below is custom to my csv file (see below), so make sure you either use the same format or change the “get_file” function to the properly process your file. MOCK_DATA_2 File Content The file above looks like this: x,y 64,13 57,14 16,30 92,29 65,97 11,33 CODE […]

python: Creating a simple bar plot with python, matplotlib module and csv data 2020

This is so simple, it needs no heading.. 08/19/201810:10:49 PM Drinks Coffee as usual… Straight to the point: So this is the CSV data I will be working with ( generated using the website: https://mockaroo.com) MOCK_DATA Goal Create a bar plot showing  the number of emails based on the alphabets they begin with . For instance, […]

Automating Simple Tasks with Python: Using Python and Window Task Scheduler to get the word of the day

❝Learning is a treasure that will follow its owner everywhere.❞‒Chinese Proverb So I want to learn one english word per day, but I am too lazy and forgetful to visit the website ? Hmm…. bulb floats on head Let us create a python script, that runs daily by the Windows Task Scheduler 12:16:00 AM Coffee break… […]

How Python helps outside of work: ods data to excel

I hate copying and pasting, so might as well automate it 9:43:24 PM Trying to complete my research paper.. … If you have any question, do ask in the comment section. See you! This allows for transforming my .ods file to .xlsx //Note –> You will have to tweak this to your needs. This is […]

Lexpression Web application | Day (can’t remember) : Deployment

Lexpression Web App  simplifying language learning… 11:17:20 AM finally can sleep Apologies for not documenting the development process daily, however, if you follow my Youtube channel, you should have seen the coding videos. So yea, the website /web application is deployed and it looks good, like functionally good.Not sure about the basic design. The web […]

Python Learning: Automate Boring Stuff with Python | Chapter 14: Excel-to-CSV Converter

And where I excel is ridiculous, sickening, work ethic. You know, while the other guy’s sleeping? I’m working. Will Smith I like will smith!! 12:50:11 AM   This task was unexpectedly difficult for me, so I am not sure if it is correct # USAGE python excel_2_csv.py import openpyxl import os import sys import logging import […]

Python Learning: Automate Boring Stuff with Python | Chapter 13: Brute-Force PDF Password Breaker

“I can stand brute force, but brute reason is quite unbearable. There is something unfair about it’s use. It is hitting below the intellect.” ― Oscar Wilde, The Picture of Dorian Gray I don’t get it.. 11:20:21 PM # USAGE python brute_force.py import PyPDF2 import os import sys import logging logging.basicConfig(level=logging.DEBUG, format=”%(asctime)s – %(levelname)s – %(message)s”) […]

Python Learning: Automate Boring Stuff with Python | Chapter 13: Custom Invitations as Word Documents

“Nothing annoys people so much as not receiving invitations.” ― Oscar Wilde, The Importance of Being Earnest I know that feeling…humph.. 10:36:20 PM   # usage python invitation.py <textFile> import docx import os import sys import logging from docx.enum.text import WD_ALIGN_PARAGRAPH logging.basicConfig(level=logging.DEBUG, format=”%(asctime)s – %(levelname)s – %(message)s”) if len(sys.argv) == 2: # TODO: GET TEXT FILE […]

Python Learning: Automate Boring Stuff with Python | Chapter 13: PDF Paranoia

“Paranoid? Probably. But just because you’re paranoid doesn’t mean there isn’t an invisible demon about to eat your face.” scary… 9:13:00 PM my solution # usage pdf_paranoia_encrypt.py import PyPDF2 import os import sys import logging logging.basicConfig(level=logging.DEBUG, format=”%(asctime)s – %(levelname)s – %(message)s”) # TODO: GET PASSWORD FROM COMMAND LINE if len(sys.argv) == 2: # TODO: OS WALK […]

Python Learning: Automate Boring Stuff with Python | Chapter 12: Spreadsheet to Text Files

Chapter 12 done!!! Finally Now I can sleep.. for 10 minutes though.. 3:42:14 AM Suggestions are welcomed. # USAGE python sheet2text.py import logging import sys import os import openpyxl logging.basicConfig(level=logging.DEBUG, format=”%(asctime)s – %(levelname)s – %(message)s”) if len(sys.argv) == 2: # TODO: EXTRACTS EXCEL FILE excelfile = sys.argv[1] excelfile = os.path.abspath(excelfile) excelfile_name = os.path.basename(excelfile).split(“.”)[0] if not os.path.exists(excelfile): […]

Python Learning: Automate Boring Stuff with Python | Chapter 12: Text Files to Spreadsheet

1 hour laturr….. I need coffee but if I drink coffee, I will go to sleep… drinks green tea instead 3:18:41 AM Code # USAGE python text2sheet import logging import sys import os import openpyxl logging.basicConfig(level=logging.DEBUG, format=”%(asctime)s – %(levelname)s – %(message)s”) if len(sys.argv) > 1: # TODO: EXTRACT TEXT FILES files = sys.argv[1:] # TODO:CREATE NEW WORKBOOK […]

Python Learning: Automate Boring Stuff with Python | Chapter 12: Spreadsheet cell Inverter 2020

This isn’t too bad …right ? Not too tired but would rather be sleeping now. Unfortunately I have to finish this chapter before Sunday.. sighs deeply 2:53:05 AM     # USAGE python sheetinverter.py import logging import openpyxl import os import sys logging.basicConfig(level=logging.DEBUG, format=”%(asctime)s – %(levelname)s – %(message)s”) if len(sys.argv) == 2: # TODO: EXTRACT WB wb […]

Lxpression Web application | Day 1 Part II: Basic Planning

The day is not over, so I decided to keep planning on the web application. I thought of a feature to add – Search Autocomplete. Yes I know, keep it simple. I promise, I would not add any other feature before the first publishing okay!. Now let us talk about what we should see in […]

“Python Learning: Automate Boring Stuff with Python | Chapter 11 : My Solution to Link Verification (with a twist)

Instead of downloading the pages, let’s just write the links out 4:40:41 PM In the last task we downloaded images directly to our machine into a folder in the current working directory. Since I am well acquainted with downloading files using requests, I decided to just write out the links into a text file instead […]

“Python Learning: Automate Boring Stuff with Python | Chapter 11 : My Solution to Image Downloader from Imgur

So you want to download images without a browser..  challenge accepted 3:43:41 PM   #Image Site Downloader #USAGE: python igmurdownloader.py <category> <limit> import sys, requests, os, logging, bs4, re logging.basicConfig(level=logging.DEBUG, format="%(asctime)s – %(levelname)s – %(message)s") logging.disable(logging.CRITICAL) if len(sys.argv) == 3: logging.info("Command line argument 3") #TODO: get category, and limit category = sys.argv[1] limit = sys.argv[2] imgur […]

“Python Learning: Automate Boring Stuff with Python | Chapter 8 : My Solution to Practice Project: Filling in the Gaps

How to fill in the gaps 1:49:09 AM I need help with this! I like this exercise but I cannot seem to find its ideal solution. Could someone suggest in pseudocode, please..? # finds files with a give prefix in a folder # locates any gaps in the numbering # renames all the later files to […]

Python Learning: Automate Boring Stuff with Python | Chapter 8 : My Solution to Practice Project: Deleting Unneeded Files

Personally, one of the simplest projects yet This code (when properly indented) helps to list out all files with a size greater than the given limit.   # Usage python big.py limit in MB import sys import os if len(sys.argv) >= 2: limit = sys.argv[1] if len(sys.argv) == 3: source = sys.argv[2] else: source = […]

Python Learning: Automate Boring Stuff with Python | Chapter 8 : My Solution to Practice Project: Selective Copy

As usual… super simple automation.. I know it is quite trivial, but the fact that with a few lines of code I could re-organize my files based on their extensions makes coding really fun even outside of work. Code # selective copy # walks through a folder tree and searches for files with a certain […]