By the way, there's a nice book by Kent Beck called "Test Driven
Development by Example" that might be helpful to look at:
http://en.wikipedia.org/wiki/Test-Driven_Development_by_Example
___
Tutor maillist - Tutor@python.org
To unsubscribe or chang
On Sun, Dec 8, 2013 at 8:22 PM, Rafael Knuth wrote:
> Hey there,
>
> I struggle to understand what unit testing specifically means in
> practice and how to actually write unit tests for my code (my gut is
> telling me that it's a fairly important concept to understand).
>
> Over the last few days
On 12/09/2013 09:27 PM, Alan Gauld wrote:
On 09/12/13 17:57, Roel Schroeven wrote:
You are right in a sense, but this is what int() does, isn't it?
No. int() can be done in several ways...
spir should have said "..., but this is what str() does, ..." I think.
Doh! Yes, that makes sense I
On 09/12/13 23:46, Steven D'Aprano wrote:
Python has two different quote characters ' and " so you can use one for
delimiters and the other inside the string:
And if you need both you can also use triple quotes.
If you need both, you can escape the one that matches the delimiter:
s = 'this
On Mon, Dec 09, 2013 at 11:14:38PM +, J Sutar wrote:
> Steven, I updated the very last line of code as below, as I need to get the
> word wrapped around quotes. Is that a good way of achieving that?
[...]
> writer.writerow([str(n) + " " + chr(34) + s + chr(34) for n, s in
>
>
> I'm trying to write to csv a string which contains double quotation
>> marks and a comma however I'm finding that the write reads the comma as a
>> delimiter. If try wrap the string around double quotes it clashes with the
>> raw quotes originally within the string text (which I'd like to/must
Thanks all. Yes csv module make it whole lot easier. I did try using it
before posting to list but couldn't get it working for some reason.
Steven, I updated the very last line of code as below, as I need to get the
word wrapped around quotes. Is that a good way of achieving that?
import csv
word
On Mon, Dec 09, 2013 at 09:52:34PM +, J Sutar wrote:
> I'm trying to write to csv a string which contains double quotation marks
> and a comma however I'm finding that the write reads the comma as a
> delimiter. If try wrap the string around double quotes it clashes with the
> raw quotes origi
On 09/12/13 22:28, Dave Angel wrote:
On Mon, 09 Dec 2013 20:27:38 +, Alan Gauld
wrote:
Incidentally, I just remembered another completely different
way to do it, although I can't recall how it works!
Unfortunately it doesn't work for 10, 20, ...
Ah, I knew it must be too good to be tru
On Tue, 10 Dec 2013 09:28:32 +1100, Steven D'Aprano
wrote:
Joel,
You don't appear to have actually written anything in your
response.
Every line in your post starts with a ">" quoting J Sutar's
original
post, with nothing new added apart from your signature at the end.
I cannot read eithe
On Mon, Dec 9, 2013 at 5:28 PM, Steven D'Aprano wrote:
> Joel,
>
> You don't appear to have actually written anything in your response.
> Every line in your post starts with a ">" quoting J Sutar's original
> post, with nothing new added apart from your signature at the end.
>
>
>
More 'google (g
Joel,
You don't appear to have actually written anything in your response.
Every line in your post starts with a ">" quoting J Sutar's original
post, with nothing new added apart from your signature at the end.
On Mon, Dec 09, 2013 at 04:57:50PM -0500, Joel Goldstick wrote:
> On Mon, Dec 9,
On Mon, 09 Dec 2013 20:27:38 +, Alan Gauld
wrote:
Incidentally, I just remembered another completely different
way to do it, although I can't recall how it works! Maybe one
of the math gurus can explain it, and how to extend it. This
version only works for 2 digit numbers... and has a huge g
On Mon, Dec 9, 2013 at 4:52 PM, J Sutar wrote:
> # Re-sending from registered email address #.
>
> Hi,
>
> Posting for first time so hope I get the forum etiquette and rules right,
> please let me know otherwise.
>
> I'm trying to write to csv a string which contains double quotation marks
> and
# Re-sending from registered email address #.
Hi,
Posting for first time so hope I get the forum etiquette and rules right,
please let me know otherwise.
I'm trying to write to csv a string which contains double quotation marks
and a comma however I'm finding that the write reads the comma as a
On 09/12/13 17:57, Roel Schroeven wrote:
You are right in a sense, but this is what int() does, isn't it?
No. int() can be done in several ways...
spir should have said "..., but this is what str() does, ..." I think.
Doh! Yes, that makes sense I should have realized.
All in all I think
Alan Gauld schreef:
On 09/12/13 13:48, spir wrote:
On 12/09/2013 02:29 PM, Wolfgang Maier wrote:
spir gmail.com> writes:
Tu sum it up (aha!): you algorithm is the right and only one
No, it's not the only one. ...
also the pure numbers approach pointed out by me and Alan.
You are right in
On Sun, Dec 8, 2013 at 8:46 PM, Varuna Seneviratna <
varunasenevira...@gmail.com> wrote:
> But what is meant by "A *namespace* is a mapping from names to objects"
>
Steven touched on this, but I'd like to emphasize: in Python, EVERYTHING is
an object - variables, functions, integers, strings, you
On Mon, 09 Dec 2013 17:00:49 +0100, spir wrote:
On 12/09/2013 03:49 PM, Alan Gauld wrote:
> On 09/12/13 13:48, spir wrote:
>> On 12/09/2013 02:29 PM, Wolfgang Maier wrote:
>> You are right in a sense, but this is what int() does, isn't it?
> No. int() can be done in several ways but usually it
On 13-12-09 03:14 AM, eryksun wrote:
> On Sun, Dec 8, 2013 at 2:36 PM, pierre dagenais wrote:
>> I'm running Ubuntu 10.04 and I've installed python 3.3.3 from the
>> tarball at http://python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz
>>
>> Here is the error I get when trying to run tkinter.
>>
>>
On 13-12-08 10:57 PM, Reuben wrote:
> Can you try importing the module '_tkinter'
> On 09-Dec-2013 6:43 AM, "pierre dagenais" wrote:
>
>> Hi,
>> I'm running Ubuntu 10.04 and I've installed python 3.3.3 from the
>> tarball at http://python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz
>>
>> Here is t
On 12/09/2013 03:49 PM, Alan Gauld wrote:
On 09/12/13 13:48, spir wrote:
On 12/09/2013 02:29 PM, Wolfgang Maier wrote:
spir gmail.com> writes:
Tu sum it up (aha!): you algorithm is the right and only one
No, it's not the only one. ...
also the pure numbers approach pointed out by me and A
On 09/12/13 04:46, Varuna Seneviratna wrote:
do not understand what is meant by "A /namespace/ is a mapping from
names to objects". How I understand to be a namespace is a particular
space within which a particular name is unique.
That's correct.
But a name on its own can refer to anything.
Bu
On 09/12/13 13:48, spir wrote:
On 12/09/2013 02:29 PM, Wolfgang Maier wrote:
spir gmail.com> writes:
Tu sum it up (aha!): you algorithm is the right and only one
No, it's not the only one. ...
also the pure numbers approach pointed out by me and Alan.
You are right in a sense, but this i
spir gmail.com> writes:
>
> On 12/09/2013 02:29 PM, Wolfgang Maier wrote:
> > spir gmail.com> writes:
> >
> >>
> >> Tu sum it up (aha!): you algorithm is the right and only one
> >
> > No, it's not the only one. It's certainly the most obvious one, but there is
> > also the pure numbers approac
On 12/09/2013 02:29 PM, Wolfgang Maier wrote:
spir gmail.com> writes:
Tu sum it up (aha!): you algorithm is the right and only one
No, it's not the only one. It's certainly the most obvious one, but there is
also the pure numbers approach pointed out by me and Alan.
You are right in a sen
On 12/09/2013 02:42 PM, Rafael Knuth wrote:
Tu sum it up (aha!): you algorithm is the right and only one
No, it's not the only one. It's certainly the most obvious one, but there is
also the pure numbers approach pointed out by me and Alan.
So far I received 7 different alternative suggestion
On 12/09/2013 05:46 AM, Varuna Seneviratna wrote:
Let’s begin with some definitions.
A *namespace* is a mapping from names to objects. Most namespaces are
currently implemented as Python dictionaries, but that’s normally not
noticeable in any way (except for performance), and it may change in t
>> Tu sum it up (aha!): you algorithm is the right and only one
>
> No, it's not the only one. It's certainly the most obvious one, but there is
> also the pure numbers approach pointed out by me and Alan.
So far I received 7 different alternative suggestions, both pure
numbers & mixed int/str app
spir gmail.com> writes:
>
> Tu sum it up (aha!): you algorithm is the right and only one
No, it's not the only one. It's certainly the most obvious one, but there is
also the pure numbers approach pointed out by me and Alan.
___
Tutor maillist -
On 12/09/2013 09:08 AM, Rafael Knuth wrote:
Hej there,
I wrote a program that converts an integer into a digit sum:
def DigitSum(YourNumber):
DigitList = []
YourNumber = str(YourNumber)
for i in YourNumber:
DigitList.append(int(i))
print(sum(DigitList))
DigitSum(55
On Mon, Dec 09, 2013 at 10:16:30AM +0530, Varuna Seneviratna wrote:
> I do not understand what is meant by "A *namespace* is a mapping from names
> to objects". How I understand to be a namespace is a particular space
> within which a particular name is unique.For a example within the space set
>
On Mon, Dec 9, 2013 at 2:46 PM, Varuna Seneviratna
wrote:
>> Let’s begin with some definitions.
>>
>> A namespace is a mapping from names to objects. Most namespaces are
>> currently implemented as Python dictionaries, but that’s normally not
>> noticeable in any way (except for performance), and
On 09/12/13 08:08, Rafael Knuth wrote:
def DigitSum(YourNumber):
DigitList = []
YourNumber = str(YourNumber)
for i in YourNumber:
DigitList.append(int(i))
print(sum(DigitList))
DigitSum(55)
10
It actually works but I was wondering if that's the only way to solve
th
>
> Let’s begin with some definitions.
>
> A *namespace* is a mapping from names to objects. Most namespaces are
> currently implemented as Python dictionaries, but that’s normally not
> noticeable in any way (except for performance), and it may change in the
> future. Examples of namespaces are: t
On 9 December 2013 08:08, Rafael Knuth wrote:
> Hej there,
>
> I wrote a program that converts an integer into a digit sum:
>
> def DigitSum(YourNumber):
> DigitList = []
> YourNumber = str(YourNumber)
> for i in YourNumber:
> DigitList.append(int(i))
> print(sum(DigitList)
Rafael Knuth gmail.com> writes:
>
> Hej there,
>
> I wrote a program that converts an integer into a digit sum:
>
> def DigitSum(YourNumber):
> DigitList = []
> YourNumber = str(YourNumber)
> for i in YourNumber:
> DigitList.append(int(i))
> print(sum(DigitList))
>
> D
Thanks, guys - got it! I was suspecting that my solution is too
complex and that there must be a simpler way to convert integers into
a digit sum. Have a great morning/day/evening, Raf
On Mon, Dec 9, 2013 at 9:23 AM, Amit Saha wrote:
> On Mon, Dec 9, 2013 at 6:08 PM, Rafael Knuth wrote:
>> Hej t
On Mon, Dec 9, 2013 at 1:38 PM, Rafael Knuth wrote:
> Hej there,
>
> I wrote a program that converts an integer into a digit sum:
>
> def DigitSum(YourNumber):
> DigitList = []
> YourNumber = str(YourNumber)
> for i in YourNumber:
> DigitList.append(int(i))
> print(sum(Dig
On Mon, Dec 9, 2013 at 6:08 PM, Rafael Knuth wrote:
> Hej there,
>
> I wrote a program that converts an integer into a digit sum:
>
> def DigitSum(YourNumber):
> DigitList = []
> YourNumber = str(YourNumber)
> for i in YourNumber:
> DigitList.append(int(i))
> print(sum(Digi
On Sun, Dec 8, 2013 at 2:36 PM, pierre dagenais wrote:
> I'm running Ubuntu 10.04 and I've installed python 3.3.3 from the
> tarball at http://python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz
>
> Here is the error I get when trying to run tkinter.
>
> ImportError: No module named '_tkinter'
>
> I'v
Hej there,
I wrote a program that converts an integer into a digit sum:
def DigitSum(YourNumber):
DigitList = []
YourNumber = str(YourNumber)
for i in YourNumber:
DigitList.append(int(i))
print(sum(DigitList))
DigitSum(55)
>>>
10
It actually works but I was wondering if
42 matches
Mail list logo