> From: keithw...@gmail.com
> Date: Mon, 13 Jan 2014 12:56:45 -0500
> Subject: Re: [Tutor] another better way to do this ?
> To: rwob...@hotmail.com
> CC: tutor@python.org
>
> On Mon, Jan 13, 2014 at 1:14 AM, Roelof Wobben wrote:
> > I have read all comments a
I have read all comments and im a little bit confused.
About which script are we talkimng about. I have seen a lot.
Roelof
> From: keithw...@gmail.com
> Date: Sun, 12 Jan 2014 16:43:40 -0500
> CC: tutor@python.org
> Subject: Re: [Tutor] another better way to do this ?
>
> On Sun, Jan 12, 2014
;Udacity') == 'Udacity'
print "Test case 3: ", fix_machine('AEIOU and sometimes y... c', 'Udacity') ==
'Udacity'
print "Test case 4: ", fix_machine('wsx0-=mttrhix', 't-shirt') == 't-shirt'
Roelof
&g
Hello,
I try to learn python by following the audicity page.
Now I have the following problem.
I have two strings a and b
Now I have to check if the characters of b are all in a.
But they do have to be in the same order.
So I thought about this solution.
length = len(b)
start = 1
wh
Thanks for all the remarks.
The problem was indeed a missing . at the end.
Roelof
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Wed, 24 Apr 2013 09:00:36 +0100
> Subject: Re: [Tutor] why does this not work
>
> On 24/04/13 04:27, frederico Batista wrote:
> > Dave, you clearly
Im trying to learn python by a course at codeacademy. Now I have this code :
def shut_down(s):
s = s.lower()
if s == "yes":
return "Shutting down..."
elif s == "no" :
return "Shutdown aborted!"
else:
return "Sorry, I didn't understand you"
But when I run
2010 at 6:43 PM, Alan Gauld
> > wrote:
>
> "Roelof Wobben" > wrote
>
>
>
> print ''.join([zf.getinfo('%s.txt' % p).comment for p in zpp])
>
> So I thought that this would be the same :
>
> for p in zpp:
> test = zf.getinfo
Hello,
I found this answer to a problem for me :
print ''.join([zf.getinfo('%s.txt' % p).comment for p in zpp])
So I thought that this would be the same :
for p in zpp:
test = zf.getinfo(p).comment
print ''.join(test)
But it seems not to work
Can anyone explain why not ?
Hello,
I have this code :
import urllib
import pickle
image = urllib.URLopener()
image.retrieve("http://www.pythonchallenge.com/pc/def/peak.html","banner.p"; )
plaatje = open("banner.p", "rb")
plaatje2 = pickle.load(plaatje)
But it gives this output :
Traceback (most recent call last)
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Wed, 13 Oct 2010 01:51:16 +1100
> Subject: Re: [Tutor] urllib problem
>
> On Tue, 12 Oct 2010 11:58:03 pm Steven D'Aprano wrote:
> > On Tue, 12 Oct 2010 11:40:17 pm R
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Tue, 12 Oct 2010 23:58:03 +1100
> Subject: Re: [Tutor] urllib problem
>
> On Tue, 12 Oct 2010 11:40:17 pm Roelof Wobben wrote:
>> Hoi,
>>
>> I have this prog
Hoi,
I have this programm :
import urllib
import re
f =
urllib.urlopen("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=6";)
inhoud = f.read()
f.close()
nummer = re.search('[0-9]', inhoud)
volgende = int(nummer.group())
teller = 1
while teller <= 3 :
url = "http://www.py
00
> From: f...@libero.it
> To: tutor@python.org
> Subject: Re: [Tutor] list of dict question
>
>
> Il 08/10/2010 10.02, Alan Gauld ha scritto:
>>
>> "Roelof Wobben" wrote
>>
>>> I have this programm :
>>>
>>> tournooi = [{'
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Fri, 8 Oct 2010 09:02:05 +0100
> Subject: Re: [Tutor] list of dict question
>
>
> "Roelof Wobben" wrote
>
>> I have this programm :
>>
>&
Hello,
I have this programm :
tournooi = [{'thuis': 'A','uit': "B",'thuisscore': 20, 'uitscore':
15},{'thuis': 'C','uit': "D",'thuisscore': 80, 'uitscore': 40}]
stand = []
tussen_thuis = {}
tussen_uit = {}
for wedstrijd in tournooi :
if wedstrijd['thuis'] in stand :
print "True"
ge from lists to tuples to dictionaries
>> and see what works.
>>
>> Ultimately this may even be best done using a database but
>> that's probably a step too far for you just now.
>>
>> Alan Gauld
>> Author of
ep too far for you just now.
>
> Alan Gauld
> Author of the Learn To Program website
> http://www.alan-g.me.uk/
>
>
>
>
> - Original Message
>> From: Roelof Wobben
>> To: alan.ga...@btinternet.com; tutor@python.org
>> Sent: Saturday, 2 October, 2010 14:15:33
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Sat, 2 Oct 2010 14:10:25 +0100
> Subject: Re: [Tutor] data question
>
>
> "Roelof Wobben" wrote
>
>> As a test I would write a programm where a us
: rwob...@hotmail.com; tutor@python.org
>> Subject: RE: [Tutor] data question
>> Date: Sat, 2 Oct 2010 09:02:41 -0400
>>
>>
>>
>>> -Original Message-
>>> From: tutor-bounces+bermanrl=cfl.rr....@python.org [mailto:tutor-
>>> bounces+b
Hello,
As a test I would write a programm where a user can input game-data like
home-team, away-team, home-score, away-score) and makes a ranking of it. And
I'm not looking of a OOP solution because im not comfertle with OOP.
Now my question is :
In which datatype can I put this data in.
>>>
>>> I assigned a card by this code :
>>>
>>> def deal(self, hands, num_cards=999):
>>> num_hands = len(hands)
>>> for i in range(num_cards):
>>> if self.is_empty(): break # break if out of cards
>>> card = self.pop() # take the top card
>>> hand = hands[i % num_hands] # whose turn is next?
>
tutor@python.org
>> From: alan.ga...@btinternet.com
>> Date: Fri, 1 Oct 2010 00:59:06 +0100
>> Subject: Re: [Tutor] inheritance problem
>>
>> "Roelof Wobben" wrote
>>
>>> So i have this programm now :
>>
>>> class
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Fri, 1 Oct 2010 00:59:06 +0100
> Subject: Re: [Tutor] inheritance problem
>
> "Roelof Wobben" wrote
>
>> So i have this programm now :
>
>> cl
hello,
Im following this page :
http://openbookproject.net/thinkcs/python/english2e/ch17.html
So i have this programm now :
class Card:
suits = ["Clubs", "Diamonds", "Hearts", "Spades"]
ranks = ["narf", "Ace", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "Jack", "Queen",
9/28/2010 10:22 AM, Roelof Wobben wrote:
> >
> >
> >
> >> Date: Tue, 28 Sep 2010 10:02:27 -0400
> >> From: da...@ieee.org
> >> To: rwob...@hotmail.com
> >> CC: tutor@python.org
> >> Subject: Re: [Tutor] question
> >>
> >>
>
>
> On 2:59 PM, Roelof Wobben wrote:
> > Hello,
> >
> >
> > Im now studying this page :
> > http://openbookproject.net/thinkcs/python/english2e/ch16.html
> >
> > But I don't get it why aces are now lower then deuces in the cmp function.
> &g
Hello,
Im now studying this page :
http://openbookproject.net/thinkcs/python/english2e/ch16.html
But I don't get it why aces are now lower then deuces in the cmp function.
Roelof
___
Tutor maillist - Tut
Hello,
Fine that you are in a arque
But can we come back to my problem.
How can I take care that test2 can be initialized.
Roelof
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscri
ments and you didn't define one default.
>> Try to do something like this:
>>
>> def find(self, strng=None, ch=None, start=None, stop=None):
>>
>> Or any other default values that matches your needs.
>>
>>
>>
>> On 25 September 2010 19:15
Hello,
I have this code:
class zoeken() :
pass
def __len__(self):
return 0
def __str__(self):
return test2
def find(self, strng, ch, start, stop):
index = start
while index < len(strng) and index < stop:
if strng[index] == ch:
> Date: Fri, 24 Sep 2010 06:29:03 -0400
> From: da...@ieee.org
> To: rwob...@hotmail.com
> CC: tutor@python.org
> Subject: Re: [Tutor] pure function problem
>
> On 2:59 PM, Roelof Wobben wrote:
>>
>>
>> --
he entire discussion every time you answer.
>
> On Fri, 24 Sep 2010 06:20:25 am Roelof Wobben wrote:
>
>> time = tijd()
> [...]
>> print time(uitkomst)
>
> Why are you calling time as a function, when it is a tijd instance?
>
>
>
>
> --
> Steven D
blem
>> From: jemejo...@gmail.com
>> To: tutor@python.org
>> CC: rwob...@hotmail.com
>>
>> The problem is that your class definition doesn't do anything to
>> explicitly set those attributes.
>>
>> On Thu, Sep 23, 2010 at 4:58 AM, Roelof Wobben wrote:
>
> On Thu, Sep 23, 2010 at 4:58 AM, Roelof Wobben wrote:
>
> > class tijd :
> >pass
>
> You're not doing any explicit setting of attributes at the class level.
>
>
> > time = tijd()
> > time.hour = 20
> > time.minutes = 20
>
Hello,
I have to rewrite a function to a pure function.
So i have this :
class tijd :
pass
def increment(time, seconds):
sum = tijd()
sum.seconds = time.seconds + seconds
if sum.seconds> 60 :
minutes, seconds = divmod(sum.seconds, 60)
sum.seconds = seco
> From: hugo.yo...@gmail.com
> Date: Wed, 22 Sep 2010 16:16:45 +0200
> Subject: Re: [Tutor] class function problem
> To: rwob...@hotmail.com
> CC: tutor@python.org
>
> On Wed, Sep 22, 2010 at 9:10 AM, Roelof Wobben wrote:
>>
HEllo,
I have this exercise :
3.Rewrite the increment function so that it doesn’t contain any loops.
The increment function looks like this :
def increment(time, seconds):
time.seconds = time.seconds + seconds
while time.seconds>= 60:
time.seconds = time.seconds - 60
> 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:
>
&
> 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: __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 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
> 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,
>>
&
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: 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 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
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 :
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
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:
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):
>>
>>>
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
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
> 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
> 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
> 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 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
: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
> 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 (
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:
> 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
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: 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
: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
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
> 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
.com
>>> To: tutor@python.org
>>> Subject: Re: [Tutor] wierd replace problem
>>>
>>>
>>>
>>> On Mon, Sep 13, 2010 at 12:37 PM, Roelof Wobben
>>>> wrote:
>>>
>>>
>>>
>>> ---
: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:
>>
>>
>>
>> ---
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
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
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
> 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
> 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:
>
>
>
> ___
> 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:
>
>
> ___
> 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
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',
> 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
-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
;> 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
> 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
> 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 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: 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.
> 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
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:
>
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 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("
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
: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
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
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
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
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 +
> 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
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([]):
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)
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: 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):
> >
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
> 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 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) +
> 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
1 - 100 of 137 matches
Mail list logo