资源简介

与孩子一起学Python(PDF书、源代码素材)

资源截图

代码片段和文件信息

# cards.py
# Copyright Warren Sande 2009
# Released under MIT license   http://www.opensource.org/licenses/mit-license.php
# Version 61  ----------------------------

# playing card class

class Card:
    def __init__(self suit_id rank_id):
        self.rank_id = rank_id
        self.suit_id = suit_id
        
        if self.rank_id == 1:                               
            self.rank = “Ace“                               
            self.value = 1                                  
        elif self.rank_id == 11:                            
            self.rank = “Jack“                              
            self.value = 10                                 
        elif self.rank_id == 12:                            
            self.rank = “Queen“                             
            self.value = 10                                 
        elif self.rank_id == 13:                            
            self.rank = “King“                              
            self.value = 10                                 
        elif 2 <= self.rank_id <= 10:                       
            self.rank = str(self.rank_id)                   
            self.value = self.rank_id                       
        else:
            self.rank = “RankError“                         
            self.value = -1                                 
            
        if self.suit_id == 1:                               
            self.suit = “Diamonds“                          
        elif self.suit_id == 2:                             
            self.suit = “Hearts“                            
        elif self.suit_id == 3:                             
            self.suit = “Spades“                            
        elif self.suit_id == 4:                             
            self.suit = “Clubs“                             
        else:                                               
            self.suit = “SuitError“                         
        self.short_name = self.rank[0] + self.suit[0]
        if self.rank == ‘10‘:
            self.short_name = self.rank + self.suit[0]
        self.long_name = self.rank + “ of “ + self.suit

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件    72503539  2016-10-27 23:21  与孩子一起学编程_中文版_详细书签.pdf
     目录           0  2019-01-08 09:06  与孩子一起学编程_源代码\
     文件      682346  2008-12-07 19:08  与孩子一起学编程_源代码\Ahoy.wav
     目录           0  2019-01-08 09:06  与孩子一起学编程_源代码\Answers\
     文件      679404  2008-12-07 19:47  与孩子一起学编程_源代码\Answers\Ahoy.wav
     文件      265612  2008-12-07 19:09  与孩子一起学编程_源代码\Answers\AvastGotIt.wav
     文件      321196  2008-12-07 19:09  与孩子一起学编程_源代码\Answers\NoMore.wav
     文件         374  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH12_1.py
     文件         413  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH12_2.py
     文件         373  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH12_3.py
     文件         537  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH12_4.py
     文件        1283  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH14_1.py
     文件        1484  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH14_2.py
     文件         268  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH15_4.py
     文件        1319  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH16_1.py
     文件         655  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH16_5.py
     文件        6728  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH18_2.py
     文件        1966  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH19_1.py
     文件        1837  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH20_1.py
     文件         477  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH21_1.py
     文件         354  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH21_3.py
     文件         829  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH22_1.py
     文件         556  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH22_2.py
     文件         549  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH22_3.py
     文件        7340  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH24_1.py
     文件        7334  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH24_2.py
     文件        9011  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH24_3.py
     文件        3643  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_CH24_3.rsrc.py
     文件        2325  2009-06-30 23:40  与孩子一起学编程_源代码\Answers\TIO_Ch20_1.rsrc.py
     文件      154444  2008-12-07 19:09  与孩子一起学编程_源代码\Answers\TooHigh.wav
     文件      184926  2008-12-07 19:09  与孩子一起学编程_源代码\Answers\TooLow.wav
............此处省略294个文件信息

评论

共有 条评论