content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
index = 0 def register(name, func): global index index += 1 func_name = name + str(index) globals()[func_name] = func return func_name
index = 0 def register(name, func): global index index += 1 func_name = name + str(index) globals()[func_name] = func return func_name
def search(data): string = "" number = "" last_i = "" for el in data: if el.isdigit(): number += el last_i = data.index(el) continue elif number == "": string += el else: break return string, number, last_i dat...
def search(data): string = '' number = '' last_i = '' for el in data: if el.isdigit(): number += el last_i = data.index(el) continue elif number == '': string += el else: break return (string, number, last_i) data = ...
# -*- coding: utf-8 -*- ''' >>> from opem.Dynamic.Padulles_Hauer import * >>> import shutil >>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":...
""" >>> from opem.Dynamic.Padulles_Hauer import * >>> import shutil >>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0.1,"i-stop":4,"i-step":...
bag = dict() bag["mathTextBook"] = 12.5 bag["nameTag"] = "Winston" bag.update({"nameTag": "Grace"}) print(bag)
bag = dict() bag['mathTextBook'] = 12.5 bag['nameTag'] = 'Winston' bag.update({'nameTag': 'Grace'}) print(bag)
M = 10**9 + 7 def solve(n): a = n i = 1 while i < n: k = n // i j = min(n // k + 1, n) a += k * (j - i) * n - k * (k + 1) * (j - i) * (i + j - 1) // 4 a %= M i = j return a for _ in range(int(input())): n = int(input()) print(solve(n))
m = 10 ** 9 + 7 def solve(n): a = n i = 1 while i < n: k = n // i j = min(n // k + 1, n) a += k * (j - i) * n - k * (k + 1) * (j - i) * (i + j - 1) // 4 a %= M i = j return a for _ in range(int(input())): n = int(input()) print(solve(n))
string = input('enter string from which vowels are need to be remove ') string = string.lower() vowels = ('a','e','i','o','u') for c in string: if string in vowels: new_str = string.replace(c,'') print(new_str)
string = input('enter string from which vowels are need to be remove ') string = string.lower() vowels = ('a', 'e', 'i', 'o', 'u') for c in string: if string in vowels: new_str = string.replace(c, '') print(new_str)
# # PySNMP MIB module EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:56:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_union, constraints_intersection, value_size_constraint) ...
#!/usr/bin/python class User(object): def __init__(self,conn, addr,name=None): self.name = name self.conn = conn self.addr = addr class Player(User): def __init__(self,conn,addr,name=None): super(Player,self).__init__(conn,addr,name) self.passwd = None self.scor...
class User(object): def __init__(self, conn, addr, name=None): self.name = name self.conn = conn self.addr = addr class Player(User): def __init__(self, conn, addr, name=None): super(Player, self).__init__(conn, addr, name) self.passwd = None self.score = 0 ...
def pkcs_7_padding(block,N=16): if N >= 256: raise Exception('N is too large.') num_remaining = N - len(block) % N return block + (chr(num_remaining) * num_remaining).encode('utf-8') if __name__ == '__main__': print(pkcs_7_padding(b'YELLOW SUBMARINE', 20))
def pkcs_7_padding(block, N=16): if N >= 256: raise exception('N is too large.') num_remaining = N - len(block) % N return block + (chr(num_remaining) * num_remaining).encode('utf-8') if __name__ == '__main__': print(pkcs_7_padding(b'YELLOW SUBMARINE', 20))
# # @lc app=leetcode id=487 lang=python3 # # [487] Max Consecutive Ones II # # @lc code=start class Solution: def findMaxConsecutiveOnes(self, nums): curzero = 0 lp = 0 rp = 0 mxlen = 0 while rp < len(nums): if nums[rp] == 0: curzero += 1 ...
class Solution: def find_max_consecutive_ones(self, nums): curzero = 0 lp = 0 rp = 0 mxlen = 0 while rp < len(nums): if nums[rp] == 0: curzero += 1 if curzero > 1: mxlen = max(mxlen, rp - lp) ...
number1 = int (input()) number2 = int (input()) if number1 >= number2: print('Greater number: ', number1) elif number2 > number1: print('Greater number: ', number2) else: print()
number1 = int(input()) number2 = int(input()) if number1 >= number2: print('Greater number: ', number1) elif number2 > number1: print('Greater number: ', number2) else: print()
# -*- coding: utf-8 -*- name = 'turret_resolver' version = '1.1.3.0' authors = ['wen.tan', 'ben.skinner', 'daniel.flood'] build_requires = ['python'] build_command = 'rez env python -c "python {root}/rezbuild.py {install}"' requires = ['pgtk', 'tk_core'] def commands(): env.PYTHONPATH....
name = 'turret_resolver' version = '1.1.3.0' authors = ['wen.tan', 'ben.skinner', 'daniel.flood'] build_requires = ['python'] build_command = 'rez env python -c "python {root}/rezbuild.py {install}"' requires = ['pgtk', 'tk_core'] def commands(): env.PYTHONPATH.append('{root}/python') env.RESOLVE.set('{root}/b...
def sum(num): return num + num def squre(num): return num * num
def sum(num): return num + num def squre(num): return num * num
# lextab.py. This file automatically created by PLY (version 2.2). Don't edit! _lextokens = {'HEADER_NAME': None, 'IDENTIFIER': None, 'PP_NUMBER': None, 'CHARACTER_CONSTANT': None, 'STRING_LITERAL': None, 'OTHER': None, 'PTR_OP': None, 'INC_OP': None, 'DEC_OP': None, 'LEFT_OP': None, 'RIGHT_OP': None, 'LE_OP': None,...
_lextokens = {'HEADER_NAME': None, 'IDENTIFIER': None, 'PP_NUMBER': None, 'CHARACTER_CONSTANT': None, 'STRING_LITERAL': None, 'OTHER': None, 'PTR_OP': None, 'INC_OP': None, 'DEC_OP': None, 'LEFT_OP': None, 'RIGHT_OP': None, 'LE_OP': None, 'GE_OP': None, 'EQ_OP': None, 'NE_OP': None, 'AND_OP': None, 'OR_OP': None, 'MUL_...
num_students = int(input()) students = {} for _ in range(num_students): name, grade = input().split(' ') if name not in students: students[name] = [] students[name].append(float(grade)) for name, grades in students.items(): average_grade = sum(grades) / len(grades) grades = [f'{...
num_students = int(input()) students = {} for _ in range(num_students): (name, grade) = input().split(' ') if name not in students: students[name] = [] students[name].append(float(grade)) for (name, grades) in students.items(): average_grade = sum(grades) / len(grades) grades = [f'{x:.2f}' f...
#Paula Duffy 2018-02-06 #Collatz Conjecture - Week 3 Exercise n = int(input("Please enter an integer: ")) while n > 1: if n % 2 == 0: n = n // 2 #divide by 2 if integer is even print (n) elif n % 2 == 1: n = (n * 3) + 1 #multiply by 3 and add 1 if integer is not even print (n)
n = int(input('Please enter an integer: ')) while n > 1: if n % 2 == 0: n = n // 2 print(n) elif n % 2 == 1: n = n * 3 + 1 print(n)
def add(a,b): return a+b def sub(a,b): return a-b def mul(a,b): return a*b def div(a,b): return a/b print(__name__)
def add(a, b): return a + b def sub(a, b): return a - b def mul(a, b): return a * b def div(a, b): return a / b print(__name__)
class ObjectView(dict): def __init__(self, *args, **kwargs): super(ObjectView, self).__init__(**kwargs) for arg in args: if not arg: continue elif isinstance(arg, dict): for key, val in arg.items(): self[key] = val ...
class Objectview(dict): def __init__(self, *args, **kwargs): super(ObjectView, self).__init__(**kwargs) for arg in args: if not arg: continue elif isinstance(arg, dict): for (key, val) in arg.items(): self[key] = val ...
# Problem: # Write a program that reads a number of integer numbers entered by the user and sums them. num_of_loops = int(input()) sum = 0; for i in range(1, num_of_loops + 1): num = int(input()) sum += num print(sum)
num_of_loops = int(input()) sum = 0 for i in range(1, num_of_loops + 1): num = int(input()) sum += num print(sum)
#!/usr/bin/env python scores = { "pullups": [(4,20), (5,23), (5,23), (5,23), (5,21), (5,20), (5,19), (4,19)], "crunches": [ (70,105), (70,110), (70,115), (70,115), (70,110), (65,105), (50,100), (40,100), ], "run": [ (18 * 60,27 * 6...
scores = {'pullups': [(4, 20), (5, 23), (5, 23), (5, 23), (5, 21), (5, 20), (5, 19), (4, 19)], 'crunches': [(70, 105), (70, 110), (70, 115), (70, 115), (70, 110), (65, 105), (50, 100), (40, 100)], 'run': [(18 * 60, 27 * 60 + 40), (18 * 60, 27 * 60 + 40), (18 * 60, 28 * 60 + 0), (18 * 60, 28 * 60 + 40), (18 * 60, 28 * 6...
# https://github.com/cthoyt/cookiecutter-snekpack how to make folder structure # https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-14-340 article for this analysis CRED = '\033[91m' CEND = '\033[0m' EXPRESSION = "../../data/GSE161533.top.table.tsv" EXPRESSION2 = "../../data/GGSE54129.top.table.tsv...
cred = '\x1b[91m' cend = '\x1b[0m' expression = '../../data/GSE161533.top.table.tsv' expression2 = '../../data/GGSE54129.top.table.tsv' interaction = '../../data/gene_interaction_map.tsv' pathway = '../../data/VEGF_signaling_pathw.txt'
f = [0,1] n = int(input("numar:")) for i in range(2, n+1): f.append(f[i-1]+f[i-2]) print(f)
f = [0, 1] n = int(input('numar:')) for i in range(2, n + 1): f.append(f[i - 1] + f[i - 2]) print(f)
# -*- coding: utf-8 -*- # Scrapy settings for tech163 project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'money163' SPIDER_MODULES = ['money163.spiders'] NE...
bot_name = 'money163' spider_modules = ['money163.spiders'] newspider_module = 'money163.spiders' item_pipelines = {'money163.pipelines.Money163Pipeline': 300} user_agent = 'Mozilla/5.0 (X11; Windows x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.7' download_timeout = 35 download_delay = 0.5
def first_letter_of_word(current_word): digits = [] new_current_word = [] for letter in current_word: if letter.isdigit(): digits.append(letter) elif letter.isalpha(): new_current_word.append(letter) first_letter = chr(int("".join(digits))) new_current_word.in...
def first_letter_of_word(current_word): digits = [] new_current_word = [] for letter in current_word: if letter.isdigit(): digits.append(letter) elif letter.isalpha(): new_current_word.append(letter) first_letter = chr(int(''.join(digits))) new_current_word.in...
N = int(input()) line = [] for a in range(N): line.append(int(input())) total = 0 curIter = 1 while min(line) < 999999: valleys = [] for a in range(N): if line[a] < 999999: if (a == 0 or line[a] <= line[a - 1]) and (a == N - 1 or line[a] <= line[a + 1]): valleys.append...
n = int(input()) line = [] for a in range(N): line.append(int(input())) total = 0 cur_iter = 1 while min(line) < 999999: valleys = [] for a in range(N): if line[a] < 999999: if (a == 0 or line[a] <= line[a - 1]) and (a == N - 1 or line[a] <= line[a + 1]): valleys.append(a...
def invert_binary_tree(node): if node: node.left, node.right = invert_binary_tree(node.right), invert_binary_tree(node.left) return node class BinaryTreeNode(object): def __init__(self, value, left=None, right=None): self.value = value self.left = None self.right = None...
def invert_binary_tree(node): if node: (node.left, node.right) = (invert_binary_tree(node.right), invert_binary_tree(node.left)) return node class Binarytreenode(object): def __init__(self, value, left=None, right=None): self.value = value self.left = None self.right = ...
#!/usr/bin/env python3 def selection_sort(lst): length = len(lst) for i in range(length - 1): least = i for k in range(i + 1, length): if lst[k] < lst[least]: least = k lst[least], lst[i] = (lst[i], lst[least]) return lst print(selection_sort([5, 2, 4, ...
def selection_sort(lst): length = len(lst) for i in range(length - 1): least = i for k in range(i + 1, length): if lst[k] < lst[least]: least = k (lst[least], lst[i]) = (lst[i], lst[least]) return lst print(selection_sort([5, 2, 4, 6, 1, 3]))
count = input('How many people will be in the dinner group? ') count = int(count) if count > 8: print('You\'ll have to wait for a table.') else: print('The table is ready.')
count = input('How many people will be in the dinner group? ') count = int(count) if count > 8: print("You'll have to wait for a table.") else: print('The table is ready.')
# Automatically generated # pylint: disable=all get = [{'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'ValidCores': [1], 'ValidThreadsPerCore': [1], 'SizeInMiB': 2048, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supp...
get = [{'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'ValidCores': [1], 'ValidThreadsPerCore': [1], 'SizeInMiB': 2048, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', ...
# https://stockmarketmba.com/globalstockexchanges.php exchanges = { 'USA': None, 'Germany': 'XETR', 'Hong Kong': 'XHKG', 'Japan': 'XTKS', 'France': 'XPAR', 'Canada': 'XTSE', 'United Kingdom': 'XLON', 'Switzerland': 'XSWX', 'Australia': 'XASX', 'South Korea': 'XKRX', 'The Net...
exchanges = {'USA': None, 'Germany': 'XETR', 'Hong Kong': 'XHKG', 'Japan': 'XTKS', 'France': 'XPAR', 'Canada': 'XTSE', 'United Kingdom': 'XLON', 'Switzerland': 'XSWX', 'Australia': 'XASX', 'South Korea': 'XKRX', 'The Netherlands': 'XAMS', 'Spain': 'XMAD', 'Russia': 'MISX', 'Italy': 'XMIL', 'Belgium': 'XBRU', 'Mexiko': ...
def SC_DFA(y): N = len(y) tau = int(np.floor(N/2)) y = y - np.mean(y) x = np.cumsum(y) taus = np.arange(5,tau+1) ntau = len(taus) F = np.zeros(ntau) for i in range(ntau): t = int(taus[i]) x_buff = x[:N - N % t] x_buff = x_buff.reshape((int(N / t),t)) ...
def sc_dfa(y): n = len(y) tau = int(np.floor(N / 2)) y = y - np.mean(y) x = np.cumsum(y) taus = np.arange(5, tau + 1) ntau = len(taus) f = np.zeros(ntau) for i in range(ntau): t = int(taus[i]) x_buff = x[:N - N % t] x_buff = x_buff.reshape((int(N / t), t)) ...
''' Formula for area of circle Area = pi * r^2 where pi is constant and r is the radius of the circle ''' def findarea(r): PI = 3.142 return PI * (r*r); print("Area is %.6f" % findarea(5));
""" Formula for area of circle Area = pi * r^2 where pi is constant and r is the radius of the circle """ def findarea(r): pi = 3.142 return PI * (r * r) print('Area is %.6f' % findarea(5))
class Take(object): def __init__(self, stage, unit, entity, not_found_proc, finished_proc): self._stage = stage self._unit = unit self._entity = entity self._finished_proc = finished_proc self._not_found_proc = not_found_proc def enact(self): if ...
class Take(object): def __init__(self, stage, unit, entity, not_found_proc, finished_proc): self._stage = stage self._unit = unit self._entity = entity self._finished_proc = finished_proc self._not_found_proc = not_found_proc def enact(self): if not self._entity...
rows = [] with open("C:\\Privat\\advent_of_code20\\puzzle14\\input1.txt") as f: for line in f: rows.append(line.strip()) #print(rows) memory = {} currentMask = "" for line in rows: split = line.split(' = ') if 'mask' in split[0]: currentMask = split[1].strip() else: # value in...
rows = [] with open('C:\\Privat\\advent_of_code20\\puzzle14\\input1.txt') as f: for line in f: rows.append(line.strip()) memory = {} current_mask = '' for line in rows: split = line.split(' = ') if 'mask' in split[0]: current_mask = split[1].strip() else: bit = format(int(split[1...
startHTML = ''' <html> <head> <style> table { border-collapse: collapse; height: 100%; width: 100%; } table, th, td { border: 3px solid black; } @media print { table { page-break-after: always; ...
start_html = '\n <html>\n <head>\n <style>\n table {\n border-collapse: collapse;\n height: 100%;\n width: 100%;\n }\n\n table, th, td {\n border: 3px solid black;\n }\n\n @media print {\n table {\n page-break-after: alw...
# Use snippet 'summarize_a_survey_module' to output a table and a graph of # participant counts by response for one question_concept_id # The snippet assumes that a dataframe containing survey questions and answers already exists # The snippet also assumes that setup has been run # Update the next 3 lines survey_df =...
survey_df = YOUR_DATASET_NAME_survey_df question_concept_id = 1585940 denominator = None def summarize_a_question_concept_id(df, question_concept_id, denominator=None): df = df.loc[df['question_concept_id'] == question_concept_id].copy() new_df = df.groupby(['answer_concept_id', 'answer'])['person_id'].nunique...
class LOG: def info(message): print("Info: " + message) def error(message): print("Error: " + message) def debug(message): print("Debug: " + message)
class Log: def info(message): print('Info: ' + message) def error(message): print('Error: ' + message) def debug(message): print('Debug: ' + message)
if __name__ == '__main__': # Fill in the code to do the following # 1. Set x to be a non-negative integer (no decimals, no negatives) # 2. If x is divisible by 3, print 'Fizz' # 3. If x is divisible by 5, print 'Buzz' # 4. If x is divisible by both 3 and 5, print 'FizzBuzz' # 5. If x is divisib...
if __name__ == '__main__': x = 1
class Solution: def rotate(self, matrix) -> None: result = [] for i in range(0,len(matrix)): store = [] for j in range(len(matrix)-1,-1,-1): store.append(matrix[j][i]) result.append(store) for i in range(0,len(result)): mat...
class Solution: def rotate(self, matrix) -> None: result = [] for i in range(0, len(matrix)): store = [] for j in range(len(matrix) - 1, -1, -1): store.append(matrix[j][i]) result.append(store) for i in range(0, len(result)): m...
provinces = [ # ["nunavut", 2], # ["yukon", 4], # ["Northwest%20Territories",2], # ["Prince%20Edward%20Island", 6], # ["Newfoundland%20and%20Labrador", 12], # ["New%20Brunswick", 28], # ["Nova%20Scotia", 36], # ["Saskatchewan", 34], # ["Manitoba", 40], # ["Alberta", 167], # [...
provinces = [['ontario', 1000]]
class Estrella: def __init__(self,galaxia ="none",temperatura = 0,masa = 0): self.galaxia = galaxia self.temperatura = temperatura self.masa = masa
class Estrella: def __init__(self, galaxia='none', temperatura=0, masa=0): self.galaxia = galaxia self.temperatura = temperatura self.masa = masa
L = int(input()) Tot = 0 Med = 0 T = str(input()).upper() M = [[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,...
l = int(input()) tot = 0 med = 0 t = str(input()).upper() m = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
######################### # DO NOT MODIFY ######################### # SETTINGS.INI C_MAIN_SETTINGS = 'Main_Settings' P_DIR_IGNORE = 'IgnoreDirectories' P_FILE_IGNORE = 'IgnoreFiles' P_SRC_DIR = 'SourceDirectory' P_DEST_DIR = 'DestinationDirectories' P_BATCH_SIZE = 'BatchProcessingGroupSize' P_FILE_BUFFER = 'FileReadBuf...
c_main_settings = 'Main_Settings' p_dir_ignore = 'IgnoreDirectories' p_file_ignore = 'IgnoreFiles' p_src_dir = 'SourceDirectory' p_dest_dir = 'DestinationDirectories' p_batch_size = 'BatchProcessingGroupSize' p_file_buffer = 'FileReadBuffer' p_server_ip = 'SFTPServerIP' p_server_port = 'SFTPServerPort' h_sha_256 = 'sha...
def bubble_sort(iterable): return sorted(iterable) def selection_sort(iterable): return sorted(iterable) def insertion_sort(iterable): return sorted(iterable) def merge_sort(iterable): return sorted(iterable) def quicksort(iterable): return sorted(iterable)
def bubble_sort(iterable): return sorted(iterable) def selection_sort(iterable): return sorted(iterable) def insertion_sort(iterable): return sorted(iterable) def merge_sort(iterable): return sorted(iterable) def quicksort(iterable): return sorted(iterable)
class Author: @property def surname(self): return self._surname @property def firstname(self): return self._firstname @property def affiliation(self): return self._affiliation @property def identifier(self): return self._identifier @firstname.sett...
class Author: @property def surname(self): return self._surname @property def firstname(self): return self._firstname @property def affiliation(self): return self._affiliation @property def identifier(self): return self._identifier @firstname.sett...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Jon Hawkesworth (@jhawkesworth) <jhawkesworth@protonmail.com> # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r''' --- module: win_toast short_descriptio...
documentation = '\n---\nmodule: win_toast\nshort_description: Sends Toast windows notification to logged in users on Windows 10 or later hosts\ndescription:\n - Sends alerts which appear in the Action Center area of the windows desktop.\noptions:\n expire:\n description:\n - How long in seconds before the n...
VERSION = "1.4.4" if __name__ == "__main__": print(VERSION, end="")
version = '1.4.4' if __name__ == '__main__': print(VERSION, end='')
party_size = int(input()) days = int(input()) total_coins = 0 for day in range (1, days + 1): if day % 10 == 0: party_size -= 2 if day % 15 == 0: party_size += 5 total_coins += (50 - (2 * party_size)) if day % 3 == 0: total_coins -= (3 * party_size) if day % 5 == 0: ...
party_size = int(input()) days = int(input()) total_coins = 0 for day in range(1, days + 1): if day % 10 == 0: party_size -= 2 if day % 15 == 0: party_size += 5 total_coins += 50 - 2 * party_size if day % 3 == 0: total_coins -= 3 * party_size if day % 5 == 0: total_co...
#break for i in range(1,10,1): if(i==5): continue print(i)
for i in range(1, 10, 1): if i == 5: continue print(i)
@bot.on(events.NewMessage(incoming=True)) @bot.on(events.MessageEdited(incoming=True)) async def common_incoming_handler(e): if SPAM: db=sqlite3.connect("spam_mute.db") cursor=db.cursor() cursor.execute('''SELECT * FROM SPAM''') all_rows = cursor.fetchall() for row in all_rows: i...
@bot.on(events.NewMessage(incoming=True)) @bot.on(events.MessageEdited(incoming=True)) async def common_incoming_handler(e): if SPAM: db = sqlite3.connect('spam_mute.db') cursor = db.cursor() cursor.execute('SELECT * FROM SPAM') all_rows = cursor.fetchall() for row in all_row...
class ElectionFraudDiv2: def IsFraudulent(self, percentages): ra, rb = 0, 0 for p in percentages: a, b = 10001, 0 for i in xrange(10001): if int(round(i*100.0 / 10000)) == p: a, b = min(a, i), max(b, i) if not b: ...
class Electionfrauddiv2: def is_fraudulent(self, percentages): (ra, rb) = (0, 0) for p in percentages: (a, b) = (10001, 0) for i in xrange(10001): if int(round(i * 100.0 / 10000)) == p: (a, b) = (min(a, i), max(b, i)) if not b:...
class Solution: def removeStones(self, stones: List[List[int]]) -> int: graph = collections.defaultdict(list) n = len(stones) for i in range(n): for j in range(n): if i == j: continue if stones[i][0] == stones[j][0] or stones[i]...
class Solution: def remove_stones(self, stones: List[List[int]]) -> int: graph = collections.defaultdict(list) n = len(stones) for i in range(n): for j in range(n): if i == j: continue if stones[i][0] == stones[j][0] or stones[...
''' Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ \ 7 2 ...
""" Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / 4 8 / / 11 13 4 / \\ 7 2 1...
class Solution: def majorityElement(self, nums: List[int]) -> List[int]: nums_dict = {} for num in nums: if num in nums_dict: nums_dict[num] += 1 else: nums_dict[num] = 1 return [key for key, value in nums_dict.items() if value > len(nu...
class Solution: def majority_element(self, nums: List[int]) -> List[int]: nums_dict = {} for num in nums: if num in nums_dict: nums_dict[num] += 1 else: nums_dict[num] = 1 return [key for (key, value) in nums_dict.items() if value > le...
# -*- python -*- load("@drake//tools/workspace:github.bzl", "github_archive") def scs_repository( name, mirrors = None): github_archive( name = name, repository = "cvxgrp/scs", # When updating this commit, see drake/tools/workspace/qdldl/README.md. commit = "v2.1.3"...
load('@drake//tools/workspace:github.bzl', 'github_archive') def scs_repository(name, mirrors=None): github_archive(name=name, repository='cvxgrp/scs', commit='v2.1.3', sha256='cb139aa8a53b8f6a7f2bacec4315b449ce366ec80b328e823efbaab56c847d20', build_file='@drake//tools/workspace/scs:package.BUILD.bazel', patches=[...
while True: ans = sorted([int(n) for n in input().split()]) if sum(ans) == 0: break print(*ans)
while True: ans = sorted([int(n) for n in input().split()]) if sum(ans) == 0: break print(*ans)
{ "object_templates": [ { "name": "fridge", "description": ["Fridge desc."], "container": [10] }, { "type_name": "barrel", "description": ["Barrel desc."], "interest": [5], "sound": { "OPEN": 2 }, "container": [5], }...
{'object_templates': [{'name': 'fridge', 'description': ['Fridge desc.'], 'container': [10]}, {'type_name': 'barrel', 'description': ['Barrel desc.'], 'interest': [5], 'sound': {'OPEN': 2}, 'container': [5]}, {'type_name': 'stove', 'description': ['device desc.'], 'device': []}]}
# card_hold_href is the stored href for the CardHold card_hold = balanced.CardHold.fetch(card_hold_href) debit = card_hold.capture( appears_on_statement_as='ShowsUpOnStmt', description='Some descriptive text for the debit in the dashboard' )
card_hold = balanced.CardHold.fetch(card_hold_href) debit = card_hold.capture(appears_on_statement_as='ShowsUpOnStmt', description='Some descriptive text for the debit in the dashboard')
''' Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? ''' class Solution: def singleNumber(self, nums: List[i...
""" Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? """ class Solution: def single_number(self, nums: List[i...
class Android: # adb keyevent KEYCODE_ENTER = "KEYCODE_DPAD_CENTER" KEYCODE_RIGHT = "KEYCODE_DPAD_RIGHT" KEYCODE_LEFT = "KEYCODE_DPAD_LEFT" KEYCODE_DOWN = "KEYCODE_DPAD_DOWN" KEYCODE_UP = "KEYCODE_DPAD_UP" KEYCODE_SPACE = "KEYCODE_SPACE" # adb get property PROP_LANGUAGE = "persist.s...
class Android: keycode_enter = 'KEYCODE_DPAD_CENTER' keycode_right = 'KEYCODE_DPAD_RIGHT' keycode_left = 'KEYCODE_DPAD_LEFT' keycode_down = 'KEYCODE_DPAD_DOWN' keycode_up = 'KEYCODE_DPAD_UP' keycode_space = 'KEYCODE_SPACE' prop_language = 'persist.sys.language' prop_country = 'persist.sy...
gainGyroAngle = 1156*1.4 gainGyroRate = 146*0.85 gainMotorAngle = 7*1 gainMotorAngularSpeed = 9*0.95 gainMotorAngleErrorAccumulated = 0.6
gain_gyro_angle = 1156 * 1.4 gain_gyro_rate = 146 * 0.85 gain_motor_angle = 7 * 1 gain_motor_angular_speed = 9 * 0.95 gain_motor_angle_error_accumulated = 0.6
# Upper makes a string completely capitalized. parrot = "norwegian blue" print ("parrot").upper()
parrot = 'norwegian blue' print('parrot').upper()
file = open('binaryBoarding_input.py', 'r') tickets = file.readlines() total_rows = 128 total_columns = 8 def find_row(boarding_pass): min_row = 0 max_row = total_rows - 1 for letter in boarding_pass[:7]: if letter == 'F': max_row = max_row - int((max_row - min_row) / 2) - 1 e...
file = open('binaryBoarding_input.py', 'r') tickets = file.readlines() total_rows = 128 total_columns = 8 def find_row(boarding_pass): min_row = 0 max_row = total_rows - 1 for letter in boarding_pass[:7]: if letter == 'F': max_row = max_row - int((max_row - min_row) / 2) - 1 eli...
x = int(input()) y = int(input()) NotMult = 0 if x<y: for c in range(x, y+1): if (c%13)!=0: NotMult += c if x>y: for c in range(y, x+1): if (c%13)!=0: NotMult += c print(NotMult)
x = int(input()) y = int(input()) not_mult = 0 if x < y: for c in range(x, y + 1): if c % 13 != 0: not_mult += c if x > y: for c in range(y, x + 1): if c % 13 != 0: not_mult += c print(NotMult)
#!/usr/bin/env python # -*- coding: UTF-8 -*- def test1(): print('\ntest1') x = 10 y = 1 result = x if x > y else y print(result) def max2(x, y): return x if x > y else y def test2(): print('\ntest2') print(max2(10, 20)) print(max2(2, 1)) def main(): test1() test2() ...
def test1(): print('\ntest1') x = 10 y = 1 result = x if x > y else y print(result) def max2(x, y): return x if x > y else y def test2(): print('\ntest2') print(max2(10, 20)) print(max2(2, 1)) def main(): test1() test2() if __name__ == '__main__': main()
name = input("What is your name?") quest = input("What is your quest?") color = input("What is your favorite color?") print(f"So your name is {name}.\nYou seek to {quest}.\nYour favorite color is {color}.\nYou may cross!")
name = input('What is your name?') quest = input('What is your quest?') color = input('What is your favorite color?') print(f'So your name is {name}.\nYou seek to {quest}.\nYour favorite color is {color}.\nYou may cross!')
a = list(map(int,input().split())) b = list(map(int,input().split())) for i in range(a[0]): if b[i] < a[1]: print(b[i],end='') print(" ",end='')
a = list(map(int, input().split())) b = list(map(int, input().split())) for i in range(a[0]): if b[i] < a[1]: print(b[i], end='') print(' ', end='')
def main(): n = int(input()) v = list(map(int, input().split())) m = dict() res = 0 for i in v: if i not in m: m[i] = 0 m[i] += 1 k = v.copy() for i in range(n - 1, 0, -1): k[i - 1] = k[i] + k[i - 1] for i in range(0, n - 1): res += -(n - i ...
def main(): n = int(input()) v = list(map(int, input().split())) m = dict() res = 0 for i in v: if i not in m: m[i] = 0 m[i] += 1 k = v.copy() for i in range(n - 1, 0, -1): k[i - 1] = k[i] + k[i - 1] for i in range(0, n - 1): res += -(n - i - 1...
expected_output = { "main": { "chassis": { "C9407R": { "name": "Chassis", "descr": "Cisco Catalyst 9400 Series 7 Slot Chassis", "pid": "C9407R", "vid": "V01", "sn": "******", } }, "TenGiga...
expected_output = {'main': {'chassis': {'C9407R': {'name': 'Chassis', 'descr': 'Cisco Catalyst 9400 Series 7 Slot Chassis', 'pid': 'C9407R', 'vid': 'V01', 'sn': '******'}}, 'TenGigabitEthernet3/0/1': {'SFP-10G-SR': {'name': 'TenGigabitEthernet3/0/1', 'descr': 'SFP 10GBASE-SR', 'pid': 'SFP-10G-SR', 'vid': '01', 'sn': '*...
a = int(input()) s = list(range(1, a+1)) k = len(s) while k > 1: if k & 1: s = s[::2] del s[0] else: s = s[::2] k = len(s) print(s[0])
a = int(input()) s = list(range(1, a + 1)) k = len(s) while k > 1: if k & 1: s = s[::2] del s[0] else: s = s[::2] k = len(s) print(s[0])
ANONYMOUS = 'Anonymous User' PUBLIC_NON_REQUESTER = 'Public User - Non-Requester' PUBLIC_REQUESTER = 'Public User - Requester' AGENCY_HELPER = 'Agency Helper' AGENCY_OFFICER = 'Agency FOIL Officer' AGENCY_ADMIN = 'Agency Administrator' POINT_OF_CONTACT = 'point_of_contact'
anonymous = 'Anonymous User' public_non_requester = 'Public User - Non-Requester' public_requester = 'Public User - Requester' agency_helper = 'Agency Helper' agency_officer = 'Agency FOIL Officer' agency_admin = 'Agency Administrator' point_of_contact = 'point_of_contact'
class Solution: def partition(self, head, x): h1 = l1 = ListNode(0) h2 = l2 = ListNode(0) while head: if head.val < x: l1.next = head l1 = l1.next else: l2.next = head l2 = l2.next head = head...
class Solution: def partition(self, head, x): h1 = l1 = list_node(0) h2 = l2 = list_node(0) while head: if head.val < x: l1.next = head l1 = l1.next else: l2.next = head l2 = l2.next head = h...
# Python 2.7 Coordinate Generation MYARRAY = [] INCREMENTER = 0 while INCREMENTER < 501: MYARRAY.append([INCREMENTER, INCREMENTER*2]) INCREMENTER += 1
myarray = [] incrementer = 0 while INCREMENTER < 501: MYARRAY.append([INCREMENTER, INCREMENTER * 2]) incrementer += 1
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../build/common.gypi', ], 'target_defaults': { 'variables': { 'chromium_code': 1, 'version_py_path': '../.....
{'includes': ['../../build/common.gypi'], 'target_defaults': {'variables': {'chromium_code': 1, 'version_py_path': '../../chrome/tools/build/version.py', 'version_path': 'VERSION'}, 'include_dirs': ['../..'], 'libraries': ['userenv.lib'], 'sources': ['win/port_monitor/port_monitor.cc', 'win/port_monitor/port_monitor.h'...
# -*- coding: utf-8 -*- '''Snippets for string. Available functions: - to_titlecase: Convert the character string to titlecase. ''' def to_titlecase(s: str) -> str: '''For example: >>> 'Hello world'.title() 'Hello World' Args: str: String excluding apostrophes in contra...
"""Snippets for string. Available functions: - to_titlecase: Convert the character string to titlecase. """ def to_titlecase(s: str) -> str: """For example: >>> 'Hello world'.title() 'Hello World' Args: str: String excluding apostrophes in contractions and possessives for...
t = int(input()) for t_itr in range(t): n = int(input()) count = 0 for i in range(n+1): if i%2 == 0: count+=1 else: count*=2 print(count)
t = int(input()) for t_itr in range(t): n = int(input()) count = 0 for i in range(n + 1): if i % 2 == 0: count += 1 else: count *= 2 print(count)
class DaemonEvent(object): def __init__(self, name, params) -> None: super().__init__() self.name = name self.params = params @classmethod def from_json(cls, json): return DaemonEvent(json["event"], json["params"])
class Daemonevent(object): def __init__(self, name, params) -> None: super().__init__() self.name = name self.params = params @classmethod def from_json(cls, json): return daemon_event(json['event'], json['params'])
#func-with-var-args.py def addall(*nums): ttl=0 for num in nums: ttl=ttl+num return ttl total=addall(10,20,50,70) print ('Total of 4 numbers:',total) total=addall(11,34,43) print ('Total of 3 numbers:',total)
def addall(*nums): ttl = 0 for num in nums: ttl = ttl + num return ttl total = addall(10, 20, 50, 70) print('Total of 4 numbers:', total) total = addall(11, 34, 43) print('Total of 3 numbers:', total)
#!/usr/bin/env python __all__ = ["test_bedgraph", "test_clustal", "test_fasta"] __author__ = "" __copyright__ = "Copyright 2007-2020, The Cogent Project" __credits__ = [ "Rob Knight", "Gavin Huttley", "Sandra Smit", "Marcin Cieslik", "Jeremy Widmann", ] __license__ = "BSD-3" __version__ = "2020.2.7...
__all__ = ['test_bedgraph', 'test_clustal', 'test_fasta'] __author__ = '' __copyright__ = 'Copyright 2007-2020, The Cogent Project' __credits__ = ['Rob Knight', 'Gavin Huttley', 'Sandra Smit', 'Marcin Cieslik', 'Jeremy Widmann'] __license__ = 'BSD-3' __version__ = '2020.2.7a' __maintainer__ = 'Gavin Huttley' __email__ ...
BOT_NAME = 'tabcrawler' SPIDER_MODULES = ['tabcrawler.spiders'] NEWSPIDER_MODULE = 'tabcrawler.spiders' DOWNLOAD_DELAY = 3 ITEM_PIPELINES = ['scrapy.contrib.pipeline.images.ImagesPipeline'] IMAGES_STORE = '/Users/jinzemin/Desktop/GuitarFan/tabcrawler/tabs' # ITEM_PIPELINES = [ # 'tabcrawler.pipelines.ArtistPipeli...
bot_name = 'tabcrawler' spider_modules = ['tabcrawler.spiders'] newspider_module = 'tabcrawler.spiders' download_delay = 3 item_pipelines = ['scrapy.contrib.pipeline.images.ImagesPipeline'] images_store = '/Users/jinzemin/Desktop/GuitarFan/tabcrawler/tabs'
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] counter = 0 for number in my_list: counter = counter + number print(counter)
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] counter = 0 for number in my_list: counter = counter + number print(counter)
''' It's Christmas time! To share his Christmas spirit with all his friends, the young Christmas Elf decided to send each of them a Christmas e-mail with a nice Christmas tree. Unfortunately, Internet traffic is very expensive in the North Pole, so instead of sending an actual image he got creative and drew the tree us...
""" It's Christmas time! To share his Christmas spirit with all his friends, the young Christmas Elf decided to send each of them a Christmas e-mail with a nice Christmas tree. Unfortunately, Internet traffic is very expensive in the North Pole, so instead of sending an actual image he got creative and drew the tree us...
cpicker = lv.cpicker(lv.scr_act(),None) cpicker.set_size(200, 200) cpicker.align(None, lv.ALIGN.CENTER, 0, 0)
cpicker = lv.cpicker(lv.scr_act(), None) cpicker.set_size(200, 200) cpicker.align(None, lv.ALIGN.CENTER, 0, 0)
class Solution: def partitionLabels(self, s: str) -> List[int]: # base case if we only have 1 letter if len(s)<2: return [1] #change to [len(s)] response = [] # final response memory = [] #track memory.append(s[0])# we already known that we have at least 2 letters ...
class Solution: def partition_labels(self, s: str) -> List[int]: if len(s) < 2: return [1] response = [] memory = [] memory.append(s[0]) count = 1 i = 1 while i < len(s): if s[i] in memory: count += 1 else: ...
class Solution: def isPowerOfTwo(self, n: int) -> bool: b = bin(n) if b[2] != '1': return False for bit in b[3:]: if bit != '0': return False return True print(Solution().isPowerOfTwo(1)) print(Solution().isPowerOfTwo(16)) print(Solution()....
class Solution: def is_power_of_two(self, n: int) -> bool: b = bin(n) if b[2] != '1': return False for bit in b[3:]: if bit != '0': return False return True print(solution().isPowerOfTwo(1)) print(solution().isPowerOfTwo(16)) print(solution()....
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBox.msg;/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBoxes.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/Che...
messages_str = '/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBox.msg;/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBoxes.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsAction.msg;/home/kalyco/mfp_workspace/dev...
# exit from infinite loop v.2 # using flag prompt = ("\nType 'x' to exit.\nEnter: ") flag = True while flag: msg = input(prompt) if msg == 'x': flag = False else: print(msg)
prompt = "\nType 'x' to exit.\nEnter: " flag = True while flag: msg = input(prompt) if msg == 'x': flag = False else: print(msg)
text = "".join(input().split()) for index,emoticon in enumerate(text): if emoticon == ":": print(f"{emoticon+text[index+1]}")
text = ''.join(input().split()) for (index, emoticon) in enumerate(text): if emoticon == ':': print(f'{emoticon + text[index + 1]}')
word_size = 4 num_words = 16 words_per_row = 1 local_array_size = 4 output_extended_config = True output_datasheet_info = True netlist_only = True nominal_corner_only = True
word_size = 4 num_words = 16 words_per_row = 1 local_array_size = 4 output_extended_config = True output_datasheet_info = True netlist_only = True nominal_corner_only = True
# Intersection Of Sorted Arrays # https://www.interviewbit.com/problems/intersection-of-sorted-arrays/ # # Find the intersection of two sorted arrays. # OR in other words, # Given 2 sorted arrays, find all the elements which occur in both the arrays. # # Example : # # Input : # A : [1 2 3 3 4 5 6] # B : [3 3 5]...
class Solution: def intersect(self, A, B): i = j = 0 res = [] while i < len(A) and j < len(B): if A[i] == B[j]: res.append(A[i]) i += 1 j += 1 elif A[i] < B[j]: i += 1 else: j...
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # SNMP Error Codes # ---------------------------------------------------------------------- # Copyright (C) 2007-2017 The NOC Project # See LICENSE for details # -------------------------------------------------------------...
no_error = 0 too_big = 1 no_such_name = 2 bad_value = 3 read_only = 4 gen_err = 5 no_access = 6 wrong_type = 7 wrong_length = 8 wrong_encoding = 9 wrong_value = 10 no_creation = 11 inconsistent_value = 12 resource_unavailable = 13 commit_failed = 14 undo_failed = 15 authorization_error = 16 not_writable = 17 inconsiste...
ACTORS = [ {"id":26073614,"name":"Al Pacino","photo":"https://placebear.com/342/479"}, {"id":77394988,"name":"Anthony Hopkins","photo":"https://placebear.com/305/469"}, {"id":44646271,"name":"Audrey Hepburn","photo":"https://placebear.com/390/442"}, {"id":85626345,"name":"Barbara Stanwyck","photo":"https://placebear.co...
actors = [{'id': 26073614, 'name': 'Al Pacino', 'photo': 'https://placebear.com/342/479'}, {'id': 77394988, 'name': 'Anthony Hopkins', 'photo': 'https://placebear.com/305/469'}, {'id': 44646271, 'name': 'Audrey Hepburn', 'photo': 'https://placebear.com/390/442'}, {'id': 85626345, 'name': 'Barbara Stanwyck', 'photo': 'h...
class MyRouter(object): def db_for_read(self, model, **hints): # if model.__name__ == 'CommonVar': if model._meta.model_name == 'commontype': return 'pgsql-ms' if model._meta.app_label == 'other': return 'pgsql-ms' # elif model._meta.app_label in ['auth', 'adm...
class Myrouter(object): def db_for_read(self, model, **hints): if model._meta.model_name == 'commontype': return 'pgsql-ms' if model._meta.app_label == 'other': return 'pgsql-ms' return 'mm-ms' def db_for_write(self, model, **hints): if model._meta.model...
Desc = cellDescClass("RF1R1WX2") Desc.properties["cell_leakage_power"] = "1118.088198" Desc.properties["dont_touch"] = "true" Desc.properties["dont_use"] = "true" Desc.properties["cell_footprint"] = "regcrw" Desc.properties["area"] = "33.264000" Desc.pinOrder = ['IQ', 'IQN', 'RB', 'RW', 'RWN', 'WB', 'WW', 'next'] Desc....
desc = cell_desc_class('RF1R1WX2') Desc.properties['cell_leakage_power'] = '1118.088198' Desc.properties['dont_touch'] = 'true' Desc.properties['dont_use'] = 'true' Desc.properties['cell_footprint'] = 'regcrw' Desc.properties['area'] = '33.264000' Desc.pinOrder = ['IQ', 'IQN', 'RB', 'RW', 'RWN', 'WB', 'WW', 'next'] Des...
def compareTriplets(a, b): alice = 0 bob = 0 for i, j in zip(a, b): if i > j: alice += 1 elif i < j: bob += 1 return alice, bob
def compare_triplets(a, b): alice = 0 bob = 0 for (i, j) in zip(a, b): if i > j: alice += 1 elif i < j: bob += 1 return (alice, bob)
# a single 3 input neuron inputs = [1, 2, 3] weights = [0.2, 0.8, -0.5] bias = 2 output = (inputs[0] * weights[0] + inputs[1] * weights[1] + inputs[2] * weights[2] + bias) print(output)
inputs = [1, 2, 3] weights = [0.2, 0.8, -0.5] bias = 2 output = inputs[0] * weights[0] + inputs[1] * weights[1] + inputs[2] * weights[2] + bias print(output)
''' Adaptable File containing all relevant information everything that could be used to customise the app for redeployment ''' # file path to log file is '/CA3/sys.log' def return_local_location() -> str: ''' Return a string of the local city. To change your local city name change the returned string: ...
""" Adaptable File containing all relevant information everything that could be used to customise the app for redeployment """ def return_local_location() -> str: """ Return a string of the local city. To change your local city name change the returned string: """ return 'Exeter' def return_html_fil...
''' A 2d grid map of m rows and n columns is initially filled with water. We may perform an `addLand` operation which turns the water at position (row, col) into a land. Given a list of positions to operate, count the number of islands after each addLand operation. An island is surrounded by water and is formed by conn...
""" A 2d grid map of m rows and n columns is initially filled with water. We may perform an `addLand` operation which turns the water at position (row, col) into a land. Given a list of positions to operate, count the number of islands after each addLand operation. An island is surrounded by water and is formed by conn...
str1=str(input("Enter an unbalanced bracket sequence:")) op=0 #number of open brackets clo=0 #number of closed brackets #for calculating open and closed brackets for i in range(0,len(str1)): if (str1[i]=="("): op=op+1 if (str1[i]==")"): clo=clo+1 if (op==clo): x = "(" + str1 + "...
str1 = str(input('Enter an unbalanced bracket sequence:')) op = 0 clo = 0 for i in range(0, len(str1)): if str1[i] == '(': op = op + 1 if str1[i] == ')': clo = clo + 1 if op == clo: x = '(' + str1 + ')' stack = [] for i in range(0, len(x)): if x[i] == '(': stack.a...
Rainbow = ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'] print("the first element of the list Rainbow is:",Rainbow[0]) print("The true colors of a rainbow are:") for i in range(len(Rainbow)): print(Rainbow[i]) #print all the elements in one line or one item per line. Here are two examples of th...
rainbow = ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'] print('the first element of the list Rainbow is:', Rainbow[0]) print('The true colors of a rainbow are:') for i in range(len(Rainbow)): print(Rainbow[i]) a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] print(a) for i in range(len(a)): print(a[i]) for...