Python Random Modules

I am having confusion on this 3rd task.

How to use this random.randint() in the list comprehension ?
Thanks

1 Like

Hey,

There’s a couple of things to note here:

  • random.randint() takes two positional arguments (the range from which to draw numbers) - that’s one error that will be thrown if it runs

  • your for-loop part of the list comprehension is inaccurate in terms of syntax (the first error thrown). Remember that to write for x in list will iterate through the list with x changing values for each loop. In this sense, x can be thought of as a temporary variable. To put a function in its place throws a SyntaxError: can't assign to function call.

Note that the instructions say for each number in range(101). How do we write this in code? How would it be in written in a normal for-loop?