class Student: def init(self): self.name = None self.rollno = None def set_info(self, Name, Rollno): self.name = Name self.rollno = Rollno ) code example
Example 1: class Student: def init(self): self.name = None self.rollno = None def set_info(self, Name, Rollno): self.name = Name self.rollno = Rollno )
class Student:
def init(self):
self.name = None
self.rollno = None
def set_info(self, Name, Rollno):
self.name = Name
self.rollno = Rollno
def get_info(self):
self.name = input(“enter name”)
self.rollno = input(“enter Rollono”)
def show_info(self):
print(“Name is”, self.name )
print(“Rollno is”, self.rollno)
#now in the nxt window i imported my class
from sinfo import Student
s1 = Student()
s1.set_info(“badar” , 999)
s1.get_info()
s1.show_info()
Example 2: class Student: def init(self): self.name = None self.rollno = None def set_info(self, Name, Rollno): self.name = Name self.rollno = Rollno )
class Student:
def init(self):
self.name = None
self.rollno = None
def set_info(self, Name, Rollno):
self.name = Name
self.rollno = Rollno
def get_info(self):
self.name = input(“enter name”)
self.rollno = input(“enter Rollono”)
def show_info(self):
print(“Name is”, self.name )
print(“Rollno is”, self.rollno)
#now in the nxt window i imported my class
from sinfo import Student
s1 = Student()
s1.set_info(“badar” , 999)
s1.get_info()
s1.show_info()