I am trying to create a program that stores a user input between 1 and 0.
It works fine when I only input numbers, however, the program fails when anything else is inputted.
I tried adding a third clause into the while statement but that made the whole program fail.
I suspect float(input)
is the erroneous code -- When I don't have that, the sums later on in the program fail, suggesting that the variable is just a string.
What's wrong here?
# Juvenile survival rate must be between 0 and 1 #
juvenile_survival = 3
while juvenile_survival < 0 or juvenile_survival > 1 or juvenile_survival.isdigit() == False:
juvenile_survival = float(input("What is your juvenile survival rate? Remember this should be between 0 and 1"))
print("Your juvenile survival rate is ", juvenile_survival)