How can we generate N lottery tickets, i.e., N numbers between 0 and 999, which are unique? You can…
Автор: Harold Edwards
Загружено: 2025-03-11
Просмотров: 0
Описание:
How can we generate N lottery tickets, i.e., N numbers between 0 and 999, which are unique? You can use the range(p) function to produce a sequence of integers from 0 to p-1. python # range(p) produces a sequence of integers from 0 to p-1 population = range(1000) # of tickets desired N = 10 random.choices(population, k=N) tickets = [] for n in range(N): tickets.append(random.choice(population)) random.sample(population, N) tickets for n in range(N): tickets.append(random.randint(0, 1000))
Watch the full video at:
https://www.numerade.com/ask/question...
Never get lost on homework again. Numerade is a STEM learning website and app with the world’s largest STEM video library.
Join today and access millions of expert-created videos, each one skillfully crafted to teach you how to solve tough problems step-by-step.
Join Numerade today at:
https://www.numerade.com/signup/?utm_...
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: