示例#1
0
def bsim(_):
    edge = 10000

    from random import choice as c
    dirs = [-1, 1]
    def r():
        return (c(dirs),c(dirs))

    x = 0
    y = 0
    x += c(dirs)
    y += c(dirs)
    # pos = [0,0]
    # pos = [ sum(x) for x in zip(pos,r()) ]
    steps = 1
    while x != 0 or y != 0:
        steps += 1
        # pos = [ sum(x) for x in zip(pos,r()) ]
        x += c(dirs)
        y += c(dirs)
        # print '\r', _, steps, x, y,
        if x > edge or x < -edge or y > edge or y < -edge:
            print "Fell over world's edge", steps, x, y
            return -1

    return steps
def get_conven_pass():
    part1, part2 = '', ''

    for i in range(length - 4):
        a = r(0, 3)
        b = c(data[a])
        part1 += b

    for i in range(0, 4):  # part two of string to ensure
        b = c(data[i])  # each category has at least
        part2 += b  # one element in the password

    temp = list(part1)

    while (part2 != ''):
        t = part2[0]  # each character of part2 being
        part2 = part2[1:]  # added into random positions
        temp.insert(r(0, len(temp)), t)  # of part1

    final = ''

    for i in temp:
        final += str(i)

    return (final)
示例#3
0
def name_chars():
	charNo = random.randint(7,51)
	charGenders = [random.randint(0,1) for _ in range(charNo)]
	charNames = [inputCharName]
	for i in charGenders:
		if charGenders[i]:
			charNames.append(c(fFirstNames)+" "+c(surnames))
		else:
			charNames.append(c(mFirstNames)+" "+c(surnames))
	return charNames
示例#4
0
def name_chars():
    charNo = random.randint(7, 51)
    charGenders = [random.randint(0, 1) for _ in range(charNo)]
    charNames = [inputCharName]
    for i in charGenders:
        if charGenders[i]:
            charNames.append(c(fFirstNames) + " " + c(surnames))
        else:
            charNames.append(c(mFirstNames) + " " + c(surnames))
    return charNames
示例#5
0
def main():
    b = Board()
    start_pos = (c(range(8)),c(range(8)))
    b.set(start_pos,1)
    last_move = start_pos
    i = 2
    while i < 64:
        next_possible = move(b,last_move)
        b.set(next_possible, i)
        i = i + 1
        last_move = next_possible
    b.set(knight_moves(b,last_move)[0],i)
    print "SUCCESS!"
    b.draw()
示例#6
0
def do_round():
    t1 = (lambda r: r, lambda r: not r, lambda r: c((True, False)))
    t2 = (lambda r: r, lambda r: not r)
    m1 = c(list(p(range(len(t1)))))
    m2 = c(range(len(t2)))

    print(m1, m2)
    for _ in range(3):
        print("I?")
        ts = [t for t in input().split(" ") if t in v]
        print("R: {}".format(calc(t1, t2, m1, m2, int(ts[0]),
                                  "".join(ts[1:]))))

    print("A?")
    return m1 == tuple(map(int, input().split(" ")))
async def WebData_By_Thundergang(webdata_credit_thundergang):
    link = webdata_credit_thundergang.pattern_match.group(1)
    await webdata_credit_thundergang.edit('**Deleting All** `.txt` **Files**')
    cmd('rm ./*.txt')  # Removing all Text Files
    await webdata_credit_thundergang.edit('**Deleting All** `.png` **Files**')
    cmd('rm ./*.png')  # Removing All Png Files
    await webdata_credit_thundergang.edit('**Deleting All** `.jpg` **Files**')
    cmd('rm ./*.jpg')  # Removing All jpg Files
    await webdata_credit_thundergang.edit('**Deleting All Files : Successful**'
                                          )
    bot = webdriver.Chrome(executable_path=CHROME_DRIVER,
                           options=chrome_options)
    if link == '':
        bot.get(c(r))
        bot.get_screenshot_as_file(filename='NoWebsiteGiven.png')
        await webdata_credit_thundergang.client.send_file(
            webdata_credit_thundergang.chat_id,
            'NoWebsiteGiven.png',
            caption="<< **U Mentioned No Link** >>",
            force_document=True)
        cmd('rm ./*.png')
        done_lago()
    elif link is not '':
        bot.get(link)
        bot.get_screenshot_as_file(filename='WebSite Data.png')
        await webdata_credit_thundergang.client.send_file(
            webdata_credit_thundergang.chat_id,
            'WebSite Data.png',
            caption="<< **The WebData Of Link U Gave** >>",
            force_document=True)
        cmd('rm ./*.png')
        done_lago()
    await webdata_credit_thundergang.delete()
示例#8
0
async def fetch(session: object, url: object) -> object:
    async with session.get(url) as response:
        url = await response.text()
        url = loads(url)
        url = url['data']['children']
        url = c(url)['data']
        return url
示例#9
0
async def WebData_By_Akash(webdata_credit_akash):
    link = webdata_credit_akash.pattern_match.group(1)
    await webdata_credit_akash.edit("**Deleting All** `.txt` **Files**")
    cmd("rm ./*.txt")  # Removing all Text Files
    await webdata_credit_akash.edit("**Deleting All** `.png` **Files**")
    cmd("rm ./*.png")  # Removing All Png Files
    await webdata_credit_akash.edit("**Deleting All** `.jpg` **Files**")
    cmd("rm ./*.jpg")  # Removing All jpg Files
    await webdata_credit_akash.edit("**Deleting All Files : Successful**")
    bot = webdriver.Chrome(executable_path=CHROME_DRIVER,
                           options=chrome_options)
    if link == "":
        bot.get(c(r))
        bot.get_screenshot_as_file(filename="NoWebsiteGiven.png")
        await webdata_credit_akash.client.send_file(
            webdata_credit_akash.chat_id,
            "NoWebsiteGiven.png",
            caption="<< **U Mentioned No Link** >>",
            force_document=True,
        )
        cmd("rm ./*.png")
        done_lago()
    elif link is not "":
        bot.get(link)
        bot.get_screenshot_as_file(filename="WebSite Data.png")
        await webdata_credit_akash.client.send_file(
            webdata_credit_akash.chat_id,
            "WebSite Data.png",
            caption="<< **The WebData Of Link U Gave** >>",
            force_document=True,
        )
        cmd("rm ./*.png")
        done_lago()
    await webdata_credit_akash.delete()
示例#10
0
    def countriesToPick(self):
        lives_remaining = 6
        rand_country = c(self.countries)
        print('Your country has been chosen! Start the guessing! '
              )  #start of the game!

        print(('You have {} lives remaining'.format(lives_remaining)))

        print('_ ' * (len(rand_country)))
        while lives_remaining > 0:

            letter_picked = input("Please enter a letter: ")
            if len(letter_picked) > 1:
                print('You can only enter one letter!')
            elif len(letter_picked) < 1:
                print('You did not enter anything, please try again. ')
                continue
            elif letter_picked not in rand_country.lower():  #incorrect guess
                lives_remaining -= 1
                print('Incorrect')
                print('You have {} lives remaining'.format(lives_remaining))
            elif letter_picked in rand_country.lower():  #correct guess
                print(letter_picked)
                print('{} is correct! \n'.format(letter_picked))
                self.pickedCountry.append(letter_picked)
            if len(rand_country) == len(
                    self.pickedCountry):  #winning condition
                print('Congrats! You guessed it - {} '.format(rand_country))
                print('Play again!')
                break
            while lives_remaining <= 0:  #when the player loses
                print('Your word was {}  - better luck next time!'.format(
                    rand_country))
                print('Try again!')
                break
示例#11
0
def rand_str(ch_nb):
    """:param ch_nb:
    :return: Random String of length ch_nb
    """
    rdm_str = ""
    for _ in range(ch_nb):
        rdm_str += c(LIST_CH)
    return rdm_str
示例#12
0
def asim(_):
    edge = 10000

    from random import choice as c
    dirs = [-1, 1]

    pos = 0
    pos += c(dirs)
    steps = 1
    while pos != 0:
        steps += 1
        pos += c(dirs)
        if pos > edge or pos < -edge:
            print "Fell over world's edge"
            return -1

    return steps
示例#13
0
async def reddit(sub: str):
    type = ['new', 'top', 'hot', 'rising']
    url = f"https://www.reddit.com/r/{sub}/{c(type)}.json?sort={c(type)}&limit=10"
    async with ClientSession() as session:
        data = await get(session, url)
        data = loads(data)
        data = data['data']['children']
        url = [d['data']['url'] for d in data]
        return c(url)
示例#14
0
def gen(amount):
    learn_yield = []
    for _ in range(amount):
        print(f"generating cases {_ + 1}/{amount}", end="\r")
        words = [[c(asc)[0] for _ in range(r(1,10))]for _ in range(r(1,5))]
        lol = lambda:r(1,100)
        case=cs(words,[lol() for x in " "*len(words)],k=r(1,20))
        learn_yield.append(" ".join(["".join(x) for x in case]))
    return learn_yield
def generate_team(lst):
    lst2 = lst[:]
    team_a = []
    team_b = []
    counter = 0
    for name in lst:
        if counter % 2 == 0:
            person = c(lst)
            team_a.append(person)
            lst2.remove(person)
            counter += 1
        else:
            person = c(lst)
            team_b.append(person)
            lst2.remove(person)
            counter += 1

    return team_a, team_b
示例#16
0
async def blue_devil_jarvis(cmd):
    sysarg = cmd.pattern_match.group(1)
    if 'hi' in sysarg or 'hel' in sysarg:
        async with borg.conversation(bot) as x:
            try:
                await x.send_message(f"/tts {start} {str(ALIVE_NAME)} {end}")
                h_audio = await x.get_response()
                await borg.send_message(cmd.chat_id, h_audio)
                await cmd.delete()
            except YouBlockedUserError:
                await cmd.edit(f"**Error:** `unblock` {bot} `and retry!`")
    elif 'me' in sysarg:
        async with borg.conversation('@Cryptowhalebot') as y:
            try:
                await y.send_message(f'/start')
                s(1)
                await y.send_message(f'/meme')
                meme = await y.get_response()
                await cmd.client.send_file(
                    cmd.chat_id,
                    meme,
                    caption=
                    "<< Here's Your Carbon Boi,\nCarbonised By [IndianBot](https://www.github.com/indianbhaiya/IndianBot)>> ",
                    force_document=True)
                await cmd.delete()
            except YouBlockedUserError:
                await cmd.edit(c(ERRORS))
    elif 'p**n' in sysarg:
        async with borg.conversation('@Maal_Supplier_Robot') as z:
            try:
                await cmd.delete()
                await z.send_message(f'/start')
                s(1)
                await z.send_message(c(Vid))
                await z.get_response()
                await z.get_response()
                await z.get_response()
                p_vid = await z.get_response()
                await borg.send_message(cmd.chat_id, p_vid)
                await cmd.delete()
            except YouBlockedUserError:
                await cmd.edit(c(ERRORS))
    else:
        await cmd.edit(c(ERRORS))
示例#17
0
 def pick(self, target: int) -> int:
     from random import choice as c
     nums = self.nums
     u = dict()
     for i, val in enumerate(nums):
         if val in u:
             u[val] += (i, )
         else:
             u[val] = (i, )
     return c(u[target])
示例#18
0
    def binger(self, x, y, size):
        pt1 = (x - size // 2, y - size // 2)
        pt2 = (x + size // 2, y - size // 2)
        pt3 = (x + size // 2, y + size // 2)
        pt4 = (x - size // 2, y + size // 2)

        fill = r(0, 255)
        s1, s2, e1, e2 = (r(0, 360), r(0, 360), r(0, 360), r(0, 360))

        pt1, pt2, pt3, pt4 = self.reflect_points(pt1, pt2, pt3, pt4)

        self.drawer.arc((*pt1, *pt3), start=s1, end=e1, fill=fill)
        self.drawer.arc((*pt2, *pt4), start=s2, end=e2, fill=fill)

        for j, i in enumerate(range(fill)):
            p0 = (p - j % 2 for p in pt1)
            p1 = (p - j % 3 for p in pt3)
            start = c((s1, s2))
            end = c((e1, e2))
            self.drawer.arc((*p0, *p1), start=start, end=end, fill=fill - i)
示例#19
0
 def respawn(self,snake): #need to avoid the snake segments
     game = [[i%self.areaW,i//self.areaW] for i in range(3,self.areaH*self.areaW)] #get matric for game again
     for [x,y] in snake:
         if [x,y] in game:
             game.remove([x,y]) #try and remove spawn slots so we dont overlap with snake
     self.ARRAY = [] #remove any fruit that would be there, always has to remove last fruit with current code iteration
     for i in range(self.fruitnum): #obvious tbh
         x = c(game)
         if x in game:
             game.remove(x)
         self.ARRAY.append(x) #same as before
示例#20
0
def tablified():
    with open("data/occupations.csv") as file: # opens the file
        reader = DictReader(file)
        dic = {'jobs': [], 'percentage': []} #sets up a destination for the contents of the csv file
        for row in reader:
            dic['jobs'].append(row["Job Class"])
            dic['percentage'].append(float(row['Percentage'])) # casts each percentage str into a float
        file.close() # closes the file
        listx = zip(tuple(dic['jobs']),tuple(dic['percentage'])) # groups each job and percentage as a tuple
    titles = ['Jobs', 'Percentages']
    random_occ = (c(dic['jobs'][:-1], weights=dic['percentage'][:-1])[0]) # chooses a random occupation by weight
    return render_template('tablified.html', randomocc = random_occ, titles = titles, data = listx )
示例#21
0
 def __init__(self,GS,screen): #need stats and screen to draw to
     self.fruitnum = GS.fruitnum #get stuff treated for use in code here
     self.areaH=GS.height
     self.areaW=GS.width
     self.cs=GS.cellsize
     self.shrink=GS.shrink
     self.screen=screen
     game = [[i%self.areaW,i//self.areaW]for i in range(3,self.areaH*self.areaW)] #initialise a matrix of all cells in the play area, except for top left 3 as they have the score in them and dont want to overlap
     self.ARRAY = [] #no fruits
     for i in range(self.fruitnum): #add fruitnum fruits
         x = c(game) #randomly choose an available spot !can coincide with snake, must fix!
         game.remove(x) #cant choose this square again
         self.ARRAY.append(x) #add to list of fruit
示例#22
0
def select(file: str, path: str) -> str:
    with open(file + path) as file:  # open the file
        reader = DictReader(file)

        jobs = []
        weights = []

        for row in reader:
            jobs.append(row["Job Class"])
            # casts each str into a float
            weights.append(float(row['Percentage']))

    file.close()

    return c(jobs[:-1], weights=weights[:-1])[0]
示例#23
0
文件: main.py 项目: SqueezyS/GALILEO
async def on_message(message):
    if message.author == client.user:
        return

        print("Hello test conducted")
    if message.content.startswith('gf!corona'):
        await message.channel.send(
            'Visit this site for Coronavirus information https://www.cdc.gov/')
    if message.content.startswith('gf!help'):
        await message.channel.send(h)
        print("Help Conducted")
    if message.content.startswith('gf!SEhelp'):
        await message.channel.send(sh)

    if message.content.startswith('gf!cl'):
        await message.channel.send(cl)
    if message.content.startswith('gf!invite'):
        await message.channel.send(DBa)
        print("Invited someone to join the bot!")
    if message.content.startswith('gf!d6'):
        b = r(1, 6)
        await message.channel.send(b)
        print("d6:", b)
    if message.content.startswith('gf!cmd'):
        d = r(1, 3267)
        await message.channel.send(
            "YOU HAVE WON THE EVENT! Quick! Message One S Q U E E Z Y Boi#0074: 44573"
        )
        print("Winning Number:", d)
    if message.content.startswith('gf!rng'):
        e = r(
            1,
            99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
        )
        await message.channel.send(e)
        print("RNG:", e)
    if message.content.startswith('gf!mr'):
        AAA = ("Ban", "Mute", "Long mute", "Kick", "Warn")
        abc = c(AAA)
        print(abc)
        await message.channel.send(abc)
 def __add__(self, other):
     z = ["Stella", "Fritz", "Jumbo", "Zoom", "Staci"]
     if isinstance(other, Dog):
         return Dog(c(z), self.species, 0)
     else:
         return "You can't do that!"
def get_team_member(team_members: list) -> str:
    return c(team_members)
示例#26
0
def luta(esp1,ado,vida,zombi,gold,poção,dano,adp):

#define se você ganha ou perde
    print("Você encontrou um zombi lute contra ele")

    defesa = ('fracassou sucesso fracassou').split()
    sorte = c(defesa)
    jogo = True
    while jogo:
        if vida <= 0:
            print("Você perdeu")
            break
        elif zombi <= 0:
            print("Parabens você ganhou")
            break
        print()

#mostra a vida e as escolhas
        print(f"sua vida: {vida}\nvida do zombi: {zombi}\nmoedas: {gold}\n")
        escolha =input("ATACAR DEFENDER ITENS POÇÕES\n").lower().strip()[:1]
        
#usa a escolha atcar e ataca
        if escolha == 'a':
            escolha_atacar = input('Para girar o dado aperte (D): ')
            print()
            if escolha_atacar == 'd':
                dado = r(1,20)
                print(f"Seu ataque foi de {dado * dano}pts")
                if escolha_atacar == 'd':
                    zombi -= dado
                
            else:
                print("Você usou o comando errado e morreu")
                break
#usa a escolha itens e abre a loja
        elif escolha == 'i':
            print(f"você tem {gold} moedas\n")
            compra = (input(f"poção = 10g (1)\nespada = {esp1}g (2)\nadorar os deuses = {ado}g (3)\n"))
            if compra == "p":
                print("a poção cura 15 pts de vida e custa 10 moedas\n")
                if gold >= 10:
                    gold = gold - 10
                    print("você comprou uma poção\n")   
                    poção = poção + 1
                else:
                    print("você não tem moedas suficientes\n")
            elif compra == "e":
                print(f"a espada aumenta o dano em 1pt e custa {esp1} moedas\n")
                if gold >= esp1:
                    gold = gold - esp1
                    print("agora seu dano esta aumentado\n")
                    dano = dano + 1
                    esp1 = esp1 + 25
                else:
                    print("você não tem moedas suficientes\n")
            elif compra == "a":
                print(f"adorar os deuses aumenta a taxa de ouro\ndropado em 1 e custa {ado}\n")
                if gold >= ado:
                    gold = gold - ado
                    print("agora dropara mais ouro dos inimigos\n")
                    adp = adp + 1
                    ado = ado + 50
                else:
                    print("você não tem moedas suficientes\n")
            else:
                escolha = "a"
#usa a escolha poção e compra um do mesmo
        elif escolha == 'p':
            if poção >= 1:
                vida = vida + 15
                poção = poção - 1
                print(f"você tomou uma poçâo agora sua vida esta em {vida}\ne você tem {poção} poções")
            else:
                print("você não tem poções")
        
        elif escolha == "d":
            dano_contra_ataque = r(1,5)
            if sorte == 'sucesso':
                print(f'voce conseguio defender e lançar um contra ataque de {dano_contra_ataque}pts')
                if sorte == 'sucesso':
                    zombi -= dano_contra_ataque
            else:
                print('sua defesa fracassou\nvocê recebera dano x2 no proximo ataque')

#executa o ataque do zumbi
        print()
        print('Agora o zombi ira atacar')
        ataque_zombi = r(1,20)
        if escolha == 'a':
            print(f'você recebeu {ataque_zombi} de dano')
            if escolha == 'a':
                vida -= ataque_zombi
        else:
            if sorte == 'sucesso':
                print('defendeu')
                continue
            else:
                print(f'você recebeu {ataque_zombi*2} de dano')
                if sorte == 'fracassou':
                    vida -= ataque_zombi*2

#ganha o ouro
        gold1 = r(1,10)
        gold2 = gold1 * adp
        gold = gold + gold2

        
        print(f"com essa batalha você conseguio mais {gold1} moedas \n ")

        print()
示例#27
0
		shifts[i] %= 26

	res = [''] * n
	for i, (c, num) in enumerate(zip(S, shifts)):
		if (ord(c) + num) > 122:
			res[i] = chr(97 + (ord(c) + num) - 122 - 1)
		else:
			res[i] = chr((ord(c) + num))
	return ''.join(res)

assert shiftingLetters("abc", [3,5,9]) == 'rpl'
assert shiftingLetters("abc", [1,50,90]) == 'llo'
assert shiftingLetters("azt", [1234567, 987654, 45671234]) == 'zpr'



from random import randint as r
from random import choice as c
n = r(1, 10)
S = []
shifts = []
for i in range(n):
	S.append(c('abcdefghijklmnopqrstuvwxyz'))
	shifts.append(r(1, 1000000000))
S = ''.join(S)
print S, shifts
print shiftingLetters(S, shifts)



示例#28
0
def s1():   
    s1_1_w1 = ['I']
    s1_1_w2 = ['write', 'am writing', 'am concerned', 'have concerns', 'write you', 'am writing you', 'write to you', 'am writing to you']
    s1_1_w3 = ['about', 'concerning', 'regarding', 'with reference to', 'in regard to', 'with regard to']
    s1_1_w3_o1 = ['the matter of', 'the issue of', 'the question of', 'the problem of', 'the concern of', 'the topic of', 'this issue:', 'this matter:', 
                  'this question:', 'this problem:', 'this concern:', 'this topic:', 'the following issue:', 'the following matter:', 
                  'the following question:', 'the following problem:', 'the following concern:', 'the following topic:']
    s1_1_w4 = issue_s1
    s1_1_w5 = ['\b.']
    s1_1 = ' '.join([c(s1_1_w1), c(s1_1_w2), c(s1_1_w3), c(["\b", c(s1_1_w3_o1)]), c(s1_1_w4), c(s1_1_w5)])

    s1_2_w1 = ['This', 'My']
    s1_2_w2 = ['letter', 'note', 'message', 'request', 'inquiry', 'correspondence']
    s1_2_w3 = ['is about', 'concerns', 'is regarding', 'is in relation to', 'is in reference to']
    s1_2_w3_o1 = s1_1_w3_o1
    s1_2_w4 = issue_s1
    s1_2_w5 = ['\b.']
    s1_2 = ' '.join([c(s1_2_w1), c(s1_2_w2), c(s1_2_w3), c(["\b", c(s1_2_w3_o1)]), c(s1_2_w4), c(s1_2_w5)])

    s1_3_w1 = ['Please', 'I hope you will']
    s1_3_w2 = ['ensure', 'make sure', 'be certain', 'take heed', 'make certain']
    s1_3_w3 = ['that']
    s1_3_w4 = issue_s1
    s1_3_w5 = ['gets', 'receives', 'has']
    s1_3_w6 = ['your']
    s1_3_w7 = ['full', 'complete', 'undivided', 'absolute']
    s1_3_w8 = ['attention', 'notice', 'consideration', 'recognition', 'awareness']
    s1_3_w9 = ['\b.']
    s1_3 = ' '.join([c(s1_3_w1), c(s1_3_w2), c(s1_3_w3), c(s1_3_w4), c(s1_3_w5), c(s1_3_w6), c(s1_3_w7), c(s1_3_w8), c(s1_3_w9)])

    s1_4_w1 = ['I']
    s1_4_w2 = c([['\b'], ['strongly', 'firmly']])
    s1_4_w3 = ['urge', 'entreat', 'advise', 'recommend', 'implore', 'request', 'beseech', 'ask']
    s1_4_w4 = ['that you', 'you to']
    s1_4_w5 = s1_3_w2
    s1_4_w6 = ['that']
    s1_4_w7 = issue_s1
    s1_4_w8 = s1_3_w5
    s1_4_w9 = s1_3_w6
    s1_4_w10 = s1_3_w7
    s1_4_w11 = s1_3_w8
    s1_4_w12 = ['\b.']
    s1_4 = ' '.join([c(s1_4_w1), c(s1_4_w2), c(s1_4_w3), c(s1_4_w4), c(s1_4_w5), c(s1_4_w6), c(s1_4_w7), 
                     c(s1_4_w8), c(s1_4_w9), c(s1_4_w10), c(s1_4_w11), c(s1_4_w12)])

    s1_5_w1 = ['The', 'This']
    s1_5_w2 = ['issue of', 'matter of', 'question of', 'concern of',]
    s1_5_w3 = issue_s1
    s1_5_w4 = ['deserves', 'merits', 'warrants', 'demands', 'should get', 'must receive', 'should receive', 'must get']
    s1_5_w5 = s1_3_w6
    s1_5_w6 = s1_3_w7
    s1_5_w7 = s1_3_w8
    s1_5_w8 = ['\b.']
    s1_5 = ' '.join([c(s1_5_w1), c(s1_5_w2), c(s1_5_w3), c(s1_5_w4), c(s1_5_w5), c(s1_5_w6), c(s1_5_w7), c(s1_5_w8)])
    
    sentence1 = c([s1_1, s1_2, s1_3, s1_4, s1_5])
    return sentence1
示例#29
0
 def r():
     return (c(dirs),c(dirs))
示例#30
0
print('Captcha')

from random import randint as r
from random import choice as c
import string

captcha = []
r1 = r(6, 10)

i = 0
while i <= r1:
    r2 = r(0, 9)
    if r2 <= 6:
        r3 = str(r(0, 9))
    else:
        r3 = c(string.ascii_letters)
    captcha.append(r3)
    i += 1

captcha = ''.join(captcha)
print('Captcha generated: ' + captcha)
示例#31
0
#!/usr/bin/env python
#coding=utf-8
from random import shuffle as mix
from string import ascii_letters as letters
from random import choice as c

#lista = [i for i in range(100)]
lista = [i for i in [c(xrange(100)) for i in xrange(100)]]
mix(lista)
lista2 = [i for i in [c(letters) for i in xrange(len(letters))]]

def main():
	"""not made for direct call"""
	print "Error: código no apto para llamada directa"
	exit(1)

if __name__ == '__main__':
	main()
示例#32
0
# if I wanted to refer to the module as another name

# I can now call on the random module using 'rand' instead of 'random'
import random as rand

# randomly picks one
print(rand.choice(['apple', 'banana', 'cherry', 'durian']))
# randomly shuffles list
print(rand.shuffle(['apple', 'banana', 'cherry', 'durian']))

# If I just want to import A PART of a module, I can use keyword 'from'
# It's best to only import what I need to be safe and keep things fast
# from MODULE import * (this imports everything into the current namespace (meaning you dont need random.randint(), just randint()))
from random import choice as c, randint as r

print(c(['a', 'b', 'c', 'd']))
print(r(1, 100))

# 218 - Custom Modules
# Less impressive than it sounds...basically just a file with Python code that I import to another file
# See the lecture for details
# I is the same as importing a built-in module
# just make sure the files are in the same directory (or you need to specify directory location)

# 220 - Installing External Modules and TermColor
# external modules need to be installed and, generally speaking, come from random developers
# A good resource for external modules: https://pypi.org/
# IMPORTANT NOTE: PyPi is not audited. This means I must be extremely careful with the packages I download. Most popular ones will be scrutinized, but others will likely not be...
# to get external packages, I need to use pip in regular Python, but since I'm using Anaconda, I need the cheatsheet:
# https://conda.io/docs/_downloads/conda-cheatsheet.pdf
# It's important to note that I should use different environments as I am testing things out...
示例#33
0
import discord
from discord.ext import commands
import brawlstats
from random import choice as c
import os
import aiohttp

colors = c([
    discord.Color.red(),
    discord.Color.blue(),
    discord.Color.green(),
    discord.Color.purple(),
    discord.Color.orange(),
    discord.Color.blurple(),
    discord.Color.magenta()
])


class BrawlStars(commands.Cog):
    """I know, the bot has Brawl Stars stats. It works perfect."""
    def __init__(self, bot):
        self.bot = bot
        self.client = brawlstats.Client('KEY', is_async=True)

    @commands.command(usage='<tag>')
    @commands.cooldown(1, 5, commands.BucketType.user)
    async def bsprofile(self, ctx, tag: str = None):
        """Get a brawl stars profile"""
        if tag is None:
            return await ctx.send(f"**Use `{ctx.prefix}bsprofile <tag>`!**")
        try:
示例#34
0
from random import choice as c

from firstnames_f import *
from firstnames_m import *
from surnames import *

firstnames = mFirstNames + fFirstNames

for _ in range(25):
	print c(firstnames) + " " + c(surnames)
示例#35
0
def cmd(send, msg, args):
    """Causes the bot to generate some jargon.
    Syntax: {command} 
    """
    msgtype = ["If we %s the %s, we can get to the %s %s through the %s %s %s!" % (c(verb), c(noun), c(abbrev), c(noun), c(adj), c(abbrev), c(noun)),
               "We need to %s the %s %s %s!" % (c(verb), c(adj), c(abbrev), c(noun)),
               "Try to %s the %s %s, maybe it will %s the %s %s!" % (c(verb), c(abbrev), c(noun), c(verb), c(adj), c(noun)),
               "You can't %s the %s without %s the %s %s %s!" % (c(verb), c(noun), c(ingverb), c(adj), c(abbrev), c(noun)),
               "Use the %s %s %s, then you can %s the %s %s!" % (c(adj), c(abbrev), c(noun), c(verb), c(adj), c(noun)),
               "The %s %s is down, %s the %s %s so we can %s the %s %s!" % (c(abbrev), c(noun), c(verb), c(adj), c(noun), c(verb), c(abbrev), c(noun)),
               "%s the %s won't do anything, we need to %s the %s %s %s!" % (c(ingverb), c(noun), c(verb), c(adj), c(abbrev), c(noun)),
               "I'll %s the %s %s %s, that should %s the %s %s!" % (c(verb), c(adj), c(abbrev), c(noun), c(verb), c(abbrev), c(noun))]

    send(c(msgtype))
示例#36
0
文件: chip.py 项目: kt3k/cilib
    for m, x in enumerate(v):
        b.append(x)
        if m%n == n-1:
            yield b
            b = []
    if b:
        b += [d] * (n - len(b))
        yield b

def fold_(v, n, d=''):
    pass

if __name__ == '__main__':

    from cilib import ciprint
    from cilib import span
    from random import randrange, choice as c

    a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    st = 'background:#%03x;font-family:terminal;padding:0px;margin:0px;'
    content = [
          [span(c(a)+c(a)+c(a))(style=st%(randrange(16**3))) for x in range(19)]
              for y in range(57)]

    ciprint(
        title = 'chip.py',
        content = table(content)(cellspacing=0)(cellpadding=0)['test'],
        separate = True,
        css = '/css/basic2',
    )
示例#37
0
def timer_handler():
    global message
    message = [''.join([c([chr(r(32,127)),'0','0','1']) for i in xrange( inc(len(message[j])+1) )]) for j in xrange(len(message))]
    if len(message) <= 22: message.extend(["",""]) 
示例#38
0
# print('hello world ')
#
# if 3 > 0:
#     print('yes')
# else:
#     print('no')
#
# x = y = 3
# print(x + y)

from random import randint as c


def sort(seq):
    if len(seq) < 2:
        return seq
    middle = seq[0]
    smaller = []
    larger = []


if __name__ == '__main__':
    nums = [c(1, 100) for i in range(10)]
    print(nums)
    sort(nums)
示例#39
0
from random import choice as c

from firstnames_f import *
from firstnames_m import *
from surnames import *

firstnames = mFirstNames + fFirstNames

for _ in range(25):
    print c(firstnames) + " " + c(surnames)
示例#40
0
import folium
from random import choice as c

marker_colors = ['red', 'blue', 'green', 'purple', 'orange', 'darkred',
             'beige', 'darkblue', 'cadetblue', 'pink', 'lightblue', 'black']

map = folium.Map(location=[45.327803, 14.466859], zoom_start=21)

uni = folium.FeatureGroup("Universities")

with open("universities_locations.txt", "r") as f:
    for univ in f:
        location = (univ.split(sep=";")[0]).split(sep=", ")
        location = [float(no) for no in location]
        name = univ.split(sep=";")[1]
        uni.add_child(
            folium.Marker(location=location, popup=name, icon=folium.Icon(color=c(marker_colors))))
map.add_child(uni)
map.add_child(folium.LayerControl())
map.save("map1.html")
示例#41
0
def s2():
    s2_1_w1 = ['I appreciate', 'Thank you for', 'I would be encouraged by']
    s2_1_w2 = c([['your'], ['your prompt', 'your courteous', 'your immediate', 'your timely']])
    s2_1_w3 = ['attention', 'notice', 'consideration', 'recognition', 'awareness', 'concern']
    s2_1_w4 = ['for', 'of', 'towards', 'toward', 'to']
    s2_1_w5 = ['this']
    s2_1_w6 = ['\b', 'important', 'critical', 'crucial', 'essential', 'far-reaching', 'serious', 'significant', 'urgent', 'meaningful', 'vital', 'pressing']
    s2_1_w7 = ['issue', 'matter', 'concern', 'question', 'problem', 'topic', 'message', 'correspondence', 'letter', 'note', 'request', 'inquiry']
    s2_1_w8 = ['\b.']
    s2_1 = ' '.join([c(s2_1_w1), c(s2_1_w2), c(s2_1_w3), c(s2_1_w4), c(s2_1_w5), c(s2_1_w6), c(s2_1_w7), c(s2_1_w8)])
    
    s2_2_w1 = c([['Your'], ['Your prompt', 'Your courteous', 'Your immediate', 'Your timely']])
    s2_2_w2 = s2_1_w3
    s2_2_w3 = s2_1_w4
    s2_2_w4 = s2_1_w5
    s2_2_w5 = s2_1_w6
    s2_2_w6 = s2_1_w7
    s2_2_w7 = ['is', 'continues to be', 'remains']
    s2_2_w8 = ['appreciated', 'welcome', 'acknowledged', 'laudatory', 'commendatory']
    s2_2_w9 = ['\b.']
    s2_2 = ' '.join([c(s2_2_w1), c(s2_2_w2), c(s2_2_w3), c(s2_2_w4), c(s2_2_w5), c(s2_2_w6), c(s2_2_w7), c(s2_2_w8), c(s2_2_w9)])
    
    sentence2 = c([s2_1, s2_2])
    return sentence2
示例#42
0
文件: memory.py 项目: marto1/polemika
def play_random_choice(words):
    answer, word = c(words)[:-1].split(",")
    result = raw_input("{0} : ".format(word))
    return result, answer
示例#43
0
from  random import choice as c
list1=list(map(int,input("Enter values:").split(",")))
print(c(list1))