I would like to import a list in a python function and run the function from the terminal of Visual Studio Code. My function, that I called “MyFunction.py“, and that I temporarily saved on the Desktop, is the following one:
def MultiplicateLists(a):
import numpy as np
import random
rand_list=[]
for i in range(10):
rand_list.append(random.randint(3,9))
b = np.array(rand_list)
result = a * b
print(a)
print(b)
print(result)
However, when I try to call and make the function run from the terminal of Visual Studio Code, I get the following error, i.e. “zsh: no matches found”:
(anaconda3) (base) xxxyyyzzz@xxx Desktop % python3 MyFunction.py MultiplicateLists(np.array([1,3,5,6,4,6,7,1,2,7]))
zsh: no matches found: MultiplicateLists(np.array([1,3,5,6,4,6,7,1,2,7]))
Here following a screenshot from Visual Studio Code
enter image description here
Might it be that the command “python3 MyFunction.py MultiplicateLists()” is wrong? How can I fix it?
BostonPlummer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.