D
D
dr sbtn2016-04-11 23:08:46
Python
dr sbtn, 2016-04-11 23:08:46

How to pass a list as a function argument?

I am engaged in the implementation of the ODE solution.
It is necessary to pass 4 arguments to the function, two of them are arrays (lists in my case, is it permissible?)
How to do this? Apparently, I misunderstood the chip using the * symbol when passing it to the list function)
(def explicitEulerMethod(n, h, *x, *y) did not work)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2016-04-12
@dawasaturday

The asterisk in this case is unpacking. It should be used in the opposite situation - when you need to pass not the list itself, but its elements as separate arguments.
To pass the list itself, no additional tricks are needed. If you just write his name, this is the list itself.

V
Vladimir Kuts, 2016-04-11
@fox_12

Well, pass it on:
where x and y are arrays

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question