0

How would you create multiple lists populated with random numbers on bigger from previous preferably using list comprehension.

Example:

create 3 lists

list_1=[47]
list_2=[56,76]
list_3=[754,45,43]
1
  • It's not clear what you're looking for. What was "on bigger from previous" intended to mean? How should these random numbers be distributed? Commented Nov 27, 2014 at 22:43

1 Answer 1

4
 import random
 [[random.randint(1, 1000) for _ in range(list_size)] for list_size in range(1,4)]
Sign up to request clarification or add additional context in comments.

1 Comment

Great was looking exactly for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.