content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#get email address email = input("What is your email address? ") #slice out username user = email[:email.index("@")] #slice domain name domain = email[email.index("@")+1:] #format message output = "User name: {}\nDomain name: {}".format(user, domain) #display message print(output)
email = input('What is your email address? ') user = email[:email.index('@')] domain = email[email.index('@') + 1:] output = 'User name: {}\nDomain name: {}'.format(user, domain) print(output)
def sequenceAlignment(str1, str2, costs): subCost, gapCost = costs dp = [[None] * (len(str2) + 1) for _ in range(len(str1) + 1)] for i in range(len(dp)): dp[i][0] = i for j in range(len(dp[0])): dp[0][j] = j for i in range(1, len(dp)): for j in range(1, len(dp[0])): op1 = dp[i - 1][j - 1] + s...
def sequence_alignment(str1, str2, costs): (sub_cost, gap_cost) = costs dp = [[None] * (len(str2) + 1) for _ in range(len(str1) + 1)] for i in range(len(dp)): dp[i][0] = i for j in range(len(dp[0])): dp[0][j] = j for i in range(1, len(dp)): for j in range(1, len(dp[0])): ...
MCS_PER_SECOND = 1000000 MCS_PER_MINUTE = MCS_PER_SECOND * 60 MCS_PER_HOUR = MCS_PER_MINUTE * 60 MLS_PER_SECOND = 1000 MLS_PER_MINUTE = MLS_PER_SECOND * 60 MLS_PER_HOUR = MLS_PER_MINUTE * 60
mcs_per_second = 1000000 mcs_per_minute = MCS_PER_SECOND * 60 mcs_per_hour = MCS_PER_MINUTE * 60 mls_per_second = 1000 mls_per_minute = MLS_PER_SECOND * 60 mls_per_hour = MLS_PER_MINUTE * 60
#!/usr/bin/env python # make this a dummy file for now print("Content-type: text/plain; charset=iso-8859-1\n")
print('Content-type: text/plain; charset=iso-8859-1\n')
S = input() S = S[::-1] result = 0 t = [0] * 2019 m = 1 n = 0 for i in range(len(S)): t[n] += 1 n += int(S[i]) * m n %= 2019 result += t[n] m *= 10 m %= 2019 print(result)
s = input() s = S[::-1] result = 0 t = [0] * 2019 m = 1 n = 0 for i in range(len(S)): t[n] += 1 n += int(S[i]) * m n %= 2019 result += t[n] m *= 10 m %= 2019 print(result)
class SQLAlchemyConnector(): def __init__(self): pass def select_all(self): pass def create_table(self): pass
class Sqlalchemyconnector: def __init__(self): pass def select_all(self): pass def create_table(self): pass
saarc = ["Bangladesh","India", "Sri Lanka", "Pakistan", "Nepal", "Bhutan"] print(saarc) saarc.append("Afganistan") print(saarc) saarc.sort() print(saarc) li = [3, 7, 9, 4, 2, 8] li.sort() print(li) li.reverse() print(li)
saarc = ['Bangladesh', 'India', 'Sri Lanka', 'Pakistan', 'Nepal', 'Bhutan'] print(saarc) saarc.append('Afganistan') print(saarc) saarc.sort() print(saarc) li = [3, 7, 9, 4, 2, 8] li.sort() print(li) li.reverse() print(li)
def createArray(size): ''' Given an integer size, return array of length size filled with 1s. ''' return [1 for i in range(size)] print(createArray(4)) print(createArray(40)) print(createArray(400))
def create_array(size): """ Given an integer size, return array of length size filled with 1s. """ return [1 for i in range(size)] print(create_array(4)) print(create_array(40)) print(create_array(400))
# indexing data DOCARRAY_PULL_NAME = 'fashion-multimodal-all' DATA_DIR = "../data/images" # Where are the files? CSV_FILE = "../data/styles.csv" # Where's the metadata? WORKSPACE_DIR = "../embeddings" MAX_DOCS = 100 DEVICE = "cpu" # PQLiteIndexer DIMS = 512 # This should be same shape as vector embedding # serving vi...
docarray_pull_name = 'fashion-multimodal-all' data_dir = '../data/images' csv_file = '../data/styles.csv' workspace_dir = '../embeddings' max_docs = 100 device = 'cpu' dims = 512 port = 12345 timeout_ready = -1
# author: Gonzalo Salazar # assigment: Homework #3 # name: Social Tagging # description: main .py file with three functions # First function (labeled) # Input: a message # Output: a list of hashtags present on that message # Second function (tabulated): # Input: an local list of words obtained fro...
def labeled(saved_words): message = input('\nPlease type in the message you want to publish.' + 'If you want to highlight a particular topic, please use hashtags (#): ') list_of_words = message.split() is_avoid = (',', '.', ';', ':') for word in list_of_words: if word[0] == '#': new_...
''' Given that Fk is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k. ''' fib = [1, 1] def get_next_fib(mx): n=1 last, curr = 0, 1 global fib while n <= mx: last, curr = curr, last + curr n += 1 yield n , curr def get_fib_series(mx): whi...
""" Given that Fk is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k. """ fib = [1, 1] def get_next_fib(mx): n = 1 (last, curr) = (0, 1) global fib while n <= mx: (last, curr) = (curr, last + curr) n += 1 yield (n, c...
inf = float('inf') def toposort(graph): vnum = len(graph) index = get_index(graph) zerov = -1 toposeq = [] for vi in range(vnum): if index[vi] == 0: index[vi] = zerov zerov = vi for n in range(vnum): if zerov == -1: break v...
inf = float('inf') def toposort(graph): vnum = len(graph) index = get_index(graph) zerov = -1 toposeq = [] for vi in range(vnum): if index[vi] == 0: index[vi] = zerov zerov = vi for n in range(vnum): if zerov == -1: break vi = zerov ...
LEXERS = [ "3d", "aap", "actionscript", "actionscript3", "ada", "ada2005", "ada95", "adl", "agda", "ahk", "al", "alloy", "amienttalk", "amienttalk/2", "ampl", "an", "antlr", "antlr-actionscript", "antlr-as", "antlr-c#", "antlr-cpp", ...
lexers = ['3d', 'aap', 'actionscript', 'actionscript3', 'ada', 'ada2005', 'ada95', 'adl', 'agda', 'ahk', 'al', 'alloy', 'amienttalk', 'amienttalk/2', 'ampl', 'an', 'antlr', 'antlr-actionscript', 'antlr-as', 'antlr-c#', 'antlr-cpp', 'antlr-csharp', 'antlr-java', 'antlr-perl', 'antlr-python', 'antlr-r', 'antlr-ruy', 'apa...
# program converting string or integer to list continuously def string_int(string): return list(str(string)) if __name__ == '__main__': print(string_int(1237893444787600.00))
def string_int(string): return list(str(string)) if __name__ == '__main__': print(string_int(1237893444787600.0))
DRAG_COEFFICIENT_SPHERE = 0.47 # mols^-1 kilograms^-1 GAS_CONSTANT = 8.3144598 def cToK(c): return c + 273.15 def kToC(k): return k - 273.15 # Degrees Celsius ROOM_TEMPERATURE = cToK(20) # g/cm^3 WATER_DENSITY = 1 # Grams/Mol MOLAR_MASS_AIR = 0.029 # Pascals AIR_PRESSURE_SEA_LEVEL = 101325 def paToBar(p...
drag_coefficient_sphere = 0.47 gas_constant = 8.3144598 def c_to_k(c): return c + 273.15 def k_to_c(k): return k - 273.15 room_temperature = c_to_k(20) water_density = 1 molar_mass_air = 0.029 air_pressure_sea_level = 101325 def pa_to_bar(pascals): return pascals / 100000 def bar_to_pa(bar): return ...
def computepay(h,r): if h > 40: p = 1.5 * r * (h - 40) + (40 *r) else: p = h * r return p hrs = input("Enter Hours:") hr = float(hrs) rphrs = input("Enter rate per hour:") rphr = float(rphrs) p = computepay(hr,rphr) print('Pay',p)
def computepay(h, r): if h > 40: p = 1.5 * r * (h - 40) + 40 * r else: p = h * r return p hrs = input('Enter Hours:') hr = float(hrs) rphrs = input('Enter rate per hour:') rphr = float(rphrs) p = computepay(hr, rphr) print('Pay', p)
# Copyright 2014 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [{ 'target_name': 'zlib', 'type': 'none', 'direct_dependent_settings': { 'conditions': [ [ 'skia_android_framework', { 'include_dirs': [ 'externa...
{'targets': [{'target_name': 'zlib', 'type': 'none', 'direct_dependent_settings': {'conditions': [['skia_android_framework', {'include_dirs': ['external/zlib']}], ['skia_os == "mac" or skia_os == "ios"', {'link_settings': {'libraries': ['$(SDKROOT)/usr/lib/libz.dylib']}}, {'link_settings': {'libraries': ['-lz']}}]]}}]}
class Converter: __syb = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] __val = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] def __init__(self, data: int): self.__user_input = data def __convert(self) -> str: result = list() user_input = self....
class Converter: __syb = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] __val = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] def __init__(self, data: int): self.__user_input = data def __convert(self) -> str: result = list() user_input = self....
# Solution to Project Euler Problem 9 def sol(): PERIMETER = 1000 for a in range(1, int(PERIMETER / 3) + 1): for c in range(int(PERIMETER / 3) - 1, PERIMETER - 2): b = PERIMETER - a - c if a * a + b * b == c * c: return str(a * b * c) if __name__ == "__main__":...
def sol(): perimeter = 1000 for a in range(1, int(PERIMETER / 3) + 1): for c in range(int(PERIMETER / 3) - 1, PERIMETER - 2): b = PERIMETER - a - c if a * a + b * b == c * c: return str(a * b * c) if __name__ == '__main__': print(sol())
def ws(i): r = "" for x in range(i): r += " " return r
def ws(i): r = '' for x in range(i): r += ' ' return r
# block types PARAGRAPH = "paragraph" HEADING_2 = "heading_2" TOGGLE = "toggle" BULLETED_LIST_ITEM = "bulleted_list_item" BLOCK_TYPES = [PARAGRAPH, HEADING_2, TOGGLE, BULLETED_LIST_ITEM]
paragraph = 'paragraph' heading_2 = 'heading_2' toggle = 'toggle' bulleted_list_item = 'bulleted_list_item' block_types = [PARAGRAPH, HEADING_2, TOGGLE, BULLETED_LIST_ITEM]
#Sicherung einer Datei als Sicherungskopie mithilfe der "finally"-Klausel daten=input("Daten: ") #Daten ohne "" eingeben pfad=input("Pfad: ") #Daten ohne "" aber mit Endung (z.B. ".txt")eingeben try: f=open(pfad,"w") f.write(daten) f.close() print("Daten gespeichert") finally: ...
daten = input('Daten: ') pfad = input('Pfad: ') try: f = open(pfad, 'w') f.write(daten) f.close() print('Daten gespeichert') finally: f = open('Daten\\daten.bak', 'w') f.write(daten) f.close() print("Sicherheitskopie im Verzeichnis'\\Daten'") print('Programm beendet')
# The following has been generated automatically from src/gui/qgsadvanceddigitizingdockwidget.h QgsAdvancedDigitizingDockWidget.CadCapacities.baseClass = QgsAdvancedDigitizingDockWidget CadCapacities = QgsAdvancedDigitizingDockWidget # dirty hack since SIP seems to introduce the flags in module # monkey patching scope...
QgsAdvancedDigitizingDockWidget.CadCapacities.baseClass = QgsAdvancedDigitizingDockWidget cad_capacities = QgsAdvancedDigitizingDockWidget QgsAdvancedDigitizingDockWidget.NoConstraint = QgsAdvancedDigitizingDockWidget.AdditionalConstraint.NoConstraint QgsAdvancedDigitizingDockWidget.AdditionalConstraint.NoConstraint.__...
pkgname = "libvpx7" pkgver = "1.11.0" pkgrel = 0 build_style = "configure" configure_args = [ "--enable-shared", "--enable-pic", "--enable-vp8", "--enable-vp9", "--enable-experimental", "--enable-runtime-cpu-detect", "--enable-postproc", "--disable-install-srcs", ] make_cmd = "gmake" hostmakedepends = ["gma...
pkgname = 'libvpx7' pkgver = '1.11.0' pkgrel = 0 build_style = 'configure' configure_args = ['--enable-shared', '--enable-pic', '--enable-vp8', '--enable-vp9', '--enable-experimental', '--enable-runtime-cpu-detect', '--enable-postproc', '--disable-install-srcs'] make_cmd = 'gmake' hostmakedepends = ['gmake', 'pkgconf',...
x = 1 y = 2 if x > 1: print(y) elif x == y: print(x) else: print(x, y)
x = 1 y = 2 if x > 1: print(y) elif x == y: print(x) else: print(x, y)
# Example of defining functions of python and using return statements def hello_world(): # define function hello_world print("Hello world") hello_world() def multiply(x, y): # define function multiply that takes parameter x and parameter y return x * y # return the parameter x multiplied by parameter y pri...
def hello_world(): print('Hello world') hello_world() def multiply(x, y): return x * y print(2 * 2) print(multiply(2, 2))
with open('day1.txt','r') as file: data = file.readlines() #print(data) found = False for num1 in data: for num2 in data: val = int(num1) + int(num2) if (val == 2020): print("found one at " + num1 + " and " + num2 ) mult1 = int(num1) * int(num2) print("Mult...
with open('day1.txt', 'r') as file: data = file.readlines() found = False for num1 in data: for num2 in data: val = int(num1) + int(num2) if val == 2020: print('found one at ' + num1 + ' and ' + num2) mult1 = int(num1) * int(num2) print('Multiplier is ' + str(...
FIXTURES_DIR = 'fixtures/' INVENTORY_FILE = FIXTURES_DIR + "inventory" SIMPLE_PLAYBOOK_SVG = FIXTURES_DIR + "simple_playbook_no_postproccess.svg"
fixtures_dir = 'fixtures/' inventory_file = FIXTURES_DIR + 'inventory' simple_playbook_svg = FIXTURES_DIR + 'simple_playbook_no_postproccess.svg'
## Script (Python) "getVivoCancelado" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title=Retorna a lista de eventos do vivo - Cancelados ## eventos = context.portal_catalog.searchResults(portal_type='Evento', \ ...
eventos = context.portal_catalog.searchResults(portal_type='Evento', review_state='Cancelado', sort_on='getData_hora') return eventos
num = list(range(1,11)) print('The first three items in the list are:') print(num[:3]) print('Three items from the middle of the list are:') print(num[3:6]) print('The last three items in the list are:') print(num[-3:])
num = list(range(1, 11)) print('The first three items in the list are:') print(num[:3]) print('Three items from the middle of the list are:') print(num[3:6]) print('The last three items in the list are:') print(num[-3:])
{ "targets": [ { "link_settings": { "libraries": [ "Psapi.lib" ] }, "includes": [ "auto.gypi" ], "sources": [ "sources/cc/all.cc" ] } ], "includes": [ "auto-top.gypi" ] }
{'targets': [{'link_settings': {'libraries': ['Psapi.lib']}, 'includes': ['auto.gypi'], 'sources': ['sources/cc/all.cc']}], 'includes': ['auto-top.gypi']}
help = ''' NAME spc - A secure Personal cloud SYNOPSIS secure personal cloud [ Xoption ... ] [ file ... ] DESCRIPTION SPC is a secure personal cloud The spc program is an advanced cloud storage system with high security. There is a continuous sync beween the files ....open. SP...
help = "\nNAME\n spc - A secure Personal cloud\n\nSYNOPSIS\n secure personal cloud [ Xoption ... ] [ file ... ]\n\nDESCRIPTION\n SPC is a secure personal cloud\n\n The spc program is an advanced cloud storage system with high security. There\n is a continuous sync beween the files .......
n, m = map(int, input().split()) p = m // 2 if p <= n: print(p) else: print(n + (m - n * 2) // 4)
(n, m) = map(int, input().split()) p = m // 2 if p <= n: print(p) else: print(n + (m - n * 2) // 4)
{ "SENDER_EMAIL":"haianhkd1989@gmail.com", "PWD_EMAIL":"dwodccohgrfwslxf", "WEATHER_API_KEY":"662cb792a84805aa39bd3dd444716996" }
{'SENDER_EMAIL': 'haianhkd1989@gmail.com', 'PWD_EMAIL': 'dwodccohgrfwslxf', 'WEATHER_API_KEY': '662cb792a84805aa39bd3dd444716996'}
response.title = settings.title response.subtitle = settings.subtitle response.meta.author = '%s <%s>' % (settings.author, settings.author_email) response.meta.keywords = settings.keywords response.meta.description = settings.description response.menu = [ (T('Index'),URL('index')==URL(),URL('index'),[]), (T('S...
response.title = settings.title response.subtitle = settings.subtitle response.meta.author = '%s <%s>' % (settings.author, settings.author_email) response.meta.keywords = settings.keywords response.meta.description = settings.description response.menu = [(t('Index'), url('index') == url(), url('index'), []), (t('Site C...
config = dict() config["base_path"] = "../" config["initial_learning_rate"] = 1e-4 # config["image_shape"] = (128, 192, 160) config["normalizaiton"] = "group_normalization" config["mode"] = "trilinear" config["all_modalities"] = ["t1", "t1ce", "flair", "t2"] config["training_modalities"] = config["all_modalities"] #...
config = dict() config['base_path'] = '../' config['initial_learning_rate'] = 0.0001 config['normalizaiton'] = 'group_normalization' config['mode'] = 'trilinear' config['all_modalities'] = ['t1', 't1ce', 'flair', 't2'] config['training_modalities'] = config['all_modalities'] config['nb_channels'] = len(config['training...
# # PySNMP MIB module CISCO-CDMA-PDSN-CRP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CDMA-PDSN-CRP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:52:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, single_value_constraint, constraints_union, value_range_constraint) ...
JSON_TYPE = "application/json" TEXT_TYPE = "text/plain; charset=utf-8" HTML_TYPE = "text/html; charset=utf-8" OVERRIDE_TYPE = "application/x-override"
json_type = 'application/json' text_type = 'text/plain; charset=utf-8' html_type = 'text/html; charset=utf-8' override_type = 'application/x-override'
##Elias Howell | 10/24/2019 | Homework #3 #Compares two lists and returns a list of items shared by the two def similar_items(list1, list2): listOfItems = [] for item in list1: if item in list2: listOfItems.append(item) return listOfItems #Compares two lists and returns a list of item...
def similar_items(list1, list2): list_of_items = [] for item in list1: if item in list2: listOfItems.append(item) return listOfItems def unique_items(list1, list2): list_of_items = [] for item in list1: if item not in list2: listOfItems.append(item) retur...
################# # C O N F I G # ################# DEBUG = False SECRET_KEY = '4001628bb0b22cefcxc6dfde280ba000' SQLALCHEMY_DATABASE_URI = 'sqlite:///site.db' # These are used in integration with the below services. # INT_USER = "INT_ADMIN" INT_PASS = "hX82ZilTgalkpqkd6dyp" # Services (docker images ran and bound...
debug = False secret_key = '4001628bb0b22cefcxc6dfde280ba000' sqlalchemy_database_uri = 'sqlite:///site.db' int_user = 'INT_ADMIN' int_pass = 'hX82ZilTgalkpqkd6dyp' service_addresses = {'auth': 'http://host.docker.internal:601', 'opp': 'http://host.docker.internal:602', 'prod': 'http://host.docker.internal:603', 'doc':...
def binary(bn): i=0 sum=0 while(bn!=0): ld = bn%10 bn = bn//10 sum=ld*pow(2,i)+sum i+=1 if(sum%3==0): return(1) else: return(0) n = int(input()) for i in range(n): bn= int(input()) result = binary(bn) print(result)
def binary(bn): i = 0 sum = 0 while bn != 0: ld = bn % 10 bn = bn // 10 sum = ld * pow(2, i) + sum i += 1 if sum % 3 == 0: return 1 else: return 0 n = int(input()) for i in range(n): bn = int(input()) result = binary(bn) print(result)
# table definition table = { 'table_name' : 'gl_ledger_params', 'module_id' : 'gl', 'short_descr' : 'G/l parameters', 'long_descr' : 'General ledger parameters', 'sub_types' : None, 'sub_trans' : None, 'sequence' : None, 'tree_params' : None, 'roll_params' ...
table = {'table_name': 'gl_ledger_params', 'module_id': 'gl', 'short_descr': 'G/l parameters', 'long_descr': 'General ledger parameters', 'sub_types': None, 'sub_trans': None, 'sequence': None, 'tree_params': None, 'roll_params': None, 'indexes': None, 'ledger_col': 'ledger_row_id', 'defn_company': None, 'data_company'...
for k in range(int(input())): B = int(input()) Ad, Dd, Ld = tuple(map(int,input().split())) Ag, Dg, Lg = tuple(map(int,input().split())) Vd = (Ad + Dd)/2 + (B if Ld%2 == 0 else 0) Vg = (Ag + Dg)/2 + (B if Lg%2 == 0 else 0) if Vd > Vg: print("Dabriel") elif Vg > Vd: print("Guarte") else: print("Empate")
for k in range(int(input())): b = int(input()) (ad, dd, ld) = tuple(map(int, input().split())) (ag, dg, lg) = tuple(map(int, input().split())) vd = (Ad + Dd) / 2 + (B if Ld % 2 == 0 else 0) vg = (Ag + Dg) / 2 + (B if Lg % 2 == 0 else 0) if Vd > Vg: print('Dabriel') elif Vg > Vd: ...
maiorpeso = 0 menor = 0 for pessoas in range(1,5+1): peso = float(input('Peso da pessoa {}: '.format(pessoas))) if pessoas == 1: maiorpeso = peso menor = peso else: if peso > maiorpeso: maiorpeso = peso if peso < menor: menor = peso print('...
maiorpeso = 0 menor = 0 for pessoas in range(1, 5 + 1): peso = float(input('Peso da pessoa {}: '.format(pessoas))) if pessoas == 1: maiorpeso = peso menor = peso else: if peso > maiorpeso: maiorpeso = peso if peso < menor: menor = peso print('O maior p...
# Copyright 2020 Valentin Dufois # # 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 ...
def on_init_cell(list, row, col, attribs): return def on_init_row(comp, row, attribs): return def on_init_col(comp, col, attribs): return def on_init_table(comp, attribs): return def on_rollover(list, row, col, coords, prevRow, prevCol, prevCoords): list.SelectRow(row) return def on_select(...
#https://leetcode.com/problems/reverse-linked-list/ # class Solution(object): # #iterative # def reverseList(self, head): # prev = None # current = head # while current: # temp = current.next # current.next = prev # prev = current # current...
class Solution(object): def reverse_list(self, node): if node and node.next: new_head = self.reverseList(node.next) node.next.next = node node.next = None return new_head return node class Solution(object): def reverse_list(self, node): ...
class Node: value: str prev: 'Node' = None next: 'Node' = None class SimpleQueue: def __init__(self): self.head: Node = None self.tail: Node = None def append(self, value: str): #assignment new_node = Node() new_node.value = value if self.tail: ...
class Node: value: str prev: 'Node' = None next: 'Node' = None class Simplequeue: def __init__(self): self.head: Node = None self.tail: Node = None def append(self, value: str): new_node = node() new_node.value = value if self.tail: new_node.nex...
types = {u'ga:CPC': 'c', u'ga:CPM': 'c', u'ga:CTR': 'p', u'ga:adClicks': 'l', u'ga:adCost': 'c', u'ga:bounces': 'l', u'ga:entrances': 'l', u'ga:exits': 'l', u'ga:goal1Completions': 'l', u'ga:goal1Starts': 'l', u'ga:goal1Value': 'c', u'ga:goal2Completions': 'l', u'ga:goal2Starts': 'l', u'ga:goal2Value': 'c'...
types = {u'ga:CPC': 'c', u'ga:CPM': 'c', u'ga:CTR': 'p', u'ga:adClicks': 'l', u'ga:adCost': 'c', u'ga:bounces': 'l', u'ga:entrances': 'l', u'ga:exits': 'l', u'ga:goal1Completions': 'l', u'ga:goal1Starts': 'l', u'ga:goal1Value': 'c', u'ga:goal2Completions': 'l', u'ga:goal2Starts': 'l', u'ga:goal2Value': 'c', u'ga:goal3C...
list_one = ["C#", "Cobol", "Elixir", "Golang", "Haskell", "Java", "Javascript", "Python", "Scala"] list_two = ["C#", "Cobol", "Elixir", "Java", "Javascript", "Python"] print(list(set(list_one) - set(list_two)))
list_one = ['C#', 'Cobol', 'Elixir', 'Golang', 'Haskell', 'Java', 'Javascript', 'Python', 'Scala'] list_two = ['C#', 'Cobol', 'Elixir', 'Java', 'Javascript', 'Python'] print(list(set(list_one) - set(list_two)))
expected_output = { "tag": { "1": { "level": { 1: { "R1.00-00": { "local_router": True, "lsp_sequence_num": "0x00000009", "lsp_checksum": "0xE369", "lsp_holdtime": ...
expected_output = {'tag': {'1': {'level': {1: {'R1.00-00': {'local_router': True, 'lsp_sequence_num': '0x00000009', 'lsp_checksum': '0xE369', 'lsp_holdtime': '1192', 'lsp_rcvd': '*', 'attach_bit': 0, 'p_bit': 0, 'overload_bit': 0, 'area_address': '49', 'nlpid': '0xCC 0x8E', 'router_id': '1.1.1.1', 'router_cap': '1.1.1....
class Complex: def __init__(self, real=0, imaginary=0): self.Real = real self.Imaginary = imaginary def Add(self, real,imaginary): self.Real += real self.Imaginary +=imaginary def Sub(self, real,imaginary): self.Real -= real self.Imaginary ...
class Complex: def __init__(self, real=0, imaginary=0): self.Real = real self.Imaginary = imaginary def add(self, real, imaginary): self.Real += real self.Imaginary += imaginary def sub(self, real, imaginary): self.Real -= real self.Imaginary -= imaginary ...
num=0 for i in input(): if i.islower(): num+=ord(i)-ord('a')+1 else: num+=ord(i)-ord('A')+27 for i in range(2,num//2+1): if num%i==0: print('It is not a prime word.') exit() print('It is a prime word.')
num = 0 for i in input(): if i.islower(): num += ord(i) - ord('a') + 1 else: num += ord(i) - ord('A') + 27 for i in range(2, num // 2 + 1): if num % i == 0: print('It is not a prime word.') exit() print('It is a prime word.')
class Board_Info: def __init__(self): self.pin_num = 48 self.ISP_RX = 4 self.ISP_TX = 5 self.WIFI_TX = 39 self.WIFI_RX = 38 self.CONNEXT_A=35 self.CONNEXT_B=34 self.MPU_SDA=29 self.MPU_SCL=28 self.MPU_INT=23 self.SPK_LRCLK=14 ...
class Board_Info: def __init__(self): self.pin_num = 48 self.ISP_RX = 4 self.ISP_TX = 5 self.WIFI_TX = 39 self.WIFI_RX = 38 self.CONNEXT_A = 35 self.CONNEXT_B = 34 self.MPU_SDA = 29 self.MPU_SCL = 28 self.MPU_INT = 23 self.SPK_...
# drinks.py drink_list = [ { "name": "Wasser", "recipe": [ ("water", 80) ] }, { "name": "Matt Colado", "recipe": [ ("rum", 40), ("cocos", 40), ("pineapple", 120) ] }, { "name": "nasty ass honey badger", ...
drink_list = [{'name': 'Wasser', 'recipe': [('water', 80)]}, {'name': 'Matt Colado', 'recipe': [('rum', 40), ('cocos', 40), ('pineapple', 120)]}, {'name': 'nasty ass honey badger', 'recipe': [('oj', 90), ('pineapple', 60), ('mango', 30), ('curacao', 30)]}, {'name': 'PineMate', 'recipe': [('mate', 100), ('pineapple', 75...
config = {'item_embed': { 'num_embeddings': 500, 'embedding_dim': 32, 'sparse': False, 'padding_idx': -1, }, 'trans': { 'input_size': 32, 'hidden_size': 16, 'n_layers': 2, 'n_heads': 4, 'max_len': 5, }, 'context_features': [ {'num_embedding...
config = {'item_embed': {'num_embeddings': 500, 'embedding_dim': 32, 'sparse': False, 'padding_idx': -1}, 'trans': {'input_size': 32, 'hidden_size': 16, 'n_layers': 2, 'n_heads': 4, 'max_len': 5}, 'context_features': [{'num_embeddings': 6, 'embedding_dim': 10, 'sparse': False, 'padding_idx': -1}, {'num_embeddings': 4, ...
#author : @Akash_Kumar for t in range(1,int(input())+1): s=str(input()) s_len=len(s) #print(s_len) if s_len==1: print("Case #"+str(t)+": "+"0") else: vov='AIOUE' vs="" cs="" n=len(s) for i in range(n): if s[i] in vov: vs+=s[i] else: cs+=s[i] ASC...
for t in range(1, int(input()) + 1): s = str(input()) s_len = len(s) if s_len == 1: print('Case #' + str(t) + ': ' + '0') else: vov = 'AIOUE' vs = '' cs = '' n = len(s) for i in range(n): if s[i] in vov: vs += s[i] e...
''' Given the head of a DLL and data, insert data and maintain sorted order return the head 1. make new node with data 2. Find the place needed to insert 3. Do insertion None x y z None -> -> -> <- <- <- if...
""" Given the head of a DLL and data, insert data and maintain sorted order return the head 1. make new node with data 2. Find the place needed to insert 3. Do insertion None x y z None -> -> -> <- <- <- if...
class Solution: def XXX(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head pre = head cur = head.next while cur: if pre.val == cur.val: cur = cur.next pre.next = cur continue ...
class Solution: def xxx(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head pre = head cur = head.next while cur: if pre.val == cur.val: cur = cur.next pre.next = cur continue ...
class Solution: def isPrintable(self, grid: List[List[int]]) -> bool: limits = [[] for _ in range(61)] for i, row in enumerate(grid): for j, val in enumerate(row): if not limits[val]: limits[val] = [i, i, j, j] else: ...
class Solution: def is_printable(self, grid: List[List[int]]) -> bool: limits = [[] for _ in range(61)] for (i, row) in enumerate(grid): for (j, val) in enumerate(row): if not limits[val]: limits[val] = [i, i, j, j] else: ...
#program to convert pressure in kilopascals to pounds per square inch, a millimeter of mercury (mmHg) and atmosphere pressure. x= float(input('Pressure= ')) print('Convert kPa to psi:') x1 = x*0.15 print(x1,"psi") print('Convert kPa to mmHg:') x2 = x* 7.501 print(x2, "mmHg") print('Convert kPa to atm:') x3 = x/101 prin...
x = float(input('Pressure= ')) print('Convert kPa to psi:') x1 = x * 0.15 print(x1, 'psi') print('Convert kPa to mmHg:') x2 = x * 7.501 print(x2, 'mmHg') print('Convert kPa to atm:') x3 = x / 101 print(x3, 'atm')
class Solution: def reverseParentheses(self, s: str) -> str: stack = [''] for c in s: if c == '(': stack.append('') elif c == ')': reversed_top = stack.pop()[::-1] stack[-1] += reversed_top else: stac...
class Solution: def reverse_parentheses(self, s: str) -> str: stack = [''] for c in s: if c == '(': stack.append('') elif c == ')': reversed_top = stack.pop()[::-1] stack[-1] += reversed_top else: st...
# The Project is about Mab libs. # Mad Libs consist of a book that has a short story on each page with many key words replaced with blanks. # Beneath each blank is specified a lexical or other category, such as "noun", "verb", "place", or "part of the body". # One player asks the other players, in turn, to contribute s...
print('Dear user, Mab Libs has started') character_name = input('Input your name please! : ') character_adjective = input('Input 3 adjectives separately : ') (adjective1, adjective2, adjective3) = character_adjective.split() character_verbs = input('Please type in 3 verbs with spaces to split them : ') (verb1, verb2, v...
# Change Map Layer Transparency # https://github.com/GeospatialPython/Learn/raw/master/Mississippi.zip lyr = QgsVectorLayer("/qgis_data/ms/mississippi.shp", "Mississippi", "ogr") lyr.setLayerTransparency(50) QgsMapLayerRegistry.instance().addMapLayer(lyr)
lyr = qgs_vector_layer('/qgis_data/ms/mississippi.shp', 'Mississippi', 'ogr') lyr.setLayerTransparency(50) QgsMapLayerRegistry.instance().addMapLayer(lyr)
__author__ = 'dennisverslegers' # Define the users who have access allowed = ( ('admin', 'admin'), )
__author__ = 'dennisverslegers' allowed = (('admin', 'admin'),)
#Arrays in python are called lists x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] for i in x: print(i)
x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] for i in x: print(i)
#!/usr/bin/python # coding:utf-8 class AkError(Exception): opt = '' msg = '' # Error msg ERROR_CONFLICT_MSG = "ERROR: Conflict with existing argument" ERROR_EMPTY_BRANCHES_MSG = "ERROR: There are empty independent branches in parentheses" ERROR_MISMATCHED_PARENTHESES_MSG = "ERROR: Mismatched p...
class Akerror(Exception): opt = '' msg = '' error_conflict_msg = 'ERROR: Conflict with existing argument' error_empty_branches_msg = 'ERROR: There are empty independent branches in parentheses' error_mismatched_parentheses_msg = 'ERROR: Mismatched parentheses' error_wrong_key_msg = 'ERROR: Wrong...
# Damien leave NPC WORLD_TREE_SUMMIT = 105300303 sm.flipSpeaker() sm.flipDialoguePlayerAsSpeaker() sm.setBoxChat() dialog = str() if sm.hasMobsInField(): dialog = "Are you sure you want to leave the battlefield and abandon your party members?" else: dialog = "You have defeated Damien. Do you want to leave?" if ...
world_tree_summit = 105300303 sm.flipSpeaker() sm.flipDialoguePlayerAsSpeaker() sm.setBoxChat() dialog = str() if sm.hasMobsInField(): dialog = 'Are you sure you want to leave the battlefield and abandon your party members?' else: dialog = 'You have defeated Damien. Do you want to leave?' if sm.sendAskYesNo(dia...
# Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'target_defaults': { 'variables': { 'deps': [ 'libchrome-<(libbase_ver)', ], 'enable_exceptions': 1, }, }, 'targ...
{'target_defaults': {'variables': {'deps': ['libchrome-<(libbase_ver)'], 'enable_exceptions': 1}}, 'targets': [{'target_name': 'container_config_parser', 'type': 'shared_library', 'sources': ['container_config_parser.cc']}, {'target_name': 'run_oci', 'type': 'executable', 'variables': {'deps': ['libcontainer', 'libbril...
# 27. Remove Element # https://leetcode.com/problems/remove-element/ # Easy # Time Complexity : O(N) # Space Complexity: O(1) class Solution: def removeElement(self, nums: List[int], val: int) -> int: r = len(nums) - 1 l = 0 while l <= r: if nums[l] == val: num...
class Solution: def remove_element(self, nums: List[int], val: int) -> int: r = len(nums) - 1 l = 0 while l <= r: if nums[l] == val: (nums[l], nums[r]) = (nums[r], nums[l]) r -= 1 else: l += 1 return r + 1
# # @lc app=leetcode id=217 lang=python3 # # [217] Contains Duplicate # class Solution: def containsDuplicate(self, nums: List[int]) -> bool: return len(nums) != len(set(nums))
class Solution: def contains_duplicate(self, nums: List[int]) -> bool: return len(nums) != len(set(nums))
#input # 1732 13 # 7830 2356 7261 2736 7682 0832 3207 2608 0672 7312 6087 1235 7250 (number, n) = (x for x in input().split()) n = int(n) guesses = input().split() for i in range(0, n): guess = guesses[i] a = 0 b = 0 for c in guess: if c in number: if guess.index(c) == number.index(c): a ...
(number, n) = (x for x in input().split()) n = int(n) guesses = input().split() for i in range(0, n): guess = guesses[i] a = 0 b = 0 for c in guess: if c in number: if guess.index(c) == number.index(c): a += 1 else: b += 1 print(str(a) ...
class Tag: def __init__(self, name, views=None, reactions=None, comments=None, articles=None): self.name = name self.views = views or 0 self.reactions = reactions or 0 self.comments = comments or 0 self.articles = articles or [] def as_json(self): return { "name...
class Tag: def __init__(self, name, views=None, reactions=None, comments=None, articles=None): self.name = name self.views = views or 0 self.reactions = reactions or 0 self.comments = comments or 0 self.articles = articles or [] def as_json(self): return {'name'...
speedOfLightSI = 299792458.0 #These constants were taken from astropy MpcInMeters = 3.0856775814671917e22 GyrInSeconds = 3.15576e16 speedOfLightMpcGyr = speedOfLightSI/MpcInMeters*GyrInSeconds CMBTemp=2.726
speed_of_light_si = 299792458.0 mpc_in_meters = 3.0856775814671917e+22 gyr_in_seconds = 3.15576e+16 speed_of_light_mpc_gyr = speedOfLightSI / MpcInMeters * GyrInSeconds cmb_temp = 2.726
class paginaWeb(object): def __init__(self, url: str, ruta: str, formato:str, contenido:str, titulo: str, slug:str, metatags:list): self.url = url self.ruta = ruta self.formato = formato self.contenido = contenido self.titulo = titulo self.slug = slug self.met...
class Paginaweb(object): def __init__(self, url: str, ruta: str, formato: str, contenido: str, titulo: str, slug: str, metatags: list): self.url = url self.ruta = ruta self.formato = formato self.contenido = contenido self.titulo = titulo self.slug = slug sel...
name = "Atilla" num = len(name) while num >= 0: ch = name[num] print(ch) num = num -1
name = 'Atilla' num = len(name) while num >= 0: ch = name[num] print(ch) num = num - 1
def f(): pass #comment class C: pass #comment if True: pass #comment if True: pass else: pass #comment if True: pass elif True: pass #comment
def f(): pass class C: pass if True: pass if True: pass else: pass if True: pass elif True: pass
# # PySNMP MIB module ASCEND-MIBOC3INT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBOC3INT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:11:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration') (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constra...
MONGO_HOST = 'mongodb' MONGO_DBNAME = 'usuario00' stock_change_schema = { 'product': { 'type': 'string', 'maxlength': 64, 'required': True, }, 'person': { 'type': 'string', 'maxlength': 16, }, 'change': { 'type': 'integer', 'required': True, ...
mongo_host = 'mongodb' mongo_dbname = 'usuario00' stock_change_schema = {'product': {'type': 'string', 'maxlength': 64, 'required': True}, 'person': {'type': 'string', 'maxlength': 16}, 'change': {'type': 'integer', 'required': True}} stock_change = {'schema': stock_change_schema, 'resource_methods': ['GET', 'POST'], '...
T = int(input()) while T: grades = list(map(int, input().split())) grades.remove(max(grades)) grades.remove(min(grades)) if max(grades) - min(grades) >=4: print('KIN') else: print(sum(grades)) T -=1
t = int(input()) while T: grades = list(map(int, input().split())) grades.remove(max(grades)) grades.remove(min(grades)) if max(grades) - min(grades) >= 4: print('KIN') else: print(sum(grades)) t -= 1
class XRay: def get_results(holdings, funds_data, currency): res = {} total = 0 for ticker, holding in holdings.items(): if ticker in funds_data: for share, weight in funds_data[ticker].items(): if weight > 0: share_pric...
class Xray: def get_results(holdings, funds_data, currency): res = {} total = 0 for (ticker, holding) in holdings.items(): if ticker in funds_data: for (share, weight) in funds_data[ticker].items(): if weight > 0: share...
# Variables # use variables to store data first_name = "Jane" last_name = "Doe" age = 25 price = 16.54 is_raining = True can_vote = False # variables can be assigned different values print(first_name) # prints Jane first_name = "John" print(first_name) # prints John
first_name = 'Jane' last_name = 'Doe' age = 25 price = 16.54 is_raining = True can_vote = False print(first_name) first_name = 'John' print(first_name)
# automatically generated by the FlatBuffers compiler, do not modify # namespace: proto class Action(object): Push = 0 Pull = 1 Exec = 2 Encode = 3 DecodeSIHO = 4 DecodeSISO = 5 DecodeHIHO = 6
class Action(object): push = 0 pull = 1 exec = 2 encode = 3 decode_siho = 4 decode_siso = 5 decode_hiho = 6
#!/usr/bin/env python # Raise Error with message def print_error(msg): print('CLIQR_EXTERNAL_SERVICE_ERR_MSG_START') print(msg) print('CLIQR_EXTERNAL_SERVICE_ERR_MSG_END') # Logging messages def print_log(msg): print('CLIQR_EXTERNAL_SERVICE_LOG_MSG_START') print(msg) print('CLIQR_EXTERNAL_SER...
def print_error(msg): print('CLIQR_EXTERNAL_SERVICE_ERR_MSG_START') print(msg) print('CLIQR_EXTERNAL_SERVICE_ERR_MSG_END') def print_log(msg): print('CLIQR_EXTERNAL_SERVICE_LOG_MSG_START') print(msg) print('CLIQR_EXTERNAL_SERVICE_LOG_MSG_END') def print_result(msg): print('CLIQR_EXTERNAL_S...
description = 'Generic configuration settings for ESTIA' group = 'configdata' ESTIA_DATA_ROOT='/opt/nicos-data/estia' KAFKA_BROKERS = ["localhost:9092"]
description = 'Generic configuration settings for ESTIA' group = 'configdata' estia_data_root = '/opt/nicos-data/estia' kafka_brokers = ['localhost:9092']
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"findpos": "00_core.ipynb", "isstrictlyascending": "00_core.ipynb", "alpha": "00_core.ipynb", "CreateMuVectors": "00_core.ipynb", "CreateLyndonIndices": "00_core.ipynb", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'findpos': '00_core.ipynb', 'isstrictlyascending': '00_core.ipynb', 'alpha': '00_core.ipynb', 'CreateMuVectors': '00_core.ipynb', 'CreateLyndonIndices': '00_core.ipynb', 'CreateEquation': '00_core.ipynb', 'CreateConditions': '00_core.ipynb'} modules...
class BridgecrewAuthError(Exception): def __init__(self, message="Authorization error accessing Bridgecrew.cloud api. Please check bc-api-key"): self.message = message def __str__(self): return 'BCAuthError, {0} '.format(self.message)
class Bridgecrewautherror(Exception): def __init__(self, message='Authorization error accessing Bridgecrew.cloud api. Please check bc-api-key'): self.message = message def __str__(self): return 'BCAuthError, {0} '.format(self.message)
def erasing_maximum(lst): # input() # lst = list(map(int, input().strip.split())) maximum = max(lst) indexes = [] for index, value in enumerate(lst): if value == maximum: indexes.append(index) if len(indexes) > 1: del lst[indexes[2]] else: del lst[indexe...
def erasing_maximum(lst): maximum = max(lst) indexes = [] for (index, value) in enumerate(lst): if value == maximum: indexes.append(index) if len(indexes) > 1: del lst[indexes[2]] else: del lst[indexes[0]] return lst
class HandState(object): def __init__(self, table, deck): self.table = table self.deck = deck self.community = [] self.posts = [] self.betting = {'preflop': [], 'flop': [], 'turn': [], 'river': []} self.showdown = [] def add_post(self, player, amount, type): ...
class Handstate(object): def __init__(self, table, deck): self.table = table self.deck = deck self.community = [] self.posts = [] self.betting = {'preflop': [], 'flop': [], 'turn': [], 'river': []} self.showdown = [] def add_post(self, player, amount, type): ...
lili_age = int(input()) laundry_machine = float(input()) toy_price = float(input()) number_toys = 0 money = 0 if 1 <= lili_age <= 77: for i in range(1, lili_age + 1): if i % 2 == 0: money += (10 * i)/2 - 1 else: number_toys += 1 sum_toys = number_toys * toy_price total_sum = ...
lili_age = int(input()) laundry_machine = float(input()) toy_price = float(input()) number_toys = 0 money = 0 if 1 <= lili_age <= 77: for i in range(1, lili_age + 1): if i % 2 == 0: money += 10 * i / 2 - 1 else: number_toys += 1 sum_toys = number_toys * toy_price total_sum = ...
def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Reserved'}, {'abbr': 'sfc', 'code': 1, 'title': 'Surface', 'units': 'of the Earth, which includes sea surface'}, {'abbr': 'sfc', 'code': 2, 'title': 'Cloud base level'}, {'abbr': 'sfc', '...
def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Reserved'}, {'abbr': 'sfc', 'code': 1, 'title': 'Surface', 'units': 'of the Earth, which includes sea surface'}, {'abbr': 'sfc', 'code': 2, 'title': 'Cloud base level'}, {'abbr': 'sfc', 'code': 3, 'title': 'Cloud top level'}, {'abbr': 'sfc', 'code': 4, 'title': ...
#multifilesread1.py with open("1.txt") as file1, open("2.txt") as file2: print(file2.readline()) print(file1.readline())
with open('1.txt') as file1, open('2.txt') as file2: print(file2.readline()) print(file1.readline())
class Solution: def minPathSum(self, grid: List[List[int]]) -> int: if grid == None or len(grid) == 0: return 0 m = len(grid) n = len(grid[0]) dp = [[0 for x in range(n)] for x in range(m)] for i in range(0,len(grid)): for j in range(...
class Solution: def min_path_sum(self, grid: List[List[int]]) -> int: if grid == None or len(grid) == 0: return 0 m = len(grid) n = len(grid[0]) dp = [[0 for x in range(n)] for x in range(m)] for i in range(0, len(grid)): for j in range(0, len(grid[i]...
host = "127.0.0.1" port = 1947 debug = True threaded = True scode = 200 message = { "mood": "howdy !!" } ca_crt = r"certs/ca-crt.pem" server_crt = r"certs/server.crt" server_key = r"certs/server.key"
host = '127.0.0.1' port = 1947 debug = True threaded = True scode = 200 message = {'mood': 'howdy !!'} ca_crt = 'certs/ca-crt.pem' server_crt = 'certs/server.crt' server_key = 'certs/server.key'
Number = input("Enter the a number ") Number = int(Number) i = 1 sum = 0 while i<=Number: sum = sum + i i = i + 1 print("Sum of the numbers") print(sum)
number = input('Enter the a number ') number = int(Number) i = 1 sum = 0 while i <= Number: sum = sum + i i = i + 1 print('Sum of the numbers') print(sum)
BOS = "<bos>" EOS = "<eos>" PAD = "<pad>" SEP = "<sep>" UNK = "<unk>" MASK = "<mask>" SPECIAL_TOKENS = [UNK, BOS, EOS, SEP, PAD, MASK] SPECIAL_TOKENS_DICT = {"unk_token": UNK, "bos_token": BOS, "eos_token": EOS, "sep_token": SEP, ...
bos = '<bos>' eos = '<eos>' pad = '<pad>' sep = '<sep>' unk = '<unk>' mask = '<mask>' special_tokens = [UNK, BOS, EOS, SEP, PAD, MASK] special_tokens_dict = {'unk_token': UNK, 'bos_token': BOS, 'eos_token': EOS, 'sep_token': SEP, 'pad_token': PAD, 'mask_token': MASK}
class OperationTypes: Save = 0 Delete = 1 Create = 2 Load = 3
class Operationtypes: save = 0 delete = 1 create = 2 load = 3
def dfs(graph, root): visited = [] tot_dist = {x: 99999 for x in graph.keys()} stack = [(root, 0)] while stack: node, dist = stack.pop() tot_dist[node] = min(tot_dist[node], dist) if node not in visited: visited.append(node) stack.extend([(x, dist + 1)for ...
def dfs(graph, root): visited = [] tot_dist = {x: 99999 for x in graph.keys()} stack = [(root, 0)] while stack: (node, dist) = stack.pop() tot_dist[node] = min(tot_dist[node], dist) if node not in visited: visited.append(node) stack.extend([(x, dist + 1) f...
def menu(menu_items): while True: for index, item in enumerate(menu_items, 1): print('[{}] - {}'.format(index, item)) choice = input() print() if choice in [str(index + 1) for index in range(len(menu_items))]: return menu_items[int(choice) - 1] ...
def menu(menu_items): while True: for (index, item) in enumerate(menu_items, 1): print('[{}] - {}'.format(index, item)) choice = input() print() if choice in [str(index + 1) for index in range(len(menu_items))]: return menu_items[int(choice) - 1] print...
class Solution: def solve(self, n): facts = [prod(range(1,i+1)) for i in range(1,13)] def solve(n, right_bound): if n == 0: return True right_bound = min(right_bound, bisect_right(facts,n)) return any(n - facts[i] >= 0 and solve(n-facts[i], i) for i in range(righ...
class Solution: def solve(self, n): facts = [prod(range(1, i + 1)) for i in range(1, 13)] def solve(n, right_bound): if n == 0: return True right_bound = min(right_bound, bisect_right(facts, n)) return any((n - facts[i] >= 0 and solve(n - facts[i...
# Demo Python Strings - Slicing Strings ''' Slice To the End By leaving out the end index, the range will go to the end. ''' # Get the characters from the start to position 5 (not included): b = "Hello, World!" print("string original: ", b) print(b[2:])
""" Slice To the End By leaving out the end index, the range will go to the end. """ b = 'Hello, World!' print('string original: ', b) print(b[2:])