"Dave Angel" wrote
while teller < len(u):
getal1 = u[teller] + v[teller]
uitkomst = uitkomst + str(getal1)
But then I get a list of string instead of integers.
You're close. Now that you've initialized the result variable to
[], you can use + just as you're doing. Just
Roelof Wobben wrote:
Date: Fri, 27 Aug 2010 14:27:34 -0400
From: da...@ieee.org
To: rwob...@hotmail.com
CC: alan.ga...@btinternet.com; tutor@python.org
Subject: Re: [Tutor] exercise problem
The other problem is you're confusing the variables inside the function
with the ones dec
We are close to the solution, keep trying!
On 27/08/2010 19.56, Roelof Wobben wrote:
Hello,
Now I have this :
def add_vectors(u, v):
"""
>>> add_vectors([1, 0], [1, 1])
[2, 1]
>>> add_vectors([1, 2], [1, 4])
[2, 6]
>>> add_vectors([1, 2, 1], [1, 4, 3])
[2, 6, 4]
>>> add_vectors([11, 0, -4,
> Date: Fri, 27 Aug 2010 14:27:34 -0400
> From: da...@ieee.org
> To: rwob...@hotmail.com
> CC: alan.ga...@btinternet.com; tutor@python.org
> Subject: Re: [Tutor] exercise problem
>
> (Don't top-post, it loses all the context)
>
> Roelof Wobben wrote:
> &g
(Don't top-post, it loses all the context)
Roelof Wobben wrote:
Hello,
Now I have this :
def add_vectors(u, v):
"""
>>> add_vectors([1, 0], [1, 1])
[2, 1]
>>> add_vectors([1, 2], [1, 4])
[2, 6]
>>> add_vectors([1, 2, 1], [1, 4, 3])
[2, 6, 4]
e.
Roelof
Date: Fri, 27 Aug 2010 10:19:30 -0700
From: alan.ga...@btinternet.com
Subject: Re: [Tutor] exercise problem
To: rwob...@hotmail.com
>u v, result
first example.
u : [1.0] v: [1,1] result [2.1]
OK, Great, you got that.
first split u en v in only numbers.
No, you shoul
Roelof Wobben wrote on 08/27/2010 12:18:01 PM:
>
>
> > Date: Fri, 27 Aug 2010 12:00:23 -0400
> > From: bgai...@gmail.com
> > To: rwob...@hotmail.com
> > CC: tutor@python.org
> > Subject: Re: [Tutor] exercise problem
> >
> > I have been reading yo
On 27/08/2010 17.05, Roelof Wobben wrote:
Hello,
My first try :
def add_vectors(u, v):
"""
>>> add_vectors([1, 0], [1, 1])
[2, 1]
>>> add_vectors([1, 2], [1, 4])
[2, 6]
>>> add_vectors([1, 2, 1], [1, 4, 3])
[2, 6, 4]
>>> add_vectors([11, 0, -4, 5], [2, -4, 17, 0])
[13, -4, 13, 5]
"""
teller
> Date: Fri, 27 Aug 2010 12:00:23 -0400
> From: bgai...@gmail.com
> To: rwob...@hotmail.com
> CC: tutor@python.org
> Subject: Re: [Tutor] exercise problem
>
> I have been reading your posts and responses. I find myself frustrated
> with your lack of understanding of
workspace\oefeningen\src\test.py", line 28, in
uitkomst = add_vectors(u,v)
File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 17, in add_vectors
getal1 = getal1 + u[teller,0] + v[teller,0]TypeError: list indices must be
integers, not tuple
Roelof
Date: Fri, 27 Aug
I have been reading your posts and responses. I find myself frustrated
with your lack of understanding of Python fundamentals and the time and
energy others are putting in that seems to help only a little.
I recommend you take a very basic tutorial, and be sure you understand
the basic concep
Hi Roelof,
See below
On 27 August 2010 16:05, Roelof Wobben wrote:
>
> uitkomst = add_vectors[u,v]
>
> But now I get this error message :
>
>
> Traceback (most recent call last):
> *File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 27, in
> *
>
> uitkomst = add_vectors[u,v]
>
> Type
#x27;function' object is not subscriptable
So it seems that I can't use vectors as a variable in a function.
Roelof
From: rwob...@hotmail.com
To: tutor@python.org
Subject: RE: [Tutor] exercise problem
Date: Fri, 27 Aug 2010 14:38:23 +
Oke,
That's also
; Date: Sat, 28 Aug 2010 00:15:15 +1000
> Subject: Re: [Tutor] exercise problem
>
> 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 i
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
On 27/08/2010 12.23, Roelof Wobben wrote:
From: rwob...@hotmail.com
To: alan.ga...@btinternet.com
Subject: RE: [Tutor] exercise problem
Date: Fri, 27 Aug 2010 07:04:39 +
> To: tutor@python.org
> From: a
From: rwob...@hotmail.com
To: alan.ga...@btinternet.com
Subject: RE: [Tutor] exercise problem
Date: Fri, 27 Aug 2010 07:04:39 +
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Thu, 26 Aug 2010 23:54:19 +0100
> Subject: Re: [Tutor] exercise problem
"Roelof Wobben" wrote
Write a function add_vectors(u, v) that takes two lists of numbers
I think that u is the name of the new list and v is the number which
represent the number which must be eveluated.
No. It sounds like you don't really understand the basic concepts
behind functions yet
On 8/26/2010 12:02 PM Roelof Wobben said...
Hello,
I have this exercise:
Lists can be used to represent mathematical vectors. In this exercise and
several that follow you will write functions to perform standard operations on
vectors. Create a file named vectors.py and write Python code to m
Hello,
I have this exercise:
Lists can be used to represent mathematical vectors. In this exercise and
several that follow you will write functions to perform standard operations on
vectors. Create a file named vectors.py and write Python code to make the
doctests for each function pass.
W
20 matches
Mail list logo