forked from anshrathod/Basic-Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoops.py
More file actions
18 lines (15 loc) · 640 Bytes
/
oops.py
File metadata and controls
18 lines (15 loc) · 640 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#Creating a Class here
class SchoolMembers:
def __init__(self, name, age):
self.name = name
self.age = age
print('The School meber is {} whose age is {} .' .format(self.name, self.age))
def introduce(self):
print('Hello, My name is {} and my age is {} .'.format(self.name, self.age))
#Creating an instance of the class, i.e, object of class SchoolMembers..
p = SchoolMembers('Munish',21)
#Calling the method introduce of 'p' object which belongs to class SchoolMembers
p.introduce()
#The output will be:
# The School meber is Munish whose age is 21 .
# Hello, My name is Munish and my age is 21 .