Mar-26-2017, 06:05 PM
I am now getting a new errors and or my code it not working rather!
animalType = input("What sort of animal do have, DOG or CAT? \n>") animalAge = int(input("How old is your "+animalType+" in whole years? \n>")) if animalType.lower() == "dog": #Dog Calculations eHA=0 if animalAge >=1: eHA = 15 if animalAge >=2: eHA += 9 if animalAge >=3: eHA += (animalAge-2)*4 if animalType.lower() == "cat": #Cat Calculations eHA=0 if animalAge >=1: eHA = 12 if animalAge >=2: eHA += 13 if animalAge >=3: eHA += (animalAge-2)*4 while animalType.lower() != "dog" or "cat": print("I don't know what a",animalType,"is, Sorry. Try Again") animalType = input("What sort of animal do have, DOG or CAT?") print("Your animal is...",eHA,"years old") #Exit print("Goodbye") input("Press ENTER to stop the program")This is my output
Output:What sort of animal do have, DOG or CAT?
> rat
How old is your rat in whole years?
> 10
I don't know what a rat is, Sorry. Try Again
What sort of animal do have, DOG or CAT? cat
I don't know what a cat is, Sorry. Try Again
What sort of animal do have, DOG or CAT?
If you dont know whats wrong, my loop - while animalType.lower() != "dog" or "cat": print("I don't know what a",animalType,"is, Sorry. Try Again") animalType = input("What sort of animal do have, DOG or CAT?")is not working as intended. It is ment to check for animals that are not dogs or cats but even when they are dogs or cats its still runs the loop! Please help!!
