Re: [Tutor] Debugging While Loops for Control

2012-02-17 Thread Peter Otten
Alan Gauld wrote: >>The "x for x in y:" syntax makes it harder to follow for learners, > > Read about list comprehensions first. > It helps if you studied sets in math at school. The format is > somewhat like the math notation for defining a set. But FWIW it took me > a long time to get used to t

Re: [Tutor] Debugging While Loops for Control

2012-02-17 Thread Robert Sjoblom
>> class Card(object): >>        def __init__(self): >>                self.score = self.deal() >> >>        def deal(self): >>                """deal a card from 1 to 52 and return it's points""" >>                return self.getValue(int(math.floor(random.uniform(1, >> 52 > > I think you only

Re: [Tutor] Debugging While Loops for Control

2012-02-17 Thread Alan Gauld
On 17/02/12 03:27, Luke Thomas Mergner wrote: In the meantime, and continuing my problem of over-cleverness, At least you know what your problem is :-) Bonus question: when I create a the "def score(self)" in class Hand, > should that be an generator? No. And if so where do I go as a n

Re: [Tutor] Debugging While Loops for Control

2012-02-16 Thread Luke Thomas Mergner
> > -- > > Message: 1 > Date: Wed, 15 Feb 2012 23:57:08 -0500 > From: Luke Thomas Mergner > To: tutor@python.org > Subject: [Tutor] Debugging While Loops for Control > Message-ID: > Content-Type

Re: [Tutor] Debugging While Loops for Control

2012-02-16 Thread Alan Gauld
On 16/02/12 04:57, Luke Thomas Mergner wrote: My problem is that I am using two functions that return True or False > to determine whether the player receives another card. Because of the way it evaluates the while condition, it either > prints too little information or previously called the

[Tutor] Debugging While Loops for Control

2012-02-15 Thread Luke Thomas Mergner
Hi, I've been translating and extending the Blackjack project from codeacademy.com into Python. My efforts so far are here: https://gist.github.com/1842131 My problem is that I am using two functions that return True or False to determine whether the player receives another card. Because of th