[Tutor] Built in functions

Dane Saltzman dane at saltzman.net
Sun Aug 5 00:41:24 CEST 2012


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!"

---DJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120804/60eedf8b/attachment.html>


More information about the Tutor mailing list