Python: Code help
I'm trying to make sure that "getFloat" checks to make sure that a positive value in entered. I tried putting the while loop that is in the code now inside of another while loop that checked for a value>0, but it was ignored. Here is the entire code: #This is meant to be a simple pace converter for a run/bike activity. #good practice with def, while, and try/except #defining funtion to get a number and error-check it def getFloat(Prompt): while True: try: number=float(input(Prompt)) return number except ValueError: print("\nPlease enter a number.") #Getting inputs from user using "getFloat" distance = getFloat("How many miles were you active? ") hours = getFloat("How many hours were you active? ") minutes = getFloat("How many minutes were you active? ") #calculations begin here totalmin=minutes+(60*hours) x=int(totalmin//distance) #^made to integer for easier reading in output below y=(totalmin/distance)%1 #^removes the value of "x" and leaves only the remainder y*=60 #^multiplying remainder by seconds in a minute y=round(y,2) #^cleaning up output by rounding to two decimal places #output of the answer print("\nYour pace was",x,":",y,"minutes/mile")