Skip to content

Instantly share code, notes, and snippets.

@bengalih
Created September 9, 2020 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bengalih/a7d929140884948495860a2d73475e42 to your computer and use it in GitHub Desktop.
Save bengalih/a7d929140884948495860a2d73475e42 to your computer and use it in GitHub Desktop.
from random import sample
picked_numbers = sample(range(1,11),4)
print(f'Lotto numbers are: {picked_numbers}')
no_match = True
attempts = 0
while no_match:
matches = 0
attempts += attempts + 1
my_numbers = sample(range(1,11),4)
for number in my_numbers:
if number in picked_numbers:
matches += 1
else:
continue
if matches == 4:
print(f'It took {attempts} attempts to pick {my_numbers}!')
no_match = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment