Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given two lists of numbers, perform the operations as defined below: UNION: Newly generated list should contain all the common elements and the remaining elements

Given two lists of numbers, perform the operations as defined below:
UNION: Newly generated list should contain all the common elements and the remaining elements which are not common. EXCEPT: Remove odd value elements from the first list and even value elements from the second list and returns the new list. INTERSECT: Returns the new list with elements that are present in both the lists.
Input Format
Rate This Challenge:
Two lines of integers, separated by space First line will be the elements of first array Second line will be the elements of second array
More
The inputs will be given as strings, you have to include logic to parse and convert them as integers.
Constraints
All integers are positive. 1<= array size <=100
Output Format
Output should print 3 lines. First line should be the Union of two arrays, space separated. Second line should be the intersection of two arrays. Third line should be the except of two arrays.
Output should print 3 lines. First line should be the Union of two arrays, space separated. Second line should be the intersection of two arrays. Third line should be the except of two arrays.
Sample Input 01253891758
Sample Output 0
125389715828175
Explanation 0
Union of {1,2,5,3,8,9} U (1,7,5,8} is {1,2,5,3,8,9,7} since 1,5,8 are already present in first list, only 7 needs to be added at the end. Intersection (common elements) of both the lists are 1,5 and 8. Except (even values in first list U odd values in second list) is found by {2,8}U(1,7,5). in python code

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

Step: 3

blur-text-image

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions