numbers = [2, 3, 5]squared = list()
squared.append(numbers[0] ** 2)
squared.append(numbers[1] ** 2)
squared.append(numbers[2] ** 2)
squared[4, 9, 25]
This kind of coding exhibits bad programming practices such as :
Difficult to scale
Difficult to modify
Clarity
The DRY in the DRY principle stands for “Don’t Repeat Yourself”. It is the principle of avoiding redundancy within code.
squared = list()
squared.append(numbers[0] ** 2)
squared.append(numbers[1] ** 2)
squared.append(numbers[2] ** 2)
squared[4, 9, 25]
[4, 9, 25]