Is there a way in which I can set a function to accept an array with a certain number of elements as a parameter?
I am wondering whether this is possible in the parameter section itself and not through some sort of validation.
CodePudding user response:
I do not believe this would be possible in Python to my knowledge, this may not be what you want but this might work:
def foo(array, array_length):
if array_length != len(array):
return
# function code