CSCA08H3 Lecture 4: CSC108 - Week 4 Notes

152 views5 pages
1 Mar 2016
School
Course
Professor

Document Summary

Most python functions are saved into different modules (not available as built-in) and you have to tell python that you want to use them. You can save your own functions into modules: module: a le containing function de nitions and other statements, for example, there is a math module in python that contains math-related functions (like square root, or sqrt(number)). Import math tells python that you want to access the module. It creates a variable called math that refers to the module object that contains the various math functions. Dir(math) lists all of the functions associated with math. One of them is sqrt(): however, we need to specify that it is from the math module. Method: a function inside of an object. We can produce new strings based on old strings using str methods: eg. if we type white_rabbit = i"m late! The method lower() created a new string based on the original string.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents