content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
BASE_URL = "https://api.justyo.co" SEND_YO_URL = "{BASE_URL}/yo/".format(BASE_URL=BASE_URL) SEND_YOS_TO_ALL_SUBSCRIBERS_URL = "{BASE_URL}/yoall/".format(BASE_URL=BASE_URL) CREATE_ACCOUNT_URL = "{BASE_URL}/accounts/".format(BASE_URL=BASE_URL) USERNAME_EXISTS_URL = "{BASE_URL}/check_username/".format(BASE_URL=BASE_URL) S...
base_url = 'https://api.justyo.co' send_yo_url = '{BASE_URL}/yo/'.format(BASE_URL=BASE_URL) send_yos_to_all_subscribers_url = '{BASE_URL}/yoall/'.format(BASE_URL=BASE_URL) create_account_url = '{BASE_URL}/accounts/'.format(BASE_URL=BASE_URL) username_exists_url = '{BASE_URL}/check_username/'.format(BASE_URL=BASE_URL) s...
n=int(input()) arr=list(map(int,input().split(" "))) c=0 for i in range(1,n-1): if(arr[i]!=min(arr[i-1],arr[i],arr[i+1]) and arr[i]!=max(arr[i-1],arr[i],arr[i+1])): c=c+1 print(c)
n = int(input()) arr = list(map(int, input().split(' '))) c = 0 for i in range(1, n - 1): if arr[i] != min(arr[i - 1], arr[i], arr[i + 1]) and arr[i] != max(arr[i - 1], arr[i], arr[i + 1]): c = c + 1 print(c)
class Solution: def containsDuplicate(self, nums: List[int]) -> bool: n = len(nums) if n <= 1: return False num_map = dict() for i in nums: if num_map.get(i) is not None: return True else: num_map[i] = True ...
class Solution: def contains_duplicate(self, nums: List[int]) -> bool: n = len(nums) if n <= 1: return False num_map = dict() for i in nums: if num_map.get(i) is not None: return True else: num_map[i] = True ...
#2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. #What is the sum of the digits of the number 2^1000? def main(): result = pow(2,1000) print(sum(map(int,str(result)))) if __name__ == '__main__': main()
def main(): result = pow(2, 1000) print(sum(map(int, str(result)))) if __name__ == '__main__': main()
def SlowSort(A, i, j): if i >= j: return m = ((i + j) // 2) SlowSort(A, i, m) SlowSort(A, m + 1, j) if A[m] > A[j]: A[m], A[j] = A[j], A[m] SlowSort(A, i, j - 1) return A # Example run of SlowSort def main(): arr = [2, 7, 9, 3, 1, 6, 5, 4, 12] print("Result: " + str...
def slow_sort(A, i, j): if i >= j: return m = (i + j) // 2 slow_sort(A, i, m) slow_sort(A, m + 1, j) if A[m] > A[j]: (A[m], A[j]) = (A[j], A[m]) slow_sort(A, i, j - 1) return A def main(): arr = [2, 7, 9, 3, 1, 6, 5, 4, 12] print('Result: ' + str(slow_sort(arr, 0, le...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: waitset = dict() for i, c in enumerate(nums): if c in waitset: return [waitset[c], i] else: waitset[target-c] = i
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: waitset = dict() for (i, c) in enumerate(nums): if c in waitset: return [waitset[c], i] else: waitset[target - c] = i
# A class is like a blueprint for creating objects. An object has properties and methods(functions) associated with it. Almost everything in Python is an object # Create class class User: # Constructor def __init__(self, name, email, age): self.name = name self.email = email self.age = age def greet...
class User: def __init__(self, name, email, age): self.name = name self.email = email self.age = age def greeting(self): return f'My name is {self.name} and I am {self.age}' def has_birthday(self): self.age += 1 class Customer(User): def __init__(self, name, ...
#function-4.py def function(string,num): 'function assumes a string and number to be passed' print ('parameter received', string, num) print ('length of string:', len(string)) if num%2==0: print (num,' is ','even') else: print (num, ' is ','odd') ...
def function(string, num): """function assumes a string and number to be passed""" print('parameter received', string, num) print('length of string:', len(string)) if num % 2 == 0: print(num, ' is ', 'even') else: print(num, ' is ', 'odd') return function('Hello', 10) function(10...
# If we list all the natural numbers below 10 that are # multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000. my_list = list(range(0, 1000)) answer = sum([number for number in my_list if number % 3 == 0 or number % 5 == 0])
my_list = list(range(0, 1000)) answer = sum([number for number in my_list if number % 3 == 0 or number % 5 == 0])
class ImageParser: def parse_image(self, spec): if spec is None: return {} image, _, __ = spec.rpartition('@') id, ___, tag = image.rpartition(':') return { 'id': id, 'tag': tag }
class Imageparser: def parse_image(self, spec): if spec is None: return {} (image, _, __) = spec.rpartition('@') (id, ___, tag) = image.rpartition(':') return {'id': id, 'tag': tag}
def func(stringa): try: arr_bytes = list() for v in stringa: jj = ord(v) if jj>255: raise Exception break for v in stringa: jj = ord(v) arr_bytes.append(jj) return arr_bytes except Exception as e: ...
def func(stringa): try: arr_bytes = list() for v in stringa: jj = ord(v) if jj > 255: raise Exception break for v in stringa: jj = ord(v) arr_bytes.append(jj) return arr_bytes except Exception as e: ...
surahs_intent = [ { "name": "surah", "collection": "quran", "type": "pre_define_filter", "number": 1, "words": [ "al-fatiha", "al-fateya", "al-fatiyha", "al-fatiya", "fatiha", "fateya", "fatiy...
surahs_intent = [{'name': 'surah', 'collection': 'quran', 'type': 'pre_define_filter', 'number': 1, 'words': ['al-fatiha', 'al-fateya', 'al-fatiyha', 'al-fatiya', 'fatiha', 'fateya', 'fatiyha', 'fatiya']}, {'name': 'surah', 'collection': 'quran', 'type': 'pre_define_filter', 'number': 2, 'words': ['al-baqarah', 'al-baq...
class card: def __init__(self, setCode): self.setCode = setCode self.isKnown = True self.enabled = True self.sortKey = -1 def str1(self): output = "%s\\isnown=%s\n" %(self.setCode, str(self.isKnown).lower()) output += "%s\\enabled=%s\n" %(self.setCode, str(se...
class Card: def __init__(self, setCode): self.setCode = setCode self.isKnown = True self.enabled = True self.sortKey = -1 def str1(self): output = '%s\\isnown=%s\n' % (self.setCode, str(self.isKnown).lower()) output += '%s\\enabled=%s\n' % (self.setCode, str(sel...
#implement a Queue which works on FIFO principle class Queue(): def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def size(self): return len(self.items) def enqueue(self, *args): for value in args: self.items.insert(0, value) ...
class Queue: def __init__(self): self.items = [] def is_empty(self): return self.items == [] def size(self): return len(self.items) def enqueue(self, *args): for value in args: self.items.insert(0, value) def dequeue(self): return self.items.p...
class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: def search(n): lo, hi = 0, len(nums) while lo < hi: mid = (lo + hi) //2 if nums[mid] >= n: hi = mid else: lo = mid...
class Solution: def search_range(self, nums: List[int], target: int) -> List[int]: def search(n): (lo, hi) = (0, len(nums)) while lo < hi: mid = (lo + hi) // 2 if nums[mid] >= n: hi = mid else: ...
# Configuration file for jupyter-notebook. # Set ip to '*' to bind on all interfaces (ips) for the public server c.NotebookApp.ip = '*' c.NotebookApp.password = u'sha1:dd2f2b160b14:2425668abef6e6c9786cac2bd3add9cf40a362df' c.NotebookApp.open_browser = False # Whether to allow the user to run the notebook as root. c.No...
c.NotebookApp.ip = '*' c.NotebookApp.password = u'sha1:dd2f2b160b14:2425668abef6e6c9786cac2bd3add9cf40a362df' c.NotebookApp.open_browser = False c.NotebookApp.allow_root = True c.NotebookApp.port = 8888
a = input() num = len(a) for i in range(1, len(a)): string = a[i-1]+a[i] if (string == "c=" or string == "c-" or string == "d-" or string == "lj" or string == "nj" or string == "s=" or string == "z="): num-=1 for i in range(2, len(a)): string = a[i-2]+a[i-1]+a[i] if (string == "dz="): ...
a = input() num = len(a) for i in range(1, len(a)): string = a[i - 1] + a[i] if string == 'c=' or string == 'c-' or string == 'd-' or (string == 'lj') or (string == 'nj') or (string == 's=') or (string == 'z='): num -= 1 for i in range(2, len(a)): string = a[i - 2] + a[i - 1] + a[i] if string ==...
alphabet = {chr(el) for el in range(ord('a'), ord('z') + 1)} alphabet.update([chr(el) for el in range(ord('A'), ord('Z') + 1)]) alphabet.update([chr(el) for el in range(ord('0'), ord('9') + 1)]) alphabet.update(['@', '-', '.', '_']) required_alphabet = {'@', '.'} def email_is_valid(email): email_as_set = set(ema...
alphabet = {chr(el) for el in range(ord('a'), ord('z') + 1)} alphabet.update([chr(el) for el in range(ord('A'), ord('Z') + 1)]) alphabet.update([chr(el) for el in range(ord('0'), ord('9') + 1)]) alphabet.update(['@', '-', '.', '_']) required_alphabet = {'@', '.'} def email_is_valid(email): email_as_set = set(email...
#!/usr/local/bin/python3.3 L = [1, 2, 3, 4] print(L) L[2] = [] print(L) L[2:3] = [] print(L)
l = [1, 2, 3, 4] print(L) L[2] = [] print(L) L[2:3] = [] print(L)
EXPECTED = {'PKIX1Explicit88': {'extensibility-implied': False, 'imports': {}, 'object-classes': {}, 'object-sets': {}, 'tags': 'EXPLICIT', 'types': {'AdministrationDomainName': {'members': [{'name': 'numeric', ...
expected = {'PKIX1Explicit88': {'extensibility-implied': False, 'imports': {}, 'object-classes': {}, 'object-sets': {}, 'tags': 'EXPLICIT', 'types': {'AdministrationDomainName': {'members': [{'name': 'numeric', 'size': [(0, 'ub-domain-name-length')], 'type': 'NumericString'}, {'name': 'printable', 'size': [(0, 'ub-doma...
'''This file contains functions that controls the way that structure_collectors, filters and file_normalizers are applied. ''' def sequential_apply(structure_collector, filters, file_normalizers): '''Apply structure_collector, filters and file_normalizers sequentially.''' # Collect candidate structures ...
"""This file contains functions that controls the way that structure_collectors, filters and file_normalizers are applied. """ def sequential_apply(structure_collector, filters, file_normalizers): """Apply structure_collector, filters and file_normalizers sequentially.""" info_dict = {'candidate_list': s...
# Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAND ---------- # M...
registration_id = 'FILL_IN' install_datasets_01(reinstall=True) files = dbutils.fs.ls(f'{working_dir}/exercise_01/raw') display(files) text = dbutils.fs.head(f'{working_dir}/exercise_01/raw/test.txt') print(text) reality_check_01_a()
class RulesPredicates(): ACCEPTED = 'accepted' ACTIVE_URL = 'active_url' AFTER = 'after' AFTER_OR_EQUAL = 'after_or_equal' ALPHA = 'alpha' ALPHA_DASH = 'alpha_dash' ALPHA_NUM = 'alpha_num' ARRAY = 'array' BAIL = 'bail' BEFORE = 'before' BEFORE_OR_EQUAL = 'before_or_equal' BETWEEN = 'between' BOOLEAN = 'b...
class Rulespredicates: accepted = 'accepted' active_url = 'active_url' after = 'after' after_or_equal = 'after_or_equal' alpha = 'alpha' alpha_dash = 'alpha_dash' alpha_num = 'alpha_num' array = 'array' bail = 'bail' before = 'before' before_or_equal = 'before_or_equal' b...
while True: line = input() if line == "": break n = int(line) for x in range(n): print(" "*(n-x-1), "*"*(2*x+1)) for v in range(n-1): print(" "*(v+1), "*"*(2*(n-v)-3))
while True: line = input() if line == '': break n = int(line) for x in range(n): print(' ' * (n - x - 1), '*' * (2 * x + 1)) for v in range(n - 1): print(' ' * (v + 1), '*' * (2 * (n - v) - 3))
# Laboratorio 7 - ej4 def top_five(lista): lista.sort() lista.reverse() if len(lista) >= 5: return lista[:5] else: return lista lista = [1, 4, 1, 2, 6, 4, 4, 3, 3, 5] print(lista, "=>", top_five(lista))
def top_five(lista): lista.sort() lista.reverse() if len(lista) >= 5: return lista[:5] else: return lista lista = [1, 4, 1, 2, 6, 4, 4, 3, 3, 5] print(lista, '=>', top_five(lista))
# What is a class? Think of a class as a blueprint. It isn't something in itself, # it simply describes how to make something. You can create lots of objects from that # blueprint - known technically as instances. class Pet: def __init__(self, name): self.name = name def getName(self): print(...
class Pet: def __init__(self, name): self.name = name def get_name(self): print('Name of the Pet is:', self.name) def set_name(self, newName): self.name = newName class Dog(Pet): def __init__(self, name, color): self.color = color super().__init__(name) ...
def ip2num(ip): ip = ip.split('.') binary_list = [bin(int(i))[2: ] for i in ip] binary_fills = [] for b in binary_list: bf = 8 - len(b) bt = '0'*bf + b binary_fills.append(bt) binary_str = ''.join(binary_fills) return int(binary_str, base=2) def num2ip(num): bi...
def ip2num(ip): ip = ip.split('.') binary_list = [bin(int(i))[2:] for i in ip] binary_fills = [] for b in binary_list: bf = 8 - len(b) bt = '0' * bf + b binary_fills.append(bt) binary_str = ''.join(binary_fills) return int(binary_str, base=2) def num2ip(num): binary ...
def setup(app): app.add_crossref_type( directivename = "admin", rolename = "admin", indextemplate = "pair: %s; admin", ) app.add_crossref_type( directivename = "command", rolename = "command", indextemplate = "pair: %s; command", ) app.add_c...
def setup(app): app.add_crossref_type(directivename='admin', rolename='admin', indextemplate='pair: %s; admin') app.add_crossref_type(directivename='command', rolename='command', indextemplate='pair: %s; command') app.add_crossref_type(directivename='form', rolename='form', indextemplate='pair: %s; form') ...
MOD = 1000000009 f = [0] * 100002 # f(3) = 1 # f(4) = 4 * f(3) # f(5) = 5 * f(4) = 5 * 4 * f(3) # f(n) = n * f(n - 1) --> recursao f[3] = 1 for i in range(4, 100001): f[i] = i * f[i - 1] % MOD while True: n = int(input()) if n == 0: break print(f[n])
mod = 1000000009 f = [0] * 100002 f[3] = 1 for i in range(4, 100001): f[i] = i * f[i - 1] % MOD while True: n = int(input()) if n == 0: break print(f[n])
#-- THIS LINE SHOULD BE THE FIRST LINE OF YOUR SUBMISSION! --# def pack_and_bill(order, prices): num_balls = sum(order) price_per_ball = prices["ball"] price_small = prices["smallbox"] price_large = prices["largebox"] num_large = num_balls // 500 rest = num_balls % 500 num_small = 0 if...
def pack_and_bill(order, prices): num_balls = sum(order) price_per_ball = prices['ball'] price_small = prices['smallbox'] price_large = prices['largebox'] num_large = num_balls // 500 rest = num_balls % 500 num_small = 0 if rest > 100: num_small = 0 num_large += 1 eli...
class BaseStatsModel(object): def __init__(self): pass def get_value(self, stats, key, default=None): return stats.get(key, default) def set_value(self, stats, key, value): stats[key] = value def inc_value(self, stats, key, count=1, start=0, spider=None): d = stats ...
class Basestatsmodel(object): def __init__(self): pass def get_value(self, stats, key, default=None): return stats.get(key, default) def set_value(self, stats, key, value): stats[key] = value def inc_value(self, stats, key, count=1, start=0, spider=None): d = stats ...
__all__ = [ 'apriori', 'fp_growth' ]
__all__ = ['apriori', 'fp_growth']
expected_output = { "vrf": { "default": { "address_family": { "ipv4": { "prefix": { "0.0.0.0/0": { "epoch": 2, "flags": ["DefRtHndlr", "defrt"], "output...
expected_output = {'vrf': {'default': {'address_family': {'ipv4': {'prefix': {'0.0.0.0/0': {'epoch': 2, 'flags': ['DefRtHndlr', 'defrt'], 'output_chain': {}, 'path_list': {'7FEE80648560': {'flags': '0x41 [shble, hwcn]', 'locks': 4, 'path': {'7FEE80648DB0': {'for': 'IPv4', 'share': '1/1', 'type': 'special prefix'}}, 'sh...
#Prims Algo Implementation class Node : def __init__(self, arg_id) : self._id = arg_id class Graph : def __init__(self, arg_source, arg_adj_list) : self.source = arg_source self.adjlist = arg_adj_list def PrimsMST(self): priority_queue = { Node(self.source) : 0...
class Node: def __init__(self, arg_id): self._id = arg_id class Graph: def __init__(self, arg_source, arg_adj_list): self.source = arg_source self.adjlist = arg_adj_list def prims_mst(self): priority_queue = {node(self.source): 0} added = [False] * len(self.adjlis...
''' Code for HackerRank Interview Preparation Kit Wesin Ribeiro ############### problem ############### string s repeated infinitely many times. find and print the number of letter a's in the first n given integer 1 <= s <= 100 1 <= n <= 10**12 for 25%, 1 <= n <= 10**6 ############### Observations ############### It ...
""" Code for HackerRank Interview Preparation Kit Wesin Ribeiro ############### problem ############### string s repeated infinitely many times. find and print the number of letter a's in the first n given integer 1 <= s <= 100 1 <= n <= 10**12 for 25%, 1 <= n <= 10**6 ############### Observations ############### It ...
class Cuenta: def __init__(self, titular, cantidad): self.__titular = titular if (cantidad<0): self.__cantidad = 0 else: self.__cantidad = cantidad def get_titular(self): return self.__titular def get_cantidad(self): return self.__cantidad ...
class Cuenta: def __init__(self, titular, cantidad): self.__titular = titular if cantidad < 0: self.__cantidad = 0 else: self.__cantidad = cantidad def get_titular(self): return self.__titular def get_cantidad(self): return self.__cantidad ...
def escreva(fra): esp = len(fra) + 4 print('-' * esp) print(f' {fra}') print('-' * esp) frase = str(input('digite um frase: ')) escreva(frase)
def escreva(fra): esp = len(fra) + 4 print('-' * esp) print(f' {fra}') print('-' * esp) frase = str(input('digite um frase: ')) escreva(frase)
class Calculator: def __init__(self): self.result = 0 print("Calculator instance initialized") def add(self, value): print("%d + %d = %d" % (self.result, value, self.result + value)) self.result += value return self.result def sub(self, value): print("%d - %...
class Calculator: def __init__(self): self.result = 0 print('Calculator instance initialized') def add(self, value): print('%d + %d = %d' % (self.result, value, self.result + value)) self.result += value return self.result def sub(self, value): print('%d - ...
data = ( 'a', # 0x00 'a', # 0x01 'a', # 0x02 'a', # 0x03 'a', # 0x04 'a', # 0x05 'a', # 0x06 'a', # 0x07 'A', # 0x08 'A', # 0x09 'A', # 0x0a 'A', # 0x0b 'A', # 0x0c 'A', # 0x0d 'A', # 0x0e 'A', # 0x0f 'e', # 0x10 'e', # 0x11 'e', # 0x12 'e', ...
data = ('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'e', 'e', 'e', 'e', 'e', 'e', '[?]', '[?]', 'E', 'E', 'E', 'E', 'E', 'E', '[?]', '[?]', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'I', 'I', 'I', 'I', 'I',...
# Displays how many miles a car traversed # given a set speed and 3 different durations # Declare variables mph = 70 hours1 = 6 hours2 = 10 hours3 = 15 # Calculate and display distance # for 6hrs at 70mph distance1 = mph * hours1 print('\nThe miles that a car will traverse in ', hours1, 'hrs at ', mph...
mph = 70 hours1 = 6 hours2 = 10 hours3 = 15 distance1 = mph * hours1 print('\nThe miles that a car will traverse in ', hours1, 'hrs at ', mph, 'mph is ', distance1, ' miles.', sep='') distance2 = mph * hours2 print('The miles that a car will traverse in ', hours2, 'hrs at ', mph, 'mph is ', distance2, ' miles.', sep=''...
class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: dp = [[] for _ in range(target + 1)] for c in candidates: for i in range(c, target + 1): if i == c: dp[i].append([c]) else: ...
class Solution: def combination_sum(self, candidates: List[int], target: int) -> List[List[int]]: dp = [[] for _ in range(target + 1)] for c in candidates: for i in range(c, target + 1): if i == c: dp[i].append([c]) else: ...
def get_interested_fields(source, fields): result = {} for field in fields: result[field] = source.get(field) return result
def get_interested_fields(source, fields): result = {} for field in fields: result[field] = source.get(field) return result
name = 'Bob' age = 30 if name =='Alice': print ('Hi Alice') elif age < 12: print ('You are not Alice, Kiddo.') elif age > 2000: print('Unlike you, Alice in not an undead, immortal vampre') elif age > 100: print('You are not Alice, grannie') #else: print('it used the else command')
name = 'Bob' age = 30 if name == 'Alice': print('Hi Alice') elif age < 12: print('You are not Alice, Kiddo.') elif age > 2000: print('Unlike you, Alice in not an undead, immortal vampre') elif age > 100: print('You are not Alice, grannie') print('it used the else command')
size_matrix = int(input()) matrix = [] row = 0 col = 0 count_t = 0 final_t = 0 for i in range(size_matrix): matrix.append([x for x in input().split()]) for search_p in matrix: if "p" in search_p: col = search_p.index("p") break else: row += 1 for search_p in matrix: for f in s...
size_matrix = int(input()) matrix = [] row = 0 col = 0 count_t = 0 final_t = 0 for i in range(size_matrix): matrix.append([x for x in input().split()]) for search_p in matrix: if 'p' in search_p: col = search_p.index('p') break else: row += 1 for search_p in matrix: for f in sear...
''' Anonymous Functions === lambda They are defined by using the lambda keyword. They can take several arguments but can only have one expression. ''' a = lambda b: b + 4 print(a(4)) # 8 c = lambda d,e : d + e print(c(7,8)) # 15 def ghost_number(n): return lambda f : f * n double_num = ...
""" Anonymous Functions === lambda They are defined by using the lambda keyword. They can take several arguments but can only have one expression. """ a = lambda b: b + 4 print(a(4)) c = lambda d, e: d + e print(c(7, 8)) def ghost_number(n): return lambda f: f * n double_num = ghost_number(2) ...
x = True y = False print(x) print(y) num1 = 1 num2 = 2 resultado = num1 < num2 print(resultado) if(num1 < num2): print("el valor num1 es mayor al num2") else: print("el valor num1 no es mayor al num2")
x = True y = False print(x) print(y) num1 = 1 num2 = 2 resultado = num1 < num2 print(resultado) if num1 < num2: print('el valor num1 es mayor al num2') else: print('el valor num1 no es mayor al num2')
#Diffie-Hellman g = 17 p = 61 A = 46 B = 5 test = 1 count = 0 a = b = 0 while(count<2): if g**test%p == A: a = test count+=1 if g**test%p == B: b = test count+=1 test+=1 print('a = ',a,'b = ',b) K1 = B**a%p K2 = A**b%p if K1 == K2: print('K = ',K1) ...
g = 17 p = 61 a = 46 b = 5 test = 1 count = 0 a = b = 0 while count < 2: if g ** test % p == A: a = test count += 1 if g ** test % p == B: b = test count += 1 test += 1 print('a = ', a, 'b = ', b) k1 = B ** a % p k2 = A ** b % p if K1 == K2: print('K = ', K1) e = 31 n = 4...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
errors = {-1: {'short': 'UNKNOWN', 'long': 'The server experienced an unexpected error when processing the request'}, 0: {'short': 'NONE', 'long': ''}, 1: {'short': 'OFFSET_OUT_OF_RANGE', 'long': 'The requested offset is not within the range of offsets maintained by the server.'}, 2: {'short': 'CORRUPT_MESSAGE', 'long'...
#Fizzbuzz 2 def fizzbuzz(x): if x % 3 == 0 and x % 5 == 0: return "FizzBuzz" elif x % 3 == 0 and x % 5 != 0: return "Fizz" elif x % 3 != 0 and x % 5 == 0: return "Buzz" else: return x
def fizzbuzz(x): if x % 3 == 0 and x % 5 == 0: return 'FizzBuzz' elif x % 3 == 0 and x % 5 != 0: return 'Fizz' elif x % 3 != 0 and x % 5 == 0: return 'Buzz' else: return x
# -*- coding: utf-8 -*- class BackgroundTaskError(Exception): def __init__(self, message, errors=None): super(BackgroundTaskError, self).__init__(message) self.errors = errors
class Backgroundtaskerror(Exception): def __init__(self, message, errors=None): super(BackgroundTaskError, self).__init__(message) self.errors = errors
if bytes is str: # pragma: no cover def isStringType(t): return isinstance(t, basestring) def isPath(f): return isinstance(f, basestring) else: # pragma: no cover def isStringType(t): return isinstance(t, str) def isPath(f): return isinstance(f, (bytes, str))
if bytes is str: def is_string_type(t): return isinstance(t, basestring) def is_path(f): return isinstance(f, basestring) else: def is_string_type(t): return isinstance(t, str) def is_path(f): return isinstance(f, (bytes, str))
NUM_BUCKETS = 2003 # A prime number class MyHashSet: def __init__(self): # Make the hash buckets. self.buckets = [[] for _ in range(NUM_BUCKETS)] def add(self, key: int) -> None: mod = key % NUM_BUCKETS if not key in self.buckets[mod]: self.buckets[mod].append(key)...
num_buckets = 2003 class Myhashset: def __init__(self): self.buckets = [[] for _ in range(NUM_BUCKETS)] def add(self, key: int) -> None: mod = key % NUM_BUCKETS if not key in self.buckets[mod]: self.buckets[mod].append(key) def remove(self, key: int) -> None: ...
# -*- coding: utf-8 -*- class Utils(object): def __init__(self, state): self.st = state def printBags(self): bags = self.BagsList(len(self.st[0])) outBag = [] for i in self.st[1]: bag_index = i[1] if bag_index != len(self.st[0]): item = ...
class Utils(object): def __init__(self, state): self.st = state def print_bags(self): bags = self.BagsList(len(self.st[0])) out_bag = [] for i in self.st[1]: bag_index = i[1] if bag_index != len(self.st[0]): item = i[0] ba...
class Solution: def mergeAlternately(self, word1: str, word2: str) -> str: ans = "" word1_c = 0 word2_c = 0 while(word1_c < len(word1) or word2_c < len(word2)): if word1_c < len(word1): ans+= word1[word1_c] ...
class Solution: def merge_alternately(self, word1: str, word2: str) -> str: ans = '' word1_c = 0 word2_c = 0 while word1_c < len(word1) or word2_c < len(word2): if word1_c < len(word1): ans += word1[word1_c] word1_c += 1 if wor...
x = 20 # if x ranges from 10 to 30 inclusive, print 'x ranges from 10 to 30' if x >= 10 and x <= 30 : print('x ranges from 10 to 30') y = 60 # if y is less than 10 or greater than 30, print 'y is less than 10 or greater than 30' if y < 10 or y > 30 : print('y is less than 10 or greater than 30') z = 55 # if z i...
x = 20 if x >= 10 and x <= 30: print('x ranges from 10 to 30') y = 60 if y < 10 or y > 30: print('y is less than 10 or greater than 30') z = 55 if not z == 77: print('z is not 77')
l = input().split(':') p = lambda x: print(x, end="") if len(l[0]) is 0: l.remove(l[0]) if len(l[-1]) is 0: l.pop() t = True for s in l: if len(s) is 0: for _ in range(8 - len(l) + 1): if t: p("0000") t = False else: p(":0000") elif t: p("%04x" % int(s, 16)) t = False else: p(":%04x" % in...
l = input().split(':') p = lambda x: print(x, end='') if len(l[0]) is 0: l.remove(l[0]) if len(l[-1]) is 0: l.pop() t = True for s in l: if len(s) is 0: for _ in range(8 - len(l) + 1): if t: p('0000') t = False else: p(':0000') ...
listOfNums = [] def getNums(n:int): listOfNums.append(n) def solve() -> int: for i,_ in enumerate(listOfNums): for j in listOfNums: for z in listOfNums: if (listOfNums[i] + j + z == 2020): return (listOfNums[i] * j * z) if __name__ == "__main__": ...
list_of_nums = [] def get_nums(n: int): listOfNums.append(n) def solve() -> int: for (i, _) in enumerate(listOfNums): for j in listOfNums: for z in listOfNums: if listOfNums[i] + j + z == 2020: return listOfNums[i] * j * z if __name__ == '__main__': ...
# Practice Question 1: Find the sum of digits of a positive number using Recursion. def sumOfDigits(num): assert num >= 0 and int(num) == num, 'Enter Only Positive numbers!!' if num == 0: return 0 else: return int(num % 10) + sumOfDigits(int(num / 10)) #Example of a number print(sumOfDigi...
def sum_of_digits(num): assert num >= 0 and int(num) == num, 'Enter Only Positive numbers!!' if num == 0: return 0 else: return int(num % 10) + sum_of_digits(int(num / 10)) print(sum_of_digits(5119429))
repeat = int(input()) x = 0 out = 0 for i in range(repeat): tmp = int(input()) while tmp != 0: tmp //=5 out +=tmp print(out) out = 0
repeat = int(input()) x = 0 out = 0 for i in range(repeat): tmp = int(input()) while tmp != 0: tmp //= 5 out += tmp print(out) out = 0
########################### # # #23 Non-abundant sums - Project Euler # https://projecteuler.net/problem=23 # # Code by Kevin Marciniak # ########################### # def sumproperdivisors(num): # sumdivsors = 0 # for x in range(1, int((num / 2)) + 1): # if num % x == 0: # sumdivsors += x ...
def getsumofdivs(n): i = 2 upper = n total = 1 while i < upper: if n % i == 0: upper = n / i total += upper if upper != i: total += i i += 1 return total def isabundant(n): return getsumofdivs(n) > n l_abundants = [x for x in r...
# # PySNMP MIB module CISCO-ITP-ACT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ITP-ACT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:46:04 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
class aes_encrypt: ##class for ecryption of data using aes## def __init__(self, cipherkey, plaintext, N): self.N = N self.cipherkey = cipherkey self.plaintext = plaintext ##plaintext MUST be entered in a STRING of HEXADECIMAL numbers with thw 0x prefix## ##Cipherke...
class Aes_Encrypt: def __init__(self, cipherkey, plaintext, N): self.N = N self.cipherkey = cipherkey self.plaintext = plaintext def state_array(self): if len(self.plaintext) % 2 != 0: self.plaintext += '0' a = [] for i in range(34, len(self.plaintex...
#!/usr/bin/env python3 # https://codeforces.com/contest/1068/problem/A n,m,k,l=map(int,input().split()) q=(l+k-1)//m+1 if q*m>n:print(-1) else:print(q)
(n, m, k, l) = map(int, input().split()) q = (l + k - 1) // m + 1 if q * m > n: print(-1) else: print(q)
DEBUG = True PINS = { 'motor': { 'left': [27, 22], 'right': [23, 24] }, 'encoder': { 'left': [12, 16], 'right': [20, 21] } } pid_params = { 'balance': { 'k': 0.6, 'p': 30, 'd': 0.2 }, 'velocity': { 'p': 3, ...
debug = True pins = {'motor': {'left': [27, 22], 'right': [23, 24]}, 'encoder': {'left': [12, 16], 'right': [20, 21]}} pid_params = {'balance': {'k': 0.6, 'p': 30, 'd': 0.2}, 'velocity': {'p': 3, 'i': 3 / 200}, 'turn': {'p': 0.4, 'd': 0.2}} gyro_offset = {'y': 1.4, 'z': 0.7} accel_offset = {'x': -230, 'y': -1.5, 'z': -...
#create a valuable x and assign 10 x = 10 #create a valuable y and assign 25 y = 25 print(x + y) #For substration print("x - y: ",x - y) #For multppllication print("x * y: ", x * y) #For divition print("x / y: ", x / y) #For exponential print("x ** y:", x ** y) #For floor division a = 12.68 b = 3 print("The floo...
x = 10 y = 25 print(x + y) print('x - y: ', x - y) print('x * y: ', x * y) print('x / y: ', x / y) print('x ** y:', x ** y) a = 12.68 b = 3 print('The floor division : ', a // b) print('The module is :', x % y) print(-x) print(abs(x)) string_1 = 'Python' string_2 = 'Programming' final_string = string_1 + ' ' + string_2...
# http://rdkit.org/docs/source/rdkit.Chem.Fragments.html vocab_len = 101 train_data_dir = "./data/chembl_500k_train.csv" max_num_mol = 10 mol_calc_setting = { 'num_atoms': True, 'tpsa': True, 'mol_log': False, 'mol_weight': False, 'num_aromatic_rings': True, 'arom': False } # Limit the number...
vocab_len = 101 train_data_dir = './data/chembl_500k_train.csv' max_num_mol = 10 mol_calc_setting = {'num_atoms': True, 'tpsa': True, 'mol_log': False, 'mol_weight': False, 'num_aromatic_rings': True, 'arom': False} radical_group_num_restraint = {'fr_Al_COO': -1, 'fr_Ar_OH': -1, 'fr_nitro': -1, 'fr_COO2': -1, 'fr_N_O':...
# This is the solution for Arrays > CyclicRotation # # This is marked as PAINLESS difficulty def solution(A, K): result = [None] * len(A) for i in range(len(A)): result[(i + K) % len(A)] = A[i] return result print(solution([1, 2, 3, 4, 5], 2)) print(solution([1, 2, 3, 4, 5], 5))
def solution(A, K): result = [None] * len(A) for i in range(len(A)): result[(i + K) % len(A)] = A[i] return result print(solution([1, 2, 3, 4, 5], 2)) print(solution([1, 2, 3, 4, 5], 5))
class Solution: def countGoodRectangles(self, rectangles: List[List[int]]) -> int: cm = 0 for dim in rectangles: if min(dim) > cm: cm = min(dim) return len([1 for rect in rectangles if min(rect)==cm])
class Solution: def count_good_rectangles(self, rectangles: List[List[int]]) -> int: cm = 0 for dim in rectangles: if min(dim) > cm: cm = min(dim) return len([1 for rect in rectangles if min(rect) == cm])
def check_prime_number(x): if x == 1: return False elif x == 2: return True for i in range(2, x): if x % i == 0: return False return True if __name__ == '__main__': for i in range(1, 101): if check_prime_number(i): print(i)
def check_prime_number(x): if x == 1: return False elif x == 2: return True for i in range(2, x): if x % i == 0: return False return True if __name__ == '__main__': for i in range(1, 101): if check_prime_number(i): print(i)
notes = ["A", "ASharp", "B", "C", "CSharp", "D", "DSharp", "E", "F", "FSharp", "G", "GSharp"] for i in range(21, 109): n = ((i-9) % 12) m = ((i-9) // 12) print(str(notes[n]) + str(m-1) + " = " + str(i) + ",")
notes = ['A', 'ASharp', 'B', 'C', 'CSharp', 'D', 'DSharp', 'E', 'F', 'FSharp', 'G', 'GSharp'] for i in range(21, 109): n = (i - 9) % 12 m = (i - 9) // 12 print(str(notes[n]) + str(m - 1) + ' = ' + str(i) + ',')
# Copyright https://www.globaletraining.com/ # Generators throw method def odd_filter(nums): for num in nums: if num % 2 == 1: yield num def squared(nums): for num in nums: yield num ** 2 def ending_in_1(nums): for num in nums: if num % 10 == 1: yield nu...
def odd_filter(nums): for num in nums: if num % 2 == 1: yield num def squared(nums): for num in nums: yield (num ** 2) def ending_in_1(nums): for num in nums: if num % 10 == 1: yield num def convert_to_string(nums): for num in nums: yield ('Matc...
c.LauncherShortcuts.shortcuts = { 'conda-store': { 'title': 'Conda Store', 'target': 'http://localhost:5000/conda-store', } }
c.LauncherShortcuts.shortcuts = {'conda-store': {'title': 'Conda Store', 'target': 'http://localhost:5000/conda-store'}}
def add_numbers(a, b): if not (isinstance(a, int) and isinstance(b, int)): raise TypeError("Inputs must be integers") return a + b print(add_numbers(10, 20)) print(add_numbers(10, "20"))
def add_numbers(a, b): if not (isinstance(a, int) and isinstance(b, int)): raise type_error('Inputs must be integers') return a + b print(add_numbers(10, 20)) print(add_numbers(10, '20'))
listnum = [] bigger = 0 smaller = 0 for c in range(0, 5): listnum.append(int(input(f'Enter a value for the position {c}: '))) if c == 0: bigger = smaller = listnum[c] else: if listnum[c] > bigger: bigger = listnum[c] if listnum[c] < smaller: menor = listnum[...
listnum = [] bigger = 0 smaller = 0 for c in range(0, 5): listnum.append(int(input(f'Enter a value for the position {c}: '))) if c == 0: bigger = smaller = listnum[c] else: if listnum[c] > bigger: bigger = listnum[c] if listnum[c] < smaller: menor = listnum[c]...
# md5 : c25a0675ac427e95f914f665c0c052be # sha1 : 68e16949bd563e7f73bddc5b6fd3c622609e85ec # sha256 : e76717203c9f1fd4ec7168fcd55c1be8a981746e64f5adb75fda2f462035cb12 ord_names = { 1: b'?$S5@?1??StaticMember@MSWindow@ms@core@@KAAAVStaticMembers@234@XZ@4IA', 2: b'?$S5@?1??StaticMember@Path@settings@core@@KAAAVS...
ord_names = {1: b'?$S5@?1??StaticMember@MSWindow@ms@core@@KAAAVStaticMembers@234@XZ@4IA', 2: b'?$S5@?1??StaticMember@Path@settings@core@@KAAAVStaticMembers@234@XZ@4IA', 3: b'??0CloseException@Handle@RegistryKey@registry@core@@QAE@ABV01234@@Z', 4: b'??0CloseException@Handle@RegistryKey@registry@core@@QAE@ABV?$basic_stri...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"openImageCV2": "00_core.ipynb", "plotCV2": "00_core.ipynb", "putText": "00_core.ipynb", "getDateTimePictureTaken": "00_core.ipynb"} modules = ["core.py"] doc_url = "https://eandr...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'openImageCV2': '00_core.ipynb', 'plotCV2': '00_core.ipynb', 'putText': '00_core.ipynb', 'getDateTimePictureTaken': '00_core.ipynb'} modules = ['core.py'] doc_url = 'https://eandreas.github.io/timelapse/' git_url = 'https://github.com/eandreas/timel...
# ====================================================================== # Report Repair # Advent of Code 2020 Day 01 -- Eric Wastl -- https://adventofcode.com # # Python implementation by Dr. Dean Earl Wright III # ====================================================================== # ============================...
"""A solver for the Advent of Code 2020 Day 01 puzzle""" class Report(object): """Object for Report Repair""" def __init__(self, text=None, part2=False): self.part2 = part2 self.text = text self.numbers = set() if text is not None and len(text) > 0: for number in te...
# Pythonista # how should we create a list of numbers from 1-100 list_100_1 = [] for i in range(1, 101): list_100_1.append(i) print(list_100_1) # or list_100_2 = [*range(1,101)] print(list_100_2)
list_100_1 = [] for i in range(1, 101): list_100_1.append(i) print(list_100_1) list_100_2 = [*range(1, 101)] print(list_100_2)
class World: def __init__(self): self.physics = Physics() self.biology = Biology() class Physics: pass class Biology: pass
class World: def __init__(self): self.physics = physics() self.biology = biology() class Physics: pass class Biology: pass
def bond(first_name, last_name): return "the name is " + last_name + ". " + first_name + " " + last_name print(bond("sid", "silverstien"))
def bond(first_name, last_name): return 'the name is ' + last_name + '. ' + first_name + ' ' + last_name print(bond('sid', 'silverstien'))
class RPC: # chain chain_getBlockCount = "getblockcount" chain_getBestBlockHash = "getbestblockhash" chain_getBlockHash = "getblockhash" chain_getBLock = "getblock" chain_getBlockStates = "getblockstates" chain_getBlockChainInfo = "getblockchaininfo" chain_getChainTips = "getch...
class Rpc: chain_get_block_count = 'getblockcount' chain_get_best_block_hash = 'getbestblockhash' chain_get_block_hash = 'getblockhash' chain_get_b_lock = 'getblock' chain_get_block_states = 'getblockstates' chain_get_block_chain_info = 'getblockchaininfo' chain_get_chain_tips = 'getchaintip...
class ConfigFrog: def __init__(self, frog_id, frog_size, frog_sizes, frog_position, frog_positions): self.frog_id = frog_id self.frog_size = frog_size self.frog_sizes = frog_sizes self.frog_position = frog_position self.frog_positions = frog_positions @classmethod de...
class Configfrog: def __init__(self, frog_id, frog_size, frog_sizes, frog_position, frog_positions): self.frog_id = frog_id self.frog_size = frog_size self.frog_sizes = frog_sizes self.frog_position = frog_position self.frog_positions = frog_positions @classmethod d...
# 1. Let us say your expense for every month are listed below, # 1. January - 2200 # 2. February - 2350 # 3. March - 2600 # 4. April - 2130 # 5. May - 2190 # # Create a list to store these monthly expenses and using that find out, # # 1. In Feb, how many dollars you spent extra compare to January? # 2. ...
exp = [2200, 2350, 2600, 2130, 2190] print('In feb this much extra was spent compared to jan:', exp[1] - exp[0]) print('Expense for first quarter:', exp[0] + exp[1] + exp[2]) print('Did I spent 2000$ in any month? ', 2000 in exp) exp.append(1980) print('Expenses at the end of June:', exp) exp[3] = exp[3] - 200 print('E...
# # LeetCode # # Problem - 101 # URL - https://leetcode.com/problems/symmetric-tree/ # # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isMirror(self, le...
class Solution: def is_mirror(self, left: TreeNode, right: TreeNode) -> bool: if left == None and right == None: return True if left == None or right == None: return False return left.val == right.val and self.isMirror(left.right, right.left) and self.isMirror(left.l...
def node_height_at_least(node, h): if node.full_node.blockchain.get_peak() is not None: return node.full_node.blockchain.get_peak().height >= h return False def node_height_exactly(node, h): if node.full_node.blockchain.get_peak() is not None: return node.full_node.blockchain.get_peak().he...
def node_height_at_least(node, h): if node.full_node.blockchain.get_peak() is not None: return node.full_node.blockchain.get_peak().height >= h return False def node_height_exactly(node, h): if node.full_node.blockchain.get_peak() is not None: return node.full_node.blockchain.get_peak().hei...
SQLI1_LINKS = { "vulnerability_source_code": "https://github.com/neumaneuma/appseccheat.codes/blob/main/webapp/webapp/vulnerabilities/sqli_login_bypass.py", "vulnerability_gist": "https://gist.github.com/neumaneuma/39a853dfe14e7084ecc8ac8b304c60a3.js", "exploit_source_code": "https://github.com/neumaneuma/a...
sqli1_links = {'vulnerability_source_code': 'https://github.com/neumaneuma/appseccheat.codes/blob/main/webapp/webapp/vulnerabilities/sqli_login_bypass.py', 'vulnerability_gist': 'https://gist.github.com/neumaneuma/39a853dfe14e7084ecc8ac8b304c60a3.js', 'exploit_source_code': 'https://github.com/neumaneuma/appseccheat.co...
r=int(input("Enter The Range: ")) for i in range(r+1): for j in range(1,i+1): print('*',end=" ") print(" ")
r = int(input('Enter The Range: ')) for i in range(r + 1): for j in range(1, i + 1): print('*', end=' ') print(' ')
class Contact: def __init__(self, firstname, middlename, nickname): self.firstname = firstname self.middlename = middlename self.nickname = nickname
class Contact: def __init__(self, firstname, middlename, nickname): self.firstname = firstname self.middlename = middlename self.nickname = nickname
def __main__(): f = open("in.txt", 'r') o = open("out.txt", 'w') noOfCases = int(f.readline()) for testNo in range(noOfCases): data = f.readline().split() r = int(data[0]) c = int(data[1]) grid = [] for row in range(r): grid.append(list(f.readline())[...
def __main__(): f = open('in.txt', 'r') o = open('out.txt', 'w') no_of_cases = int(f.readline()) for test_no in range(noOfCases): data = f.readline().split() r = int(data[0]) c = int(data[1]) grid = [] for row in range(r): grid.append(list(f.readline()...
def anubis(*args): print("[+] Consultando anubis") domain,requests,json,re = args subs = [] url = 'https://jldc.me/anubis/subdomains/'+domain response = requests.get(url) resp = json.loads(response.content.decode('utf-8')) if len(resp) > 0: for x in resp: if x != b'[]...
def anubis(*args): print('[+] Consultando anubis') (domain, requests, json, re) = args subs = [] url = 'https://jldc.me/anubis/subdomains/' + domain response = requests.get(url) resp = json.loads(response.content.decode('utf-8')) if len(resp) > 0: for x in resp: if x != b...
def isPrime(n): for i in range(2, n): if n % i == 0: return False break return True n = 10 for j in range(2, n): if isPrime(j): print(j)
def is_prime(n): for i in range(2, n): if n % i == 0: return False break return True n = 10 for j in range(2, n): if is_prime(j): print(j)
__author__ = 'Hugo Sadok' __email__ = 'sadok@cmu.edu' __version__ = '0.1.9'
__author__ = 'Hugo Sadok' __email__ = 'sadok@cmu.edu' __version__ = '0.1.9'
sum = 1 n = int(input('Type a valid integer: ')) for i in range(n): sum = sum + i print(sum)
sum = 1 n = int(input('Type a valid integer: ')) for i in range(n): sum = sum + i print(sum)
# Copyright 2016 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. { 'variables': { 'chromium_code': 1, }, 'targets': [ { # GN version: //ui/base/x 'target_name': 'ui_base_x', 'type': '<(compo...
{'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'ui_base_x', 'type': '<(component)', 'all_dependent_settings': {'ldflags': ['-L<(PRODUCT_DIR)']}, 'dependencies': ['<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base_i18n', '<(DEPTH)/build/linux/system.gyp:x11', '<(DEPTH)/build/linux/system.gyp:xc...
class Task(object): def __init__(self, taskTuple): super().__init__() self._TaskID = taskTuple[0] self._BranchID = taskTuple[1] self._StudentID = taskTuple[2] self._ProjectID = taskTuple[3] self._TaskDescription = taskTuple[4] self._Resolved = taskTuple[5] ...
class Task(object): def __init__(self, taskTuple): super().__init__() self._TaskID = taskTuple[0] self._BranchID = taskTuple[1] self._StudentID = taskTuple[2] self._ProjectID = taskTuple[3] self._TaskDescription = taskTuple[4] self._Resolved = taskTuple[5] ...
class ApiRoutes: ALIVE = "/alive" USER_OPER = "/user" CONTACT_OPER = "/contacts" ONE_TIME_KEY = "/crypto/one-time-key" ONE_TIME_KEY_LIST = "/crypto/one-time-key-list" CHAT_OPER = "/chat"
class Apiroutes: alive = '/alive' user_oper = '/user' contact_oper = '/contacts' one_time_key = '/crypto/one-time-key' one_time_key_list = '/crypto/one-time-key-list' chat_oper = '/chat'
#Skill : binary tree, recursive #You are given the root of a binary tree. Invert the binary tree in place. # That is, all left children should become right children, and all right children should become left children. class Node: def __init__(self, value): self.left = None self.right = None self.value = ...
class Node: def __init__(self, value): self.left = None self.right = None self.value = value def preorder(self): print(self.value, end=' ') if self.left: self.left.preorder() if self.right: self.right.preorder() def preorder_out(self...
txt=open('ping.txt').readlines() outputs=[] w=open('pingout.txt','w') for line in txt: line=line.replace('64 bytes from 10.0.2.22: icmp_seq=','') line=line.replace(' ttl=63 time=',',') line=line.replace(' ms','') w.write(line)
txt = open('ping.txt').readlines() outputs = [] w = open('pingout.txt', 'w') for line in txt: line = line.replace('64 bytes from 10.0.2.22: icmp_seq=', '') line = line.replace(' ttl=63 time=', ',') line = line.replace(' ms', '') w.write(line)
class Node: def __init__(self, data=None): self.data = data self.next = None class LinkedList: def __init__(self): self.head = Node() def append(self, data): if self.head.data is None: self.head = Node(data) else: new_node = Node(data) ...
class Node: def __init__(self, data=None): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = node() def append(self, data): if self.head.data is None: self.head = node(data) else: new_node = node(data) ...
class Solution: def wordBreak(self, s: str, wordDict: [str]) -> [str]: #@lru_cache(None) def backtrack(index: int) -> [[str]]: if index == len(s): return [[]] ans = [] for i in range(index + 1, len(s) + 1): word = s[index:i] ...
class Solution: def word_break(self, s: str, wordDict: [str]) -> [str]: def backtrack(index: int) -> [[str]]: if index == len(s): return [[]] ans = [] for i in range(index + 1, len(s) + 1): word = s[index:i] if word in wor...