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
Get step-by-step solutions from verified subject matter experts
