i want to continue the loop for asking input(), i use "type(p) is not int" to check the alphabet number, but i get UnboundLocalError when i use "type(p) is not int"
def check(p):
"""
>>> get the value which is non-negative integer and not alphabet
Checking if the input is negative or not.
or repeat asking for input
loop will terminate until positive integer
"""
while p < 0 or type(p) is not int:
p = float(input("Invaild response, please try again:"))
return p
check("4")
check(4)
i want to continue the loop for asking input(), i use "type(p) is not int" to check the alphabet number, but i get UnboundLocalError when i use "type(p) is not int"