We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
0 parents commit 9187d09Copy full SHA for 9187d09
.DS_Store
6 KB
code/Class objects and methods.py
@@ -0,0 +1,33 @@
1
+#Class objects and methods
2
+
3
+class Person:
4
+ name=""
5
6
+ def setName(self,name):
7
+ self.name=name
8
9
+ def getName(self):
10
+ return self.name
11
12
+ def greet(self):
13
+ return "Hello {}".format(self.name)
14
15
16
+p=Person()
17
18
+print(p.name)
19
+p.setName("Vaibhav")
20
21
+p.setName("Ri")
22
23
24
+p2=Person()
25
26
+print(p2.name)
27
+p2.setName("Ha")
28
29
+p2.setName("Hp")
30
31
32
33
output/output.png
835 KB
0 commit comments