Or what the heck is a lambda function?

Image credit: Shahadat Rahman at Unsplash

Functions are an extremely common form of code organization, simplification, and clarification in Python. They provide several benefits such as:


How to use enumerate, sorted, zip, and reversed to make your life easier

Having the right tools make any job significantly easier. This is just as true for writing computer programs in Python as it is for creating hardware using your hands. A huge part of learning to write programs in a new language is learning about the tools that are available, so you can use them to make your life, and the live’s of your collaborators, easier.

Fortunately, Python has many of these tools readily available for your use. …


If you thought list comprehensions improved your code, wait until you see this

Image Credit: True Agency on Pexels

One of the biggest challenges that beginning programmers have when learning a new language is figuring out how to make their code more readable.

Since collaboration is a critical part of the modern working world it’s vital that we can ensure that other people can easily understand and make use of our code.

At the same time, beginning programmers are struggling to figure out how to make their code work, and figuring out how to make it user-friendly seems like an added hurdle that you just don’t have time for.

I’ve been there, I get it.

Fortunately, there are any…


List comprehensions dramatically reduce the length and complexity of your code

Image Credit: True Agency on Pexels

One of the biggest challenges that beginning programmers have when learning a new language is figuring out how to make their code more readable. Since collaboration is a critical part of the modern working world it’s vital that we can ensure that other people can easily understand and make use of our code. At the same time, beginning programmers are struggling to figure out how to make their code work, and figuring out how to make it user-friendly seems like an added hurdle that you just don’t have time for.

I’ve been there, I get it.

Fortunately, there are any…


Level up your control flow game with these advanced tricks

In a recent article I introduced the fundamentals of control flow in Python programming to readers. These critical skills instruct your programs on which sections of code to run, giving you the power to perform the calculations that you need to perform for different circumstances.

That said, the techniques listed in the article were quite basic and left some efficiency off the table. It was called the fundamentals of control flow after all.

Since that article only covered the basics, I’ll now introduce you to some useful tricks that improve the speed, flexibility, and readability of your control flow processes…


Learn the fundamentals of making your code do what you want it to do

Python has become a favorite programming language among the scientific and data science communities. The relatively easy to understand syntax, open nature of the community, and availability of many useful packages all make it a very attractive language. This has lead to many people, myself included, wanting to become experts in Python to improve our career opportunities.

In order to write scientific Python scripts, you must know how to have your program make decisions. This leads to the concept of control flow.

What is control flow?

“In computer science, control flow (or flow of control) is the order in which individual statements, instructions or…


Image credit: Elliot Alderson from Pixabay, https://unsplash.com/s/photos/dystopian

Last year was inarguably the best year of my life. Society shutting down finally gave me the opportunity to live my life the way I wanted, away from judgemental eyes. Here are all the bucket list items that I used to enhance my life, all thanks to the pandemic:

Be the hero in a dystopian fantasy

The virus was spreading. Every interaction was a chance at infection. No, Covid-19 isn’t the zombie virus, but I was able to pretend. I finally got the chance to live through a pseudo-zombie-pocalypse. I had to prepare. In case of economic collapse I bought a lifetime supply of toilet paper. To…


An in-depth tutorial in using bokeh to impress your boss and clients

Data science is really all about communication. Those of us who are interested in the subject spend our time learning new numerical methods, learning about how to manipulate data, and learning how to create regressions to draw conclusions from the data set.

But none of that is worth anything if you can’t communicate the results.

This is why I argue that data science is really about communication. The most important part is conveying the conclusions from your data analysis in a way that convinces other people to listen to what you have to say.

Since most people don’t want to…


1000x Faster is Now Available!

The cover of 1000x Faster

Before diving in, I want to make sure I’m being fully straightforward with you. This article is shameless self-promotion. I’ve recently published my book, 1000x Faster: How to Automate Laboratory Data Analysis with Python, and I think you might want to know how it can help your life. If you do, excellent. If you don’t, there’s no need to read on.

What’s the inspiration behind 1000x Faster?

To be honest, I don’t like doing data analysis. You sit at a computer, you open a spreadsheet, you type some calculations and maybe generate some plots, then you move on to the next spreadsheet to do it again…


Or why publishing one article is more profitable than publishing one article

Connecting the dots between your passive income content — Image credit: geralt at Pixabay

Anybody who creates and sells content as a form of passive income what’s to know how to earn more money from the content they create. I’m sure that’s no surprise to you; anybody who invests their time in something wants to have as big of an impact as possible, and make as much profit from it as possible.

Medium is full of articles talking about how we can have that impact by writing more, and more, and more. If we commit to creating new passive income sources every day we get better at creating those products. …

Peter Grant

Pioneering a new research department at Beyond Efficiency. I write about building science, data science, marketing and leadership.

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