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 08:10
Ihave a music player on my phone. i can buy songs, add them to playlists and play them. obviously it would be redundant to store each song in each playlist; each playlist is just a list of pointers to the songs. for this lab you will simulate this behavior. your program will need to have options to: add songs to the system library (you will store the text of the first line of the song, rather than the audio) add playlists add songs to a playlist list playlists play a playlist list all of the songs in the library with a count of how many times each song has been played remove a song from a playlist remove a playlist remove a song from the library (and thus from all playlists that contain it) note that we will not be checking many error cases. in real programming this would be bad, you should usually try to recognize and respond to as many types of errors as you can. in the context of class we are trying to acquaint you with as many concepts as possible, so for the sake of educational efficiency we will not be checking most errors in this lab, you may assume that your user provides correct input. you may add all appropriate error testing if you wish, but we will not be testing for it.
Answers: 2
question
Computers and Technology, 24.06.2019 00:50
Which of the following is not a key player in the sale of travel products?
Answers: 2
question
Computers and Technology, 24.06.2019 19:30
Which phrase is the best definition of a pivottable a a table containing data that is organized horizontally b a table used to calculate financial pivot values c a tool used to summarize data d a table containing specific formatting
Answers: 1
question
Computers and Technology, 25.06.2019 05:00
Craig keeps missing important staff meetings and getting double-booked for appointments. craig should use scheduling software a database diagramming software a word processor
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, 16.12.2020 17:50
question
Health, 16.12.2020 17:50
question
Mathematics, 16.12.2020 17:50