Answer:
Explanation:
union function is used to get the set containing all elements in set1 and set2
intersection function is used to get the set containing the elements common in both sets.
- operator is used to get the set containing elements in set1 but not in set2
- operator is again used to get the set containing elements in set2 but not in set1
difference of union and intersection is taken to get the set containing the elements not shared by both sets.
Code:

set1 = {10, 20, 30, 40}
set2 = {30, 40, 50, 90}
set3 = set1.union(set2)
print(set3)
set4 = set1.intersection(set2)
print(set4)
set5 = set1 - set2
print(set5)
set6 = set2 - set1
print(set6)
set7 = set1.union(set2) - set1.intersection(set2)
print(set7)
Output:

PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!
I am using python, thanks! 2. Write code to create 2 sets with the following integers...
Using Java programming language, build a class called IntegerSet. Instructions - Create class IntegerSet An IntegerSet object holds integers in the range 0-100 Represented by an array of booleans, such that array element a[i] is set to true if integer i is in the set, and false otherwise Create these constructors and methods for the class IntegerSet() public IntegerSet union(IntegerSet iSet) public IntegerSet intersection(IntegerSet iSet) public IntegerSet insertElement(int data) public IntegerSet deleteElement(int data) public boolean isEqualTo(IntegerSet iSet) public String toString()...
I can't get my code to work on xcode and give me an output.
#include <conio.h>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
using namespace std; // So
"std::cout" may be abbreviated to "cout"
//Declare global arrays
int dummy1[10];
int dummy2[10];
int dummy3[10];
int universalSet[] = { 1, 2, 3, 4, 5, 6, 7, 8,
9, 10 };
//Function to return statement "Empty thread" when the
resultant set is
empty
string isEmpty(int arr[])
{
string...
This is a standard C++ programming assignment using a command line g++ compiler or the embedded one in zyBooks. No GUI forms and no Visual Studio. No external files and no databases are used. There is only one object-oriented program to complete in this assignment. All code should be saved in a file named ExamScoresUpdate.cpp, which is the only file to submit for grading. No .h files used. The .cpp file contains main() and two classes, ExamScores and DataCollector. There...
Python Question. I am trying to connect to a database and create a table using Python in this code but I keep getting an error on line 48 saying that "Quotes" is not defined. Could anyone please help me set this up correctly? I am using Azure SQL Database to create this. import pyodbc import json import requests as r import pprint connection_string = 'Driver={ODBC Driver 17 for SQL Server};' \ 'Server=randomquotegenerator.database.windows.net,1433;' \ 'Database=RandomQuoteGenerator;' \ 'Uid=carterholliday;' \ 'Pwd=MIS54002k19;' \ 'TrustServerCertificate=no;'...
Write Python code examples of statements to remove the name at position 2 from the list in problem 32, and to remove one of the remaining names by referencing that name. Write Python code to declare a tuple named stuck that holds the three remaining names from famfri by referencing those names as elemens of famfri. Declare a Python set containing the names of the four seasons. What happens if you declare a set using a list that contains two...
This needs to be in python, however, I am having trouble with the code. Is there any way to use the code that I already have under the main method? If so, what would be the rest of the code to finish it? #Create main method def main(): #Create empty list list=[] #Display to screen print("Please enter a 3 x 4 array:") #Create loop for rows and have each entered number added to list for i in range(3): list.append([int(x) for...
The following are short Python calculations. Give the answer and the Python code for each. 1. What is the sum of the numbers from 22:100 incrementing by 2? Do this in two ways: Use a while statement and a for loop to do the calculation. (Hint: make sure the numbers include 100) 2. What is the mean, standard deviation of the square root of the numbers from 3 to 5 incrementing by 0.1? Use the linspace function from the numpy...
1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...
This assignment shpuld be code in java. Thanks
Overview In this assignment you will write a program that will model a pet store. The program will have a Pet class to model individual pets and the Assignment5 class will contain the main and act as the pet store. Users will be able to view the pets, make them age a year at a time, add a new pet, and adopt any of the pets. Note: From this point on, your...
please write these as you would into python. . i will give an thumbs ups 1. Evaluate the following expressions using Python 1. Product of first 10 even integers. 2. Midterm scores of 4 students are 89, 78, 90, 98. Find the average of these scores. 3. Evaluate 3 to the power 7 4. Find the number of foot in 345 inches. 5. find the remainder when 34567 divides by 17. 2. animals = ['cat', 'dog', 'lion', 'tiger', 'monkey', 'hyena']...