subject

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}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:20
Cengagenowv2 is a comprehensive online learning tool. using cengagenowv2, you may access all of the following except: 2. each time you log in, cengagenowv2 automatically performs a system check and informs you if your computer does not meet the cengagenowv2 system requirements. 3. which tab/page allows you to easily track your assignment scores, number of submissions, time spent, as well as the ability view assign
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
Which of the following is not a symptom of chronic fatigue syndrome
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
With editing, word automatically displays a paste options button near the pasted or moved text. a. cut-and-paste b. drag-and-drop c. inline d. copy-and-carry
Answers: 1
You know the right answer?
Write a Python program for each of the problems in this lab. Please use PyCharm to type and test you...
Questions
question
Mathematics, 18.03.2021 20:00
question
Mathematics, 18.03.2021 20:00
question
Biology, 18.03.2021 20:00
question
Geography, 18.03.2021 20:00
question
Mathematics, 18.03.2021 20:00
Questions on the website: 13722363