Computer Studies‎ > ‎Python‎ > ‎Video Tutorials‎ > ‎

04 - Modules and Functions

Watch the following video, and do the examples shown in the video as they are demonstrated.


Assignment

Write a program that prompts for 2 numbers a and b then outputs a to the power b using the pow() function.

Save as "04_Function.py".

Assignment

Write a program that redefines the sqrt() function as "beens" then uses the beens function to output the square root of 1E6.

Save as "04_Function_2.py".

Assignment

Visit Math Functions in Python to investigate the function used to convert degrees to radians, then write a program that converts 360 degrees (the number of degrees in a circle) to radians.

Save as "04_Function_3.py".

Some examples from the video

pow(5,4)
abs(-18)
import math
math.floor(18.7)
math.sqrt(81)
bucky = math.sqrt
bucky(10.4)


Comments