This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cols=int(input('How many columns do you want? ')) | |
rows=int(input('How many rows do you want? ')) | |
winnum=int(input('Please enter the victory threshold: ')) | |
table='' | |
field=list() | |
def create_table(f,r,c): #make a function for table drawing | |
collist=list(range(1,c+1)) | |
colstr='\t ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import | |
random | |
with open ('SOWPODS.txt','r') | |
as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [1, 3, 5, 30, 42, 43, 500] | |
q=int(input('Which number do you want to look for?')) | |
while a != []: | |
#print(a) | |
mid=int(len(a)/2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
print('''Hi! Welcome to the cows and bulls game. You have to figure out a 4 digit number. | |
For every digit you guess correctly in the correct place, you get a 'cow'. For every digit you guess correctly in the wrong place is a 'bull'. | |
Good luck, have fun!''') | |
solution=[] | |
for i in range(0,4): | |
solution.append(random.randint(0,9)) | |
#print(solution[i]) | |
guess=[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
solution=[] | |
for i in range(0,4): solution.append(str(random.randint(0,9))) print(solution[i]) | |
#solution="".join(solution)print(solution) | |
guess=str(input('Make a guess')) | |
while guess != solution: sol=solution gu=guess cows=0 bulls=0 counter=0 | |
for i in range(0,len(guess)): print(guess[i]) if guess[i]==solution[i]: cows+=1 del sol[i] del gu[i] | |
for k in len(gu): for l in len(sol): print(sol[l]) if gu[k]==sol[l]: bulls+=1 del gu[k] del sol[l] k-=1 l-=1 | |
print('You guessed the number, Congrats!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
num=int(input('How long password do you want in characters?')) | |
char='qwertzuiopasdfghjklyxcvbnmQWERTZUIOPASDFGHJKLYXCVBNM<>#&@{}<' | |
password="".join(random.sample(char,num)) | |
print('Your password is: '+ password) |