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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!