class student:
x = 0
c = 0
def f(stu):
stu.x = 20
stu.c = 'c'
a = student()
a.x = 3
a.c = 'a'
f(a)
print(a.x, a.c)
結構體變量傳遞
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
輸入一個奇數,然後判斷最少幾個 9 除於該數的結果爲整數
i = int(input("請輸入一個奇數:")) n = "9" a = True while a: if int(n)%i != 0: n += "9" else: a =