import math print(math.pi) # Output: 3.14159...
The moment you realize you are writing the same code twice, you need a function. This teaches you the DRY principle (Don't Repeat Yourself). You learn to package logic into reusable blocks. python bootcamp from zero to hero