DSA with Python
Create Arrays (Working with For Loops)
CREATING ARRAYS WITH USER INPUT
Array is a collection of items stored at contiguous memory locations. The idea is to store multiple items of the same type together. This makes it easier to calculate the position of each element by simply adding an offset to a base value, i.e., the memory location of the first element of the array (generally denoted by the name of the array). The base value is index 0 and the difference between the two indexes is the offset. For simplicity, we can think of an array as a fleet of stairs where on each step is placed a value (let’s say one of your friends). Here, you can identify the location of any of your friends by simply knowing the count of the step they are on.
- Remember: " Location of next index depends on the data type we use "
Note
This is the first Repo for DSA with python.
Follow here :
#create a folder named DSA
mkdir dsa
cd dsa
mkdir Create_Array_Dynamically
cd Create_Array_Dynamically
# create the file
touch index.py
# write the code
#run it
python index.py