课程内容更新

This commit is contained in:
LSGOMYP
2020-08-01 18:21:09 +08:00
parent dee658467d
commit 48cb16570a
2 changed files with 6 additions and 4 deletions

View File

@@ -404,7 +404,7 @@ print(n) # 120
def factorial(n):
if n == 1:
return 1
return n * fact(n - 1)
return n * factorial(n - 1)
print(factorial(5)) # 120

View File

@@ -534,9 +534,11 @@ c = A()
【例子】
```python
class A():
a = xx #类属性
def __init__(self):
A.a = xx #使用类属性可以通过 (类名.类属性)调用。
a = 0 # 类属性
def __init__(self, xx):
# 使用类属性可以通过 (类名.类属性)调用。
A.a = xx
```