[Tutor] exercise problem
Alan Gauld
alan.gauld at btinternet.com
Sat Aug 28 00:56:24 CEST 2010
"Dave Angel" <davea at ieee.org> 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 take out the str()
> function in that line. You've still got duplicate names there
> between that function and the outer level code.
You will need to make the new result a list too for + to work, like
so:
uitkomst = uitkomst + [getal1]
Or you can just append() the answer to uitkomst
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list