content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- """ Last update: Sep. 2, 2020 @author: Asieh Abolpour Mofrad Initialization values details This code is used for simulation results reported in an article entitled: ''Enhanced Equivalence Projective Simulation: a Framework for Modeling Formation of Stimulus Equivalence C...
""" Last update: Sep. 2, 2020 @author: Asieh Abolpour Mofrad Initialization values details This code is used for simulation results reported in an article entitled: ''Enhanced Equivalence Projective Simulation: a Framework for Modeling Formation of Stimulus Equivalence Classes" in Neural Computat...
class Writing: ''' --help = This class provides the working of TOEFL Writing section. ''' def question(self): pass def __init__(self): pass ## TODO: Label - instructions, question ## TODO: Text Field - Write answerd
class Writing: """ --help = This class provides the working of TOEFL Writing section. """ def question(self): pass def __init__(self): pass
class GameObject: def __init__(self, data, localizer): # self.key will be set prior to invoking _name() self.key = self._key(data) self.name = self._name(localizer) self.prerequisites = self._prerequisites(data[self.key]) def _name(self, localizer): return localizer.get(...
class Gameobject: def __init__(self, data, localizer): self.key = self._key(data) self.name = self._name(localizer) self.prerequisites = self._prerequisites(data[self.key]) def _name(self, localizer): return localizer.get(self.key) def _key(self, data): return list...
ALL_LETTERS = [ letter.lower() for letter in [ "E", "A", "R", "I", "O", "T", "N", "S", "L", "C", "U", "D", "P", "M", "H", "G", "B", "F", "Y", "W", ...
all_letters = [letter.lower() for letter in ['E', 'A', 'R', 'I', 'O', 'T', 'N', 'S', 'L', 'C', 'U', 'D', 'P', 'M', 'H', 'G', 'B', 'F', 'Y', 'W', 'K', 'V', 'X', 'Z', 'J', 'Q']] class Gamestate: def __init__(self, word_length=5): self.word_length = word_length self.unexplored_letters = ALL_LETTERS ...
class PistonResponse: def __init__(self, data: dict) -> None: self.ran = data.get("ran") self.language = data.get("language") self.version = data.get("version") self.stdout = data.get("stdout") self.stderr = data.get("stderr") self.output = data.get("output"...
class Pistonresponse: def __init__(self, data: dict) -> None: self.ran = data.get('ran') self.language = data.get('language') self.version = data.get('version') self.stdout = data.get('stdout') self.stderr = data.get('stderr') self.output = data.get('output') de...
# 066 - TRATANDO VARIOS VALORES V1.0 # LER VARIOS NUMEROS INTEIROS, PARA QUANDO FOR DIGITADO 999 E SOMAR TODOS DIGITADOS # DESCONSIDERANDO 999 somar = qtd = 0 while True: n = int(input('Digite um numero: [Digite 999 para parar[: ')) if n == 999: break somar += n qtd += 1 print(f'Foram digitado...
somar = qtd = 0 while True: n = int(input('Digite um numero: [Digite 999 para parar[: ')) if n == 999: break somar += n qtd += 1 print(f'Foram digitados {qtd} numeros, com o total de {somar}')
""" LC 2156 The hash of a 0-indexed string s of length k, given integers p and m, is computed using the following function: hash(s, p, m) = (val(s[0]) * p0 + val(s[1]) * p1 + ... + val(s[k-1]) * pk-1) mod m. Where val(s[i]) represents the index of s[i] in the alphabet from val('a') = 1 to val('z') = 26. You are given...
""" LC 2156 The hash of a 0-indexed string s of length k, given integers p and m, is computed using the following function: hash(s, p, m) = (val(s[0]) * p0 + val(s[1]) * p1 + ... + val(s[k-1]) * pk-1) mod m. Where val(s[i]) represents the index of s[i] in the alphabet from val('a') = 1 to val('z') = 26. You are given...
class MissingVenvException(Exception): def __init__(self, msg=''): super().__init__(msg) class CantRunProgramException(Exception): def __init__(self, msg=''): super().__init__(msg) class NoPythonExeFound(Exception): def __init__(self, msg=''): super().__init__(msg='') class N...
class Missingvenvexception(Exception): def __init__(self, msg=''): super().__init__(msg) class Cantrunprogramexception(Exception): def __init__(self, msg=''): super().__init__(msg) class Nopythonexefound(Exception): def __init__(self, msg=''): super().__init__(msg='') class Nop...
# Sem else Condicao simples # Com else Condicao composta nome = str(input('Qual eh o seu nome: ')) if nome == 'Rafael': print('Que nome lindo voce tem!') else: print('Seu nome eh tao normal!') print('Bom dia, {}' .format(nome))
nome = str(input('Qual eh o seu nome: ')) if nome == 'Rafael': print('Que nome lindo voce tem!') else: print('Seu nome eh tao normal!') print('Bom dia, {}'.format(nome))
class Cliente: def __init__(self, nome, sexo, data_nascimento, email, profissao, endereco): self.__nome = nome self.__sexo = sexo self.__data_nascimento = data_nascimento self.__email = email self.__profissao = profissao self.__endereco = endereco @property d...
class Cliente: def __init__(self, nome, sexo, data_nascimento, email, profissao, endereco): self.__nome = nome self.__sexo = sexo self.__data_nascimento = data_nascimento self.__email = email self.__profissao = profissao self.__endereco = endereco @property ...
# 3.3 Write a program to prompt for a score between 0.0 and 1.0. # If the score is out of range, print an error. # If the score is between 0.0 and 1.0, print a grade using the following table: # Score Grade # >= 0.9 A # >= 0.8 B # >= 0.7 C # >= 0.6 D # < 0.6 F # If the user enters a value out of range, # print a sui...
score = float(input('Enter the score between 0.0 and 1.0')) if score > 1.0 and score < 0.0: print('Error out of range input.') elif score >= 0.9: print('A') elif score >= 0.8: print('B') elif score >= 0.7: print('C') elif score >= 0.6: print('D') elif score < 0.6: print('F') else: print('Inv...
num_1 = int(input("Enter a number: ")) num_3 = 0 while num_1 > 0: num_2 = num_1 % 10 print(num_2,end = "") num_1 = num_1 // 10 num_3 = num_3 + num_2 print(" ",num_2**3) print(" ") print(num_3)
num_1 = int(input('Enter a number: ')) num_3 = 0 while num_1 > 0: num_2 = num_1 % 10 print(num_2, end='') num_1 = num_1 // 10 num_3 = num_3 + num_2 print(' ', num_2 ** 3) print(' ') print(num_3)
class Solution: def maximalRectangle(self, matrix): res, m, n = 0, len(matrix), len(matrix and matrix[0]) for i in range(m): for j in range(n): if matrix[i][j] != "0": if j > 0 and matrix[i][j - 1] != "0": matrix[i][j] = matrix[...
class Solution: def maximal_rectangle(self, matrix): (res, m, n) = (0, len(matrix), len(matrix and matrix[0])) for i in range(m): for j in range(n): if matrix[i][j] != '0': if j > 0 and matrix[i][j - 1] != '0': matrix[i][j] = m...
database = { 'name': 'splice_auth_db', 'user': 'postgres', 'password': '#100100Borjan', 'host': '127.0.0.1', 'port': 5432, } mail = { 'host': 'localhost', 'port': 25, 'user': '', 'password': '#100100Borjan', 'tls': False, 'ssl': False, }
database = {'name': 'splice_auth_db', 'user': 'postgres', 'password': '#100100Borjan', 'host': '127.0.0.1', 'port': 5432} mail = {'host': 'localhost', 'port': 25, 'user': '', 'password': '#100100Borjan', 'tls': False, 'ssl': False}
class State(object): def __init__(self, data): self.data = data pass def change_data(self, data): self.data = data
class State(object): def __init__(self, data): self.data = data pass def change_data(self, data): self.data = data
# coding=utf-8 KEYBOARD_URL_MAPS = { 'default': [ [ 'Site wide shortcuts', # keyboard category [ # ('keyboard shortcut', 'keyboard info') ('s', 'Focus search bar'), ('g n', 'Go to Notifications'), ('g h', 'Go to person...
keyboard_url_maps = {'default': [['Site wide shortcuts', [('s', 'Focus search bar'), ('g n', 'Go to Notifications'), ('g h', 'Go to personal page'), ('?', 'Bring up this help dialog')]], ['Registration and login', [('l r', 'Open register window'), ('l o', 'Open login window'), ('l t', 'Logout'), ('l c', 'Close register...
class Files: path = './coordinates/' qatar = 'qatar.csv' western_sahara = 'western_sahara.csv' uruguay = 'uruguay.csv' djibouti = 'djibouti.csv' random_10_cities = 'random_10_cities.csv' random_20_cities = 'random_20_cities.csv' random_30_cities = 'random_30_cities.csv' # config class ...
class Files: path = './coordinates/' qatar = 'qatar.csv' western_sahara = 'western_sahara.csv' uruguay = 'uruguay.csv' djibouti = 'djibouti.csv' random_10_cities = 'random_10_cities.csv' random_20_cities = 'random_20_cities.csv' random_30_cities = 'random_30_cities.csv' class Enconfig: ...
number = int(input("Which number do you want to check? ")) if number % 2==0: print("Even") else: print("Odd")
number = int(input('Which number do you want to check? ')) if number % 2 == 0: print('Even') else: print('Odd')
"""You kwow, a little of this, a little of that.""" class CacheDict(dict): def get(self, key): try: return self[key] except KeyError: return None def set(self, key, value, time): self[key] = value class SettingsRequired(RuntimeWarning): pass
"""You kwow, a little of this, a little of that.""" class Cachedict(dict): def get(self, key): try: return self[key] except KeyError: return None def set(self, key, value, time): self[key] = value class Settingsrequired(RuntimeWarning): pass
def eigenvalues(eigenvalues_at_kpoints, kpoint_index=0, spin_index=0): """ Returns eigenvalues for a given kpoint and spin. Args: eigenvalues_at_kpoints (list): a list of eigenvalues for all kpoints. kpoint_index (int): kpoint index. spin_index (int): spin index. Returns: ...
def eigenvalues(eigenvalues_at_kpoints, kpoint_index=0, spin_index=0): """ Returns eigenvalues for a given kpoint and spin. Args: eigenvalues_at_kpoints (list): a list of eigenvalues for all kpoints. kpoint_index (int): kpoint index. spin_index (int): spin index. Returns: ...
class DataRandomAccess(): def __init__(self, dataset): self._dataset = dataset self._scheme = dataset._scheme def __getitem__(self, slice): return self._scheme.ra(slice)
class Datarandomaccess: def __init__(self, dataset): self._dataset = dataset self._scheme = dataset._scheme def __getitem__(self, slice): return self._scheme.ra(slice)
# STRUCTURE INFORMATION WITH A SIMPLE STACK METHOD # Santiago Garcia Arango, July 2020 """ Stacks are simple data-structures that work really well, when we have a problem that involves adding or removing elements but following the concept of LIFO(Last-In, First-Out). This means that the operations affect always the "t...
""" Stacks are simple data-structures that work really well, when we have a problem that involves adding or removing elements but following the concept of LIFO(Last-In, First-Out). This means that the operations affect always the "top-item" that is currently on the stack. We usually create methods to: PUSH --> Add...
class Result(object): """ Base class for analysis results """ def __init__(self): self.results = [] self.header = 'Abstract analysis result' def is_ok(self): return len(self.results) == 0 def add(self, err): self.results.append(err) def format_header(self)...
class Result(object): """ Base class for analysis results """ def __init__(self): self.results = [] self.header = 'Abstract analysis result' def is_ok(self): return len(self.results) == 0 def add(self, err): self.results.append(err) def format_header(self)...
num = int(input()) num2 = int(input()) soma = num + num2 print('X = {}'.format(soma))
num = int(input()) num2 = int(input()) soma = num + num2 print('X = {}'.format(soma))
print('hey its a calculator') print('select from thr below') print('select 1 for addtion, 2 for multiplication, 3 for division, 4 for substract') while True: try: opearation = int(input('select 1 or 2 or 3 or 4 : ')) break except ValueError: print("pls enter a number") while True: ...
print('hey its a calculator') print('select from thr below') print('select 1 for addtion, 2 for multiplication, 3 for division, 4 for substract') while True: try: opearation = int(input('select 1 or 2 or 3 or 4 : ')) break except ValueError: print('pls enter a number') while True: tr...
def extractLilBlissNovels(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if ':' in item['title'] and 'Side Story' in item['title'] and not postfix: postfix = item['title'].split(':')[-1] if 'Wei W...
def extract_lil_bliss_novels(item): """ """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if ':' in item['title'] and 'Side Story' in item['title'] and (not postfix): postfix = item...
def _single_fortran_object_impl(ctx): toolchain_cflags = (ctx.fragments.cpp.compiler_options([]) + ctx.fragments.cpp.c_options + ctx.fragments.cpp.unfiltered_compiler_options([]) + ['-fPIC', '-Wno-maybe-uninitialized', '-Wno-unused-dummy-argument', '-Wno-conversion', '-Wno-unused-variable', '...
def _single_fortran_object_impl(ctx): toolchain_cflags = ctx.fragments.cpp.compiler_options([]) + ctx.fragments.cpp.c_options + ctx.fragments.cpp.unfiltered_compiler_options([]) + ['-fPIC', '-Wno-maybe-uninitialized', '-Wno-unused-dummy-argument', '-Wno-conversion', '-Wno-unused-variable', '-Wno-character-truncatio...
# Column/Label Types NULL = 'null' CATEGORICAL = 'categorical' TEXT = 'text' NUMERICAL = 'numerical' ENTITY = 'entity' # Feature Types ARRAY = 'array'
null = 'null' categorical = 'categorical' text = 'text' numerical = 'numerical' entity = 'entity' array = 'array'
def lift1d(n): """ Convert the first n arguments of the decorated function to 1d lists if they are not passed as lists, then unpack lists before returning """ def decorator(fn): def new_fn(*args, **kwargs): assert len(args) >= n, 'Expected first {} arguments to be non-keyword' ...
def lift1d(n): """ Convert the first n arguments of the decorated function to 1d lists if they are not passed as lists, then unpack lists before returning """ def decorator(fn): def new_fn(*args, **kwargs): assert len(args) >= n, 'Expected first {} arguments to be non-keyword' ...
class Driver: def __init__(self, cores: int) -> None: self._cores = cores def shield_cpu(self, *cpu): pass def unshield_cpu(self, *cpu): pass
class Driver: def __init__(self, cores: int) -> None: self._cores = cores def shield_cpu(self, *cpu): pass def unshield_cpu(self, *cpu): pass
i = 40 - 3 for j in range(3, 12, 2): print(j) i = i + 1 print(i)
i = 40 - 3 for j in range(3, 12, 2): print(j) i = i + 1 print(i)
#qualquer coisa c =10 d =2 print(c/d) a = c + d e = c + d
c = 10 d = 2 print(c / d) a = c + d e = c + d
""" ## Questions: MEDIUM ### 1015. [Smallest Integer Divisible by K](https://leetcode.com/problems/smallest-integer-divisible-by-k) Given a positive integer K, you need find the smallest positive integer N such that N is divisible by K, and N only contains the digit 1. Return the length of N. If there is no such N,...
""" ## Questions: MEDIUM ### 1015. [Smallest Integer Divisible by K](https://leetcode.com/problems/smallest-integer-divisible-by-k) Given a positive integer K, you need find the smallest positive integer N such that N is divisible by K, and N only contains the digit 1. Return the length of N. If there is no such N,...
__author__ = "Adriaan van der Graaf" class Sample: """ Implements a sample. only name is stored. Attributes ---------- Name: str sample name Phenotype: can be a value, an array or dictionary of values, but initialized as None """ def __init__(self, name, phenotype=None): ...
__author__ = 'Adriaan van der Graaf' class Sample: """ Implements a sample. only name is stored. Attributes ---------- Name: str sample name Phenotype: can be a value, an array or dictionary of values, but initialized as None """ def __init__(self, name, phenotype=None): se...
# Jim Lawless # License: https://github.com/jimlawless/AoC2020/LICENSE x=0 y=0 # treat N,W as -1, S,W as +1. # NESW directions=[-1,1,1,-1] # begin with East direction=1 infile = open("input.txt","r") for line in infile: line=line.rstrip() cmd=line[0:1] arg=int(line[1:]) if cmd=="F": ...
x = 0 y = 0 directions = [-1, 1, 1, -1] direction = 1 infile = open('input.txt', 'r') for line in infile: line = line.rstrip() cmd = line[0:1] arg = int(line[1:]) if cmd == 'F': if direction == 0 or direction == 2: y = y + directions[direction] * arg else: x = x +...
print(4 + 4) print(10 - 2) print(2 * 4) print(int(64 / 8))
print(4 + 4) print(10 - 2) print(2 * 4) print(int(64 / 8))
"""Color palette information for the Tetris game.""" WHITE = (255, 255, 255) GRAY = (185, 185, 185) BLACK = (0, 0, 0) CYAN = (4, 216, 219) LIGHT_CYAN = (3, 252, 255) BLUE = (20, 27, 194) LIGHT_BLUE = (25, 34, 251) ORANGE = (202, 131, 24) LIGHT_ORANGE = (250, 146, 0) YELLOW = (218, 217, 42) LIGHT_YELLOW = (255, 255, 0...
"""Color palette information for the Tetris game.""" white = (255, 255, 255) gray = (185, 185, 185) black = (0, 0, 0) cyan = (4, 216, 219) light_cyan = (3, 252, 255) blue = (20, 27, 194) light_blue = (25, 34, 251) orange = (202, 131, 24) light_orange = (250, 146, 0) yellow = (218, 217, 42) light_yellow = (255, 255, 0) ...
def next0(A,n,x): while x<n and A[x]!=0: x+=1 return x n=int(input()) A=[int(j) for j in input().split()] b=0 for i in range(n): if A[i]==1: b=next0(A,n,max(b,i)) if b==n: break A[i],A[b]=A[b],A[i] for i in A: print(i,end=" ")
def next0(A, n, x): while x < n and A[x] != 0: x += 1 return x n = int(input()) a = [int(j) for j in input().split()] b = 0 for i in range(n): if A[i] == 1: b = next0(A, n, max(b, i)) if b == n: break (A[i], A[b]) = (A[b], A[i]) for i in A: print(i, end=' ')
c = get_config() # get the config object c.IPKernelApp.pylab = 'inline' # in-line figure when using Matplotlib c.NotebookApp.ip = '*' c.NotebookApp.allow_remote_access = True # allow access from outside localhost c.NotebookApp.open_browser = False # do not open a browser window by default when using notebooks c.Note...
c = get_config() c.IPKernelApp.pylab = 'inline' c.NotebookApp.ip = '*' c.NotebookApp.allow_remote_access = True c.NotebookApp.open_browser = False c.NotebookApp.notebook_dir = '/notebooks' c.NotebookApp.allow_root = True
class Solution: def reverse(self, x: int) -> int: reverse = '' num = x if num < 0: neg = True num = -1 * (num) num = str(num) for i in range (len(num),0,-1): reverse += num[i-1] final = (-1 * int(reverse)) ...
class Solution: def reverse(self, x: int) -> int: reverse = '' num = x if num < 0: neg = True num = -1 * num num = str(num) for i in range(len(num), 0, -1): reverse += num[i - 1] final = -1 * int(reverse) el...
def groupAnagrams(strs): x=[[i,tuple(sorted(list(i)))] for i in strs] # print(x) d= {} for i,j in x: if j not in d: d[j] = [i] else: d[j].append(i) return(d.values())
def group_anagrams(strs): x = [[i, tuple(sorted(list(i)))] for i in strs] d = {} for (i, j) in x: if j not in d: d[j] = [i] else: d[j].append(i) return d.values()
number = "9,223,372,036,854,775,807" cleanedNumber = '' for i in range(0, len(number)): if number[i] in '0123456789': cleanedNumber = number[i] newNumber = int(cleanedNumber) print("The number is {} ".format(newNumber)) x = 23 x += 1 print(x) x -= 4 print(x) x *= 5 print(x) x /= 4 print(x) x **=2 p...
number = '9,223,372,036,854,775,807' cleaned_number = '' for i in range(0, len(number)): if number[i] in '0123456789': cleaned_number = number[i] new_number = int(cleanedNumber) print('The number is {} '.format(newNumber)) x = 23 x += 1 print(x) x -= 4 print(x) x *= 5 print(x) x /= 4 print(x) x **= 2 print(...
n, l, r = map(int, input().split()) box = [] for i in range(n): box += [list(map(int, input().split()))] total = 0 for i in range(n): firstX = box[i][0] + box[i][1] lastX = box[i][2] + box[i][3] fx, lx = max(firstX, l), min(lastX, r) uly = min(lx - box[i][2], box[i][3]) dly = max(box[i][3]+(lx...
(n, l, r) = map(int, input().split()) box = [] for i in range(n): box += [list(map(int, input().split()))] total = 0 for i in range(n): first_x = box[i][0] + box[i][1] last_x = box[i][2] + box[i][3] (fx, lx) = (max(firstX, l), min(lastX, r)) uly = min(lx - box[i][2], box[i][3]) dly = max(box[i][...
# D = {4:5, "apple":6, (4,3):"test"} print(D) print('\n') for key in D: print(key,D[key]) print('\n') for item in D.items(): print(item) print('\n') for key,value in D.items(): print(key,value) print('\n') for value in D.values(): print(value) print('\n') L = [4 , 5, 7] for ind,item in enumerat...
d = {4: 5, 'apple': 6, (4, 3): 'test'} print(D) print('\n') for key in D: print(key, D[key]) print('\n') for item in D.items(): print(item) print('\n') for (key, value) in D.items(): print(key, value) print('\n') for value in D.values(): print(value) print('\n') l = [4, 5, 7] for (ind, item) in enumerat...
# From : https://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks # Most significant bit first (big-endian) # x^16+x^12+x^5+1 = (1) 0001 0000 0010 0001 = 0x1021 def crc16(data): rem = 0 n = 16 # A popular variant complements rem here for d in data: rem = rem ^ (d << (n-8)) # n...
def crc16(data): rem = 0 n = 16 for d in data: rem = rem ^ d << n - 8 for j in range(1, 8): if rem & 32768: rem = rem << 1 ^ 4129 else: rem = rem << 1 rem = rem & 65535 return rem
flash_size_table = {} flash_size_table['4'] = 16 flash_size_table['6'] = 32 flash_size_table['8'] = 64 flash_size_table['B'] = 128 flash_size_table['C'] = 256 flash_size_table['D'] = 384 flash_size_table['E'] = 512 flash_size_table['F'] = 768 flash_size_table['G'] = 1024 flash_size_table['I'] = 2048 flash_si...
flash_size_table = {} flash_size_table['4'] = 16 flash_size_table['6'] = 32 flash_size_table['8'] = 64 flash_size_table['B'] = 128 flash_size_table['C'] = 256 flash_size_table['D'] = 384 flash_size_table['E'] = 512 flash_size_table['F'] = 768 flash_size_table['G'] = 1024 flash_size_table['I'] = 2048 flash_size_table['K...
def test(): assert ( "import Doc, Span" in __solution__ or "import Span, Doc" in __solution__ ), "Did you import the Doc and Span correctly?" assert doc.text == "I like David Bowie", "Did you create the Doc correctly?" assert span.text == "David Bowie", "Did you create the span correctly?" a...
def test(): assert 'import Doc, Span' in __solution__ or 'import Span, Doc' in __solution__, 'Did you import the Doc and Span correctly?' assert doc.text == 'I like David Bowie', 'Did you create the Doc correctly?' assert span.text == 'David Bowie', 'Did you create the span correctly?' assert span.label...
# mensagens que aparecem no "sistema" # instructions INPUT_INST = "Enter info:" VAL1 = "FIRST VALUE" VAL2 = "SECOND VALUE" VAL3 = "THIRD VALUE" op1 = "1 TO TEST A SAMPLE" op2 = "2 TO END CONECTION" # success CONNECTED = "CONNECTED TO...
input_inst = 'Enter info:' val1 = 'FIRST VALUE' val2 = 'SECOND VALUE' val3 = 'THIRD VALUE' op1 = '1 TO TEST A SAMPLE' op2 = '2 TO END CONECTION' connected = 'CONNECTED TO SERVER.' processing = '10 - Data received, PROCESSING...' ok = '20 - OK' connection_error = '53 - Service Unavailable :(' server_error = '50 - Intern...
pos=-1 def binarysearch(lst,num): '''Function that returns True and index number of element if found else returns False and -1''' lst.sort()#any sort algorithm can be used print(lst) l=0 u=len(lst)-1 while l<= u: mid=(u+l)//2 if lst[mid] == num: global pos pos=mid return True,pos else: ...
pos = -1 def binarysearch(lst, num): """Function that returns True and index number of element if found else returns False and -1""" lst.sort() print(lst) l = 0 u = len(lst) - 1 while l <= u: mid = (u + l) // 2 if lst[mid] == num: global pos pos = mid ...
suffix = ['', 'K', 'M', 'B', 'T', 'P'] def human_format(num): num = float('{:.3g}'.format(num)) magnitude = 0 while abs(num) >= 1000: magnitude += 1 num /= 1000.0 return '{}{}'.format('{:f}'.format(num).rstrip('0').rstrip('.'), suffix[magnitude])
suffix = ['', 'K', 'M', 'B', 'T', 'P'] def human_format(num): num = float('{:.3g}'.format(num)) magnitude = 0 while abs(num) >= 1000: magnitude += 1 num /= 1000.0 return '{}{}'.format('{:f}'.format(num).rstrip('0').rstrip('.'), suffix[magnitude])
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @Filename :prime_origin.py @Author :Arthur Zhan @Init Time :2020/06/16 """ def primes_1(num): i = 2 lst = [] while len(lst) < num: if 2 > i // 2 + 1: limit = i else: limit = i // 2 + 1 for d in...
""" @Filename :prime_origin.py @Author :Arthur Zhan @Init Time :2020/06/16 """ def primes_1(num): i = 2 lst = [] while len(lst) < num: if 2 > i // 2 + 1: limit = i else: limit = i // 2 + 1 for d in range(2, limit): if i % d == 0: ...
# # PySNMP MIB module NNCEXTSPVC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NNCEXTSPVC-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:22:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint) ...
#!/usr/bin/python3 # -*- coding : UTF-8 -*- """ Name : Pyrix/Exceptions\n Author : Abhi-1U <https://github.com/Abhi-1U>\n Description : Exceptions are implemented here \n Encoding : UTF-8\n Version :0.7.19\n Build :0.7.19/21-12-2020 """ class ExceptionTemplate(Exception): def __call__(se...
""" Name : Pyrix/Exceptions Author : Abhi-1U <https://github.com/Abhi-1U> Description : Exceptions are implemented here Encoding : UTF-8 Version :0.7.19 Build :0.7.19/21-12-2020 """ class Exceptiontemplate(Exception): def __call__(self, *args): return self.__class__(*self.a...
# Client Messages disconnectServer = "[x] Server disconnected." keysUnpacked = "[+] Symmetric keys unpacked." keysUnpackFail = "[x] Keys not unpacked. Try again." welcome = "@Yo: You're in. Welcome to the underground." # Default Commands bootNoUser = "[!] Which user do you want to boot? Eg: /boot <user>" bootUserNotFo...
disconnect_server = '[x] Server disconnected.' keys_unpacked = '[+] Symmetric keys unpacked.' keys_unpack_fail = '[x] Keys not unpacked. Try again.' welcome = "@Yo: You're in. Welcome to the underground." boot_no_user = '[!] Which user do you want to boot? Eg: /boot <user>' boot_user_not_found = '[x] No one here by tha...
"""Aggregator functions are monkey patched into the DarshanReport object during initialization of DarshanReport class. .. note:: These functions are only enabled if the `darshan.enable_experimental(True)` function is called. Example usage:: import darshan import darshan.report dasrhan.enable_experimental(Tr...
"""Aggregator functions are monkey patched into the DarshanReport object during initialization of DarshanReport class. .. note:: These functions are only enabled if the `darshan.enable_experimental(True)` function is called. Example usage:: import darshan import darshan.report dasrhan.enable_experimental(Tr...
class Solution: """ @param grid: Given a 2D grid, each cell is either 'W', 'E' or '0' @return: an integer, the maximum enemies you can kill using one bomb """ def maxKilledEnemies(self, grid): if grid == []: return 0 n_row, n_col = len(grid), len(grid[0]) ...
class Solution: """ @param grid: Given a 2D grid, each cell is either 'W', 'E' or '0' @return: an integer, the maximum enemies you can kill using one bomb """ def max_killed_enemies(self, grid): if grid == []: return 0 (n_row, n_col) = (len(grid), len(grid[0])) r...
# name: csc_devices.py # desc: lists all devices with devicename, IP, username, password, secret router_013 = {'device_name': 'router_013', 'device_type': 'cisco_nxos', 'ip': '1.1.1.10', 'username': 'dummy_username', 'password': 'dummy_password', 'port': 22, 'verbose': False, 'secret': 'dummy_secret', } router_023...
router_013 = {'device_name': 'router_013', 'device_type': 'cisco_nxos', 'ip': '1.1.1.10', 'username': 'dummy_username', 'password': 'dummy_password', 'port': 22, 'verbose': False, 'secret': 'dummy_secret'} router_023 = {'device_name': 'router_023', 'device_type': 'cisco_nxos', 'ip': '1.1.1.11', 'username': 'dummy_usern...
# class Persona: # #def __init__(self): # def __init__(self,nombre,apellido,edad): # self.nombre = nombre # self.apellido = apellido # self.edad = edad # persona1 = Persona('Juan','Castellanos',21) # print(f'Objeto Persona 1: {persona1.nombre} {persona1.apellido} {persona1.edad}') # #M...
class Person: def __init__(self, name: str, last_name: str, age: int): self.name = name self.last_name = last_name self.age = age def show_details(self): print(f'Person: {self.name} {self.last_name} {self.age}') persona1 = person('Juan', 'Castellanos', 21) persona1.show_details...
# # PySNMP MIB module XEDIA-DRIVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XEDIA-DRIVER-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:42:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) ...
DEFAULT_FILENAME = "output_test_file.txt" DEFAULT_CONTENT = [ "Obi-Wan Kenobi: Hello there.", "General Grievous: General Kenobi. You are a bold one." ] def main(): filename = DEFAULT_FILENAME content = DEFAULT_CONTENT; with open(filename, "w") as text_file: for line in content: ...
default_filename = 'output_test_file.txt' default_content = ['Obi-Wan Kenobi: Hello there.', 'General Grievous: General Kenobi. You are a bold one.'] def main(): filename = DEFAULT_FILENAME content = DEFAULT_CONTENT with open(filename, 'w') as text_file: for line in content: text_file.w...
# # PySNMP MIB module XYLAN-ATM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-ATM-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:44:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) ...
""" LeetCode Problem 240. Search a 2D Matrix II Link: https://leetcode.com/problems/search-a-2d-matrix-ii/ Written by: Mostofa Adib Shakib Language: Python Search space reduction Algorithm: First, we initialize a (row, col)(row,col) pointer to the bottom-left of the matrix. Then, until we find target and return true...
""" LeetCode Problem 240. Search a 2D Matrix II Link: https://leetcode.com/problems/search-a-2d-matrix-ii/ Written by: Mostofa Adib Shakib Language: Python Search space reduction Algorithm: First, we initialize a (row, col)(row,col) pointer to the bottom-left of the matrix. Then, until we find target and return true...
def count_down(num): if num == 0: return 0 else: print(num) num = num -1 return count_down(num) print(count_down(10))
def count_down(num): if num == 0: return 0 else: print(num) num = num - 1 return count_down(num) print(count_down(10))
"""User account app""" # pylint: disable=invalid-name default_app_config = 'open_connect.accounts.apps.AccountsConfig'
"""User account app""" default_app_config = 'open_connect.accounts.apps.AccountsConfig'
#! /usr/bin/env python3 # author: Mark W. Naylor # file: message.py # date: 2018-Jan-28 def message(msg, name): output = "{0}, {1}.".format(msg, name) print(output) def hello(name="world"): message("Hello", name) def goodbye(name="world"): message("Goodbye", name) def main(): #hello() hell...
def message(msg, name): output = '{0}, {1}.'.format(msg, name) print(output) def hello(name='world'): message('Hello', name) def goodbye(name='world'): message('Goodbye', name) def main(): hello('David') goodbye('David') if __name__ == '__main__': main()
""" Pobierz od uzytkownika trzy dlugosci bokow i sprawdz, czy mozna z nich zbudowac trojkat. """ if __name__ == "__main__": a = int(input()) b = int(input()) c = int(input()) if a + b > c and b + c > a and a + c > b: print("z podanych bokow mozna zbudowac trojkat") else: print("z...
""" Pobierz od uzytkownika trzy dlugosci bokow i sprawdz, czy mozna z nich zbudowac trojkat. """ if __name__ == '__main__': a = int(input()) b = int(input()) c = int(input()) if a + b > c and b + c > a and (a + c > b): print('z podanych bokow mozna zbudowac trojkat') else: print('z p...
__all__ = ("QuietExit", "EmbedExit") class QuietExit(Exception): """ An exception that is silently ignored by its error handler added in :ref:`cogs_error_handlers`. The primary purpose of this class is to allow a command to be exited from within a nested call without having to propagate return va...
__all__ = ('QuietExit', 'EmbedExit') class Quietexit(Exception): """ An exception that is silently ignored by its error handler added in :ref:`cogs_error_handlers`. The primary purpose of this class is to allow a command to be exited from within a nested call without having to propagate return val...
# -*- coding: utf-8 -*- def comp_angle_opening(self): """Compute the average opening angle of the Slot Parameters ---------- self : SlotMPolar A SlotMPolar object Returns ------- alpha: float Average opening angle of the slot [rad] """ Nmag = len(self.magnet) ...
def comp_angle_opening(self): """Compute the average opening angle of the Slot Parameters ---------- self : SlotMPolar A SlotMPolar object Returns ------- alpha: float Average opening angle of the slot [rad] """ nmag = len(self.magnet) return self.W0 * Nmag + s...
# V0 # V1 # https://blog.csdn.net/fuxuemingzhu/article/details/81079495 # IDEA : LINEAR SCAN class Solution(object): def binaryGap(self, N): """ :type N: int :rtype: int """ binary = bin(N)[2:] dists = [0] * len(binary) left = 0 for i, b in enumer...
class Solution(object): def binary_gap(self, N): """ :type N: int :rtype: int """ binary = bin(N)[2:] dists = [0] * len(binary) left = 0 for (i, b) in enumerate(binary): if b == '1': dists[i] = i - left left...
def decimal2binario(d): if d == 0: return d b = bin(d).lstrip("0b") return b
def decimal2binario(d): if d == 0: return d b = bin(d).lstrip('0b') return b
TAS_TO_PORTAL_MAP = {'description': 'description', 'piId': 'pi_id', 'title': 'title', 'chargeCode': 'charge_code', 'typeId': 'type_id', 'fieldId': 'field_id', 'type': 'type_name', ...
tas_to_portal_map = {'description': 'description', 'piId': 'pi_id', 'title': 'title', 'chargeCode': 'charge_code', 'typeId': 'type_id', 'fieldId': 'field_id', 'type': 'type_name', 'field': 'field_name', 'nickname': 'nickname'}
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
def multiscale_def(image_shape, num_scale, use_flip=True): base_name_list = ['image'] multiscale_def = {} ms_def_names = [] if use_flip: num_scale //= 2 base_name_list.append('image_flip') multiscale_def['image_flip'] = {'shape': [None] + image_shape, 'dtype': 'float32', 'lod_lev...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next # Solution A class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: dummy = ListNode(0) dummy.next = head cur = hea...
class Solution: def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: dummy = list_node(0) dummy.next = head cur = head length = 0 while cur: length += 1 cur = cur.next cur = dummy for _ in range(length - n): c...
# Feature objects: these are mapped to feature identifiers within the rich text # feature registry (wagtail.core.rich_text.features). Each one implements # a `construct_options` method which modifies an options dict as appropriate to # enable that feature. class BooleanFeature: """ A feature which is enabled ...
class Booleanfeature: """ A feature which is enabled by a boolean flag at the top level of the options dict """ def __init__(self, option_name): self.option_name = option_name def construct_options(self, options): options[self.option_name] = True class Listfeature: """ ...
# input input_word = input("Enter a word: ") vowels = ["a", "e", "i", "o", "u"] num_vowels = 0 # response for letter in input_word: if letter in vowels: num_vowels += 1 print(num_vowels)
input_word = input('Enter a word: ') vowels = ['a', 'e', 'i', 'o', 'u'] num_vowels = 0 for letter in input_word: if letter in vowels: num_vowels += 1 print(num_vowels)
"""Docstring for validate_input.py.""" class CheckUserInput(object): """docstring for CheckUserInput.""" def check_if_input_is_string(self, user_input): """Docstring for validating if input is str.""" if type(user_input) is not str: return False elif bool(user_input.strip(...
"""Docstring for validate_input.py.""" class Checkuserinput(object): """docstring for CheckUserInput.""" def check_if_input_is_string(self, user_input): """Docstring for validating if input is str.""" if type(user_input) is not str: return False elif bool(user_input.strip()...
class State: def __init__(self, isInit = False, isFinish = False): self._isInit = isInit self._isFinish = isFinish def setInit(self, nval): self._isInit = nval def isInit(self): return self._isInit def setFinish(self, nval): self._isFinish = nval d...
class State: def __init__(self, isInit=False, isFinish=False): self._isInit = isInit self._isFinish = isFinish def set_init(self, nval): self._isInit = nval def is_init(self): return self._isInit def set_finish(self, nval): self._isFinish = nval def is_fi...
class Trapeziums(object): def __init__(self, left, left_top, right_top, right): self.left = left self.right = right self.left_top = left_top self.right_top = right_top def membership_value(self, input_value): if (input_value >= self.left_top) and (input_value <= self.rig...
class Trapeziums(object): def __init__(self, left, left_top, right_top, right): self.left = left self.right = right self.left_top = left_top self.right_top = right_top def membership_value(self, input_value): if input_value >= self.left_top and input_value <= self.right...
numlist=list() while True: x=input("Enter a no.") if x=="done": break x=float(x) numlist.append(x) print(sum(numlist)/len(numlist))
numlist = list() while True: x = input('Enter a no.') if x == 'done': break x = float(x) numlist.append(x) print(sum(numlist) / len(numlist))
def TowerOfHanoi(n , first, last, mid): if n == 1: print ("Move disk 1 from rod",first,"to rod",last) return TowerOfHanoi(n-1, first, mid, last) print ("Move disk",n,"from rod",first,"to rod",last ) TowerOfHanoi(n-1, mid, last, first) n=int(input()) TowerOfHanoi(n, 'F', 'M', 'L') ...
def tower_of_hanoi(n, first, last, mid): if n == 1: print('Move disk 1 from rod', first, 'to rod', last) return tower_of_hanoi(n - 1, first, mid, last) print('Move disk', n, 'from rod', first, 'to rod', last) tower_of_hanoi(n - 1, mid, last, first) n = int(input()) tower_of_hanoi(n, 'F',...
def crit_dim_var(var): """Check if nested dict or not Arguments --------- var : dict Dictionary to test wheter single or multidimensional parameter Returns ------- single_dimension : bool True: Single dimension, False: Multidimensional parameter """ single_dimension...
def crit_dim_var(var): """Check if nested dict or not Arguments --------- var : dict Dictionary to test wheter single or multidimensional parameter Returns ------- single_dimension : bool True: Single dimension, False: Multidimensional parameter """ single_dimension...
db._DBProxy__ctxid = 'b85246688f24c14712e0a7dfb93413f5defd50c4' db.getrecord(0) db.checkcontext() dbtree.get_children() dbtree.get_children([1])
db._DBProxy__ctxid = 'b85246688f24c14712e0a7dfb93413f5defd50c4' db.getrecord(0) db.checkcontext() dbtree.get_children() dbtree.get_children([1])
quantidade_habilidades, quantidade_texto = [int(n) for n in input().split()] dicionario = dict() for c in range(quantidade_habilidades): habilidade_descricao = input().split() dicionario[habilidade_descricao[0]] = float(habilidade_descricao[1]) for c in range(quantidade_texto): salario = 0 while True...
(quantidade_habilidades, quantidade_texto) = [int(n) for n in input().split()] dicionario = dict() for c in range(quantidade_habilidades): habilidade_descricao = input().split() dicionario[habilidade_descricao[0]] = float(habilidade_descricao[1]) for c in range(quantidade_texto): salario = 0 while True:...
# # PySNMP MIB module TUBS-IBR-XEN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TUBS-IBR-XEN-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:27:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ...
class BridgeWorker(): def __init__(self, thread_name, connection_string, process, action_queue): self.thread_name = thread_name self.connection_string = connection_string self.process = process self.action_queue = action_queue self.should_shutdown = False ...
class Bridgeworker: def __init__(self, thread_name, connection_string, process, action_queue): self.thread_name = thread_name self.connection_string = connection_string self.process = process self.action_queue = action_queue self.should_shutdown = False self.pika_que...
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ # # Copyright (C) 2014-2017 Regents of the University of California. # Author: Jeff Thompson <jefft0@remap.ucla.edu> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License a...
""" This module defines the Tlv class with type codes for the NDN-TLV wire format. """ class Tlv(object): interest = 5 data = 6 name = 7 implicit_sha256_digest_component = 1 name_component = 8 selectors = 9 nonce = 10 interest_lifetime = 12 min_suffix_components = 13 max_suffix_...
class Solution: def spiralMatrixIII(self, R: int, C: int, r0: int, c0: int) -> 'List[List[int]]': directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] uncolored = R * C result = [] x, y = r0, c0 turns = 0 while uncolored > 0: dx, dy = directions...
class Solution: def spiral_matrix_iii(self, R: int, C: int, r0: int, c0: int) -> 'List[List[int]]': directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] uncolored = R * C result = [] (x, y) = (r0, c0) turns = 0 while uncolored > 0: (dx, dy) = directions[turns ...
n,k=map(int,input().split()) x=[*map(int,input().split())] forbidden=[False]*10 for i in range(0,10): if i not in x: forbidden[i]=True ans=-1 for i in range(1,n+1): fail=False t=i while i: if forbidden[i%10]: fail=True break i//=10 if not fail: ans=t ...
(n, k) = map(int, input().split()) x = [*map(int, input().split())] forbidden = [False] * 10 for i in range(0, 10): if i not in x: forbidden[i] = True ans = -1 for i in range(1, n + 1): fail = False t = i while i: if forbidden[i % 10]: fail = True break i ...
class PaymentLink: def __init__( self, url, id ): self.__url = url self.__id = id @property def url(self): """:rtype: str""" return self.__url @property def id(self): """:rtype: int""" return self.__id
class Paymentlink: def __init__(self, url, id): self.__url = url self.__id = id @property def url(self): """:rtype: str""" return self.__url @property def id(self): """:rtype: int""" return self.__id
class palindrome(): def __init__(self,string): self.string = string def __call__(self): testStr = self.string.lower() for x in [" ","!",]: testStr = testStr.replace(x,"") if testStr == testStr[::-1]: return True else: return False def pri...
class Palindrome: def __init__(self, string): self.string = string def __call__(self): test_str = self.string.lower() for x in [' ', '!']: test_str = testStr.replace(x, '') if testStr == testStr[::-1]: return True else: return False ...
""" @author: Li Xi @file: __init__.py.py @time: 2019/10/29 16:20 @desc: """
""" @author: Li Xi @file: __init__.py.py @time: 2019/10/29 16:20 @desc: """
""" this is a regional comment """ print('hello world') # this is a single line comment print('Hello, World'.upper())
""" this is a regional comment """ print('hello world') print('Hello, World'.upper())
def headfront(): i01.head.neck.moveTo(90) i01.head.rothead.moveTo(90)
def headfront(): i01.head.neck.moveTo(90) i01.head.rothead.moveTo(90)
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isValidBST(self, root): """ :type root: TreeNode :rtype: bool """ return self...
class Solution(object): def is_valid_bst(self, root): """ :type root: TreeNode :rtype: bool """ return self.recur(root) def recur(self, node): if node is None: return True left_valid = self.recur(node.left) right_valid = self.recur(no...
bot_major_version = 0 bot_minor_version = 1 bot_patch_version = 2 def bot_version_string(): return f'{bot_major_version}.{bot_minor_version}.{bot_patch_version}'
bot_major_version = 0 bot_minor_version = 1 bot_patch_version = 2 def bot_version_string(): return f'{bot_major_version}.{bot_minor_version}.{bot_patch_version}'
""" @author: David Lei @since: 5/11/2017 https://www.hackerrank.com/challenges/detect-whether-a-linked-list-contains-a-cycle/problem A cycle exists if any node is visited once during traversal. Both Passed :) """ def has_cycle_better(head): # a.k.a floyd cycle detection, hare & turtle. # Idea: if a cycle exists...
""" @author: David Lei @since: 5/11/2017 https://www.hackerrank.com/challenges/detect-whether-a-linked-list-contains-a-cycle/problem A cycle exists if any node is visited once during traversal. Both Passed :) """ def has_cycle_better(head): tortoise = head hare = head.next while tortoise and hare and ha...
namesList = ['Tuffy','Ali','Nysha','Tim' ] sentence = 'My dog sleeps on sofa' names = ';'.join(namesList) print(type(names), ':', names) wordList = sentence.split(' ') print((type(wordList)), ':', wordList) additionExample = 'ganehsa' + 'ganesha' + 'ganesha' multiplicationExample = 'ganesha' * 2 print('Text Additions...
names_list = ['Tuffy', 'Ali', 'Nysha', 'Tim'] sentence = 'My dog sleeps on sofa' names = ';'.join(namesList) print(type(names), ':', names) word_list = sentence.split(' ') print(type(wordList), ':', wordList) addition_example = 'ganehsa' + 'ganesha' + 'ganesha' multiplication_example = 'ganesha' * 2 print('Text Additio...
class Prompts: def CPrompt(): ExtentionType = input("What type of extention do you want the output to be? Ex. exe \n") ProjectName = input("Whats the name of the project?") Flags = input("What other flags would you like to add? \n -g ")
class Prompts: def c_prompt(): extention_type = input('What type of extention do you want the output to be? Ex. exe \n') project_name = input('Whats the name of the project?') flags = input('What other flags would you like to add? \n -g ')
class Solution: # @param s, a string # @return an integer def titleToNumber(self, s): alphabets = ['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'] s = list(s) sum = 0 for index, element in enu...
class Solution: def title_to_number(self, s): alphabets = ['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'] s = list(s) sum = 0 for (index, element) in enumerate(s[::-1]): sum += 26 ** index...
def main(): # input N, M = map(int, input().split()) ABs = [[*map(int, input().split())] for _ in range(M)] # compute adj = [[] for _ in range(N)] for A, B in ABs: A -= 1 B -= 1 adj[A].append(B) adj[B].append(A) ans = 0 for i, vs in enumerate(adj): ...
def main(): (n, m) = map(int, input().split()) a_bs = [[*map(int, input().split())] for _ in range(M)] adj = [[] for _ in range(N)] for (a, b) in ABs: a -= 1 b -= 1 adj[A].append(B) adj[B].append(A) ans = 0 for (i, vs) in enumerate(adj): tmp_cnt = 0 ...