content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def buildTree(self, inorder: 'List[int]', postorder: 'List[int]') -> 'TreeNode': if not inorder or not postorder: ret...
class Solution: def build_tree(self, inorder: 'List[int]', postorder: 'List[int]') -> 'TreeNode': if not inorder or not postorder: return root = tree_node(postorder[-1]) i = 0 while inorder[i] != postorder[-1]: i += 1 root.left = self.buildTree(inorde...
expected_output = { "tag": { "1": { "topo_type": "unicast", "topo_name": "base", "tid": 0, "topo_id": "0x0", "flex_algo": { "None": { "prefix": { "4.4.4.4": { "...
expected_output = {'tag': {'1': {'topo_type': 'unicast', 'topo_name': 'base', 'tid': 0, 'topo_id': '0x0', 'flex_algo': {'None': {'prefix': {'4.4.4.4': {'prefix_attr': {'x_flag': False, 'r_flag': False, 'n_flag': True}, 'subnet': '32', 'source_router_id': '4.4.4.4', 'algo': {0: {}, 1: {}}, 'via_interface': {'GigabitEthe...
{ "targets": [ { "target_name": "baseJump", "sources": [ "cc/baseJump.cc", "cc/BigInteger.cc", "cc/BigIntegerAlgorithms.cc", "cc/BigIntegerUtils.cc", "cc/BigUnsigned.cc", "cc/BigUnsignedInABase.cc" ], "include_dirs": [ "<!(node -e \"require('nan')\")" ], "cflags!": [ "-f...
{'targets': [{'target_name': 'baseJump', 'sources': ['cc/baseJump.cc', 'cc/BigInteger.cc', 'cc/BigIntegerAlgorithms.cc', 'cc/BigIntegerUtils.cc', 'cc/BigUnsigned.cc', 'cc/BigUnsignedInABase.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'cond...
i = 0 while i < 3: print("i: ", i) j = 0 while j < 3: print("j: ", j) j += 1 i += 1
i = 0 while i < 3: print('i: ', i) j = 0 while j < 3: print('j: ', j) j += 1 i += 1
#!/usr/bin/env python3 # # Author: Vishwas K Singh # Email: vishwasks32@gmail.com # # Script to Program to find Sum, Diff, Prod, Avg, Div num1 = input("Enter the first Number: ") num2 = input("Enter the second Number: ") # Check if the user has entered the number itself try: # Convert the numbers to double always...
num1 = input('Enter the first Number: ') num2 = input('Enter the second Number: ') try: num1 = float(num1) num2 = float(num2) except ValueError: print('The entered input is not a number') exit(0) except TypeError: print('The entered input is not a number') exit(0) print('Sum of the two Numbers i...
class Bands: all_bands = [] def __init__(self, band_name, members): self.band_name = 'band_name' self.members = members self.__class__.all_bands.append(self) def to_list(self): return self.all_bands def __str__(self): return f'the band name is {se...
class Bands: all_bands = [] def __init__(self, band_name, members): self.band_name = 'band_name' self.members = members self.__class__.all_bands.append(self) def to_list(self): return self.all_bands def __str__(self): return f'the band name is {self.band_name}'...
# Author: btjanaka (Bryon Tjanaka) # Problem: (Leetcode) 1 # Title: Two Sum # Link: https://leetcode.com/problems/two-sum/ # Idea: The easy solution is to check every pair of elements, but this is # O(n^2). To achieve O(n), the basic idea is to use a set that keeps track of # which elements we have seen so far while it...
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: prev_nums_with_indices = dict() for i in range(len(nums)): x = nums[i] if target - x in prev_nums_with_indices: prev_num_index = prev_nums_with_indices[target - x] r...
a = list(map(lambda i: ord(i) - 97, list(input()))) idx_array = [-1 for _ in range(26)] for i in range(len(a)): if idx_array[a[i]] == -1: idx_array[a[i]] = i for idx in idx_array: print(idx, end=' ')
a = list(map(lambda i: ord(i) - 97, list(input()))) idx_array = [-1 for _ in range(26)] for i in range(len(a)): if idx_array[a[i]] == -1: idx_array[a[i]] = i for idx in idx_array: print(idx, end=' ')
# Complete the compareTriplets function below. def compareTriplets(a, b): al =0 bo=0 for i in range(3): if(a[i]>b[i]): al+=1 elif(b[i]>a[i]): bo+=1 return(al,bo) if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') a = list(map(int, in...
def compare_triplets(a, b): al = 0 bo = 0 for i in range(3): if a[i] > b[i]: al += 1 elif b[i] > a[i]: bo += 1 return (al, bo) if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') a = list(map(int, input().rstrip().split())) b = list(...
def partition(top, end, array): pivot_index = top pivot = array[pivot_index] while top < end: while top < len(array) and array[top] <= pivot: top += 1 while array[end] > pivot: end -= 1 if(top < end): array[top], array[end] = array[end], array[top] ar...
def partition(top, end, array): pivot_index = top pivot = array[pivot_index] while top < end: while top < len(array) and array[top] <= pivot: top += 1 while array[end] > pivot: end -= 1 if top < end: (array[top], array[end]) = (array[end], array[to...
def find_coordinates(x, y): # Get coordinates of mouse click return (x- x%10, y - y%10) def get_all_neighbours(cell): # get neighbours along with current cell (x,y) = cell return [(x-i,y-j) for i in range(-10,20,10) for j in range(-10,20,10)] def get_next_generation(cells): # Get next generati...
def find_coordinates(x, y): return (x - x % 10, y - y % 10) def get_all_neighbours(cell): (x, y) = cell return [(x - i, y - j) for i in range(-10, 20, 10) for j in range(-10, 20, 10)] def get_next_generation(cells): next_gen = {} which_cells_to_check = set() for (curr_cell, _) in cells.items()...
# # PySNMP MIB module BIANCA-BRICK-PPP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BIANCA-BRICK-PPP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:37:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ...
def gcd(a,b): res = 1 for i in range(1, min(a,b)+1): if a % i == 0 and b % i == 0: res = i return res def solution(w,h): return w * h - (w + h - gcd(w,h))
def gcd(a, b): res = 1 for i in range(1, min(a, b) + 1): if a % i == 0 and b % i == 0: res = i return res def solution(w, h): return w * h - (w + h - gcd(w, h))
def markov_tweet(): #Created a nested dictionary with the 1st Key = a word second key = possible words that come after and value = counter words_dic = {} with open("prunedLyrics.txt", 'r', encoding="utf-8") as f: for line in f: line = line.replace("\n"," \n") words_list = line.split(" ") for index, word i...
def markov_tweet(): words_dic = {} with open('prunedLyrics.txt', 'r', encoding='utf-8') as f: for line in f: line = line.replace('\n', ' \n') words_list = line.split(' ') for (index, word) in enumerate(words_list): temp_kv_dic = {} if w...
class Person: @property def full_name(self): return f"{self.first_name} {self.last_name}"
class Person: @property def full_name(self): return f'{self.first_name} {self.last_name}'
chassis_900 = '192.168.65.36' chassis_910 = '192.168.65.21' linux_900 = '192.168.65.34:443' linux_910 = '192.168.65.23:443' windows_900 = 'localhost:11009' windows_910 = 'localhost:11009' cm_900 = '172.40.0.204:443' server_properties = {'linux_900': {'server': linux_900, 'locatio...
chassis_900 = '192.168.65.36' chassis_910 = '192.168.65.21' linux_900 = '192.168.65.34:443' linux_910 = '192.168.65.23:443' windows_900 = 'localhost:11009' windows_910 = 'localhost:11009' cm_900 = '172.40.0.204:443' server_properties = {'linux_900': {'server': linux_900, 'locations': [f'{chassis_900}/1/1', f'{chassis_9...
n=int(input()) arr=list(map(int,input().split())) a=0 p=0 for k in range(0,n): a=a+arr[k] for j in range(0,n): d=(arr[j] - (a/n))**2 p=p+d sigma=float ((p/n)**(1/2)) print(sigma)
n = int(input()) arr = list(map(int, input().split())) a = 0 p = 0 for k in range(0, n): a = a + arr[k] for j in range(0, n): d = (arr[j] - a / n) ** 2 p = p + d sigma = float((p / n) ** (1 / 2)) print(sigma)
class Port: def __init__(self, path, vendor_id, product_id, serial_number): self.path = path self.vendor_id = vendor_id self.product_id = product_id self.serial_number = serial_number def __repr__(self): return f'<Port ' \ f'path={self.path} ' \ ...
class Port: def __init__(self, path, vendor_id, product_id, serial_number): self.path = path self.vendor_id = vendor_id self.product_id = product_id self.serial_number = serial_number def __repr__(self): return f'<Port path={self.path} vendor_id={self.vendor_id} product...
def less_or_equal(value): if value : # Change this line return "25 or less" elif value : # Change this line return "75 or less" else: return "More than 75" # Change the value 1 below to experiment with different values print(less_or_equal(1))
def less_or_equal(value): if value: return '25 or less' elif value: return '75 or less' else: return 'More than 75' print(less_or_equal(1))
# # @lc app=leetcode id=2 lang=python3 # # [2] Add Two Numbers # # https://leetcode.com/problems/add-two-numbers/description/ # # algorithms # Medium (30.66%) # Likes: 5024 # Dislikes: 1280 # Total Accepted: 848.6K # Total Submissions: 2.7M # Testcase Example: '[2,4,3]\n[5,6,4]' # # You are given ...
class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: if not l1.next and l1.val == 0: return l2 if not l2.next and l2.val == 0: return l1 (p1, p2) = (l1, l2) sol = list_node(0) head = sol head.next = None (...
class ValueBlend: def _init_corners(self, **kwargs): # Corners is list of tuples: # [bottomleft, bottomright, topleft, topright] if 'corners' in kwargs: self.corners = kwargs['corners'] if len(self.corners) != 4 or \ any(len(v) != 2 for v in self.cor...
class Valueblend: def _init_corners(self, **kwargs): if 'corners' in kwargs: self.corners = kwargs['corners'] if len(self.corners) != 4 or any((len(v) != 2 for v in self.corners)): raise value_error("corner should be a list of four tuples, set either option 'corners'...
str_1 = input() str_2 = input() str_3 = input() print([str_1, [str_2], [[str_3]]])
str_1 = input() str_2 = input() str_3 = input() print([str_1, [str_2], [[str_3]]])
class Dataset(object): def __init__(self, name=None): self.name = name def __str__(self): return self.name def get_instance_name(self, filepath, id): raise NotImplementedError("Abstract class") def import_model(self, filepath): raise NotImplementedError("Abstra...
class Dataset(object): def __init__(self, name=None): self.name = name def __str__(self): return self.name def get_instance_name(self, filepath, id): raise not_implemented_error('Abstract class') def import_model(self, filepath): raise not_implemented_error('Abstract ...
def isValid(s: str) -> bool: open_to_close = { '(': ')', '{': '}', '[': ']' } close_to_open = {v: k for k, v in open_to_close.items()} stack = [] for i in s: if i in open_to_close: stack.append(i) elif i in close_to_open: ...
def is_valid(s: str) -> bool: open_to_close = {'(': ')', '{': '}', '[': ']'} close_to_open = {v: k for (k, v) in open_to_close.items()} stack = [] for i in s: if i in open_to_close: stack.append(i) elif i in close_to_open: if len(stack) <= 0: retur...
client_id = 'Ch8pNOBOAYzASwSmKClKZJKts8VnKDsj' # your bot's client ID token = 'Mzc3MDU4MTc2MzUwMDI3Nzc3.DQ8csA.YRTHtBKENVulI8bk17-6gzGnScU' # your bot's token carbon_key = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiIyMjA5NTkxNzg3NzkyNjI5ODYiLCJyYW5kIjozOTksImlhdCI6MTUxMjkzNTQ5NH0.1Al7nXx5HmvA7Lyc_ddc6V_czVxv...
client_id = 'Ch8pNOBOAYzASwSmKClKZJKts8VnKDsj' token = 'Mzc3MDU4MTc2MzUwMDI3Nzc3.DQ8csA.YRTHtBKENVulI8bk17-6gzGnScU' carbon_key = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiIyMjA5NTkxNzg3NzkyNjI5ODYiLCJyYW5kIjozOTksImlhdCI6MTUxMjkzNTQ5NH0.1Al7nXx5HmvA7Lyc_ddc6V_czVxvD5K7dxPdrW0D1yE' bots_key = 'https://discord...
def generate_concept_HTML(concept_title, concept_description): html_text_1 = ''' <div class="concept"> <div class="concept-title"> ''' + concept_title html_text_2 = ''' </div> <div class="concept-description"> ''' + concept_description html_text_3 = ''' </div> </di...
def generate_concept_html(concept_title, concept_description): html_text_1 = '\n<div class="concept">\n <div class="concept-title">\n ' + concept_title html_text_2 = '\n </div>\n <div class="concept-description">\n ' + concept_description html_text_3 = '\n </div>\n</div>' full_...
nop = b'\x00\x00' brk = b'\x00\xA0' ld1 = b'\x63\x25' # Load 0x25 into register V3 ld2 = b'\x64\x26' # Load 0x26 into register V4 sne = b'\x93\x40' # Skip next instruction if V3 != V4 with open("snevxvytest.bin", 'wb') as f: f.write(ld1) # 0x0200 <-- Load the byte 0x25 into register V3 f.write(ld2) # 0x...
nop = b'\x00\x00' brk = b'\x00\xa0' ld1 = b'c%' ld2 = b'd&' sne = b'\x93@' with open('snevxvytest.bin', 'wb') as f: f.write(ld1) f.write(ld2) f.write(sne) f.write(brk) f.write(nop) f.write(nop) f.write(brk) f.write(nop)
''' Python program to remove two duplicate numbers from a given number of list. Sample Input: ([1,2,3,2,3,4,5]) ([1,2,3,2,4,5]) ([1,2,3,4,5]) Sample Output: [1, 4, 5] [1, 3, 4, 5] [1, 2, 3, 4, 5] ''' a = [10,20,30,20,10,50,60,40,80,50,40] dup_items = set() uniq_items = [] for x in a: if x not in dup_items: ...
""" Python program to remove two duplicate numbers from a given number of list. Sample Input: ([1,2,3,2,3,4,5]) ([1,2,3,2,4,5]) ([1,2,3,4,5]) Sample Output: [1, 4, 5] [1, 3, 4, 5] [1, 2, 3, 4, 5] """ a = [10, 20, 30, 20, 10, 50, 60, 40, 80, 50, 40] dup_items = set() uniq_items = [] for x in a: if x not in dup_ite...
# optimal performance def copy_random_list(head): if not head: return head # copy each node and insert right after itself curr = head while curr: node_new = RandomListNode(curr.label) node_next = curr.next curr.next = node_new node_new.next = node_next curr = no...
def copy_random_list(head): if not head: return head curr = head while curr: node_new = random_list_node(curr.label) node_next = curr.next curr.next = node_new node_new.next = node_next curr = node_next curr = head while curr: if curr.random: ...
class CoinPaymentsProviderError(Exception): pass class TxInfoException(Exception): pass
class Coinpaymentsprovidererror(Exception): pass class Txinfoexception(Exception): pass
current_number=0 while current_number <=5: current_number +=1 print(current_number)
current_number = 0 while current_number <= 5: current_number += 1 print(current_number)
def tree(length): if length>5: t.forward(length) t.right(20) tree(length-15) t.left(40) tree(length-15) t.right(20) t.backward(length) t.left(90) t.color("green") t.speed(1) tree(90)
def tree(length): if length > 5: t.forward(length) t.right(20) tree(length - 15) t.left(40) tree(length - 15) t.right(20) t.backward(length) t.left(90) t.color('green') t.speed(1) tree(90)
#!/usr/bin/env python ''' https://leetcode.com/problems/find-the-duplicate-number/ Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. Input: [1,3,4...
""" https://leetcode.com/problems/find-the-duplicate-number/ Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. Input: [1,3,4,2,2] Output: 2 Input:...
cases = int(input()) for a in range(cases): tracks = int(input().split(" ")[0]) requests = input().split(" ") last = int(requests[0]) total = 0 for i in requests[1:]: next = int(i) total += min(tracks - ((next - last - 1) % tracks + tracks) % tracks, ((next - last - 1) % trac...
cases = int(input()) for a in range(cases): tracks = int(input().split(' ')[0]) requests = input().split(' ') last = int(requests[0]) total = 0 for i in requests[1:]: next = int(i) total += min(tracks - ((next - last - 1) % tracks + tracks) % tracks, ((next - last - 1) % tracks + tra...
def alternating_sums(a): even, odd = [], [] for i in range(len(a)): if i % 2 == 0: even.append(a[i]) else: odd.append(a[i]) return [sum(even), sum(odd)] def alternating_sums_short(a): return [ sum(a[::2]), sum(a[1::2]) ] if __name__ == '__main__': ...
def alternating_sums(a): (even, odd) = ([], []) for i in range(len(a)): if i % 2 == 0: even.append(a[i]) else: odd.append(a[i]) return [sum(even), sum(odd)] def alternating_sums_short(a): return [sum(a[::2]), sum(a[1::2])] if __name__ == '__main__': a = [50, ...
# [h] close all fonts '''Close all open fonts.''' all_fonts = AllFonts() if len(all_fonts) > 0: for font in all_fonts: font.close()
"""Close all open fonts.""" all_fonts = all_fonts() if len(all_fonts) > 0: for font in all_fonts: font.close()
def adder(a:int, b:int) -> int: while b: _xor = a ^ b _and = (a & b) << 1 a = _xor b = _and return a if __name__ == "__main__": bin_digits = 8 for i in range(2 ** bin_digits): for ii in range(2 ** bin_digits): true = i + ii test = adder(i, ii) if true != test: print(f"Adding: {i:b} + {ii:b}"...
def adder(a: int, b: int) -> int: while b: _xor = a ^ b _and = (a & b) << 1 a = _xor b = _and return a if __name__ == '__main__': bin_digits = 8 for i in range(2 ** bin_digits): for ii in range(2 ** bin_digits): true = i + ii test = adder(i...
# calculate 10! @profile def factorial(num): if num == 1: return 1 else: print("Calculating " + str(num) + "!") return factorial(num -1) * num @profile def profiling_factorial(): value = 10 result = factorial(value) print("10!= " + str(result)) if __name__ == "__main__": ...
@profile def factorial(num): if num == 1: return 1 else: print('Calculating ' + str(num) + '!') return factorial(num - 1) * num @profile def profiling_factorial(): value = 10 result = factorial(value) print('10!= ' + str(result)) if __name__ == '__main__': profiling_fact...
BZX = Contract.from_abi("BZX", "0xc47812857a74425e2039b57891a3dfcf51602d5d", interface.IBZx.abi) TOKEN_REGISTRY = Contract.from_abi("TOKEN_REGISTRY", "0x2fA30fB75E08f5533f0CF8EBcbb1445277684E85", TokenRegistry.abi) list = TOKEN_REGISTRY.getTokens(0, 100) for l in list: iTokenTemp = Contract.from_abi("iTokenTemp", ...
bzx = Contract.from_abi('BZX', '0xc47812857a74425e2039b57891a3dfcf51602d5d', interface.IBZx.abi) token_registry = Contract.from_abi('TOKEN_REGISTRY', '0x2fA30fB75E08f5533f0CF8EBcbb1445277684E85', TokenRegistry.abi) list = TOKEN_REGISTRY.getTokens(0, 100) for l in list: i_token_temp = Contract.from_abi('iTokenTemp',...
lowestPossible = 1 highestPossible = 999 num = 0 while True: enemy = hero.findNearest(hero.findEnemies()) if enemy: if enemy.type == "scout": lowestPossible = num elif enemy.type == "munchkin": highestPossible = num hero.attack(enemy) else: num = lowe...
lowest_possible = 1 highest_possible = 999 num = 0 while True: enemy = hero.findNearest(hero.findEnemies()) if enemy: if enemy.type == 'scout': lowest_possible = num elif enemy.type == 'munchkin': highest_possible = num hero.attack(enemy) else: num = l...
#!/usr/bin/env python # coding: utf-8 # Utility functions def get_image_size(model_prefix): if 'caffenet' in model_prefix: return 227 elif 'squeezenet' in model_prefix: return 227 elif 'alexnet' in model_prefix: return 227 elif 'googlenet' in model_prefix: return 299 elif 'inception-v3' in m...
def get_image_size(model_prefix): if 'caffenet' in model_prefix: return 227 elif 'squeezenet' in model_prefix: return 227 elif 'alexnet' in model_prefix: return 227 elif 'googlenet' in model_prefix: return 299 elif 'inception-v3' in model_prefix: return 299 ...
# variable = a container for a value. # Behaves as the value that it contains first_name = "Bro" last_name = "Code" full_name = first_name +" "+ last_name #name='Bro' print("Hello "+full_name) #print(type(name)) age = 21 age += 1 print("Your age is: "+str(age)) #print(age) #print(type(age)) height = 250.5 print("Yo...
first_name = 'Bro' last_name = 'Code' full_name = first_name + ' ' + last_name print('Hello ' + full_name) age = 21 age += 1 print('Your age is: ' + str(age)) height = 250.5 print('Your height is: ' + str(height) + 'cm') human = True print('Are you a human: ' + str(human))
#!/usr/bin/python # Any system should have an sh capable of `command -v` # REQUIRES: command -v sh print("Oh, but it is!") # CHECK: This should never be compared
print('Oh, but it is!')
class Solution: def intToRoman(self, num): symbols_list = [ ["M", "M", "M"], ["C", "D", "M"], ["X", "L", "C"], ["I", "V", "X"] ] pown_list = [1000, 100, 10, 1] def digitToRoman(digit, symbols): if digit < 4: ...
class Solution: def int_to_roman(self, num): symbols_list = [['M', 'M', 'M'], ['C', 'D', 'M'], ['X', 'L', 'C'], ['I', 'V', 'X']] pown_list = [1000, 100, 10, 1] def digit_to_roman(digit, symbols): if digit < 4: return symbols[0] * digit elif digit == ...
CLUSTERS_DB = 'complete_clusters.db' SAMPLE2PROTEIN_DB = 'sample2protein.db' SAMPLE2PATH = 'sample2path.tsv'
clusters_db = 'complete_clusters.db' sample2_protein_db = 'sample2protein.db' sample2_path = 'sample2path.tsv'
def funny(x): if (x%2 == 1): return x+1 else: return funny(x-1) print(funny(7)) print(funny(6))
def funny(x): if x % 2 == 1: return x + 1 else: return funny(x - 1) print(funny(7)) print(funny(6))
class TweetComplaint: def __init__(self, complain_text, city, state, tweet_id, username, image_url): self.complain_text = complain_text self.tweet_id = tweet_id self.username = username self.city = city self.state = state self.image_url = image_url self.statu...
class Tweetcomplaint: def __init__(self, complain_text, city, state, tweet_id, username, image_url): self.complain_text = complain_text self.tweet_id = tweet_id self.username = username self.city = city self.state = state self.image_url = image_url self.statu...
class Solution: def rob(self, num): ls = [[0, 0]] for e in num: ls.append([max(ls[-1][0], ls[-1][1]), ls[-1][0] + e]) return max(ls[-1])
class Solution: def rob(self, num): ls = [[0, 0]] for e in num: ls.append([max(ls[-1][0], ls[-1][1]), ls[-1][0] + e]) return max(ls[-1])
# -*- coding: utf-8 -*- __version__ = '0.16.1.dev0' PROJECT_NAME = "planemo" PROJECT_USERAME = "galaxyproject" RAW_CONTENT_URL = "https://raw.github.com/%s/%s/master/" % ( PROJECT_USERAME, PROJECT_NAME )
__version__ = '0.16.1.dev0' project_name = 'planemo' project_userame = 'galaxyproject' raw_content_url = 'https://raw.github.com/%s/%s/master/' % (PROJECT_USERAME, PROJECT_NAME)
spec = { 'name' : "ODL demo", 'external network name' : "exnet3", 'keypair' : "X220", 'controller' : "r720", 'dns' : "10.30.65.200", 'credentials' : { 'user' : "nic", 'password' : "nic", 'project' : "nic" }, # 'credentials' : { 'user' : "admin", 'password' : "admin", 'project' : "admin" }, ...
spec = {'name': 'ODL demo', 'external network name': 'exnet3', 'keypair': 'X220', 'controller': 'r720', 'dns': '10.30.65.200', 'credentials': {'user': 'nic', 'password': 'nic', 'project': 'nic'}, 'Networks': [{'name': 'odldemo', 'start': '192.168.50.2', 'end': '192.168.50.254', 'subnet': ' 192.168.50.0/24', 'gateway': ...
#encoding:utf-8 subreddit = 'kratom' t_channel = '@r_kratom' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'kratom' t_channel = '@r_kratom' def send_post(submission, r2t): return r2t.send_simple(submission)
n = 5 count = 0 total = 0 startCount = n - 3 while True: if count == n: break elif count < n: x = int(input()) if count > startCount: total = total + x count = count + 1 print('') print('Sum is %d.' % total)
n = 5 count = 0 total = 0 start_count = n - 3 while True: if count == n: break elif count < n: x = int(input()) if count > startCount: total = total + x count = count + 1 print('') print('Sum is %d.' % total)
JPEG_10918 = ( 'SOF0', 'SOF1', 'SOF2', 'SOF3', 'SOF5', 'SOF6', 'SOF7', 'SOF9', 'SOF10', 'SOF11', 'SOF13', 'SOF14', 'SOF15', ) JPEG_14495 = ('SOF55', 'LSE', ) JPEG_15444 = ('SOC', ) PARSE_SUPPORTED = { '10918' : [ 'Process 1', 'Process 2', 'Process 4', 'Process 14', ...
jpeg_10918 = ('SOF0', 'SOF1', 'SOF2', 'SOF3', 'SOF5', 'SOF6', 'SOF7', 'SOF9', 'SOF10', 'SOF11', 'SOF13', 'SOF14', 'SOF15') jpeg_14495 = ('SOF55', 'LSE') jpeg_15444 = ('SOC',) parse_supported = {'10918': ['Process 1', 'Process 2', 'Process 4', 'Process 14']} decode_supported = {} encode_supported = {} zigzag = [0, 1, 5,...
class Solution: def numberOfArithmeticSlices(self, A: List[int]) -> int: count, currentSum = 0, 0 for i in range(2, len(A)): if A[i] - A[i - 1] == A[i - 1] - A[i - 2]: count += 1 else: currentSum += ((count + 1) * count) // 2 co...
class Solution: def number_of_arithmetic_slices(self, A: List[int]) -> int: (count, current_sum) = (0, 0) for i in range(2, len(A)): if A[i] - A[i - 1] == A[i - 1] - A[i - 2]: count += 1 else: current_sum += (count + 1) * count // 2 ...
app_name = 'tulius.profile' urlpatterns = [ ]
app_name = 'tulius.profile' urlpatterns = []
# # PySNMP MIB module CISCO-WBX-MEETING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WBX-MEETING-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:04:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
# Column/Label Types NULL = 'null' CATEGORICAL = 'categorical' TEXT = 'text' NUMERICAL = 'numerical' ENTITY = 'entity' # Feature Types ARRAY = 'array' # backend PYTORCH = "pytorch" MXNET = "mxnet"
null = 'null' categorical = 'categorical' text = 'text' numerical = 'numerical' entity = 'entity' array = 'array' pytorch = 'pytorch' mxnet = 'mxnet'
def main(): a,b,c,k = map(int,input().split()) ans = 0 ans += min(a, k) ans -= max(0, k-a-b) print(ans) if __name__ == "__main__": main()
def main(): (a, b, c, k) = map(int, input().split()) ans = 0 ans += min(a, k) ans -= max(0, k - a - b) print(ans) if __name__ == '__main__': main()
def main(): # equilibrate then isolate cold finger info('Equilibrate then isolate coldfinger') close(name="C", description="Bone to Turbo") sleep(1) open(name="B", description="Bone to Diode Laser") sleep(20) close(name="B", description="Bone to Diode Laser")
def main(): info('Equilibrate then isolate coldfinger') close(name='C', description='Bone to Turbo') sleep(1) open(name='B', description='Bone to Diode Laser') sleep(20) close(name='B', description='Bone to Diode Laser')
class AmrTypes: dbpedia = { "person": "dbo:Person", "family": "dbo:Agent", "animal": "dbo:Animal", "language": "dbo:Language", "nationality": "dbo:Country", "ethnic-group": "dbo:EthnicGroup", "regional-group": "dbo:EthnicGroup", "religious-group": "db...
class Amrtypes: dbpedia = {'person': 'dbo:Person', 'family': 'dbo:Agent', 'animal': 'dbo:Animal', 'language': 'dbo:Language', 'nationality': 'dbo:Country', 'ethnic-group': 'dbo:EthnicGroup', 'regional-group': 'dbo:EthnicGroup', 'religious-group': 'dbo:Religious', 'political-movement': 'dbo:PoliticalParty', 'organiz...
students = [] def get_students_titlecase(): students_titlecase = [] for student in students: students_titlecase.append(student['name'].title()) return students_titlecase def print_students_titlecase(): print(get_students_titlecase()) def add_student(name, student_id = 332): student = {'n...
students = [] def get_students_titlecase(): students_titlecase = [] for student in students: students_titlecase.append(student['name'].title()) return students_titlecase def print_students_titlecase(): print(get_students_titlecase()) def add_student(name, student_id=332): student = {'name...
class Solution: def numIslands(self, grid: List[List[str]]) -> int: return num_islands(grid) def num_islands(grid): res = 0 R = len(grid) C = len(grid[0]) def dfs(i, j): if grid[i][j] == '1': grid[i][j] = '0' if i > 0: dfs(i - 1, j) ...
class Solution: def num_islands(self, grid: List[List[str]]) -> int: return num_islands(grid) def num_islands(grid): res = 0 r = len(grid) c = len(grid[0]) def dfs(i, j): if grid[i][j] == '1': grid[i][j] = '0' if i > 0: dfs(i - 1, j) ...
sample_rate = 16000 audio_duration = 10 audio_samples = sample_rate * audio_duration audio_duration_flusense = 1 audio_samples_flusense = sample_rate * audio_duration_flusense window_size = 512 overlap = 256 mel_bins = 64 device = 'cuda' num_epochs = 30 gamma = 0.4 patience = 4 step = 10 random_seed = 36851234 split_...
sample_rate = 16000 audio_duration = 10 audio_samples = sample_rate * audio_duration audio_duration_flusense = 1 audio_samples_flusense = sample_rate * audio_duration_flusense window_size = 512 overlap = 256 mel_bins = 64 device = 'cuda' num_epochs = 30 gamma = 0.4 patience = 4 step = 10 random_seed = 36851234 split_ra...
def minion_game(string): # your code goes here vowels = frozenset('AEIOU') length = len(string) kev_sc = 0 stu_sc = 0 for i in range(length): if string[i] in vowels: kev_sc += length - i else: stu_sc += length - i if kev_sc > stu_sc: print('Kev...
def minion_game(string): vowels = frozenset('AEIOU') length = len(string) kev_sc = 0 stu_sc = 0 for i in range(length): if string[i] in vowels: kev_sc += length - i else: stu_sc += length - i if kev_sc > stu_sc: print('Kevin', kev_sc) elif kev_...
class Message: def __init__(self, to_channel): self.to_channel = to_channel self.timestamp = "" self.text = "" self.blocks = [] self.is_completed = False def get_message(self): return { "ts": self.timestamp, "channel": self.to_channel, ...
class Message: def __init__(self, to_channel): self.to_channel = to_channel self.timestamp = '' self.text = '' self.blocks = [] self.is_completed = False def get_message(self): return {'ts': self.timestamp, 'channel': self.to_channel, 'text': self.text, 'blocks'...
productions = { (52, 1): [1,25,47,53,49 ], (53, 2): [54, 57,59,62,64], (53, 3): [54,57,59,62,64], (53, 4): [54,57,59,62,64], (53, 5): [54,57,59,62,64], (53, 6): [54,57,59,62,64], (54, 2): [2,55,47], (54, 3): [0], (54, 4): [0], (54, 5): [0], (54, 6): [0], (55, 25): [25,56]...
productions = {(52, 1): [1, 25, 47, 53, 49], (53, 2): [54, 57, 59, 62, 64], (53, 3): [54, 57, 59, 62, 64], (53, 4): [54, 57, 59, 62, 64], (53, 5): [54, 57, 59, 62, 64], (53, 6): [54, 57, 59, 62, 64], (54, 2): [2, 55, 47], (54, 3): [0], (54, 4): [0], (54, 5): [0], (54, 6): [0], (55, 25): [25, 56], (56, 39): [0], (56, 46...
class CDI(): def __init__(self,v3,v2,v3SessionID,v3BaseURL,v2BaseURL,v2icSessionID): print("Created CDI Class") self._v3=v3 self._v2=v2 self._v3SessionID = v3SessionID self._v3BaseURL = v3BaseURL self._v2BaseURL = v2BaseURL self._v2icSessionID = v2icSessionID ...
class Cdi: def __init__(self, v3, v2, v3SessionID, v3BaseURL, v2BaseURL, v2icSessionID): print('Created CDI Class') self._v3 = v3 self._v2 = v2 self._v3SessionID = v3SessionID self._v3BaseURL = v3BaseURL self._v2BaseURL = v2BaseURL self._v2icSessionID = v2icS...
# ---------------------------------------------------------------------------- # MODES: serial # CLASSES: nightly # # Test Case: multicolor.py # # Tests: Tests setting colors using the multiColor field in some of # our plots. # Plots - Boundary, Contour, FilledBoundary, Subset # ...
def test_color_definitions(testname, colors): s = '' for c in colors: s = s + str(c) + '\n' test_text(testname, s) def test_multi_color(section, plotAtts, decreasingOpacity): m = plotAtts.GetMultiColor() test('multicolor_%d_00' % section) for i in range(len(m)): t = float(i) / f...
def run_tests_count_tokens(config): scenario = sp.test_scenario() admin, [alice, bob] = get_addresses() scenario.h1("Tests count token") #----------------------------------------------------- scenario.h2("Nothing is minted") contract = create_new_contract(config, admin, scenario, []) cou...
def run_tests_count_tokens(config): scenario = sp.test_scenario() (admin, [alice, bob]) = get_addresses() scenario.h1('Tests count token') scenario.h2('Nothing is minted') contract = create_new_contract(config, admin, scenario, []) count = contract.count_tokens() scenario.verify(count == 0) ...
gal_sgd = ['HP0370', 'HP0950', 'HP0371', 'HP0557', 'HP0202', 'HP0587', 'HP0618', 'HP1112', 'HP0255', 'HP0859', 'HP0089', 'HP0106', 'HP0738', 'HP0942', 'HP0976', 'HP1483', 'HP1280', 'HP1281', 'HP1282', 'HP0598', 'HP1505', 'HP0422', 'HP1399', 'HP1017', 'HP1189', 'HP0723', 'HP0034', 'HP1084', 'HP1229', 'HP0672', 'HP1406',...
gal_sgd = ['HP0370', 'HP0950', 'HP0371', 'HP0557', 'HP0202', 'HP0587', 'HP0618', 'HP1112', 'HP0255', 'HP0859', 'HP0089', 'HP0106', 'HP0738', 'HP0942', 'HP0976', 'HP1483', 'HP1280', 'HP1281', 'HP1282', 'HP0598', 'HP1505', 'HP0422', 'HP1399', 'HP1017', 'HP1189', 'HP0723', 'HP0034', 'HP1084', 'HP1229', 'HP0672', 'HP1406',...
# This is not for real use! # This is normally generated by the build and install so should not be used for anything or filled in with real values. # File generated from /opt/config # GLOBAL_INJECTED_AAI1_IP_ADDR = "10.0.1.1" GLOBAL_INJECTED_AAI2_IP_ADDR = "10.0.1.2" GLOBAL_INJECTED_APPC_IP_ADDR = "10.0.2.1" GLOBAL_INJ...
global_injected_aai1_ip_addr = '10.0.1.1' global_injected_aai2_ip_addr = '10.0.1.2' global_injected_appc_ip_addr = '10.0.2.1' global_injected_artifacts_version = '1.2.0' global_injected_clamp_ip_addr = '10.0.12.1' global_injected_cloud_env = 'openstack' global_injected_dcae_ip_addr = '10.0.4.1' global_injected_dns_ip_a...
############################################################################### # Copyright (c) 2017-2020 Koren Lev (Cisco Systems), # # Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others # # # ...
vedge_id = '3858e121-d861-4348-9d64-a55fcd5bf60a' vedge = {'configurations': {'tunnel_types': ['vxlan'], 'tunneling_ip': '192.168.2.1'}, 'host': 'node-5.cisco.com', 'id': '3858e121-d861-4348-9d64-a55fcd5bf60a', 'tunnel_ports': {'vxlan-c0a80203': {}, 'br-tun': {}}, 'type': 'vedge'} vedge_without_configs = {} vedge_witho...
class RedbotMotorActor(object): # TODO(asydorchuk): load constants from the config file. _MAXIMUM_FREQUENCY = 50 def __init__(self, gpio, power_pin, direction_pin_1, direction_pin_2): self.gpio = gpio self.power_pin = power_pin self.direction_pin_1 = direction_pin_1 sel...
class Redbotmotoractor(object): _maximum_frequency = 50 def __init__(self, gpio, power_pin, direction_pin_1, direction_pin_2): self.gpio = gpio self.power_pin = power_pin self.direction_pin_1 = direction_pin_1 self.direction_pin_2 = direction_pin_2 self.gpio.setup(power_...
#!/usr/bin/env python3 print("// addTable") for a in range(0, 10): print(" '{0}': {{".format(a)) for b in range(a, 10): s = (a + b) % 10 c = (a + b) // 10 print(" '{0}': '{1}{2}',".format(b, s, c)) print(" },") print() print("// subTable") for a in range(0, ...
print('// addTable') for a in range(0, 10): print(" '{0}': {{".format(a)) for b in range(a, 10): s = (a + b) % 10 c = (a + b) // 10 print(" '{0}': '{1}{2}',".format(b, s, c)) print(' },') print() print('// subTable') for a in range(0, 10): print(" ...
n, k = map(int, input().split()) dis = input().split() m = n while True: m = str(m) for d in dis: if d in m: break else: print(m) exit() m = int(m) + 1
(n, k) = map(int, input().split()) dis = input().split() m = n while True: m = str(m) for d in dis: if d in m: break else: print(m) exit() m = int(m) + 1
def replay(adb): adb.tap(1720, 1000) def go_to_home(adb): adb.tap(1961, 40) def go_to_battle(adb): adb.tap(1943, 928) def go_to_event_battle(adb): adb.tap(1900, 345) def select_daily_event(adb): adb.tap(313, 267) def select_unit(adb): adb.tap(1935, 935) def sortie(adb): adb.tap(1930, 947) def stage_clear_ok(adb)...
def replay(adb): adb.tap(1720, 1000) def go_to_home(adb): adb.tap(1961, 40) def go_to_battle(adb): adb.tap(1943, 928) def go_to_event_battle(adb): adb.tap(1900, 345) def select_daily_event(adb): adb.tap(313, 267) def select_unit(adb): adb.tap(1935, 935) def sortie(adb): adb.tap(1930, 9...
player_1_position = 7 player_2_position = 10 player_1_score = 0 player_2_score = 0 def roll_die(): i = 1 while 1: yield i i += 1 if i > 100: i = 1 roll = roll_die() number_of_die_rolls = 0 # while (player_1_score < 1000 and player_2_score < 1000): # for i in range(6): whi...
player_1_position = 7 player_2_position = 10 player_1_score = 0 player_2_score = 0 def roll_die(): i = 1 while 1: yield i i += 1 if i > 100: i = 1 roll = roll_die() number_of_die_rolls = 0 while 1: three_die_rolls = next(roll) + next(roll) + next(roll) number_of_die_...
class RevasCalculations: '''Functions related to calculations go there ''' pass
class Revascalculations: """Functions related to calculations go there """ pass
list = [ 'abcd', 786 , 2.23, 'john', 70.2 ] tinylist = [123, 'john'] print(list) # Prints complete list print(list[0]) # Prints first element of the list print(list[1:3]) # Prints elements starting from 2nd till 3rd print(list[2:]) # Prints elements starting from 3rd element print(tinylist * 2) ...
list = ['abcd', 786, 2.23, 'john', 70.2] tinylist = [123, 'john'] print(list) print(list[0]) print(list[1:3]) print(list[2:]) print(tinylist * 2) print(list + tinylist)
def solve(s): word_list = s.split(' ') name_capitalized = [] for word in word_list: name_capitalized.append(word.capitalize()) word = ' '.join(name_capitalized) return word
def solve(s): word_list = s.split(' ') name_capitalized = [] for word in word_list: name_capitalized.append(word.capitalize()) word = ' '.join(name_capitalized) return word
#!/usr/bin/python print('Content-type: text/plain\n\n') print('script cgi with GET')
print('Content-type: text/plain\n\n') print('script cgi with GET')
OLD_EXP_PER_HOUR = 10 OLD_TIME_TO_LVL_DELTA = 5 NEW_EXP_PER_HOUR = 10 NEW_TIME_TO_LVL_DELTA = 7 NEW_TIME_TO_LVL_MULTIPLIER = 1.02 def old_level_to_exp(level, exp): total_exp = exp for i in range(2, level + 1): total_exp += i * OLD_TIME_TO_LVL_DELTA * OLD_EXP_PER_HOUR return total_exp def new_...
old_exp_per_hour = 10 old_time_to_lvl_delta = 5 new_exp_per_hour = 10 new_time_to_lvl_delta = 7 new_time_to_lvl_multiplier = 1.02 def old_level_to_exp(level, exp): total_exp = exp for i in range(2, level + 1): total_exp += i * OLD_TIME_TO_LVL_DELTA * OLD_EXP_PER_HOUR return total_exp def new_time_...
#!/usr/bin/env python3 # probleme des 8 dames def printGrid(grid): for y in range(8): print(8 - y, end=" |") for x in range(8): print(grid[x][y], "", end="") print() print("------------------") print("X |A B C D E F G H") grid = [[0] * 8 for _ in range(8)] for j in ran...
def print_grid(grid): for y in range(8): print(8 - y, end=' |') for x in range(8): print(grid[x][y], '', end='') print() print('------------------') print('X |A B C D E F G H') grid = [[0] * 8 for _ in range(8)] for j in range(8): for i in range(8): grid[i][j]...
class Bicicleta: def __init__(self, marca, aro, calibragem): self.marca = marca; self.aro = aro; self.calibragem = calibragem; def __str__(self): string = "Marca: "+self.marca+"\nAro: "+str(self.aro)+"\nCalibragem: "+str(self.calibragem) return string def getMarca(...
class Bicicleta: def __init__(self, marca, aro, calibragem): self.marca = marca self.aro = aro self.calibragem = calibragem def __str__(self): string = 'Marca: ' + self.marca + '\nAro: ' + str(self.aro) + '\nCalibragem: ' + str(self.calibragem) return string def ge...
with open("spiderman.txt") as song: print(song.read(2)) print(song.read(8)) print(song.read())
with open('spiderman.txt') as song: print(song.read(2)) print(song.read(8)) print(song.read())
# -*- coding: utf-8 -*- # # Specifies the name of the last variable considered # before plotting # lastvar = "k" # # Specifies the columns to be plotted # and its label (in grace format) # col_contents = [(1, "\\f{Symbol} <r>"), (2, "\\f{Symbol} <dr>"), (3, "U\\sl")] # # Specifies the grace format of the x axis # ...
lastvar = 'k' col_contents = [(1, '\\f{Symbol} <r>'), (2, '\\f{Symbol} <dr>'), (3, 'U\\sl')] xlabel = '\\f{Times-Italic}P'
print(open('teste_win1252.txt', errors='strict').read()) print(open('teste_win1252.txt', errors='replace').read()) print(open('teste_win1252.txt', errors='ignore').read()) print(open('teste_win1252.txt', errors='surrogateescape').read()) print(open('teste_win1252.txt', errors='backslashreplace').read())
print(open('teste_win1252.txt', errors='strict').read()) print(open('teste_win1252.txt', errors='replace').read()) print(open('teste_win1252.txt', errors='ignore').read()) print(open('teste_win1252.txt', errors='surrogateescape').read()) print(open('teste_win1252.txt', errors='backslashreplace').read())
# -------------- class_1 = ["Geoffrey Hinton", "Andrew Ng", "Sebastian Raschka", "Yoshua Bengio"] class_2 = ["Hilary Mason", "Carla Gentry", "Corinna Cortes"] new_class = class_1 + class_2 print(new_class) new_class.append("Peter Warden") print(new_class) new_class.remove("Carla Gentry") print(new_class) course...
class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio'] class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes'] new_class = class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_class) courses = {'Math': 65, 'English...
first_name = "ada" last_name = "lovelace" full_name = f"{first_name} {last_name}" #print(full_name) #print(f"Hello, {full_name.title()}!") message = f"Hello, {full_name.title()}!" print(message) #print("\tPython") #print("Languages:\nPython\nC\nJavaScript") print("Languages:\n\tPython\n\tC\n\tJavaScript")
first_name = 'ada' last_name = 'lovelace' full_name = f'{first_name} {last_name}' message = f'Hello, {full_name.title()}!' print(message) print('Languages:\n\tPython\n\tC\n\tJavaScript')
class FakeConfig(object): def __init__( self, src_dir=None, spec_dir=None, stylesheet_urls=None, script_urls=None, stop_spec_on_expectation_failure=False, stop_on_spec_failure=False, random=True ): self._src_...
class Fakeconfig(object): def __init__(self, src_dir=None, spec_dir=None, stylesheet_urls=None, script_urls=None, stop_spec_on_expectation_failure=False, stop_on_spec_failure=False, random=True): self._src_dir = src_dir self._spec_dir = spec_dir self._stylesheet_urls = stylesheet_urls ...
class Timer: def __init__(self, bot, ring_every=1.0): self.bot = bot self.last_ring = 0.0 self.ring_every = ring_every @property def rings(self): if (self.bot.time - self.last_ring) >= self.ring_every: self.last_ring = self.bot.time return True ...
class Timer: def __init__(self, bot, ring_every=1.0): self.bot = bot self.last_ring = 0.0 self.ring_every = ring_every @property def rings(self): if self.bot.time - self.last_ring >= self.ring_every: self.last_ring = self.bot.time return True ...
#!/usr/bin/python3 class ComplexThing: def __init__(self, name, data): self.name = name self.data = data def __str__(self): return self.name + ": " + str(self.data)
class Complexthing: def __init__(self, name, data): self.name = name self.data = data def __str__(self): return self.name + ': ' + str(self.data)
CATEGORIES = [ ('Arts & Entertainment', [ 'Books & Literature', 'Celebrity Fan/Gossip', 'Fine Art', 'Humor', 'Movies', 'Music', 'Television' ]), ('Automotive', [ 'Auto Parts', 'Auto Repair', 'Buying/Selling Cars', 'Car C...
categories = [('Arts & Entertainment', ['Books & Literature', 'Celebrity Fan/Gossip', 'Fine Art', 'Humor', 'Movies', 'Music', 'Television']), ('Automotive', ['Auto Parts', 'Auto Repair', 'Buying/Selling Cars', 'Car Culture', 'Certified Pre-Owned', 'Convertible', 'Coupe', 'Crossover', 'Diesel', 'Electric Vehicle', 'Hatc...
print( "Welcome to the Shape Generator:" ) cont = True shape1 = 0 shape2 = 0 shape3 = 0 shape4 = 0 shape5 = 0 shape6 = 0 drawAnotherShape = False def menu(): print() print( "This program draw the following shapes:" ) print( f"{'1) Horizontal Line':>20s}" ) print( f"{'2) Vertical Line':>18s}" ) pr...
print('Welcome to the Shape Generator:') cont = True shape1 = 0 shape2 = 0 shape3 = 0 shape4 = 0 shape5 = 0 shape6 = 0 draw_another_shape = False def menu(): print() print('This program draw the following shapes:') print(f"{'1) Horizontal Line':>20s}") print(f"{'2) Vertical Line':>18s}") print(f"{'...
num = 45 # symVal = {1000:'M',900:'CM',500:'D',400:'CD',100:'C',90:'XC',50:'L',40:'XL',10:'X',9:'IX',5:'V',4:'IV',1:'I'} # romanNum = '' # i = 0 # while num > 0 : # curVal = list(symVal)[i] # for _ in range(num // curVal): # # if (divmod(num,4)[1] == 0 or divmod(num,9)[1] == 0): # romanNum += ...
num = 45 class Solution(object): def __init__(self): self.roman = '' def int_to_roman(self, num): self.num = num self.checkRoman(1000, 'M') self.checkRoman(500, 'D') self.checkRoman(100, 'C') self.checkRoman(50, 'L') self.checkRoman(10, 'X') sel...
# -*- coding: utf-8 -*- TO_EXCLUDE = [ "ACITAK", "ACITAK", "ADASUW", "AFEHOL", "AFENAA", "AFENAA", "AMUTEI", "AQUCOF", "AQUCOF", "AQUDAS", "AQUDAS", "ARADEE", "ATAGOQ", "ATAGOR", "ATAGOR", "BAXLA", "BAXLAP", "BAXLAP", "BICPOV", "BICPOV", ...
to_exclude = ['ACITAK', 'ACITAK', 'ADASUW', 'AFEHOL', 'AFENAA', 'AFENAA', 'AMUTEI', 'AQUCOF', 'AQUCOF', 'AQUDAS', 'AQUDAS', 'ARADEE', 'ATAGOQ', 'ATAGOR', 'ATAGOR', 'BAXLA', 'BAXLAP', 'BAXLAP', 'BICPOV', 'BICPOV', 'BIYWAK', 'BIYWAK', 'BIZLOO', 'BUHVOP', 'BUPVEP', 'BUXZAX', 'CAVWEC', 'CIGXIA', 'COFYOM', 'COFYOM', 'COFYOM...
# -*- coding: utf-8 -*- URL = '127.0.0.1' PORT = 27017 DATABASE = 'MyFunctions' COLLECTION = 'FunctionCheckers' FILE_PATH = '../examples/functions.py' CATCHER = 'result' IMPORT_POST = True STATIC_POST = True FUNC_POST = True
url = '127.0.0.1' port = 27017 database = 'MyFunctions' collection = 'FunctionCheckers' file_path = '../examples/functions.py' catcher = 'result' import_post = True static_post = True func_post = True
#Parsing and Extracting data= "From Stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008" atpos= data.find("@") print(atpos) atss= data.find(" ",atpos) #here it starts at 21 and then goes and find the next space print(atss) host= data[atpos+1: atss] #Now we are extracting the part that we are interested in print(host) #...
data = 'From Stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008' atpos = data.find('@') print(atpos) atss = data.find(' ', atpos) print(atss) host = data[atpos + 1:atss] print(host)
# Solution def part1(data): stack = [] meta_sum = 0 gen = input_gen(data) for x in gen: if x != 0 or len(stack) % 2 == 1: stack.append(x) continue m = next(gen) while m > 0 or len(stack) > 0: for _ in range(m): meta_sum += next(...
def part1(data): stack = [] meta_sum = 0 gen = input_gen(data) for x in gen: if x != 0 or len(stack) % 2 == 1: stack.append(x) continue m = next(gen) while m > 0 or len(stack) > 0: for _ in range(m): meta_sum += next(gen) ...
## IMPORTANT: Must be loaded after `02-service-common.py ## announcement service service_env = dict() service_url = f'{hub_hostname}:{service_port}' if c.JupyterHub.internal_ssl: # if we are using end-to-end mTLS, then pass # certs to service and set scheme to `https` # TODO: Generate certs automatic...
service_env = dict() service_url = f'{hub_hostname}:{service_port}' if c.JupyterHub.internal_ssl: pki_store = c.JupyterHub.internal_certs_location service_env = {'JUPYTERHUB_SSL_CERTFILE': f'{PKI_STORE}/hub-internal/hub-internal.crt', 'JUPYTERHUB_SSL_KEYFILE': f'{PKI_STORE}/hub-internal/hub-internal.key', 'JUPY...