Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
