Beginner Question

Garry Knight garryknight at gmx.net
Fri Mar 28 03:23:12 CET 2003


Kevin Reeder wrote:

>       self.cards[i], self.cards[j] = self.cards[j], self.cards[i]
> 
> The problem is to rewrite the last line without using a sequence
> assignment.

One way is by using a temporary variable:
        t = self.cards[i]
        self.cards[i] = self.cards[j]
        self.cards[j] = t

-- 
Garry Knight
garryknight at gmx.net   ICQ: 126351135
Linux registered user 182025




More information about the Python-list mailing list