A quick introduction to unit testing in Python

Photo by Joshua Woroniecki on Unsplash

It is a truth universally acknowledged that it’s best to find bugs in your program before your users do.

As the old programming joke goes: a programmer walks into a bar and orders a beer. 99 beers. 0.999999 beers. Orders 0 beers. Orders an iguana.

Then a customer enters and asks where the bathroom is — and the whole bar bursts into flames.

via Giphy and tenor.com

Sure, your code runs when a user enters any number — but what if they enter a string of meaningless letters? A random symbol? Nothing…


Photo by C D-X on Unsplash

*Cracks knuckles* It’s time to talk coding podcasts.

Coding podcasts are like personal, portable gurus. Some demystify coding concepts — how to build an app using React, what the hell vanilla JS is, what it means to be an “ethical hacker”.

Others lay out career paths — what it’s like working front-end vs back-end, whether to take a coding bootcamp or get a computer science degree, etc. And some will point you in the direction of resources you wouldn’t otherwise know about.

Most importantly, they all help show you that you’re not alone in learning to code.

And listen —…


Photo by Cookie the Pom on Unsplash

You’ve done it, you magnificent bastard. You’ve taken the leap. Bitten that bullet. Taken the advice of nearly all tech Twitter.

You, you glorious creature, have started learning JavaScript.

Now it’s time to level up your code.

This article outlines three style tips to use to write cleaner, more concise JavaScript. Neater code is easier to read (and therefore debug). Taking the time to learn these tips will help save time later on.

Let’s get started.

1. Use arrow function expressions

via Giphy and AllWriteByMe

If you’re reading this, odds are you’ve already encountered JavaScript functions. They look something like this:

function myFunction(parameter) {
statement…


A quick, caffeinated tutorial

Photo by Naufal Giffari on Unsplash

Okay, you’re probably wondering — why Starbucks orders? Why not use normal things to explain classes? Alarm clocks? Cars? Bank accounts? Literally anything else?

Well, they say write about what you know — and I’m a millennial with a coffee addiction. So Starbucks it is, friends.

In this article, we’re going to create Python objects (*ahem* ridiculous Starbucks orders) using classes. We’ll explore classes in the context of object-oriented programming — but focus mostly on classes. (And coffee too, of course.)

Let’s go over some of the basics of object-oriented programming.

Okay, what’s object-oriented programming?

If you’re a new coder…


“Heaven truly knows that thou art false as hell”

Photo by Esther Wechsler on Unsplash

It’s Monday night, which can mean only one thing: it’s time to write a Shakespearean insult generator in Python.

(I’m very cool.)

Let’s face it. If rap battles had existed in his time, the bard would have blown away the competition. From the vicious (“Thou art a boil; a plague sore” (King Lear)), to the scornful (“Thine face is not worth sunburning” (Henry V)), to the downright scandalous: (“Villain, I have done thy mother” (Titus Andronicus)), Shakespeare’s insults were ruthless, devastating, and, frankly, pretty weird.

In this article, we’ll design and…


A tutorial for new coders

Photo by Markus Winkler on Unsplash

From the Urban Outfitter’s website to the mobile menu at Chipotle, Boolean logic is, well, everywhere.

If you’ve ever shopped online, or performed a Google search, odds are that you’ve used Boolean logic, and already know how to use some of its operators. This is a quick tutorial to sharpen your coding skills using Booleans and comparison operators.

What’s Boolean logic?

In coding, Boolean logic boils down to the idea that every statement is either ‘True’ or ‘False’.

We use Boolean operators — symbols you might recognize from algebra class — to pose questions in the form of…


A guide for new coders

Photo by Nick Fewings on Unsplash

If you know how to use a regular dictionary, you know how to use a Python dictionary. (Well, sort of.)

In a regular dictionary, you look up a word to find its definition. In a Python dictionary, you look up a “key” (a word) to find its associated “value” (its definition). Together, we call these “key-value pairs”.

So what’s a Python dictionary?

A Python dictionary is essentially a collection of data (i.e., key-value pairs) organized in an associative array.

Dictionaries can store all kinds of information — from numbers and strings to lists and sets (and even other dictionaries). …


Myth 3. “Coding isn’t social.”

Photo by Marvin Meyer on Unsplash

Myth 1: “Coding isn’t creative.”

Before I started coding, I always imagined that a day in the life of a programmer must be unbearably dull. The idea of working with algorithms sounded like actual torture. Math class? The bane of my existence. And the idea of computer programming — managing algorithms all day, typing data into a cold, bright screen — was my personal idea of hell.

Good news for all you humanities nerds and creative brained friends— we’ve been lied to.

via Giphy @isluhart

Just like writing isn’t just grammar, coding isn’t just algorithms. It’s also problem solving, design…


Spoiler: you don’t have to wake up at 4am

Photo by Christin Hume on Unsplash

Going to college is challenging even under the best circumstances. So is working 40 hours a week. If you work full-time, first of all — you’re doing great. Go team. You’re already kicking ass and taking names. If you’re working full-time and taking classes… my thoughts and prayers are with you.

I’m a full-time librarian, a computer science major, and, until last year, was a grad student getting my Masters in Library Science. I’ve been pursuing a degree in one form or another for the past five years — two years…


A beginner’s guide to formatting string literals

Photo by JESHOOTS.COM on Unsplash

Sure, sex is cool, but have you ever written efficient code that worked on the first try? F-strings are a great tool for writing clean, concise code. If you’re new to Python, or just looking for a quick refresher to clean up your code, save yourself some time and learn about f-strings.

What’s an f-string?

An f-string is a type of formatted Python string literal. It’s easily the most user-friendly Python feature I’ve encountered, and was a great confidence booster as a new programmer.

Here’s the basic format of an f-string:

print(f “[string] {placeholder1} {placeholder2}”)

It…

Ayla Yersel

Humanities nerd learning to code • She / her • lady-codes.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store