Question

In: Computer Science

In DrRacket Write a function, removeAll, which takes two lists, list-a and list-b and returns a...

In DrRacket

Write a function, removeAll, which takes two lists, list-a and list-b and returns a list containing only the items in list-a that are not also in list-b. E.g., (remove-all '(a b b c c d) '(a c a)) -> '(b b d)

Solutions

Expert Solution

PYTHON CODING:-

OUTPUT:-

1.

Enter the no of items in the first list:6
Enter the items of the first list:
a
b
b
c
c
d
Enter the no of items in the second list:3
Enter the items in the second list:
a
c
a
The first input list:
['a', 'b', 'b', 'c', 'c', 'd']
The second input list:
['a', 'c', 'a']
The output list:
['b', 'b', 'd']

2.

Enter the no of items in the first list:4
Enter the items of the first list:
book
pen
mobile
scale
Enter the no of items in the second list:3
Enter the items in the second list:
book
pen
watch
The first input list:
['book', 'pen', 'mobile', 'scale']
The second input list:
['book', 'pen ', 'watch']
The output list:
['pen', 'mobile', 'scale']


Related Solutions

write a member function in C++ , that takes two lists and return list that contain...
write a member function in C++ , that takes two lists and return list that contain the merge of the two lists in the returned list: first insert the first list and then the second list  
1.Write a function div7(lst) which takes in a list of integers, and returns a list of...
1.Write a function div7(lst) which takes in a list of integers, and returns a list of booleans of the same length, such that for each integer in the original list, the boolean in the output list is True if that integer was divisible by 7, or False if not. Use list comprehensions in python, the function only could be at most two lines long. Here is some examples: >>> div7([14, 5, 7, 3, 29, 28, 10]) [True, False, True, False,...
Write a function that takes a list of integers as input and returns a list with...
Write a function that takes a list of integers as input and returns a list with only the even numbers in descending order (Largest to smallest) Example: Input list: [1,6,3,8,2,5] List returned: [8, 6, 2] Do not use any special or built in functions like append, reverse etc.
Write a LISP function COUNTX which takes an atom and a list and returns the number...
Write a LISP function COUNTX which takes an atom and a list and returns the number of top-level occurrences of the atom in the list. For example: (COUNTX ‘A ‘(A (A B) B A B A (B A)) Returns the value 3, the other two A’s are not at the top level
Python Question Using lists, write the function non_unique(list) that takes a list list as argument. It...
Python Question Using lists, write the function non_unique(list) that takes a list list as argument. It returns a list which duplicated elements remains and each duplicated element is followed by a number which shows how many times it appears. All elements in return list should be in the same order as their appearance in the original list. For example, given the input [‘a’, ‘b’, ‘c’, ‘a’, ‘b’, ‘d’, ‘a’,‘e’], the function would return [‘a’, 3, ‘b’, 2]. Another example, ['abc',...
Write a Python function that takes a list of integers as a parameter and returns the...
Write a Python function that takes a list of integers as a parameter and returns the sum of the elements in the list. Thank you.
Write a Python function that takes a list of integers as a parameter and returns the...
Write a Python function that takes a list of integers as a parameter and returns the sum of the elements in the list. Thank you.
We were asked this: Write a function that takes a list, and returns a list representing...
We were asked this: Write a function that takes a list, and returns a list representing each word whose reverse is also in the list. def find_reversals(lst: List[str]) -> List[str]: Each pair, such as 'abut', 'tuba', should be represented by the first element encountered. Don't report the same pairs twice. Don't list palindromes. I wrote this, which might not be optimal but passes the unit test! def find_reversals(lst): #Place to save to found_reversals=[]    #Make each string lowercase for i...
USING PYTHON, write a function that takes a list of integers as input and returns a...
USING PYTHON, write a function that takes a list of integers as input and returns a list with only the even numbers in descending order (Largest to smallest) Example: Input list: [1,6,3,8,2,5] List returned: [8, 6, 2]. DO NOT use any special or built in functions like append, reverse etc.
Use Scheme Language Write a Scheme function that takes a list and returns a list identical...
Use Scheme Language Write a Scheme function that takes a list and returns a list identical to the parameter except the third element has been deleted. For example, (deleteitem '(a b c d e)) returns ‘(a b d e) ; (deleteitem '(a b (c d) e)) returns ‘(a b e).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT