← VCE Software Development U4O1

What a library is: standard vs third-party

A collection of ready-made code you can reuse. The standard library comes with Python; third-party libraries are made by others and must be installed separately (e.g. with pip).

Understanding What a library is: standard vs third-party in VCE Software Development U4O1

What it does: math is in the standard library, so you can import it immediately and reuse its functions such as math.sqrt(). pandas is a third-party library, so it has to be installed with pip before your program can import it. Reusing code from a library means you don't have to write and test common features from scratch. Python does not fetch libraries by itself. If the library is not installed, you get a ModuleNotFoundError. random is part of the Python standard library, so it can be imported straight away and reuses ready-made code.

Common mistakes: The random module is part of the standard library, but it has no function called pick(). The function that chooses an item from a list is random.choice(names). The program uses import math, so pi must be accessed through the module as math.pi. Writing pi on its own causes a NameError. It should be area = math.pi * r ** 2.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 115–124) and word search (Modules 115–171).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What is a library in Python?
A collection of ready-made code you can reuseA program that only runs in a web browser
Matches
pip install random import random
↓
random is part of the standard library, so it already comes with Python and does not need to be installed with pip.
Applying
Meanings
Term
library
Meaning
A collection of ready-made code you can reuse. The standard library comes with Python; third-party libraries are made by others and must be installed separately (e.g. with pip).
Practice
import math
Testing
Gaps
math
Check Answer
Spots
3count = len(names)
4winner = random.pick(names)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Moon Jellyfish' badge — Orbital Streak, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What is a library in Python?
A. A collection of ready-made code you can reuse ✓
B. A program that only runs in a web browser
A library is a collection of ready-made code (functions, classes and so on) that you can import into your own program instead of writing it yourself.
2. Which library comes with Python when you install it?
A. random (standard library) ✓
B. requests (standard library)
random is part of the standard library and ships with Python. requests is a third-party library and must be installed separately.
3. A third-party library is...
A. Built into Python and always available
B. Made by others and installed separately, e.g. with pip ✓
Third-party libraries are written by other developers and are not included with Python. You install them with a tool such as pip.
4. Which statement is correct?
A. import math works without installing anything ✓
B. import math needs pip install math first
math is in the standard library, so it is available as soon as Python is installed. No pip install is needed.
5. What is the main benefit of using a library?
A. You must rewrite every function yourself
B. Reusing tested code saves time and effort ✓
Reusing code from a library means you don't have to write and test common features from scratch.

Match the Pairs

import random → Loads a standard library module that ships with Python, so no installation is needed
pip install requests → Installs a third-party library made by others so it can be imported into your program
The standard library is a collection of ready-made code that comes with Python and needs no installation → import math
A third-party library is made by others and must be installed separately before you can reuse its code → pip install pandas
pip install random import random → random is part of the standard library, so it already comes with Python and does not need to be installed with pip.
import requests (never installed) → requests is a third-party library. Importing it without installing it first with pip causes a ModuleNotFoundError.

Key Term

library
A collection of ready-made code you can reuse. The standard library comes with Python; third-party libraries are made by others and must be installed separately (e.g. with pip).

Fill in the Blanks

1. import math print(math.sqrt(25))
Hint: Type the keyword that loads a library into your program so you can reuse its code.
2. import random print(random.randint(1, 6))
Hint: Type the name of the standard library module that provides randint().
3. pip install requests
Hint: Type the tool used in the terminal to install a third-party library.
4. from math import sqrt print(sqrt(49))
Hint: Type the name of the ready-made function being reused from the math library.
5. import datetime today = datetime.date.today()
Hint: Type the name of the standard library module that is used here to get today's date.

Spot the Error

Question 1
A import random
B names = ['Ava', 'Liam', 'Mia']
C count = len(names)
D winner = random.pick(names)
E print(winner)
Line D — The random module is part of the standard library, but it has no function called pick(). The function that chooses an item from a list is random.choice(names).
Question 2
A import math
B r = 5
C area = pi * r ** 2
D print(area)
Line C — The program uses import math, so pi must be accessed through the module as math.pi. Writing pi on its own causes a NameError. It should be area = math.pi * r ** 2.
Question 3
A import random
B dice = Random.randint(1, 6)
C print(dice)
Line B — Python is case-sensitive and the standard library module is named random in lowercase. Random is not defined. It should be dice = random.randint(1, 6).
Question 4
A import numpy as np
B marks = np.array([70, 85, 90])
C avg = numpy.mean(marks)
D print(avg)
Line C — numpy is a third-party library that was imported with the alias np, so the name numpy is not defined in this program. It should be avg = np.mean(marks).
Question 5
A from datetime import date
B today = datetime.today()
C print(today.year)
Line B — Only date was imported from the standard library datetime module, so the name datetime does not exist here. It should be today = date.today().

Student with a class code? Join your class →