A variable or Function that can keep track of a turning stepper motor.

Let me start by explaining my project. I'm building a system that would let a bike change gears automatically depending on a gyroscope and the cadence using a stepper motor. I haven't written my code for the moment but I have the general outline and shouldn't have a problem for the most part.

What I'm looking for is something that would tell my code what gear it's currently on. I have two pushbuttons that tell my code the first and last gear and these would be stored as constants.
My motor does 875 steps per gear, with 10 gears gives us 8750 steps for 23mm (the distance that the cable goes ).

I'm doing this for a school project and my teacher doesn't know how to help me. I don't have that much experience here, but I do in coding, and this is my first post, I'm sorry if I forgot to say something.

TLDR: I would need a variable or function that could keep track of what gear the bike is currently on, every increment is 875 steps on my stepper motor.

Thank you kindly

I would need a variable or function that could keep track of what gear the bike is currently on, every increment is 875 steps on my stepper motor.

That sounds simple

Put the bike in its lowest gear
Move the motor 875 steps and you are in the next gear
Move the motor 875 steps and you are in the next gear
Move the motor 875 steps and you are in the next gear
and so on

If you want/need some sort of current gear indicator then increment a counter every 875 steps

Going down the gears is the same thing in reverse