Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the following code to generate two lists of random numbers >>> #irand is a function given to the students that generates a list of

image text in transcribed
Use the following code to generate two lists of random numbers >>> #irand is a function given to the students that generates a list of length >>> is the random selection of the integers from 0 to 1- without replacement. >>> det irandin, m): generate an array of length n made up of random integers import random between 0 and without replacement blist (range (n)) brandom. sample (range (m),n) return b >>># I haven't decided whether to give this to the students or have them do it >>> # thier own. Then next steps generate two lists A and B. A and B will be >>># students lists and they will have to convert them to binary and then uset >>> # lists to form a intersect B, A union 3, NOT A given a universal set, A-3, >>> symmetrie difference A XOR B. Still considering Across 3. >>> >>> # Generate A and B >>> A-irand (100, 200) B rand (100, 200) #generate A and B 100 elemets each >>> Avirand (100, 200); B-irand (100, 200) >>> A [162, 197, 129, 192, 190, 191, 141, 110, 128, 139, 122, 32, 10, 101, 59, 112, 14 0, 102, 31, 120, 130, 27, 194, 137, 30, 29, 167, 103, 114, 53, 68, 99, 163, 183, 134, 33, 50, 16, 146, 8, 155, 87, 71, 55, 150, 97, 175, 84, 79, 96, 156, 1, 51, 174, 106, 177, 113, 2, 46, 41, 21, 77, 153, 26, 178, 124, 67, 76, 17, 118, 135, 92, 88, 170, 75, 157, 148, 164, 37, 83, 12, 19, 13, 98, 149, 57, 14, 82, 198,7 2, 58, 199, 102, 180, 15, 152, 40, 171, 63, 80) Form and sort in ascending order the intersection and union of the two sets. Print of the intersection followed by lista and b sorted into ascending order. (This is the only way I can check your output any any reasonable time. Then print off the union of the two sets followed by a and b sorted into ascending! order. Given that the universal set is the whole numbers between o and 200 inclusive form and print not A in ascending order. Form and print A-B in ascending order. You can use the built in sort algorithm below and the logical operators weetc but no other built in set functions. >>> Sort-listange (la)) >>> tot in range (la) asort 1]-A >>> Sort.srt >>> baort-list range (lb)) >>>tot in range (lb) bar11-[1] >>> bar.BOFLO) . . . . . . . . . . . . . . . .1.1.. . . . . . 18. 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Repeat Problem 91 if the gas is argon.

Answered: 1 week ago