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

DL Neil PythonList at danceswithmice.info
Sun Mar 10 14:55:43 EDT 2019


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



More information about the Python-list mailing list