CS计算机代考程序代写 ”’

”’
CSC373 Fall 2021
Problem Set 3, Laptop Peripherals
University of Toronto Mississauga
”’

# Do NOT add any “import” statements

def max_devices(ports, devices, adapters):
”’Given a list of ports available on the laptop,
a list of pairs of devices and their corresponding ports,
and a list of adapter types, find and return the maximum number
of devices that can connect to the laptop simultaneously.
”’
pass # TODO: implement this function

if __name__ == ‘__main__’:
# Small test case mentioned in the problem statement.
ports = [
“USB”,
“3.5mm audio”,
“SD slot”,
“Ethernet”,
]
devices = [
(“scanner”, “USB”),
(“mouse”, “USB”),
(“keyboard”, “USB”),
(“headphones”, “3.5mm audio”),
(“printer”, “parallel”),
]
adapters = [
(“parallel”, “Ethernet”), # parallel to Ethernet (but not vice versa)
(“parallel”, “SD slot”),
]

print(max_devices(ports, devices, adapters)) # Answer should be 3