Answer:
Follows are the program code to this question:
def check():#defining a method check
while(True):#defining a while loop that uses for the input value
x=input("Enter value to check valid or not: ")#print message
if x=='':#use if block that check input is null
break#use break keyword for exit
else:#defining else block
try:#use try block
x=float(x)#use x vaiable to convert value into float
print("valid number")#print message
except:#use except block
print("not valid number")#print message
continue#use continue keyword
check()#call ing method
Output:
please find the attachment.
Step-by-step explanation:
In the above-given program, a method "check" is defined, and inside the method, a while loop is used to input the value in the "x" variable.
In the next step, a conditional statement is used in the if block, it checks if x value is equal to null it will use break keyword to exit the program.
In the else block x variable is used, that converts the integer value into float and uses the try and except for check the given value and print the message respectively.