Home » Python (page 13)

Python

Python: Find the highest value in a group

In my continued playing around with a How I met your mother data set I needed to find out the last episode that happened in a season so that I could use it in a chart I wanted to plot. I had this CSV file containing each of the episodes:             I started out by ...

Read More »

The Genius of Python’s Self

When I first started learning python and read about how they do class methods, I was a bit thrown off. To be an object-level method (rather than class-level, like Java static methods), the first parameter needed to be self. Technically, you could name it whatever you wanted, but the first parameter was supposed to be assumed to be an object ...

Read More »

Scripting with Python and AutoHotkey

After I began programming, I started noticing that some of the things I was doing on my computer at home were repetitive and could be automated to save time and effort. Unfortunately my first language was C++, which doesn’t exactly lend itself well to that kind of work. I discovered that certain scripting languages could help me fill that need ...

Read More »

Double-Duty Recursive Functions in Python

Functional programming encourages the use of recursive functions in order to tackle bigger problems, allowing you to avoid mutable state and express the problem as small problems. One of the most popular example of recursive functions is the factorial function, which can be written in python as follows:         That’s the old-school approach to recursive functions and ...

Read More »