Main Content

Groupsave tickets - 3 or 4 train tickets for the price of 2

Archive - Originally posted on "The Horse's Mouth" - 2010-08-02 08:30:41 - Graham Ellis

First Great Western offer "Groupsave" tickets where 3 or 4 adults can travel for the price of two on most off peak, book at time of travel, services. And children can go along at a pound each. But there's no "Groupsave 5", so if there are five of you, you'll need to buy a Groupsave 4 plus an extra ticket ... and if there are six of you ...

As an exercise during yesterday's course, I wrote a "groupsave calculator" to work out, given a regular fare and group sizes, what you might expect to pay for your party. It's a great illustration of how you can code a series of conditions (and conditions within conditions) into a program. [source].

If you run this program a few times, you'll find some curious anomalies thrown up - that it's cheaper for 3 adults and 2 children that for 2 adults and 2 children, for example (the adults pay the same, 2 or 3, but the children drop from half fare to just a pound each). But then if the adults have a "family railcard", the 2 + 2 may get a better deal there. And is a child allowed to travel on an adult ticket, so buying a 3 + 1? All absurdly complex.


Python is great language for trying out algorithms ... and indeed for then encapsulating those algorithms into more complex programs. The code this article refers to was written on the first day of training for delegates new to programming, so I kept it fairly straightforward. But we could (with suitable data sources) go on to put other factors into the code, such as the fact that you can't use Groupsave to Henley on Thames on Regatta day, or to Reading during the pop festival - but you are allowed on trains that pass through there is you're not changing ...

Me thinks learning Python is easier than learning about train fares!

P.S. - Groupsaves are a well hidden secret, it seems. You have to know to ask for them on many online planners, and ticket vending machines don't sell them (or didn't). Anyone would think that the Train Operating Companies don't really want too many people to buy them!