Question: 4. Write a program that makes both a list L and a tuple T with the following values: a) The numbers 1 to 100,

4. Write a program that makes both a list L and a tuple T with the following values: a) The numbers 1 to 100, inclusive. b) The odd numbers from 1 to 101, inclusive. c) The squares of numbers from 0 to 49, inclusive d) 60 random integers from 0 to 49, where you import random and use random.randrange(0, 50) to get each value. e) 50 zeroes, i.e., [0, 0, ...., 0] and (0, 0, ..., 0). Note, you can use repetition, as you would for a string. Do not use list comprehension for this question. 5. Repeat Question 4, but this time use list comprehension, and you can skip the tuple part.
Step by Step Solution
There are 3 Steps involved in it
4ans import random La listrange1 101 Ta tuplerange1 101 Lb num for num in range1 102 ... View full answer
Get step-by-step solutions from verified subject matter experts
