Boston University Python Functions Returns Project

User Generated

uhfxlwnzrf

Programming

Boston University

Description

"""

This function returns the associated ‘scientific’ name. Input is the common names.

I am trying create a condition in this function. Function will output the all the keys

in the host_keywords dictionary if the input is not one of the common word or NULL.

"""

def get_keywords(word):

obama = "Obama"

trump = "Trump"

bernie = "Bernie"

biden = "Biden"

keywords = {

"Obamaaa" : obama,

"B.Obama" : obama,

"B.H.O" : obama,

"donald" : trump,

"d.j.trump" : trump,

"joe" : biden,

"j.biden" : biden

}

if word != keywords.keys:

return keywords.keys

else:

return keywords[word]

print(get_keywords('BBB'))

Unformatted Attachment Preview

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

The soluti...

Related Tags