Review: Built-In Functions


#1


https://www.codecademy.com/courses/python-beginner-c7VZg/4/3?curriculum_id=4f89dab3d788890003000096#


My program works correctly if I just follow the instructions but I want to test other scenario as given below


what if argument s was indeed an integer or float. How can I test that; right now program is only testing the scenario when s is neither int nor float.


def distance_from_zero(s):
    if type(s)== int or type(s)== float:
        return abs(s)
    else:
        return "Nope"


#2

I don't quite understand your question :smile:

Right now your if statement is checking whether s is an integer or a float.

Not,


#3

To check for both scenarios use this operator !=