git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help!!! How to apply my created function to another function


Dear Joyce,


On 11/03/19 7:30 AM, djoyceb at gmail.com wrote:

...
> A = [ 4, 5, 1]
> 
> #TASK0
> 
> def displayVector(v) :
> 
>      print(v)
> 
> displayVector(A)
...

> B = buildRandomVector(A)
> 
> def vectorMagnitude(v) :
> 
>      tsum = 0
> 
>      for i in v:
> 
>          tsum = tsum + i**2
> 
>          x = math.sqrt(tsum)
> 
>      print(x)
> 
> vectorMagnitude(B)  ==>>>> this is problem


Perhaps "this..." is not, but is merely where you *notice* a problem?

After defining B, and before assessing its magnitude, try displaying 
that vector.

Does it contain what you expect?


-- 
Regards =dn