Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task 7 Write a function add _ owners that will match cars with their owners based on a dictionary passed as a parameter. The dictionary
Task Write a function addowners that will match cars with their owners based on a dictionary passed as a parameter. The dictionary uses owners Person objects as keys and tuples of Car objects they own, as values. You mayshould reuse the previously developed function getaddress to retrieve Persons addresses. Note that this function does not print or return anything, its role is to modify existing objects. Example usage: houses h House Happy St Blackwood' h House Agnes Av Aldinga' h House Daw St Aldinga' h House Oak St Blackwood' h House Gorge Av Aldinga' h House Waterman St Aldinga' c CarFord'Mustang', c CarFord'Fiesta', c CarToyota'Camry', c CarMazdaCx c CarMazdaCx c CarMitsubishi'Colt', c CarToyota'Corolla', p PersonJim p PersonAshley p PersonCleo p PersonJessica p PersonAdam p PersonAndrew p PersonJake p PersonJoshua p PersonAmica p PersonHelen p PersonBarney p PersonSandra p PersonJohn p PersonPatrick p PersonSammy haddcarcc haddcarc haddcarc haddcarccc haddcarc haddcarcc haddinhabitantpppp haddinhabitantpp haddinhabitantppp haddinhabitantp haddinhabitantpp haddinhabitantppp houses.extendhhhhhh d p:ccp:ccp:ccc p:c addownershousesd printcgetownerslist printcgetownerslist printcgetownerslist output: Jim Happy St Blackwood'Cleo Happy St Blackwood' Ashley Happy St Blackwood' Adam Agnes Av Aldinga'
Task
Write a function addowners that will match cars with their owners based on a dictionary passed as a parameter. The dictionary uses owners Person objects as keys and tuples of Car objects they own, as values. You mayshould reuse the previously developed function getaddress to retrieve Persons addresses. Note that this function does not print or return anything, its role is to modify existing objects.
Example usage:
houses
h House Happy St Blackwood'
h House Agnes Av Aldinga'
h House Daw St Aldinga'
h House Oak St Blackwood'
h House Gorge Av Aldinga'
h House Waterman St Aldinga'
c CarFord'Mustang',
c CarFord'Fiesta',
c CarToyota'Camry',
c CarMazdaCx
c CarMazdaCx
c CarMitsubishi'Colt',
c CarToyota'Corolla',
p PersonJim
p PersonAshley
p PersonCleo
p PersonJessica
p PersonAdam
p PersonAndrew
p PersonJake
p PersonJoshua
p PersonAmica
p PersonHelen
p PersonBarney
p PersonSandra
p PersonJohn
p PersonPatrick
p PersonSammy
haddcarcc
haddcarc
haddcarc
haddcarccc
haddcarc
haddcarcc
haddinhabitantpppp
haddinhabitantpp
haddinhabitantppp
haddinhabitantp
haddinhabitantpp
haddinhabitantppp
houses.extendhhhhhh
d p:ccp:ccp:ccc p:c
addownershousesd
printcgetownerslist
printcgetownerslist
printcgetownerslist
output:
Jim Happy St Blackwood'Cleo Happy St Blackwood'
Ashley Happy St Blackwood'
Adam Agnes Av Aldinga'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started