GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.hackerrank.com — Set Mutations | HackerRank We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies. We have seen the applications of union, intersection, difference and symmetric difference operations, but these operations do not make any changes or mutations to the set. We can use the following operations to create mutations to a set: .update() or >>> H = set("Hacker") >>> R = set("Rank") >>> H.update(R) >>> print H set(['a', 'c', 'e', 'H', 'k', 'n', 'r', 'R']) .intersection_update() or >>> H = set("Hacker") >>> R = set("Rank") >>> H.intersection_update(R) >>> print H set(['a', 'k']) .difference_update() or >>> H = set("Hacker") >>> R = set("Rank") >>> H.difference_update(R) >>> print H set(['c', 'e', 'H', 'r']) .symmetric_difference_update() or >>> H = set("Hacker") >>> R = set("Rank") >>> H.symmetric_difference_update(R) >>> print H set(['c', 'e', 'H', 'n', 'r', 'R']) TASK Your task is to execute those operations and print the sum of elements from set . Input Format The first line contains the number of elements in set . len(set(A)) Output Format Output the sum of elements in set . Sample Input Sample Output Explanation After the first operation, (intersection_update operation), we get: After the second operation, (update operation), we get: After the third operation, (symmetric_difference_update operation), we get: After the fourth operation, ( difference_update operation), we get: The sum of elements in set after these operations is . Cookie support is required to access HackerRankSeems like cookies are disabled on this browser, please enable them to open this website |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |