22 lines
425 B
Text
22 lines
425 B
Text
|
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()
|
|||
|
|
|||
|
|