PYTHON PROGRAMMING ONLY Instructions: 1. Must be user input 2. NO BUILT IN FUNCT
ID: 658060 • Letter: P
Question
PYTHON PROGRAMMING ONLY
Instructions:
1. Must be user input
2. NO BUILT IN FUNCTIONS
3. Can use: list, length, in, not in, range, lists, size
4. Must use def main():
5. Must use input validation
6. No append
Design a program that creates two subsets, first one having 3 numbers, the second having 4 numbers. Then you must join the subsets without duplication. MUST BE USER INPUT!!! Example is shown below.
Subset A = {1,2,3}
Subset B = {6,5,4,3}
Subset C = A join B {1,2,3,4,5,6}
You want to join the two subsets without duplication
No Duplication of A and B to get C
I NEED THE CODE
Explanation / Answer
The above method is using Union Method we can find out the unique numbers in both lists and combine the two lists.
Now without using Union method we try to write the code for combining two lists.
j=0
for i in range(len(C)):
if C[j]==C[i+1]
c.pop(i)
j=j+1
Therfore this is the code without using union or unique methods.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.