A lot of nested lists

Report a typo

Let's write a program that will read a positive integer n from the input and create a nested list containing the inner list [1, 2] repeated n times.

Use list comprehension and remember what arguments range() takes.

Sample Input 1:

5

Sample Output 1:

[[1, 2], [1, 2], [1, 2], [1, 2], [1, 2]]

Sample Input 2:

2

Sample Output 2:

[[1, 2], [1, 2]]
Write a program in Python 3
n = int(input())

my_list = # your code here
print(my_list)
___

Create a free account to access the full topic