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
for me at once! And no, not all the functionality of a real game is > implemented. The code is pretty raw. I'm just a hobbyist trying to learn a > few things in my spare time. > > Thanks in advance. > > Luke > > ---------- > > Message: 2 &

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