Subnetting is cutting one network into smaller ones. You do it by borrowing bits from the host part and giving them to the network part. Each bit you borrow doubles the number of subnets and halves the size of each.
Say an office has 192.168.10.0/24 and wants four separate networks: staff, guests, cameras and servers. Four subnets need 2 bits (2² = 4), so the prefix grows from /24 to /26. Each /26 has 6 host bits left: 64 addresses, 62 hosts.
import ipaddress
net = ipaddress.ip_network("192.168.10.0/24")
for sub in net.subnets(new_prefix=26):
print(sub)
Work from what you need. If each subnet needs room for 50 hosts, find the smallest host part that fits 50 + 2: 6 bits give 62 hosts, so each subnet is a /26. If you need 10 subnets, find the smallest number of borrowed bits that gives 10: 3 bits only give 8, so you need 4 (16 subnets).
Why bother? Smaller networks mean smaller broadcasts, and a router between them can apply rules: the guest Wi-Fi can reach the internet but not the office printers. You can also give different-sized subnets to different needs (VLSM), as long as they don't overlap.
Practice
You split a /24 into two equal subnets. What's the new prefix?