Advertisement
GamerBhai02

APP Exp 15

May 29th, 2025
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | Source Code | 0 0
  1. class Student():
  2.     def __init__(self,name,rollno,street,city,pincode):
  3.         self.name = name
  4.         self.rollno = rollno
  5.         self.address = self.Address(street,city,pincode)
  6.     def display(self):
  7.         print("Student Name:",self.name)
  8.         print("Student Roll No:",self.rollno)
  9.         self.address.display()
  10.     class Address():
  11.         def __init__(self,street,city,pincode):
  12.             self.street = street
  13.             self.city = city
  14.             self.pincode = pincode
  15.         def display(self):
  16.             print(f"Address: {self.street}, {self.city} - {self.pincode}")
  17. std1 = Student("Abu",101,7,"Bangalore",560001)
  18. std1.display()
Tags: exp 15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement