4.3
Using Python libraries (4.3) is a Class 10 Computer Science lesson for the Punjab boards. It walks through the idea in plain steps, then sets a short check, in English, Urdu or Roman Urdu.
Your guide: Miss HiraExplains computers with chai, cricket and your phone.
Chapter 1 of every subject is free. Unlock every chapter of this class with the full course.
Unlock full courseAlready paid? Sign in with the Google account you paid with.
A library (module) is a pre-built toolkit of code. You load it with import and then call its functions, so you do not have to write everything yourself.
import random; number = random.randint(1, 10) gives a random whole number from 1 to 10, both ends included.
import statistics; statistics.mean([23, 45, 67, 89, 12, 44, 56]) gives 48. The library also has median and mode. Import only what you need.
Step 1 / 1
A library (module) is a pre-built toolkit of code. You load it with import and then call its functions, so you do not have to write everything yourself.
import random; number = random.randint(1, 10) gives a random whole number from 1 to 10, both ends included.
import statistics; statistics.mean([23, 45, 67, 89, 12, 44, 56]) gives 48. The library also has median and mode. Import only what you need.
import library → library.function(): reuse tested code instead of reinventing the wheel.
Found a mistake? Tell us the lesson and the line at exciting@boringeducation.com.
No ads. Tell us what to fix.