编辑代码

struct BasketBallPlayer{
    var name:String
    var threePointShot:Int
    var twoPointShot:Int
    var score:Int{
        get{
            return 2*twoPointShot+3*threePointShot
        }
    }
    mutating func shot(point:Int){
        if point == 3{
            threePointShot += 1
        }else if point == 2{
            twoPointShot += 1
        }
    }
    func description(){
        print("""
            Player \(name) 
            three point shot\(threePointShot) 
            two point shot\(twoPointShot)
            the total score is \(score)
            """)
    }
}

var player = BasketBallPlayer(name:"Kobe",threePointShot:1,twoPointShot:2)