-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagicFunctions
More file actions
30 lines (22 loc) · 754 Bytes
/
Copy pathMagicFunctions
File metadata and controls
30 lines (22 loc) · 754 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
class person():
###Class variable: Common for all variables of the same class
National="INDIAN"
def __init__(self,pname,clg):
##Instance variables : Different for every instance of the class
self.college=clg
self.name=pname
def sayHi(self,name):
print("hello "+name)
def introduce(self):
print("My name is "+self.name)
print("I study in "+self.college)
print("My nationality is "+self.National)
def secretActivity(self):
print("Doing secret activity " +self.name)
p=person("Prubhtej Singh","GTBIT")
p.sayHi("World")
p.introduce()
print("\n ")
p2=person("Abhishek","MAIT")
p2.introduce()
p.secretActivity()