diff --git a/Codes/Practical-A4.py b/Codes/Practical-A4.py index a1f7e45..380ba87 100644 --- a/Codes/Practical-A4.py +++ b/Codes/Practical-A4.py @@ -54,6 +54,12 @@ def intersection(setA, setB): intersectionSet.append(i) print(f"Intersection is:\t{intersectionSet}") +def iterator(setA): + a = iter(setA) + for i in range(0,len(setA)-1): + print(next(a),"->",end=' ') + print(next(a)) + def union(setA, setB): # Function to perform union of two sets unionSet = [] @@ -136,7 +142,14 @@ def main(): else: print("\nPlease choose a valid option.\n") elif (optn == 5): - print("\nIMPLEMENTATION PENDING\n") + setSel = int(input("Which set to operate on?\n1. Set one\n2. Set two\nSet 1/2:\t")) + a = None + if (setSel == 1): + iterator(setOne) + elif (setSel == 2): + iterator(setTwo) + else: + print("\nPlease choose a valid option.\n") elif (optn == 6): intersection(setOne, setTwo) elif (optn == 7): @@ -152,4 +165,4 @@ def main(): print("Please choose a valid option (1-10).") main() # Calling the main function -# END OF CODE \ No newline at end of file +# END OF CODE