Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Student():
- def __init__(self,name,rollno,street,city,pincode):
- self.name = name
- self.rollno = rollno
- self.address = self.Address(street,city,pincode)
- def display(self):
- print("Student Name:",self.name)
- print("Student Roll No:",self.rollno)
- self.address.display()
- class Address():
- def __init__(self,street,city,pincode):
- self.street = street
- self.city = city
- self.pincode = pincode
- def display(self):
- print(f"Address: {self.street}, {self.city} - {self.pincode}")
- std1 = Student("Abu",101,7,"Bangalore",560001)
- std1.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement