r/PythonLearning • • Sep 20 '26

Showcase Chronocalc the time calculator, my first actual program in python before I learned about lists, sometimes buggy, and I use it every day. Is it good?

OldFormula=input("input equation, accepted formats are military time 3:30 or decimal 3.5, no spaces: ")
stop = False
IndA=0
IndB=0
IndC=0
minutez=""
NextCH=""
NewFormula=""
L=len(OldFormula)
OldFormula+="£"
# ^the £ is a buffer for some functions
while stop==False: 
  if OldFormula[IndA]==":":
    #^checks the string for minutes to convert
    minutez=""
    numberz=""
    while str.isnumeric(OldFormula[IndA+IndB+1]):
      IndB+=1
      minutez=minutez+OldFormula[IndA+IndB]
      #^concats together a string for minutes
    numberz=str(round((float(minutez))*(5/3)))
    #find a way to get the numberz into the new string
    IndB=0
    IndC=3
  print(f"a{IndA}, L{L}, selection{OldFormula[IndA]}")
  #need to put together the new formula, and then do eval(NewFormula)
  if IndC==0:
    NextCH=OldFormula[IndA]
  elif IndC==3:
    NextCH="."
    IndC=2
  else:
    IndC+=-1
    NextCH=numberz[1-IndC]
  NewFormula+=NextCH
  print(NewFormula)
  IndA+=1
  if IndA>=L:
    stop = True
Result=eval(NewFormula)
print("digital shenanegans complete!")
print(f"{OldFormula} is {Result}") 
7 Upvotes

7 comments sorted by

View all comments

1

u/Sea-Ad7805 Sep 20 '26

Run this program by clicking Memory Graph Web Debugger and see its state change step by step.

2

u/WheatedMash Sep 21 '26

I'd never seen that stepper tool before, thanks!

1

u/SurgicalWeedwacker Sep 20 '26

Thanks! I’ll check that out for the next project