Question: def countNames(names): sol = {} firstName = [] for name in names: nameFirst, nameLast = name.split() sol[nameFirst] = list() sol[nameFirst].append(nameLast) firstName.append(nameFirst) return sol Test print

 def countNames(names): sol = {} firstName = [] for name innames: nameFirst, nameLast = name.split() sol[nameFirst] = list() sol[nameFirst].append(nameLast) firstName.append(nameFirst) return sol

Test print (countNames ((1)) dic=countNames( ["Michael Jackson", "Michael Jordan", "Michael Douglas "1)

"(" + ", ".join("Sr: "join("%r: ".join("%r: % (key, (key, (key, diclkey]) dic

def countNames(names): sol = {} firstName = [] for name in names: nameFirst, nameLast = name.split() sol[nameFirst] = list() sol[nameFirst].append(nameLast) firstName.append(nameFirst) return sol

Test print (countNames ((1)) dic=countNames( ["Michael Jackson", "Michael Jordan", "Michael Douglas "1) "(" + ", ".join("Sr: "join("%r: ".join("%r: % (key, (key, (key, diclkey]) dic [key]) diclkey]) print %r" for key in sorted (dic)) + ")" x dic countNames ([" Meghan Markle", "Prince Harry", "Meghan Trainor", "Prince William"]) print "(" + ", %r" % for key in sorted(dic)) ")" + x dic-countNames (["Mike Flynn","Adam Wager"Adam Dj", "Marie Lee", ""]) print "(" + ", %r" % for key in sorted (dic)) "}" +

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!