I'm trying to write a mathematical notation for the following logic
total = 0
Co = 10
for element in elementlist:
if element contains A:
Ci = A
elif element contains B:
Ci = B
else:
Ci = Po
total += Co - Ci
Here is what I have come up with but I'd like some extra eyes.
Thanks so much!
total += Co - Ci
sums $n+1$ instances of $C_0$ (once for each time through the loop) and subtracts some values that happen to occur in one of the three lists. If that's not what you're after then you will have to explain it a bit more - I can't. $\endgroup$Co
is the End Time (for example right now).Ci
is the Start Time. If the element containsA
then useA
asCi
otherwiseB
etc. Once you determineCi
addCo-Ci
to the total. In english take the end time - start time and add it to the total time $\endgroup$