Question: write a function in python called garbage(p) that takes one arguement and determine if its garbage for example in the set {tophat,superhero,hat,top,hero,fog,s,u,p,e,r} tophat is considered

write a function in python called garbage(p)

that takes one arguement and determine if its garbage

for example in the set

{"tophat","superhero","hat","top","hero","fog","s","u","p","e","r"}

tophat is considered garbage becuase it can be written as top + hat

superhero is also considered garbage becuase it can be written as super+hero

it should return all elements in P that are not garbage

use only sets in the function do not use dictionaries, list, or tuples. calling the function should not modify P

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!