Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function create _ social _ network ( traders ) that takes traders, a list of tuples specifing trader connections ( edges in the
Write a function createsocialnetworktraders that takes traders, a list of tuples specifing trader connections edges in the trader social network and returns a list containing trader directconnections for each trader in traders.
Input:
traders: a list of tuples specifing trader connections edges in the trader social network Each tuple is of the form trader trader where trader and trader are string names of each trader.
Your function should return list of tuples in alphanumeric order of trader name, where each tuple is of the form trader directconnections and directconnections is an alphanumerically sorted list of that trader's direct connections ie there exists an edge between them in the trader social network
You may assume:
Inputs are correctly formatted data structures and types. Just like Qa you don't need to guard against something like TTTT or duplicate entries.
The pictured example:
createsocialnetworktraders
TTTTTTTTTTTTTTT
Another example not pictured:
createsocialnetworktraders
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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