Question: Python code You will need to make use of the random library for this homework. It is pretty simple to use. You can use the

Python code  Python code You will need to make use of the random
library for this homework. It is pretty simple to use. You can

You will need to make use of the random library for this homework. It is pretty simple to use. You can use the following methods: random.choice(list) returns a single item from the list, tuple or string at random. random.sample(list.o - returns a new list of n items randomly chosen from the list, tuple or string random shufflellist)randomly reorders all of the items in the list and changes the list itself. The list must be a mutable object so this will not work with strings or tuples random.randintim.a) -returns a randomly selected number between m and n as long as mcen. m and n are included in the possible return values. There are other methods that you can look at on your own but these should be all you will need for this assignment. A complete sample program might be: import random or: from random import shoice samal& sbutfle candint if you want to avoid using random. each time print(random.choice(elements)) print(gandomsample(elements,2)) random.sbuttlelfelements) print(elements) print(candom.tandint(1,5)) print(choice(elements)) print(sample(elements,2) shuffle(elements) trying to use print(random shuffle(elements)) results in None because shuffle doesn't return anything print(candint(1,5) The output in either case might be: water

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!