Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Did the groups function as a team?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago