Skip to content

Instantly share code, notes, and snippets.

@XChrisUnknownX
Created August 21, 2018 21:06
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 XChrisUnknownX/a141106c3b0bdbf4d1ddeb6d2c504eb8 to your computer and use it in GitHub Desktop.
Save XChrisUnknownX/a141106c3b0bdbf4d1ddeb6d2c504eb8 to your computer and use it in GitHub Desktop.
probability experiment.py
import time
import random
char = "zero"
letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
numbers = ["0","1","2","3","4","5","6","7","8","9"]
sevens = "mmmmmmm"
masternumber = []
for n in sevens:
which = random.choice([letters,numbers])
if which == letters:
new = random.choice(letters)
else:
new = random.choice(numbers)
masternumber.append(new)
#master number picked
tester = False
if tester == True:
print(masternumber)
input()
else:
pass
attempt = 1
attempts = str(attempt)
cracknumber = []
while True:
attempts = str(attempt)
print("Attempt " + attempts+".")
print()
which = random.choice([letters,numbers])
if which == letters:
new = random.choice(letters)
else:
new = random.choice(numbers)
cracknumber.append(new)
if masternumber == cracknumber:
print("Found the master number.")
print(masternumber)
print(attempts + " attempts.")
else:
print(cracknumber)
attempt += 1
if len(cracknumber) >= 7:
cracknumber = []
else:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment