I am gradually learning Python, using version 3.9.
I want to check if an input() is an INT or FLOAT, i have the following script but whatever i enter the first IF always runs.
i = input("Please enter a value: ") if not isinstance(i, int) or not isinstance(i, float): print("THis is NOT an Integer or FLOAT") elif isinstance(i, int) or isinstance(i, float): print("THis is an Integer or FLOAT") could someone explain what i am doing wrong please
iis always string.input()always returns a string, which is neither an int nor a float. Even if it were an int or a float, you'd always go into the firstifbecausex or yis true if eitherxoryare true.