i have attention deficit disorder explain this properly to me so i understand deeply- " this REPEATING CODE: DEFINITE LOOPS
Computers shine when we have them repeat a process over and over.
They tirelessly do exactly what we ask, whether it involves doing
something 10, 100, or a billion times. In this chapter, we’ll learn about
loops, statements that instruct the computer to repeat the execution of
part of our program.
We’ll use loops to solve three problems: tracking the location of a
ball under a cup, counting the number of occupied parking spaces, and
determining how much data is available on a cell phone plan.
Problem #5: Three Cups
In this problem, we’ll track the location of a ball under a cup as the
cups move. But the cups can move many times, so we won’t be able to
write code for each move separately. Instead, we’ll learn about and use
the for loop, which allows us to more easily run code for each move.
This is DMOJ problem coci06c5p1.
The Challenge
Borko has a row of three opaque cups: one at the left (location 1), one at
the middle (location 2), and one at the right (location 3). There is a ball
under the cup at the left. It’s our job to keep track of the location of the
ball as Borko swaps the locations of the cups.
Borko can make three types of swap:
A Swap the left and middle cups
B Swap the middle and right cups
C Swap the left and right cups
For example, if Borko’s first swap is type A, then he swaps the left
and middle cups; because the ball starts at the left, this swap moves it to
the middle. If instead his first swap is type B, then he swaps the middle
and right cups; the left cup stays where it is, so the ball doesn’t change
locations.
Input
The input is one line of at most 50 characters. Each character specifies a
type of swap that Borko makes: A, B, or C.
Output
Output the final location of the ball:
1 if the ball is at the left
2 if the ball is at the middle
3 if the ball is at the right

Why Loops?
Consider this test case:
ACBA
There are four swaps here. To determine the final location of the
ball, we need to carry out each one.
The first swap is type A, which swaps the cups at the left and middle.
Since the ball starts at the left, this results in the ball moving to the
middle. The second swap is type C, which swaps the cups at the left and
right. Since the ball is currently at the middle, this has no effect on the
location of the ball. The third swap is type B, which swaps the cups at
the middle and right. This moves the ball from the middle to the right.
The fourth swap is type A, which swaps the cups at the left and middle.
This has no effect on the ball. The correct output is therefore 3, because
the ball ends up at the right.
Notice that for each swap, we have to make a decision to determine
whether the ball moves and, if it does, to move the ball appropriately.
Making decisions is something we know how to do from Chapter 2. For
example, if the swap type is A and the ball is at the left, then the ball
moves to the middle. That looks like this:
if swap_type == 'A' and ball_location == 1:
ball_location = 2
We could add an elif for each other case where the ball moves: swap
type A and ball is at the middle, swap type B and ball is at the middle,
swap type B and ball is at the right, and so on. This big if statement
would be enough to handle one swap. But that’s not enough to solve the
Three Cups problem, because we could have a test case of up to 50
swaps. We’d need to repeat the if statement logic for each swap. And we
certainly wouldn’t want to copy and paste the same code 50 times.
Imagine if you had made a typo and had to fix it 50 times. Or if you
suddenly became interested in test cases with up to a million swaps. No,
what we have learned so far is not going to cut it. We need a way to
walk through the swaps, performing the same logic for each one. We
need a loop"