there isn't a way in python to declare a array of a fixed lenght but there are some "tricks" to do this as:
lenght = 100
# You are creating an array of 100 None items
listOfNone = [None] * lenght
Another thing you can't do is declare an array of that fixed value type (like string). You can create an array only made of string but at any time you could replace a string element of the array with an int for example.
Here is an example:
lenght = 100
# Declaring an array made of 100 "a beautiful string" repeating
listOfStrings = ["a beautiful string"] * lenght
# Replacing the tenth element with a 12 (type int)
listOfStrings[9] = 12
# You can check the type of the element in python by printing:
print(type(listOfStrings[9])) # This will print int
print(type(listOfStrings[8])) # This will print string. As you can see there are 2 types of var in the same list (python doesn't matter)
listOfStrings[24] = False #Placing a bool in the 25th element
There is a workaround to this: you can create a function that handles the array (or use a class too, but I don't know your Python level).
I'm typing a basic function for you that you can adjust for your needs
def fillArrayWithElement(array, element):
if not str(type(array)) == "<class 'list'>":
# The array is not an array
raise ValueError('The first parameter must be list type')
return
if not str(type(prova2)) == "<class 'str'>":
# The element to add is not a string
raise ValueError('The element must be str type')
return
array.append(element)
return array