Furman University



#File: myFunctions.py # Purpose: two programmer-defined functionsdef cube( y ): return y * y * ydef doubleIt ( z ): return 2 * z# Purpose: Example: importing programmer-defined functions# from its own module file# IMPORTANT: myFunctions.py should be in the same folder as this fileimport myFunctionsprint ("1 to 5 cubed")for x in range(1,6): print (myFunctions.cube(x),)print()print()print ("1 to 5 doubled" )for x in range(1,6): print (myFunctions.doubleIt(x),)1 to 5 cubed1827641251 to 5 doubled246810Importing User Defined Functions ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download