[Tutor] exercise problem

Steven D'Aprano steve at pearwood.info
Fri Aug 27 16:15:15 CEST 2010


On Fri, 27 Aug 2010 08:23:06 pm Roelof Wobben wrote:
> > > Write a function add_vectors(u, v) that takes two lists of
> > > numbers
[...]
> My new idea is that u is the number which must be calculated and v is
> the vector which containts the outcome or u is the outcome of the
> first numbers and v the outcome of the second numbers. 

If you had a function called "add_numbers(x, y)", you would say that x 
and y are the numbers which are to be added. If you have a function 
called "add_vectors(u, v)", then u and v are the vectors to be added. 
Perhaps this example will help:


u = [1, 10, 100]
v = [2, 11, 111]
add_vectors(u, v)
=> [3, 21, 211]




-- 
Steven D'Aprano


More information about the Tutor mailing list