I have a function that receives a string argument and condition inside this function that checks if this argument is int or float. Although the outcome of this condition is false, the following line is still executed.
I use PyCharm IDE and Python 3.8
Here is the code.
number1 = 17
number2 = 17.1
testStr = "Test string"
def define_type(argument01):
if type(argument01) == str:
print(argument01 + " - string")
if type(argument01) == int or float:
print(str(argument01) + " - int or float")
define_type(testStr)
The output:
Test string - string
Test string - int or float
Process finished with exit code 0