value = "3.14" # A floating-point number try: float_value = float(value) integer_value = int(float_value) except ValueError: # Handle the case where the string cannot be converted integer_value = None