Dane Saltzman wrote: > I'm new to python and I was wondering if you could tell me how I would: > > first, define a function,distance_from_zero, with one parameter (choose > any parameter name you like). Second, have that function do the following: > 1. Check the type of the input it receives. > > 2. If the type is int or float, the function should return the absolute > value of the function input. > > 3. If the type is any other type, the function should return "This isn't > an integer or a float!"
I'm assuming that the subject line is a hint from your professor where you should look for functions that (a) check if a value is of a particular type (b) calculate an absolute value I suggest that you scan the table at http://docs.python.org/library/functions.html for candidates and try to come up with a suggestion for the implementation of distance_from_zero() yourself. Come back with the code you have if you run into problems. We will be glad to help you fix them. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor