For an assignment, I am trying to write a function named Exam, which takes one argument n where n>2.
The function is supposed to create a list (list1) of n random integers in range(1,5) and print all elements of list1 on one line.
So far what I have is :
def Exam(n):
import random
random.randrange(1,5)
I am not sure how to limit the input to n>2 or even really what it means. If anyone can assist or give hint, it would be appreciated!
Updated code:
def Test(n):
import random
random.randrange(1,5)
list1*[]
if n>2:
for i in range (n):
list1.append(random.randrange(1.5))
Does this seem on the right path?
using list comprehension: