CS 1301 Chapter 12: Modules

46 views2 pages

Document Summary

Module- file containing python definitions and statements intended for use in other python programs. Standard modules: random, randrange- generates integer between lower and upper argument, range- lower bound included, upper bound excluded. Deterministic- random number generators are based on this algorithm; repeatable and predictable. Pseudo random- not genuinely random; start with seed value. 12. 2 time module: time- clock function; returns floating point number representing how many seconds have elapsed since your program started running. 12. 3 math module: math- contains kind of mathematical functions you"d typically find on your calculations (sin, cos, sqrt, asin, log, log10) and some mathematical constants like pi and e. Import statement- statement which makes objects contained in module available for use within another module: mymod1, mymod2. Namespaces- collection of identifiers that belong to module, or to a function; holds related things. Attribute- variable defined using module (or class); module attributes are accessed by using dot operators (. )

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