Computers and Technology

Write a Python program for each of the problems in this lab. Please use PyCharm to type and test your programs. Problem 1
This program is about sets. Write a Python program to do the following:
(a) Generate 5 random integers between 1 and 10, inclusive. Store the random integers in a set named set1. Display the set. Please note that the set may have less than 5 elements because some of the random integers generated may be redundant.
(b) Generate 5 random integers between 1 and 10, inclusive. Store the random integers in another set named set2. Display the set. Please note that the set may have less than 5 elements because some of the random integers generated may be redundant.
(c) Find and display the union of set1 and set2.
(d) Use set comprehension to select odd numbers from the union and store them in a set. Display this set.
(e) Find and display the intersection of set1 and set2.
(f) Find and display the symmetric difference of set1 and set2.
The following is an example.
set1: {9, 10, 1, 7} set2: {8, 1, 7} Union of set1 and set2: {1, 7, 8, 9, 10} Odd numbers in union of seti and set2: {1, 9, 7}| Intersection of set1 and set2: {1, 7} Symmetric difference of set1 and set2: {8, 9, 10}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 20:00, spetgrave069
2.)how does a graphical user interface (gui) on a touchscreen interface differ from a gui on a desktop or laptop? a.)a finger or stylus is used instead of a pointer. b.) a magic wand is used instead of a pointer. c.)users speak commands instead of using a pointer. d.)users visualize commands instead of using a pointer.
Answers: 1
image
Computers and Technology, 22.06.2019 14:00, GGerardi7552
What are procedures that keep a data base current
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, bowmanari2154
What is used to analyze and summarize your data without graphical support
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, devenybates
Which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
Do you know the correct answer?
Write a Python program for each of the problems in this lab. Please use PyCharm to type and test you...

Questions in other subjects:

Konu
Mathematics, 10.12.2020 20:30
Konu
Biology, 10.12.2020 20:30