content
stringlengths
7
1.05M
"""Created by sgoswami on 8/30/17.""" """Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it upside down and turn it into a tree where the original right nodes turned into left leaf nodes.""" # Definition for a binary tre...
# C100--- python classes class Car(object): """ blueprint for car """ def __init__(self, modelInput, colorInput, companyInput, speed_limitInput): self.color = colorInput self.company = companyInput self.speed_limit = speed_limitInput self.model = modelInput def s...
class ConfigSVM: # matrix_size = 1727 # matrix_size = 1219 # matrix_size = 1027 matrix_size = 798 # matrix_size = 3
print('\033[1;93m-=-\033[m' * 15) print(f'\033[1;31m{"LARGEST AND SMALLEST ON THE LIST":^45}\033[m', ) print('\033[1;93m-=-\033[m' * 15) numbers = list() largest = 0 big_position = list() small_position = list() numbers.append(int(input(f'Type a number for the position {0}: '))) smallest = numbers[0] for i in range(...
# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
getObject = { 'primaryRouter': { 'datacenter': {'id': 1234, 'longName': 'TestDC'}, 'fullyQualifiedDomainName': 'fcr01.TestDC' }, 'id': 1234, 'vlanNumber': 4444, 'firewallInterfaces': None }
"""Library package info""" author = "linuxdaemon" version_info = (0, 3, 0) version = ".".join(map(str, version_info)) __all__ = ("author", "version_info", "version")
"""The module has following classes: - Room""" class Room(object): '''Takes name and description of the object and initializes paths.\nProvides methods \n\t go(direction) and,\n\t add_paths(paths)''' def __init__(self, name, description): self.name = name self.description = description ...
class Car: def wheels(self): print('Car.wheels') return 4 class Bike(Car): def wheels(self): return 2 class Truck(Car): def wheels(self): print('Truck.wheels: start') super().wheels() print('Truck.wheels: end') return 6 car = Bike() print(car.wh...
class NodeEndpoint: protocol = '' host = '' port = '' @staticmethod def from_parameters(protocol, host, port): endpoint = NodeEndpoint() endpoint.protocol = protocol endpoint.host = host endpoint.port = port return endpoint @staticmethod def from_jso...
class SchemaConstructionException(Exception): def __init__(self, claz): self.cls = claz class SchemaParseException(Exception): def __init__(self, errors): self.errors = errors class ParseError(object): def __init__(self, path, inner): self.path = path self.inner = inner...
""" Created on Sun Feb 15 01:52:42 2015 @author: Enes Kemal Ergin The Field: Introduction to Complex Numbers (Video 2) """ # complex number = (real part) + (imaginary part) * i ## Pyhton use j for doing complex 1j 1+3j (1+3j) + (10+20j) x = 1+3j (x-1)**2 # (-9+0j) -> -9 x.real # 1.0 x.imag # 3.0 ## Write a pr...
class Solution: def maxPerformance(self, n: int, speed: List[int], efficiency: List[int], k: int) -> int: modulo = 10 ** 9 + 7 # build tuples of (efficiency, speed) candidates = zip(efficiency, speed) # sort the candidates by their efficiencies candidates = sorted(candidates...
"""Helper functions used in various modules.""" def deserialize_thing_id(thing_id): """Convert base36 reddit 'thing id' string into int tuple.""" return tuple(int(x, base=36) for x in thing_id[1:].split("_")) def update_sr_tables(cursor, subreddit): """Update tables of subreddits and subreddit-moderator...
"""Test the link to the help docco.""" def test_help_redirect_to_rtd(webapp, f_httpretty): """Test we redirect to read the docs.""" f_httpretty.HTTPretty.allow_net_connect = False response = webapp.get('/help') assert response.status_code == 302 assert response.headers['location'] == 'https://dn...
# Minimum Size Subarray Sum class Solution: def minSubArrayLen(self, target, nums): length = len(nums) Invalid = length + 1 left, right = 0, 0 added = nums[left] if added >= target: return 1 ans = Invalid while True: if left + 1 <= r...
# http://codingbat.com/prob/p165321 def near_ten(num): return (num % 10 <= 2) or (num % 10 >= 8)
# 计算圆的周长和面积(其二:用变量表示圆周率) PI = 3.14159 # 圆周率 r = float(input('半径:')) print('圆的周长是', 2 * PI * r, '。') print('面积是', PI * r * r, '。')
class WorkerNode(object): def __init__(self, ip, k8s_name, k8s_is_ready): self.ip = ip self.k8s_name = k8s_name self.k8s_is_ready = k8s_is_ready self.k8s_pod_num = 0 self.vc = None self.to_turn_on = False self.to_turn_off = False class Pod(object): d...
filmler= { "Kara Korsanın Laneti":{"Yapım Yılı":1957,"Imdb":8.2,"Tür":"Korku"}, "Sineğin İntikamı":{"Yapım Yılı":2957,"Imdb":1.2,"Tür":"Belgesel"} } def filmEkle(): film_adı = input("Film adı girin: ") global filmler if film_adı: yapım_yılı = input("Yapım yılını girin: ") imdb = input("İmdb...
class Solution: def countAndSay(self, n): numb = 1 w = 1 while n > 1: w = Solution.CountSay(numb) numb = w n -= 1 return str(w) def CountSay(no): tnumb = str(no) x = tnumb[0] count = 1 strr = "" ...
# domoticz configuration DOMOTICZ_SERVER_IP = "xxx.xxx.x.xxx" DOMOTICZ_SERVER_PORT = "xxxx" DOMOTICZ_USERNAME = "" DOMOTICZ_PASSWORD = "" # sensor dictionary to add own sensors # if you don't want to use the raw voltage option, just write -1 in the VOLTAGE_IDX value field sensors = { 1: {"MAC": "xx:xx:xx:xx:xx...
n = int(input('Digite um número para calcular seu Fatorial: ')) c = n f = 1 print('Calculando {}! = '.format(n), end='') while c > 0: print('{}'.format(c), end='') print(' x ' if c > 1 else ' = ', end='') f *= c c -= 1 print('{}'.format(f)) '''fazer com for for i in range(n, 0, -1): print('{}'.forma...
del_items(0x8009E2A0) SetType(0x8009E2A0, "char StrDate[12]") del_items(0x8009E2AC) SetType(0x8009E2AC, "char StrTime[9]") del_items(0x8009E2B8) SetType(0x8009E2B8, "char *Words[117]") del_items(0x8009E48C) SetType(0x8009E48C, "struct MONTH_DAYS MonDays[12]")
class FunctionLink: def __init__(self, linked_function): self.__linked_function = linked_function @property def linked_function(self): return self.__linked_function
workers = 2 timeout = 120 reload = True limit_request_field_size = 0 limit_request_line = 0
n = int(input('Digite um número: ')) c = 0 for i in range(1, n + 1): if n % i == 0: c += 1 print('\033[1;33m{}\033[m'.format(i), end=' ') else: print('\033[1;31m{}\033[m'.format(i), end=' ') print('O número {} foi divisível {} vezes'.format(n, c)) if c == 2: print('E por isso ele ...
def codesTable(char): table = { "A": ".-", "B": "-...", "C": "-.-.", "D": "-..", "E": ".", "F": "..-.", "G": "--.", "H": "....", "I": "..", "J": ".---", "K": "-.-", "L": ".-..", "M": "--", "N": "-.", "O": "---", "P": ".--.", "Q": "--.-", "R": ".-.", "S": "...", "T": "-", "U":...
GITHUB_TOKENS = ['GH_TOKEN'] GITHUB_URL_FILE = 'rawGitUrls.txt' GITHUB_API_URL = 'https://api.github.com/search/code?q=' GITHUB_API_COMMIT_URL = 'https://api.github.com/repos/' GITHUB_SEARCH_PARAMS = '&sort=indexed&o=desc' GITHUB_BASE_URL = 'https://github.com' GITHUB_MAX_RETRY = 10 XDISCORD_WEBHOOKURL = 'https://disco...
# -*- coding:utf-8 -*- # /usr/bin/env python """ Author: Albert King date: 2019/11/14 20:32 contact: jindaxiang@163.com desc: 学术板块配置文件 """ # EPU epu_home_url = "http://www.policyuncertainty.com/index.html" # FF-factor ff_home_url = "http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html"
class Fish: def __init__(self,filename): with open(filename,'r') as input_file: ages = [int(age) for age in input_file.readline().strip('\n').split(',')] # create a population breakdown - for each age contains a count of number of fish in this age group. Needed to make this ...
class QuickSort(object): "In Place Quick Sort" def __init__(self, arr): self.arr = arr def sort(self, left_i, right_i): if right_i - left_i < 1: return pivot_i = self.partition(left_i, right_i) self.sort(left_i, pivot_i - 1) self.sort(pivot_i + 1, right_...
def validate(instruction) -> bool: """Validates an instruction Parameters ---------- instruction : BaseCommand The instruction to validate Returns ------- bool Valid or not valid """ switch = { # R Type instructions "add": validate_3_rtype, ...
a = [] for i in range(100): a.append(i) if (n := len(a)) > 10: print(f"List is too long ({n} elements, expected <= 10)")
# model initial conditions x = -1 y = 0 z = 0.5 t = 0 # model constants _alpha = 0.3 gamma = 0.01 # gradients palette_relaxing_red = [color(180, 15, 48), color(255, 251, 213)] palette_shahabi = [color(104, 250, 0), color(166, 1, 116)] palette_flare = [color(245, 174, 25), color(241, 40, 16)] palette_rose_colored_lens...
def get_bid(exchange, symbol, n=1): return 0 def get_bid(exchange, symbol, n=1): return 0
def build_tuple_type(*columns): class Tuple(object): __slots__ = columns def __init__(self, d=None, **kw): if d is None: d = kw for k in self.__slots__: setattr(self, k, d.get(k)) def __getitem__(self, k): if k in s...
# ------------------------------------------------------------------------------ # Site Configuration File # ------------------------------------------------------------------------------ theme = "carbon" title = "Holly Demo" tagline = "A blog-engine plugin for Ivy." extensions = ["holly"] holly = { "homepage": ...
def Prime_number(n): a = [] for i in range(2,n+1): e1 = n % i if e1 == 0: b.append(e1) if len(a) > 1: print('FALSE') print('This is not a prime number!') elif len(a) == 1: print('TRUE') print('This is a Prime number!') Prime_number(int(input('Please give your number: ')))
class Platform: def __init__(self, designer, debug): self.designer = designer self.debug = debug def generate_wrappers(self): raise Exception("Method not implemented") def create_mem(self, mem_type, name, data_type, size, init): raise Exception("Method not implemented") ...
# Here I've implemented a method of finding square root of imperfect square # Steps (Pseudocode): visit http://burningmath.blogspot.in/2013/12/finding-square-roots-of-numbers-that.html # Read the steps carefully or you'll not understand the program! # To check is number is a perfect square or not def is_perfect_square...
"""Constants that define units""" AUTO = 'auto' METRIC = 'metric' US = 'us' UK = 'uk' CA = 'ca'
usuario = input("Informe o nome de usuario: ") senha = input("Informe a senha: ") while usuario == senha: print("Usuario deve ser diferente da senha!\n") senha = input("Informe uma nova senha: ") else: print("Dados confirmados")
# Criei uma função para receber o parâmetro e validá-lo ao mesmo tempo def testeCodigoValido(): while True: codigoProdutos = int(input('Digite o código do produto entre 10000 e 30000:')) # Se o código for menor que 10000 e maior que 30000 ele retorna: código invalido # e faz o usuário digita...
print() n = 0 tot = 0 soma = 0 media = 0 maior = 0 menor = 0 opc = '' while (opc != 'N'): n = int(input('Informe um número: ')) tot += 1 soma += n if(n > maior): maior = n else: menor = n opc = str(input('Deseja continuar: [S/N]: ')).upper() print() media = soma / tot print('O ma...
""" This is a simple binary search algorithm for python. This is the exact implementation of the pseudocode written in README. """ def binary_search(item_list,item): left_index = 0 right_index = len(item_list)-1 while left_index <= right_index: middle_index = (left_index+right_index) // 2 ...
# Dependency Inversion Principle (SOLID) # https://www.geeksforgeeks.org/dependecy-inversion-principle-solid/ # SGVP391900 | 12:03 7Mar19 # Mootto - Any higher classes should always depend upon the abstraction of the class # rather than the detail. class Employee(object): def Work(): pass class Manager...
# desafio050 Soma dos Pares For #Desenvolva um progama que leia 6 números inteiros e mostre a soma apenas daqueles que forem pares. se o # valor for impar, desconsidere-o. acumulador = cont = 0 for c in range(1, 7): valor = int(input("Digite o {} número:".format(c))) if valor % 2 == 0: acumulador = acum...
def asarray(a, dtype=None, order=None): """Convert the input to an array. Parameters ---------- a : array_like Input data, in any form that can be converted to an array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays. dtype : d...
[b'z' if foldnuls and not word else b'y' if foldspaces and word == 0x20202020 else (chars2[word // 614125] + chars2[word // 85 % 7225] + chars[word % 85]) ]
inputs = {"sentence": "a very well-made, funny and entertaining picture."} archive = ( "https://storage.googleapis.com/allennlp-public-models/" "basic_stanford_sentiment_treebank-2020.06.09.tar.gz" ) predictor = Predictor.from_path(archive) interpreter = SimpleGradient(predictor) interpretation = interpreter.sa...
# -*- coding: utf-8 -*- """ Created on Fri Dec 6 15:17:07 2019 @author: bdobson """ """Constants """ M3_S_TO_ML_D = 86.4 MM_KM2_TO_ML = 1e-3 * 1e6 * 1e3 * 1e-6 PCT_TO_PROP = 1e-2 PROP_TO_PCT = 100 L_TO_ML = 1e-6 FLOAT_ACCURACY = 1e-10
# File: adldap_view.py # # Copyright (c) 2021-2022 Splunk Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
while True: try: p = input() d = 0 for i in range(len(p)): if(p[i]=='('): d += 1 elif(p[i]==')'): d -= 1 if(d < 0): break if(d != 0): print('incorrect') else: print('co...
f = open('69_sample.txt') # read 1st line data = f.readline() print (data) # read second line data = f.readline() print (data) f.close()
class Node(object): def __init__(self, val, children): self.val = val self.children = children class Solution(object): def trace(self, node, nodelist): if node is None: return for n in node.children: self.trace(n, nodelist) nodelist.append(node.v...
bot = {'owner': '', 'client_id': '', 'version': '', 'prefix': '|', 'pstart': 'python3 ./main.py', 'game': '', 'token': '', 'invite_url': '', 'update_name': '', 'release_details': './data/misc/releaseplaceholder.txt', 'checkin_details': './data/misc/c...
""" Module to contain the configuration information loaded from the config file. DO NOT MODIFY THIS FILE! Use yaml files in configurations directory to change the settings. """ # Optional settings (set defaults) show_labels = False show_sensory = False show_individual = False display_legend = True combination_strate...
""" This module provide solution for first task. """ def change_sub_strings(text, pattern, new_string): """ Function for changing all entrance of pattern to new_string. :param text: str String for changing. :param pattern: str String which should be removed. Any suffix of this string...
ENTRY_POINT = 'fizz_buzz' FIX = """ Update doc string to remove requirement for print. """ #[PROMPT] def fizz_buzz(n: int): """Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. >>> fizz_buzz(50) 0 >>> fizz_buzz(78) 2 >>> fizz_buzz(79) ...
""" constants """ #!/usr/bin/env python3 # -*- coding:utf-8 -*- PATH_RASPICAM = "/raspicam_node/image/compressed" PATH_USBCAM = "/usb_cam/image_raw/compressed" PATH_LIDAR = "/scan" PATH_ASSETS = "../assets/" PATH_GALAPAGOS_STATE = "/galapagos_state" # SELECTED_STATE = "" # ! deprecated MAX_SPEED = 0.22 TURNING_SPEED ...
def type2diabetes(filepath): """ 1. Takes a text file as the only parameter and returns means and std of the phenotype typeII diabetes 2. Search for data labels on the text file and read text file to csv file starting from the rows of labels present 3. Replace missing data '--' with NaN and drop mis...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jul 12 10:49:34 2020 @author: ravi """ def recordBreaker(arr): peak = 0 cmax = float("-inf") if len(arr)==0: return 0 if len(arr)==1: return 1 for i in range(len(arr)): if i==0: if arr[i]>arr[i+1]...
N = int(input()) for i in range(N): line = input() print("I am Toorg!")
def divide(n1, n2):#dessa forma levantamos o erro sem parar o cod if n2 == 0:#se n2 for igual a zero raise ValueError("n2 nao pode ser 0 ") return n1 / n2 try: print(divide(n1=2,n2=1)) except ValueError as error: print('Voce esta tentando dividir por zero') print('log:', error)
# 566. Reshape the Matrix # Runtime: 109 ms, faster than 30.83% of Python3 online submissions for Reshape the Matrix. # Memory Usage: 14.7 MB, less than 87.88% of Python3 online submissions for Reshape the Matrix. class Solution: # Using Queue def matrixReshape(self, mat: list[list[int]], r: int, c: int) ->...
def is_odd(n): return n%2 == 1 def is_even(n): return n%2 == 0 print('------------- Filter --------------') lst_a = list(range(10)) print(lst_a) lst_c = filter(is_odd,lst_a) print(lst_c) # filter返回的迭代器对象只能迭代一次 print("iteraction 1:") for elem in lst_c: print(elem, end=" ") print() print("iteraction 2:") f...
def n_primos (x): numero =2 quantidadeDePrimos=0 while numero<=x: divisor = 2 divisores=0 while divisor<numero: if numero%divisor==0: divisores+=1 divisor+=1 if divisores==0: quantidadeDePrimos+=1 numero+=1 return...
#Now let's make things a little more challenging. # #Last exercise, you wrote a function called word_count that #counted the number of words in a string essentially by #counting the spaces. However, if there were multiple spaces #in a row, it would incorrectly add additional words. For #example, it would have counted t...
def sortByHeight(a): trees = [] peoples = [] for i in range(len(a)): if (a[i] != -1): peoples.append(a[i]) else: trees.append(i) peoples = sorted(peoples) for i in range(len(trees)): peoples.insert(trees[i], -1) return peoples
class Helper(object): defaultText = """Eddie knowledge - what your opponents don't want you to know.\n\nCommands: .help .changes .fd <CHAR> [<MOVENAME>] .fds <CHAR> [<MOVENAME>] .atklevel <LEVEL> .alias <ALIAS> .addalias <ALIAS> | <VALUE> .removealias <ALIAS> .charnames...
nome = str(input('qual o seu nome ')) print('Prazer em te conhecer {:-^20}! \n'.format(nome)) n = int(input(' Bem vindo a Tabuada, digite um numero para ver o resultado: ')) multiplicando = 0 cont = 0 while cont <= 10: print(n * multiplicando) multiplicando = multiplicando + 1 cont = cont + 1
""" @FileName: __init__.py.py @Description: Implement __init__.py @Author: Ryuk @CreateDate: 2021/06/27 @LastEditTime: 2021/06/27 @LastEditors: Please set LastEditors @Version: v0.1 """
__all__ = ["RefMixin"] class RefMixin: def __init__(self, loop, ref=True): self.loop = loop self.ref = ref self._ref_increased = False def _increase_ref(self): if self.ref: self._ref_increased = True self.loop.increase_ref() def _decrease_ref(self)...
#!/usr/bin/env python3 max_seat = 0 with open('input.txt') as infile: for line in infile: row = 0 col = 0 for c in line: if c == 'B': row = 2*row + 1 if c == 'F': row *= 2 if c == 'R': col = 2*col + 1 ...
# -*- coding: utf-8 -*- """ @contact: lishulong.never@gmail.com @time: 2018/3/25 上午11:07 """
class Solution: def closedIsland(self, grid: List[List[int]]) -> int: m = len(grid) n = len(grid[0]) vis = [[0]*n for i in range(m)] res = 0 def bfs(i,j): vis[i][j] = 1 q = [(i,j)] valid = 1 while len(q)> 0...
''' Escreva um programa que leia um número N inteiro qualquer e mostre na tela os N primeiros elementos de uma Sequência de Fibonacci. Ex: 0 - 1 - 1 - 2 - 3 - 5 - 8 ''' print('-='*20) print('Sequencia de Fibonacci') print('-='*20) n = int(input('Quantos Termos Voce quer Mostrar: ')) t1 = 0 t2 = 1 print('~'*40) print('...
UK = "curb accessorise accessorised accessorises accessorising acclimatisation acclimatise acclimatised acclimatises acclimatising accoutrements aeon aeons aerogramme aerogrammes aeroplane aeroplanes aesthete aesthetes aesthetic aesthetically aesthetics aetiology ageing aggrandisement agonise agonised agonises agonisin...
s = [[int(i) for i in input().split(' ')] for j in range(3)] n = [s[i][j] for i in range(3) for j in range(3)] all_n = [[8,1,6,3,5,7,4,9,2],[6,1,8,7,5,3,2,9,4],[4,9,2,3,5,7,8,1,6],[2,9,4,7,5,3,6,1,8],[8,3,4,1,5,9,6,7,2],[4,3,8,9,5,1,2,7,6],[6,7,2,1,5,9,8,3,4],[2,7,6,9,5,1,4,3,8]] allsum=[] for l in all_n: summ=...
BUILTIN_ENGINES = {"spark": "feaflow.engine.spark.SparkEngine"} BUILTIN_SOURCES = { "query": "feaflow.source.query.QuerySource", "pandas": "feaflow.source.pandas.PandasDataFrameSource", } BUILTIN_COMPUTES = {"sql": "feaflow.compute.sql.SqlCompute"} BUILTIN_SINKS = { "table": "feaflow.sink.table.TableSink...
""" This module contains everything that calls command line calls. """ class Command(object): base_cmd = ['transmission-remote'] args = [] def run_command(self): return subprocess.check_output(self.base_cmd + self.args, stderr=subprocess.STDOUT) class ListCommand(Command): args = ['-l'] c...
APP_ID = '390093838084850' DOMAIN = 'https://ef1ac6ba.ngrok.io' COMMENTS_CALLBACK = DOMAIN + \ '/webhook_handler/' MESSENGER_CALLBACK = DOMAIN + \ '/webhook_handler/' VERIFY_TOKEN = '19990402' APP_SECRET = 'e3d24fecd0c82e3c558d9cca9c6edad7'
# Copyright 2017 Ryan D. Williams # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
#!/usr/bin/python #coding=utf-8 ''' @author: sheng @license: ''' SPELL=u'yìshè' CN=u'意舍' NAME=u'yishe44' CHANNEL='bladder' CHANNEL_FULLNAME='BladderChannelofFoot-Taiyang' SEQ='BL49' if __name__ == '__main__': pass
bind = '0.0.0.0:5000' workers = 1 backlog = 2048 worker_class = "sync" debug = True proc_name = 'gunicorn.proc' pidfile = '/tmp/gunicorn.pid' logfile = '/var/log/gunicorn/debug.log' loglevel = 'error'
def fizzbuzz(i): ''' int -> str If i is divisible by 3, return "Fizz". If i is divisible by 5, return "Buzz". If i is divisible by 3 and 5, return "FizzBuzz".''' if i % 3 == 0 and i % 5 == 0: return ("FizzBuzz") elif i % 3 == 0: return ("Fizz") elif i % 5 == 0: retur...
# Configuration file for the Sphinx documentation builder. # -- Project information project = 'ChemW' copyright = '2022, Andrew Philip Freiburger' author = 'Andrew Philip Freiburger' release = '1' version = '0.3.1'
""" Quoridor Online Quentin Deschamps, 2020 """ class Game: """Create a game""" def __init__(self, game_id, nb_players): self.game_id = game_id self.nb_players = nb_players self.connected = [False] * nb_players self.names = [''] * nb_players self.run = False sel...
''' Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit within the range of a 32-bit signed integer. You could assume no leading zero bit in the integer’s binary representation. Example 1: ...
""" >>> bus1 = HountedBus(['Alice', 'Bill']) >>> bus1.passengers ['Alice', 'Bill'] >>> bus1.pick('Charlie') >>> bus1.drop('Alice') >>> bus1.passengers ['Bill', 'Charlie'] >>> bus2 = HountedBus() >>> bus2.pick('Carrie') >>> bus2.passengers ['Carrie'] >>> bus3 = HountedBus() >>> bus3.passengers ['Carrie'] >>> bus3.pick('...
""" File: caesar.py Name: Isabelle ------------------------------ This program demonstrates the idea of caesar cipher. Users will be asked to input a number to produce shifted ALPHABET as the cipher table. After that, any strings typed in will be encrypted. """ # This constant shows the original order of alphabetic s...
#URL: https://www.hackerrank.com/challenges/two-characters/problem def alternate(l, s): chars = list(set(s)) n = len(chars) maxlen = 0 #print(chars) for i in range(n): for j in range(i+1,n): ch1 = chars[i] ch2 = chars[j] tempans = "" ansl = 0 ...
def arithmetic_arranger(problems, answer=False): # check to see if the list is too long num_problems = len(problems) answers_list = [] top_operand = [] operator = [] bottom_operand = [] # calculate answers, create a list of answers # check to see if there are too many problems...
# # PySNMP MIB module OUTBOUNDTELNET-PRIVATE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OUTBOUNDTELNET-PRIVATE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:35:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: FBOutput class PassMask(object): _img = 1 _id = 2 _category = 4 _mask = 8 _depth = 16 _normals = 32 _flow = 64
class Config(): def __init__(self): self.api_token = None self.module_name = None self.port = None self.enable_2fa = None self.creds = None self.seen = set() self.verbose = False
board=[" "]*9 def draw_board(board): print("|----|----|----|") print("| | | |") print("| "+board[0]+"| "+board[1]+" | "+board[2]+" |") print("| | | |") print("|----|----|----|") print("| | | |") print("| "+board[3]+"| "+board[4]+" | "+board[5]+" |") pr...
""" Script testing 3.4.1 control from OWASP ASVS 4.0: 'Verify that cookie-based session tokens have the 'Secure' attribute set.' The script will raise an alert if 'Secure' attribute is not present. """ def scan(ps, msg, src): #find "Set-Cookie" header headerCookie = str(msg.getResponseHeader().getHeader("Set-...
__example_payload__ = "AND 1=1" __type__ = "putting the payload in-between a comment with obfuscation in it" def tamper(payload, **kwargs): return "/*!00000{}*/".format(payload)