Write the Division class so that the given code provides the expected output. You can not change the given code. dhaka = Division() print('----------------------------------') dhaka.printDetail() print('----------------------------------') dhaka.add_district("Narayanganj", "Gazipur") print('----------------------------------') dhaka.setName("Rangpur") print('----------------------------------') dhaka.setName("Dhaka") dhaka.add_district("Narayanganj") dhaka.printDetail() print('----------------------------------') dhaka.add_district("Gazipur", "Munshiganj") dhaka.printDetail() print("===================================") chittagong = Division("Chittagong") chittagong.add_district("Feni", "Comilla", "Cox's Bazar") chittagong.printDetail() print("===================================") sylhet = Division("Sylhet") sylhet.add_district("Habiganj") sylhet.printDetail() Expected Output: ---------------------------------- Name of division is not set ---------------------------------- You must set name of division first before adding district ---------------------------------- Invalid name. Name must be among "Dhaka", "Sylhet", or "Chittagong" ---------------------------------- Division: Dhaka Districts: ['Narayanganj'] Neighbour Divisions: Sylhet Chittagong ---------------------------------- Division: Dhaka Districts: ['Narayanganj', 'Gazipur', 'Munshiganj'] Neighbour Divisions: Sylhet Chittagong =================================== Division: Chittagong Districts: ['Feni', 'Comilla', "Cox's Bazar"] Neighbour Divisions: Dhaka Sylhet =================================== Division: Sylhet Districts: ['Habiganj'] Neighbour Divisions: Dhaka Chittagong SOLVE WITHIN 40 MINS SIR PLEASE
Write the Division class so that the given code provides the expected
output. You can not change the given code.
dhaka = Division()
print('----------------------------------')
dhaka.printDetail()
print('----------------------------------')
dhaka.add_district("Narayanganj", "Gazipur")
print('----------------------------------')
dhaka.setName("Rangpur")
print('----------------------------------')
dhaka.setName("Dhaka")
dhaka.add_district("Narayanganj")
dhaka.printDetail()
print('----------------------------------')
dhaka.add_district("Gazipur", "Munshiganj")
dhaka.printDetail()
print("===================================")
chittagong = Division("Chittagong")
chittagong.add_district("Feni", "Comilla", "Cox's Bazar")
chittagong.printDetail()
print("===================================")
sylhet = Division("Sylhet")
sylhet.add_district("Habiganj")
sylhet.printDetail()
Expected Output:
----------------------------------
Name of division is not set
----------------------------------
You must set name of division first before adding district
----------------------------------
Invalid name. Name must be among "Dhaka", "Sylhet", or "Chittagong"
----------------------------------
Division: Dhaka
Districts: ['Narayanganj']
Neighbour Divisions:
Sylhet
Chittagong
----------------------------------
Division: Dhaka
Districts: ['Narayanganj', 'Gazipur', 'Munshiganj']
Neighbour Divisions:
Sylhet
Chittagong
===================================
Division: Chittagong
Districts: ['Feni', 'Comilla', "Cox's Bazar"]
Neighbour Divisions:
Dhaka
Sylhet
===================================
Division: Sylhet
Districts: ['Habiganj']
Neighbour Divisions:
Dhaka
Chittagong
SOLVE WITHIN 40 MINS SIR PLEASE
Step by step
Solved in 4 steps with 3 images