Feb-13-2019, 01:26 AM
Use a set instead of a list:
def n_nonrepeated(q_of_nums, minimum_number, maximum_number): """Generates odd and even numbers, they can't be repeated.""" printed_numbers = set() while len(printed_numbers) < q_of_nums: printed_numbers.add(randint(minimum_number, maximum_number)) return printed_numbersPlease note that there is the possibility of an infinite loop with this. You may want to add some more logic to prevent that.