OneBite.Dev - Coding blog in a bite size

create an array of number in python

Code snippet on how to create an array of number in python

x = [5, 10, 15, 20, 25]

This code creates an array of numbers in Python. It starts by declaring a new variable, “x”. Then, an array of numbers is assigned to it: 5, 10, 15, 20, and 25. The array is denoted by square brackets with the numbers separated by commas. All together, this code creates a collection of 5 numbers that are stored in the “x” variable. This is useful when you need to store a collection of values in one place. In this case, those values happen to be numbers, but the same technique could be used to store any type of value such as strings or objects.

python