# Binary Search Algorithm

No BS: It is important to try and implement known ‘easy’ algorithms as it provides practice on working towards trickier algorithms, as well as translating human instructions into a usable program. With BS: Working through Exercise 20 of practicepython.org, you are tasked to implement the Binary Search Algorithm for a sorted list of numerical integers, […]

# Read the Client Specification, No, Really…

No BS: Make sure you read the client specification properly and clearly. Otherwise you will end up attempting to deliver something that they didn’t even ask for, and ultimately, wasting your time.   With BS: So while attempting Exercise 18from https://www.practicepython.org, I ran into a bit of a dilemma. What I should have done was […]

# Guessing Game

So as part of the exercises I was following from https://www.practicepython.org/ one of the exercises was to create a guessing game: Generate a random number Ask the user to guess the number and print Tell them whether they guessed to high or low Keep a track of how many guesses they had and tell them […]

# Basic Exceptions

No BS: using a ‘while True’ loop and a ‘continue’ line in an exception is good because it gives the user another go at an input (if that’s what it was used for) without having to go through the whole program again.   With BS: So I just put together a quick program to check […]

# re.findall()

No BS: re.findall(pattern, string) is a powerful tool that will find all matches of a particular pattern in a string. This could be used to produce a list of email addresses, IP addresses, post codes. An example would be s = ‘alice.goodall@google.com lorem ipsum neil.blompkamp@AOL.com adipiscing elit. Vestibulum jennifer@yahoo-net.com’ emails = re.findall(r'[\w_.-]+@[\w_.-]+’,s)   With BS: […]

# Word/Count Dict (Part 2)

No BS: Previous code didn’t strip out punctuation and left us with weird duplicates of words. For example, “the”, “the–“, and “(the” would all be considered separate words. I added a piece of code to strip out the punctuation which was: out = s.translate(str.maketrans(”, ”, string.punctuation)) I then sorted the words based on the output […]

Read more "Word/Count Dict (Part 2)"

# Schiit Audio Modi 2 DAC – Power Issues

No BS: My modi DAC wouldn’t power on, turns out one of the solder joints failed. Reflowing this joint fixed it.     With BS: My Modi DAC failed to power on one day and I had tried a number of different tests to see what it was. I tried a different wall wart (AKA […]

Read more "Schiit Audio Modi 2 DAC – Power Issues"

# Word/Count Dict (Part 1)

No BS: Given a .txt file, count the appearance of each word (ignoring case) and do either: Print a full list sorted by alphabetical order. Print a list of the top 20 most common words. Taken from Google’s Python class: https://developers.google.com/edu/python/dict-files (bottom of the page). Once I’ve figured out how to display code snippets correctly […]

Read more "Word/Count Dict (Part 1)"

# NO BS

For reference, I’m not keen on articles and journals and videos that take 10 minutes to get to the punchline or fact that they roped you in for. I’ll preface pretty much all of my posts with a TLDR, and then if you want to read more I’ll post that underneath.   I’ve always fantasized […]