Write a Python program (hat reads three lists of positive integers into three se
ID: 3686862 • Letter: W
Question
Write a Python program (hat reads three lists of positive integers into three separate lists and creates a fourth list that is the intersection of the three lists. The intersection is defined as those values that appear in all three lists. For instance, if the three lists were: [9. 2. 3.4], [4, 3, 6, 5| and [3. 2. 1.4], the intersection would be the set [3, 4] because the values 3 and 4 appear in all three lists. If there are no values in common, this is called an "empty" intersection. Request the values in each list by prompting the user to enter positive integers and to signal the end of input by typing a zero. You may assume that the user will enter the same number of values for each list. Then, calculate the intersection and. if the intersection is non-empty, print the intersection. If the intersection is empty, print an appropriate message. Write a Python program that determines which values are repeated in a list of positive integers. Prompt the user to enter positive integers and store them in a list. The user should enter zero to signal the end of input. Then, use a loop to determine which numbers appear more than once in the list. (There are Python functions that will help you out with this.) In a separate list store those values which appear more than once, but store each number only once. For example, suppose the number 5 appears 4 times in the input. You should store only one 5 in your list of duplicates. After placing the duplicated values in a list, sort the values and then print them out. An example run of the program is given below. Note how in the list of duplicates each value that appeared more than once in the original list is printed only once.Explanation / Answer
45)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.