Question: number = raw_input(Please enter a number) Number = True try: valid = float(number) Number = False print(This is valid) except: Number = True print(This is
number = raw_input("Please enter a number")
Number = True
try: valid = float(number) Number = False print("This is valid")
except: Number = True print("This is a invalid response")
This is my code I'm trying to check for wrong data types I only want floats taken as inputs and integers and strings to get denied this is my code so far in python.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
