(a) Use a for loop and a random integer generator to generate 10 random integers in 1 through 15. Store the random integers in a tuple. Display the tuple. [Hint: you may want to store the random integers in a list first and then convert the list to a tuple].
(b) Create a new tuple. Copy the first three elements of the tuple in part (a) to this tuple. Display this tuple.
(c) Create a new tuple. Copy the last three elements of the tuple in part (a) to this tuple. Display this tuple.
(d) Concatenate the two tuples in part (b) and part (c). Display the concatenated tuple.
(e) Sort the concatenated tuple. Display the sorted tuple. The following is an example. There is no user input in this program.
+4
Answers (1)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a Python program to do the following: (a) Use a for loop and a random integer generator to generate 10 random integers in 1 through ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Home » Computers & Technology » Write a Python program to do the following: (a) Use a for loop and a random integer generator to generate 10 random integers in 1 through 15. Store the random integers in a tuple. Display the tuple.