May-28-2020, 02:29 PM
Oops, I didn't realize the numbers needed to be unique! The code as it currently stands could result in the same number being selected more than once. To ensure there are no duplicates, it might be best to first create a list of random numbers outside of your loop, and then just print each one sequentially within your loop. I think you probably know everything you need to do this based on your previous code. You'd want to do something like:
import random numbers = ... # use sorted(), random.sample(), and range() on this line to create your list of 100 sequential random numbers for i in range(100): letters=sorted(random.sample('abcdefgh',4)) print(numbers[i]...) # print values from the numbers list sequentially along with your letters list generated within the loopTry to fill in the blanks where the "..." is shown, and see what you can come up with.