I want to do a while loop which ask user to enter value until the value is a float value between 0 and 1
Current code is
while True:
seuil =input("Please enter a threshold between 0 and 1 (e.g 0.7):")
try:
seuil = float(seuil)
except ValueError as e:
print("Enter numeric value")
if (seuil <0 or seuil >1):
raise ValueError('Please enter value between 0 and 1')
else:
break
Problems:
if value is not between 0 and 1 I have an error message but the code doesnt ask again to user to enter a value
if value is a string then got following error message
TypeError: '<' not supported between instances of 'str' and 'int'
any help appreciated