Introduction to Python Modules - CBSE Class 11 Computer Science Notes, Diagrams and Solved Questions

Borrow ready-made code from Python's standard library: import and from-import, the math functions (pi, e, sqrt, pow, fabs, ceil, floor, sin, cos, tan), random numbers with random, randint and randrange, and mean, median and mode with statistics.

In this chapter

  • What a module is: import vs from-import
  • math constants pi and e; sqrt, pow, fabs, ceil and floor
  • sin, cos and tan with angles in radians
  • random, randint and randrange, and repeatable results with seed
  • mean, median and mode with the statistics module
  • Return types, float rounding and possible-output questions