17 lines
474 B
Python
17 lines
474 B
Python
x = 10 # x bir global değişken
|
||
|
||
class Sample:
|
||
y = 20 # y bir sınıf özniteliği
|
||
print(x) # 10
|
||
print(y) # 20
|
||
|
||
|
||
def foo(self):
|
||
z = 30 # z bir yerel değişken
|
||
print(z) # 30
|
||
print(Sample.y) # 20
|
||
|
||
print(x) # 10
|
||
print(Sample.y) # 20
|
||
s = Sample()
|
||
s.foo()
|