Hello,
I follow the online book " How to think like a computer scientist".
But now I have a problem with a exercise.
This is not homework.
The exercise is :
Using a text editor, create a Python script named tryme3.py . Write a function
in this file called nine_lines that uses three
error message you receive in the traceback
when you run your program. Also, copy the complete program here since it is
only a handful of lines
On Thu, Aug 19, 2010 at 7:31 AM, Roelof Wobben wrote:
Hello,
I follow the online book " How to think like a computer scientist".
But now I
Hello,
I have this exercise:
Now write the function is_odd(n) that returns True when n is odd and False
otherwise. Include doctests for this function as you write it.
Finally, modify it so that it uses a call to is_even to determine if its
argument is an odd integer.
So I thought of
Oke,
I don''t understand it complety.
return not arg%2
Why use not here ?
I think that arg%2 is True not makes it false.
Another question.
How can I round outcome of a calculation.
round ( ( t-32)/1.8) does not work because I get a message that there are two
arguments.
Outcome
From: waynejwer...@gmail.com
Date: Fri, 20 Aug 2010 15:07:56 -0500
Subject: Re: [Tutor] flow problem with a exercise
To: rwob...@hotmail.com
CC: tutor@python.org
On Fri, Aug 20, 2010 at 2:48 PM, Roelof Wobben wrote:
Oke,
I don''t understand it complety.
return not arg%2
> Subject: Re: [Tutor] flow problem with a exercise
> From: evert@gmail.com
> Date: Sat, 21 Aug 2010 12:39:05 +0200
> CC: tutor@python.org
> To: rwob...@hotmail.com
>
> > In [39]: t = 3
> >
> > In [40]: round((t-32)/1.8)
> > Out[40]: -16.0
> >
> > In [41]: t = 3.0
> >
> > In [42]: roun
Hello,
I have to make a programm which can test if a number is a prime.
I know a prime is a number which can only be diveded by 1 and itself.
One way is was thinking about is to make a loop which try if % has output 0.
But that don't work.
Can someone give me a hint what's the best
this problem u will get lots of solutions on the net.
e.g wilson's theorem , sieve of eranthoses etc.
--nitin
On Sat, Aug 21, 2010 at 7:05 PM, Roelof Wobben wrote:
Hello,
I have to make a programm which can test if a number is a prime.
I know a prime is a number which can only be divede
et lots of solutions on the net.
e.g wilson's theorem , sieve of eranthoses etc.
--nitin
On Sat, Aug 21, 2010 at 7:05 PM, Roelof Wobben wrote:
Hello,
I have to make a programm which can test if a number is a prime.
I know a prime is a number which can only be diveded by 1 and itself.
al"
else :
print 7, "is geen prime getal"
But this one gets in a indefinitive loop.
Roelof
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Sun, 22 Aug 2010 02:49:26 +1000
> Subject: Re: [Tutor] prime test problem
>
> On Sun, 22 Aug 2010 1
s (functions, if you're on Python >= 3) are a simple, but at
> times extremely quick and useful way to debug scripts.
>
> Ah yes, and either use "is een priemgetal" or "is a prime number", not a mix
> of both (sorry, couldn't help myself ;-).
>
>
&g
Hello,
I have this programm :
def print_digits(n):
"""
>>> print_digits(13789)
9 8 7 3 1
>>> print_digits(39874613)
3 1 6 4 7 8 9 3
>>> print_digits(213141)
1 4 1 3 1 2 """
count = 0
while n:
count = count + 1
n = n / 10
Hello,
This is my exercise:
Write Python code to make each of the following doctests pass:
"""
>>> type(fruit)
>>> len(fruit)
8
>>> fruit[:3]
'ram'
"""
I have made this :
>>> type(fruit)
>>> len(fruit)
8
>>> fruit[:3]
'ram'
"""
fruit="ramadana"
print "fruit
Hello,
Very wierd.
>From a python shell it works.
If a type it as module in SPE , it doesn't work.
Roelof
> Date: Sun, 22 Aug 2010 19:47:09 +0200
> From: knack...@googlemail.com
> To: tutor@python.org
> Subject: Re: [Tutor] type() problem
>
>
> > fruit="ramadana"
> > print "fruit
Hello,
I made this programm :
def count_letters(n,a):
count = 0
for char in n:
if char == a:
count += 1
return count
fruit=""
letter=""
fruit= input("Enter a sort of fruit: ")
teller = input("Enter the character which must be counted: ")
x=count_letters (f
Hello,
I have this exercise :
Now rewrite the count_letters function so that instead of traversing the
string, it repeatedly calls find (the version from Optional parameters), with
the optional third parameter to locate new occurences of the letter being
counted.
And I have this
From: rwob...@hotmail.com
To: obe...@gmail.com
Subject: RE: [Tutor] find() problem
Date: Tue, 24 Aug 2010 12:25:24 +
> Date: Tue, 24 Aug 2010 08:09:54 -0400
> Subject: Re: [Tutor] find() problem
> From: obe...@gmail.com
> To: rwob...@hotmail.com
>
> > I will try again.
> >
> > def
> Subject: Re: [Tutor] FW: find() problem
> From: evert@gmail.com
> Date: Tue, 24 Aug 2010 17:03:07 +0200
> CC: tutor@python.org
> To: rwob...@hotmail.com
>
> > > > def find(strng, ch, start, step=1):
> > > > index = start
> > > The problem lies here, if you do a print on index, it never
Hello,
I found it.
This one does the trick :
def find(strng, ch, start, step=1):
index=start
while 0 <= index < len(strng):
if strng[index] == ch:
return index
index += step
return -2
fruit=""
letter=""
fruit= raw_input("Enter a sort of fruit:
Hello,
I have this programm :
def remove_letter(letter, strng):
"""
>>> remove_letter('a', 'apple')
'pple'
>>> remove_letter('a', 'banana')
'bnn'
>>> remove_letter('z', 'banana')
'banana'
>>> remove_letter('i', 'Mississippi')
'Mpp'
> Date: Wed, 25 Aug 2010 12:27:39 +0200
> From: cwi...@compuscan.co.za
> To: tutor@python.org
> Subject: Re: [Tutor] why does this fail
>
> On 25/08/2010 12:00, Roelof Wobben wrote:
> > Hello,
> >
> > I have this programm :
>
oo it was
important to make the distinction.
Regards,
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/
From: Roelof Wobben
To: alan.ga...@btinternet.com
Sent: Wednesday, 25 August, 2010 19:38:03
Subject: RE: [Tutor] why does this fail
Oke,
That's w
Hello,
I have this exercise :
Try each of the following formatted string operations in a Python shell and
record the results:
“%s %d %f” % (5, 5, 5)
“%-.2f” % 3
“%-10.2f%-10.2f” % (7, 1.0/2)
print ” $%5.2fn $%5.2fn $%5.2f” % (3, 4.5, 11.2)
But if I try in a python 2.7 IDLE enviroment
hello,
I have this programm
# Add your doctests here:
"""
>>> a_list[3]
42
>>> a_list[6]
'Ni!'
>>> len(a_list)
8
"""
a_list = ['test', 'test','test',42,'test','test','Ni!','test']
print a_list[3]
print a_list[6]
print len(a_list)
if __name__ == '__main__':
import doctes
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
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
; 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
the point Alan is making.
I try now to make the function and puttting it on this maillist if it's ready.
Maybe I can learn more about efficient progamming or better way to do this.
Roelof
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Sat, 28 Aug 2010 00:15:15 +1000
2010 16:20:27 +0100
Subject: Re: [Tutor] exercise problem
From: wpr...@gmail.com
To: rwob...@hotmail.com
CC: tutor@python.org
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 ca
> 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 Python fundamentals and t
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, 5], [2, -4, 17, 0])
[13, -4, 13
> 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
Hello,
Im trying to do a import on a linux machine.
But now Im gettting this message :
Python 2.6.5 (r265:79063, Apr 1 2010, 05:28:39)
[GCC 4.4.3 20100316 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import calender
Traceback (most recent
> Date: Sat, 28 Aug 2010 10:24:06 -0700
> Subject: Re: [Tutor] import prroblem
> From: thud...@opensuse.us
> To: rwob...@hotmail.com
>
> On Sat, Aug 28, 2010 at 9:54 AM, Roelof Wobben wrote:
> > Hello,
> >
> > Im trying to do a import on a linux machine.
Hello,
For a exerise I made this one :"
import string
def extract_words(s):
"""
>>> extract_words('Now is the time! "Now", is the time? Yes, now.')
['now', 'is', 'the', 'time', 'now', 'is', 'the', 'time', 'yes', 'now']
>>> extract_words('she tried to curtsey as she
> Subject: Re: [Tutor] can this be done easerly
> From: evert@gmail.com
> Date: Mon, 30 Aug 2010 12:04:08 +0200
> CC: tutor@python.org
> To: rwob...@hotmail.com
>
> > For a exerise I made this one :"
> >
> > import string
> > def extract_words(s):
> > """
> > >>> extract_words('Now is th
Hello,
I have made this program as solution to a exercise from thinking like a
computer scientist.
def encapsulate(val, seq):
if type(seq) == type(""):
return str(val)
if type(seq) == type([]):
return [val]
return (val,)
def insert_in_middle(val, seq):
middle = len(seq)/2
return seq[:
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Sun, 5 Sep 2010 23:55:32 +1000
> Subject: Re: [Tutor] (no subject)
>
> On Sun, 5 Sep 2010 11:44:09 pm Roelof Wobben wrote:
> > Hello,
> >
> > I have made this program as solution to a exerci
Hello,
I have this programm:
def encapsulate(val, seq):
if type(seq) == type(""):
return str(val)
if type(seq) == type([]):
return [val]
return (val,)
def insert_in_middle(val, seq):
middle = len(seq)/2
return seq[:middle] + encapsulate(val, seq) +
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Mon, 6 Sep 2010 08:27:31 +0100
> Subject: Re: [Tutor] why do i get None as output
>
>
> "Roelof Wobben" wrote
>
> def make_empty(seq):
> word2=""
> teller=0
> if typ
Hello,
I have this programm :
def index_of(val, seq, start=0):
"""
>>> index_of(9, [1, 7, 11, 9, 10])
3
>>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5))
3
>>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
6
>>> index_of('y', 'happy birthday')
4
> Date: Mon, 6 Sep 2010 21:45:17 +0200
> Subject: Re: [Tutor] exercise correct ??
> From: sander.swe...@gmail.com
> To: rwob...@hotmail.com
> CC: tutor@python.org
>
> On 6 September 2010 19:32, Roelof Wobben wrote:
> > def index_of(val, seq, start=0):
> >
bject: Re: [Tutor] exercise correct ??
>
>
> "Roelof Wobben" wrote
>
> #
> def index_of(val, seq, start=0):
> """
> >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
> 6
> """
>
> But I get t
Date: Tue, 7 Sep 2010 00:52:38 -0700
From: alan.ga...@btinternet.com
Subject: Re: [Tutor] exercise correct ??
To: rwob...@hotmail.com; tutor@python.org
Oke, the 4 is a starting point for the index.
Next problem.
The begin looks like this :
index_of(5, (1, 2, 4, 5, 6, 10, 5, 5)
Hello,
I have this :
def sort_sequence(seq):
"""
>>> sort_sequence([3, 4, 6, 7, 8, 2])
[2, 3, 4, 6, 7, 8]
>>> sort_sequence((3, 4, 6, 7, 8, 2))
(2, 3, 4, 6, 7, 8)
>>> sort_sequence("nothappy")
'ahnoppty'
"""
if type(seq) == type([]):
> Subject: Re: [Tutor] sort problem
> From: evert@gmail.com
> Date: Wed, 8 Sep 2010 17:26:58 +0200
> CC: tutor@python.org
> To: rwob...@hotmail.com
>
> > I have this :
> >
> > def sort_sequence(seq):
> > """
> > >>> sort_sequence([3, 4, 6, 7, 8, 2])
> > [2, 3, 4, 6, 7, 8]
> > >>> sort_se
Date: Wed, 8 Sep 2010 12:38:03 -0400
From: gregb...@gmail.com
To: tutor@python.org
Subject: Re: [Tutor] sort problem
On Wed, Sep 8, 2010 at 11:50 AM, Roelof Wobben wrote:
> Subject: Re: [Tutor] sort problem
> From: evert@gmail.com
> Date: Wed, 8 Sep 2010 17:26:58 +
Date: Wed, 8 Sep 2010 20:10:28 +0200
From: f...@libero.it
To: tutor@python.org
Subject: Re: [Tutor] sort problem
On 08/09/2010 19.12, Francesco Loffredo wrote:
> ...
> a little example:
>
> separator = "Roelof"
> list = ["Wobben", "Python", "Learner"]
> print separator.join(list)
>
> ... what
Hello,
I have this :
def recursive_count(target, nested_num_list):
"""
>>> recursive_count(2, [2, 9, [2, 1, 13, 2], 8, [2, 6]])
4
>>> recursive_count(7, [[9, [7, 1, 13, 2], 8], [7, 6]])
2
>>> recursive_count(15, [[9, [7, 1, 13, 2], 8], [2, 6]])
0
From: anand.shash...@gmail.com
Date: Thu, 9 Sep 2010 15:08:10 +0530
Subject: Re: [Tutor] recursive problem
To: rwob...@hotmail.com
CC: tutor@python.org
On Thu, Sep 9, 2010 at 2:21 PM, Roelof Wobben wrote:
Hello,
I have this :
def recursive_count(target, nested_num_list
:31 PM, Roelof Wobben wrote:
Oke,
So If I understand you right LBYL is more the python way.
Wierd that the book im following (Thinking like a computer scientist) is more
EAFP.
Roelof
Subject: Re: [Tutor] recursive problem
From: rabidpoob...@gmail.com
Date: Thu, 9 Sep 2010 13:24:06
Hello,
I have this problem :
Write a function named readposint that prompts the user for a positive integer
and then checks the input to confirm that it meets the requirements. A sample
session might look like this:
>>> num = readposint()
Please enter a positive integer: yes
yes is not
Date: Fri, 10 Sep 2010 18:07:13 +0200
From: f...@libero.it
To: tutor@python.org
Subject: Re: [Tutor] exceptions problem
Oops, I sent this to Roelof... Ok, I must amend it anyway...
On 10/09/2010 17.13, Roelof Wobben wrote:
> ...
> def readposint():
> x = raw_input("
must amend it anyway...
On 10/09/2010 17.13, Roelof Wobben wrote:
> ...
> def readposint():
> x = raw_input("Please enter a positive integer :")
> try:
> x = int(x) and x> 0
> except:
> print x , "
Date: Fri, 10 Sep 2010 20:23:09 +0200
From: f...@libero.it
To: tutor@python.org
Subject: Re: [Tutor] exceptions problem
On 10/09/2010 18.12, Roelof Wobben wrote:
> ...
> def readposint():
> x = raw_input("Please enter a positive integer :")
> try:
>
> Date: Sat, 11 Sep 2010 11:05:54 -0400
> From: bgai...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] exceptions problem
>
> On 9/11/2010 6:56 AM, Peter Otten wrote:
>> Steven D'Aprano wrote:
>>
>>> On Sat, 11 Sep 2010 09:56:41 am bob gailer wro
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Sun, 12 Sep 2010 03:18:19 +1000
> Subject: Re: [Tutor] recursive problem
>
> On Fri, 10 Sep 2010 09:30:23 pm Ewald Horn wrote:
>
>> While EAFP is great, it's not
>> always the best way to proceed.
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Sun, 12 Sep 2010 03:27:42 +1000
> Subject: Re: [Tutor] recursive problem
>
> On Sun, 12 Sep 2010 03:18:19 am Steven D'Aprano wrote:
>
>> But that hasn't done anything to prevent race conditions. S
> From: rwob...@hotmail.com
> To: wpr...@gmail.com
> Subject: RE: [Tutor] recursive problem
> Date: Sat, 11 Sep 2010 18:05:12 +
>
>
>
>
>
>> Date: Sat, 11 Sep 2010 19:01:39 +0100
>> Subject: Re: [Tutor] recursive probl
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Sun, 12 Sep 2010 04:03:43 +1000
> Subject: Re: [Tutor] recursive problem
>
> On Sun, 12 Sep 2010 03:40:38 am Roelof Wobben wrote:
>
>> But why is type checking then w
;> To: tutor@python.org
>> Date: Sun, 12 Sep 2010 04:19:57 +1000
>> Subject: Re: [Tutor] recursive problem
>>
>> On Sun, 12 Sep 2010 04:09:20 am Roelof Wobben wrote:
>>
>>>> On Sun, 12 Sep 2010 03:40:38 am Roelof Wobben wrote:
>>>>> But why
-0400
>> From: bgai...@gmail.com
>> To: tutor@python.org
>> Subject: Re: [Tutor] exceptions problem
>>
>> On 9/11/2010 12:12 PM, Roelof Wobben wrote:
>>>
>>>
>>>
>>>> Date: Sat, 11 S
> From: rwob...@hotmail.com
> To: st...@pearwood.info
> Subject: RE: [Tutor] recursive problem
> Date: Sun, 12 Sep 2010 07:58:48 +
>
>
>
>
>
>> From: st...@pearwood.info
>> To: tutor@python.org
>> Date: Sun, 12
Hello,
I have this problem.
Write a program named litter.py that creates an empty file named trash.txt in
each subdirectory of a directory tree given the root of the tree as an argument
(or the current directory as a default).
So I change the example to this :
def traverse(path, s='.\n',
> Subject: Re: [Tutor] tree problem
> From: evert@gmail.com
> Date: Sun, 12 Sep 2010 13:29:12 +0200
> CC: tutor@python.org
> To: rwob...@hotmail.com
>
>> Write a program named litter.py that creates an empty file named trash.txt
>> in each subdirecto
> Date: Sun, 12 Sep 2010 09:46:08 -0400
> From: joel.goldst...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] tree problem
>
>
>
> On Sun, Sep 12, 2010 at 9:32 AM, Roelof Wobben
>> wrote:
>
>
> ___
> Date: Sun, 12 Sep 2010 13:40:09 -0400
> Subject: Re: [Tutor] tree problem
> From: joel.goldst...@gmail.com
> To: rwob...@hotmail.com
>
>
>
> On Sun, Sep 12, 2010 at 1:20 PM, Roelof Wobben
>> wrote:
>
>
>
> ___
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Sun, 12 Sep 2010 20:52:06 +0100
> Subject: Re: [Tutor] recursive problem
>
> "Roelof Wobben" wrote
>
>>>> I guess the question to ask/consi
Hello,
I have this string called test with the contents of 'het is een wonder \\TIS'
Now I want to get rid of the \\ so I do this : test2 = test.replace ('\\', '')
And I get at the python prompt this answer : 'het is een wonder TIS'
So that's right.
Now I try the same in a IDE with this progr
2010 11:07:19 -0400
>> From: bgai...@gmail.com
>> To: tutor@python.org
>> Subject: Re: [Tutor] wierd replace problem
>>
>> On 9/13/2010 8:19 AM, Roelof Wobben wrote:
>>> Hello,
>>>
>>> I have this string called test with the contents of 'het is een
Date: Mon, 13 Sep 2010 12:17:47 -0400
From: mich...@trollope.org
To: tutor@python.org
Subject: Re: [Tutor] wierd replace problem
On Mon, Sep 13, 2010 at 12:19:23PM +, Roelof Wobben wrote:
>
> Hello,
>
> I have this string called t
:42:56 -0400
>> From: joel.goldst...@gmail.com
>> To: tutor@python.org
>> Subject: Re: [Tutor] wierd replace problem
>>
>>
>>
>> On Mon, Sep 13, 2010 at 12:37 PM, Roelof Wobben
>>> wrote:
>>
>>
>>
>> ---
.com
>>> To: tutor@python.org
>>> Subject: Re: [Tutor] wierd replace problem
>>>
>>>
>>>
>>> On Mon, Sep 13, 2010 at 12:37 PM, Roelof Wobben
>>>> wrote:
>>>
>>>
>>>
>>> ---
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Mon, 13 Sep 2010 18:28:46 +0100
> Subject: Re: [Tutor] wierd replace problem
>
>
> "Roelof Wobben" wrote
>
>> Now I want to get rid of th
2010 14:08:46 -0400
>> From: bgai...@gmail.com
>> To: tutor@python.org
>> Subject: Re: [Tutor] wierd replace problem
>>
>> On 9/13/2010 1:50 PM, Roelof Wobben wrote:
>>
>> [snip]
>>> hello Alan,
>>>
>>> Your right. Then it prints like
:18:36 -0400
>> From: joel.goldst...@gmail.com
>> To: tutor@python.org
>> Subject: Re: [Tutor] wierd replace problem
>>
>>
>>
>> On Mon, Sep 13, 2010 at 2:08 PM, bob gailer
>>> wrote:
>> On 9/13/2010 1:50 PM, Roelof Wobben wrote:
>>
>&g
> Date: Mon, 13 Sep 2010 15:31:08 -0400
> Subject: Re: [Tutor] FW: wierd replace problem
> From: joel.goldst...@gmail.com
> To: rwob...@hotmail.com
>
>
>
> On Mon, Sep 13, 2010 at 2:24 PM
Hello,
Strip ('"'') does not work.
Still this message : SyntaxError: EOL while scanning string literal
So I think I go for the suggestion of Bob en develop a programm which deletes
all the ' and " by scanning it character by character.
Roelof
>
>>
> Date: Tue, 14 Sep 2010 09:32:38 +0200
> From: timomli...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] FW: wierd replace problem
>
> On 14-09-10 09:28, Roelof Wobben wrote:
>>
>>
>> Hello,
>>
&g
Oke,
Can this also be the same problem.
In the text is this :
'tis is represent as "'this
And this
part is represent as part.
Roelof
> Date: Tue, 14 Sep 2010 11:41:28 +0100
> From: wpr...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] FW:
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Tue, 14 Sep 2010 21:30:01 +1000
> Subject: Re: [Tutor] FW: wierd replace problem
>
> On Tue, 14 Sep 2010 05:38:18 pm Roelof Wobben wrote:
>
>>>> Strip (
:28:10 -0400
>> From: joel.goldst...@gmail.com
>> To: tutor@python.org
>> Subject: Re: [Tutor] FW: wierd replace problem
>>
>>
>>
>> On Tue, Sep 14, 2010 at 10:29 AM, Roelof Wobben
>>> wrote:
>>
>> I offer my solution. I didn't
Date: Tue, 14 Sep 2010 17:45:35 +0200
From: f...@libero.it
To: tutor@python.org
Subject: Re: [Tutor] FW: wierd replace problem
On 14/09/2010 16.29, Roelof Wobben wrote:
>...
> Oke,
>
> I see the problem.
>
> When I have this sentence
> From: rwob...@hotmail.com
> To: sander.swe...@gmail.com
> Subject: RE: [Tutor] FW: wierd replace problem
> Date: Tue, 14 Sep 2010 17:40:28 +
>
>
>
>
>
>> From: sander.swe...@gmail.com
>> To: tutor@python.org
> Date: Tue, 14 Sep 2010 21:05:06 +0100
> Subject: Re: [Tutor] FW: wierd replace problem
> From: wpr...@gmail.com
> To: rwob...@hotmail.com
> CC: tutor@python.org
>
> Roelof,
>
> On 14 September 2010 17:35, Roelof Wobben
>> wrot
> Date: Tue, 14 Sep 2010 22:15:40 +0100
> From: wpr...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] FW: wierd replace problem
>
>
>
> On 14 September 2010 21:10, Roelof Wobben
>> wrote:
> I understand it but I try to
Hello,
As a exercise from this book ( Thinking like a computer scientist ) I have to
make this programm on this
page(http://openbookproject.net/thinkcs/python/english2e/ch12.html)
Exercise 11
#
# robots.py
#
from gasp import *
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
GRID_WIDTH = SCREEN_WIDTH
sleep(3)
end_graphics()
if __name__ == '__main__':
play_game()
And now Im getting this message :
** Message: pygobject_register_sinkfunc is deprecated (GtkWindow)
** Message: pygobject_register_sinkfunc is deprecated (GtkInvisible)
** Message: pygobject_register_sinkfunc i
From: __pete...@web.de
>> Date: Thu, 16 Sep 2010 20:10:02 +0200
>> Subject: Re: [Tutor] FW: robots question
>>
>> Roelof Wobben wrote:
>>
>>> I change everything to this :
>>
>>> def check_collisions(robots, junk, player):
>>
>>>
play_game():
begin_graphics(SCREEN_WIDTH, SCREEN_HEIGHT)
player = place_player()
robots = []
place_robots(4)
junk = [ place_robot(GRID_WIDTH/2, GRID_HEIGHT/2, junk=True )]
defeated = False
while not defeated:
quit = move_player(player)
if quit:
Hello,
I have this exercise :
Create and print a Point object, and then use id to print the
object’s unique identifier. Translate the hexadecimal form into decimal and
confirm that they match.
So I thought that this would solve it:
class Point:
def __init__(self, x=0, y=0):
self.x
From: st...@pearwood.info
>> To: tutor@python.org
>> Date: Sun, 19 Sep 2010 01:54:11 +1000
>> Subject: Re: [Tutor] class problem
>>
>> On Sat, 18 Sep 2010 07:14:03 pm Roelof Wobben wrote:
>>
>>> P=(Point)
>>
>> This line does not do what you think it does. B
Hello,
I have this exercise :
Rewrite the distance function from chapter 5 so that it takes two Points as
parameters instead of four numbers.
I have this solution :
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def distance(p1,p2):
dx
> Date: Sat, 18 Sep 2010 13:40:55 -0400
> From: bgai...@gmail.com
> To: rwob...@hotmail.com
> CC: tutor@python.org
> Subject: Re: [Tutor] next class problem
>
> On 9/18/2010 1:20 PM, Roelof Wobben wrote:
>>
>>
Hello,
I have this programm :
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
class Rectangle(Point):
def _init_(self, width=0, length=0):
self.width = width
self.length = length
punt = Point(3,4)
rechthoek = Rectang
> Date: Sun, 19 Sep 2010 14:19:46 +0200
> From: knack...@googlemail.com
> To: tutor@python.org
> Subject: Re: [Tutor] Can this be done easly
>
> Am 19.09.2010 10:49, schrieb Roelof Wobben:
>>
>>
>> Hello,
>>
&
> To: tutor@python.org
> From: __pete...@web.de
> Date: Sun, 19 Sep 2010 18:04:25 +0200
> Subject: Re: [Tutor] Can this be done easly
>
> Roelof Wobben wrote:
>
>> When I change everything to this :
>
>> I get this me
From: __pete...@web.de
>> Date: Sun, 19 Sep 2010 18:27:54 +0200
>> Subject: Re: [Tutor] Can this be done easly
>>
>> Roelof Wobben wrote:
>>
>>>> Hint: why does this work:
>>>>
>>>>> def __init__(self, x=0, y=0):
>>>
> To: tutor@python.org
> From: __pete...@web.de
> Date: Sun, 19 Sep 2010 20:07:05 +0200
> Subject: Re: [Tutor] FW: Can this be done easly
>
> Roelof Wobben wrote:
>
>> For this exercise :
>>
>> 3.Write a function
> From: andreeng...@gmail.com
> Date: Sun, 19 Sep 2010 20:54:01 +0200
> Subject: Re: [Tutor] FW: Can this be done easly
> To: rwob...@hotmail.com
> CC: tutor@python.org
>
> On Sun, Sep 19, 2010 at 8:33 PM, Roelof Wobben wrote:
>
&
1 - 100 of 137 matches
Mail list logo