Skip to content

Commit 34384e5

Browse files
authored
Add files via upload
1 parent 8517d92 commit 34384e5

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class test:
2+
x = 3
3+
4+
y = test()
5+
print(y.x) # instance attribute is not present
6+
7+
y.x = 4 # instance attribute is created
8+
print(y.x) # now it prints the instance attribute
9+
10+
#-----instance attribute is printed but class attribute is not changed.
11+
print(test.x) # prints class attribute
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class message:
2+
@staticmethod
3+
def greet():
4+
print("Have a nice day!")
5+
6+
print(message.greet())

0 commit comments

Comments
 (0)