-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoops.py
More file actions
40 lines (23 loc) · 974 Bytes
/
oops.py
File metadata and controls
40 lines (23 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Initiating a class:
class employee:
# Class attributes
def __init__(self):
print("Started Executing attributes/data")
self.id = 1009
self.age = 26
self.salary = 100000
self.designation = "AI Engineer"
print("Finished Executing attributes/data")
def travel(self, destination):
print("This travel Method is called manually")
print(f"Employee is travelling to {destination}")
# Creating an object of the class:
aniket = employee()
ram = employee()
#print(aniket.salary) # Accessing the class attribute using the object
aniket.travel("Pune") # Calling the method using the object
print(type(aniket)) # Checking the type of the object
print(id(aniket)) # Checking the memory address of the object
print(id(ram)) # Checking the memory address of the object
print(aniket.__class__) # Checking the class of the object
print(aniket.__dict__) # Checking the attributes of the object