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 = [] | |
numtoguess=0 | |
cows=0 | |
bulls=0 | |
for i in range(0,4): | |
num.append(random.randint(0,9)) | |
numtoguess = int('{}{}{}{}'.format(num[0],num[1],num[2],num[3])) | |
def doguess(): | |
global cows |
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
prime = open(r'C:\Users\Raid7\Desktop\prac\primenumbers.txt') | |
happy = open(r'C:\Users\Raid7\Desktop\prac\happynumbers.txt') | |
primes = prime.readlines() | |
happy = happy.readlines() | |
for num in primes: | |
if num in happy: | |
print(num) |
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
from random import randint | |
cows = 0 | |
bulls = 0 | |
ONE = randint(1,9) | |
TWO = randint(1,9) | |
THREE = randint(1,9) | |
FOUR = randint(1,9) | |
sec_num = str(ONE) + str(TWO) + str(THREE) + str(FOUR) | |
while True: | |
bulls = cows = 0 |
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 requests | |
from bs4 import BeautifulSoup | |
r = requests.get('http://www.nytimes.com') | |
soup = BeautifulSoup(r.text,'lxml') | |
for story_heading in soup.find_all(class_="story-heading"): | |
try: | |
string = story_heading.a.text.replace(" ",'') | |
string = string.replace('\n','') | |
print(string) | |
except: |
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Forms; | |
using System.Threading; | |
using System.Media; |
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
decid = input('would you like to analyze a string or a file?') | |
def printit(cheer): | |
if cheer is not None or cheer != ' ': | |
if textls.count(cheer) != 0: | |
print(cheer + ":" + str(textls.count(cheer))) | |
elif cheer is None: | |
print("space:" + str(textls.count(cheer))) | |
elif cheer == '\n': |
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 | |
decid = input('how string do you want your password to be?(weak/medium/strong): ') | |
leng = int(input('how long do you want your password to be?: ')) | |
weak = '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'.split(':') | |
medium = '0:1:2:3:4:5:6:7:8:9'.split(':') | |
strong = '!:@:#:$:%:^:&:*:_:-:=:.'.split(':') | |
password = '' | |
if decid.lower() == 'weak': | |
while len(password) < leng: | |
password += weak[random.randint(0,25)] |
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
list = input('enter a string that you want to be reversed: ').split(' ') | |
list.reverse() | |
print(' '.join(list)) | |
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
listwithdups = [1,2,2,3,456,4,654,984,3,21,65,132,1,321,32,165,4,654,32,1,321,321,32,16,54,549,84,3,21,6,5,5,5,55,6,9,9,8,7,4,9,8,4,65,456] | |
def removedups(): | |
return set(listwithdups) | |
print(removedups()) |
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
num=int(input('Enter a number:')) | |
length=int(input('To what length u want it to be?:')) | |
nuz=0 | |
list=[] | |
if len(str(num))>0: | |
list.append (num) | |
r=num+nuz | |
list.append (r) | |
while len(list)!=length: | |
dd=list[nuz]+list[nuz+1] |