diff --git a/classes/class1.py b/classes/class1.py new file mode 100644 index 0000000..a504d9d --- /dev/null +++ b/classes/class1.py @@ -0,0 +1,13 @@ +class student(): + name = "rakesh" + website ="binarynote.com" + expertise ="PHP, CSS, HTML,JavaScript,JQuery,WordPress and Now Python Django" + + def showMessage(self): + print("This is a demo message from class ") + +s = student() + +print("Default Behaviour of Class Members in Python\n\n\nName : ",s.name) +print("website : ", s.website) +print("Expertise :", s.expertise,"\n") diff --git a/classes/classDemo.py b/classes/classDemo.py index 8c1694b..55266d3 100644 --- a/classes/classDemo.py +++ b/classes/classDemo.py @@ -1,14 +1,14 @@ -class student(): +class student: def read_data(self,name,fatherName,stream): - name = self.name; - fatherName = self.fatherName - stream = self.stream + self.name = name + self.fatherName = fatherName + self.stream = stream def show_data(self): print("Student Name ",self.name) print("father Name ",self.fatherName) print("Stream Name ",self.stream) -student s; +s = student() s.read_data('rakesh','jagdish','computer') s.show_data() \ No newline at end of file