I'm learning Python, and I wrote a simple script that creates a list of tasks I need to do today. After putting an input on the task to be done, I have the script ask how long it will take to do that task. It would work in adding the float to a variable called "totaltime" but if you entered a word, it would crash, so I created an if else statement looking for if the user entered an integer and float and if they didn't, have them repeat the process. For some reason when I run it, it can't see if the input is a float or integer, it just moves on the else statement and repeats it. Please help! I've been scouring the internet and can't find a solution. I added the issue part of the script so that's its easier to read (and the totaltime variable)
totaltime = float()
while True:
print("How long will this task take?")
new_time = input("> ")
if new_time == int or new_time == float:
totaltime = float(totaltime) + float(new_time)
break
else:
print("You must enter a valid number, written as (H.M).")