content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" Given an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). Follow up: Recursive solution is trivial, could you do it iteratively? Example 1: htt...
""" Given an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). Follow up: Recursive solution is trivial, could you do it iteratively? Example 1: htt...
class TableViewUIUtils(object): """ This utility class contains members that involve the Revit UI and operate on schedule views or MEP electrical panel schedules. """ @staticmethod def TestCellAndPromptToEditTypeParameter(tableView,sectionType,row,column): """ TestCellAndPromptToEditTypeParameter(tableView:...
class Tableviewuiutils(object): """ This utility class contains members that involve the Revit UI and operate on schedule views or MEP electrical panel schedules. """ @staticmethod def test_cell_and_prompt_to_edit_type_parameter(tableView, sectionType, row, column): """ TestCellAndPromptToEditTyp...
# Q5. Write a program to implement OOPs concepts in python i.e. inheritance etc. class Person: def __init__(self, name, age, address): # constructor self.name = name self.age = age self.address = address def set_data(self, name, age, address): self.name = name self.age = age self.address...
class Person: def __init__(self, name, age, address): self.name = name self.age = age self.address = address def set_data(self, name, age, address): self.name = name self.age = age self.address = address def get_data(self): print('Name : ', self.nam...
class PolarPoint(): def __init__(self, angle, radius): self.angle = angle self.radius = radius
class Polarpoint: def __init__(self, angle, radius): self.angle = angle self.radius = radius
def mu(i, lo=0, hi=None): hi = hi or len(i.has) return sum([i.x(i.has[j]) for j in range(lo, hi)]) / (hi - lo) class Some(o): "Collect some examples, not all." hi = 256 # max number of items to collect def __init__(i, pos=0, txt=" ", inits=[]): i.pos, i.txt, i.n, i._all, i.sorted = pos, txt, 0, [], Fa...
def mu(i, lo=0, hi=None): hi = hi or len(i.has) return sum([i.x(i.has[j]) for j in range(lo, hi)]) / (hi - lo) class Some(o): """Collect some examples, not all.""" hi = 256 def __init__(i, pos=0, txt=' ', inits=[]): (i.pos, i.txt, i.n, i._all, i.sorted) = (pos, txt, 0, [], False) i...
''' Truth tables for logical expressions. Define predicates and/2, or/2, nand/2, nor/2, xor/2, impl/2 and equ/2 (for logical equivalence) which succeed or fail according to the result of their respective operations; e.g. and(A,B) will succeed, if and only if both A and B succeed. Note that A and B can be Prolog goa...
""" Truth tables for logical expressions. Define predicates and/2, or/2, nand/2, nor/2, xor/2, impl/2 and equ/2 (for logical equivalence) which succeed or fail according to the result of their respective operations; e.g. and(A,B) will succeed, if and only if both A and B succeed. Note that A and B can be Prolog goa...
''' *000*000* 0*00*00*0 00*0*0*00 000***000 Utkarsh ''' l=int(input()) b=int(input()) print("With for\n") for i in range(1,b+1): for j in range(1,l+1): if j==(l+1)//2 or j==i or j==(l+1)-i: print('*',end='') else: print('0',end='') print() i=1 j=1 print("\nWith while\n")...
""" *000*000* 0*00*00*0 00*0*0*00 000***000 Utkarsh """ l = int(input()) b = int(input()) print('With for\n') for i in range(1, b + 1): for j in range(1, l + 1): if j == (l + 1) // 2 or j == i or j == l + 1 - i: print('*', end='') else: print('0', end='') print() i = 1 j...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: flat class SeriesLengthOption(object): Unlimited = 0 Three_Games = 1 Five_Games = 2 Seven_Games = 3
class Serieslengthoption(object): unlimited = 0 three__games = 1 five__games = 2 seven__games = 3
"""69. Sqrt(x) https://leetcode.com/problems/sqrtx/ Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 ...
"""69. Sqrt(x) https://leetcode.com/problems/sqrtx/ Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 ...
# coding: utf-8 __author__ = 'tack' class Position(object): ''' position ''' def __init__(self, code, num, price, commission, date): ''' Args: code: stock code price: cost price commission: commission num: num date: date ...
__author__ = 'tack' class Position(object): """ position """ def __init__(self, code, num, price, commission, date): """ Args: code: stock code price: cost price commission: commission num: num date: date """ s...
with open("p022_names.txt","r") as names: names = names.read().replace("\"","").split(",") names.sort() Sum = 0 length = len(names) for position in range(length): alphavalue=0 for j in names[position]: alphavalue += (ord(j)-64) Sum += (alphavalue * (position+1)) print(Sum)
with open('p022_names.txt', 'r') as names: names = names.read().replace('"', '').split(',') names.sort() sum = 0 length = len(names) for position in range(length): alphavalue = 0 for j in names[position]: alphavalue += ord(j) - 64 sum += alphavalue * (position + 1) print(Sum)
config = { 'population_size' : 100, 'mutation_probability' : .1, 'crossover_rate' : .9, # maximum simulation runs before finishing 'max_runs' : 100, # maximum timesteps per simulation 'max_timesteps' : 150, # smoothness value of the line in [0, 1] 'line_smoothness' : .4, # Bound ...
config = {'population_size': 100, 'mutation_probability': 0.1, 'crossover_rate': 0.9, 'max_runs': 100, 'max_timesteps': 150, 'line_smoothness': 0.4, 'max_gain_value': 3, 'new_map': True, 'runs_per_screenshot': 10, 'data_directory': '/home/monk/genetic_pid_data', 'map_filename': 'map.csv'}
expected_output = { 'mstp': { 'blocked-ports': { 'mst_instances': { '0': { 'mst_id': '0', 'interfaces': { 'GigabitEthernet0/0/4/4': { 'name': 'GigabitEthe...
expected_output = {'mstp': {'blocked-ports': {'mst_instances': {'0': {'mst_id': '0', 'interfaces': {'GigabitEthernet0/0/4/4': {'name': 'GigabitEthernet0/0/4/4', 'cost': 200000, 'role': 'ALT', 'port_priority': 128, 'port_num': 196, 'port_state': 'BLK', 'designated_bridge_priority': 4097, 'designated_bridge_address': '00...
class Solution: def containsNearbyAlmostDuplicate(self, nums: List[int], k: int, t: int) -> bool: tup = [(ind, i) for ind, i in enumerate(nums)] tup.sort(key=lambda x: x[1]) for i in range(len(tup)): for j in range(i+1, len(tup)): if abs(tup[i][1]-tup[j][1])>t: ...
class Solution: def contains_nearby_almost_duplicate(self, nums: List[int], k: int, t: int) -> bool: tup = [(ind, i) for (ind, i) in enumerate(nums)] tup.sort(key=lambda x: x[1]) for i in range(len(tup)): for j in range(i + 1, len(tup)): if abs(tup[i][1] - tup[j]...
del_items(0x80139F2C) SetType(0x80139F2C, "void PresOnlyTestRoutine__Fv()") del_items(0x80139F54) SetType(0x80139F54, "void FeInitBuffer__Fv()") del_items(0x80139F7C) SetType(0x80139F7C, "void FeAddEntry__Fii8TXT_JUSTUsP7FeTableP5CFont(int X, int Y, enum TXT_JUST Just, unsigned short Str, struct FeTable *MenuPtr, struc...
del_items(2148769580) set_type(2148769580, 'void PresOnlyTestRoutine__Fv()') del_items(2148769620) set_type(2148769620, 'void FeInitBuffer__Fv()') del_items(2148769660) set_type(2148769660, 'void FeAddEntry__Fii8TXT_JUSTUsP7FeTableP5CFont(int X, int Y, enum TXT_JUST Just, unsigned short Str, struct FeTable *MenuPtr, st...
# -*- coding: utf-8 -*- # Create and print a dictionary: thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 } print(thisdict) # Duplicate values will overwrite existing values: thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964, "year": 2020 } print(thisdict) # String, int, boolean, and list dat...
thisdict = {'brand': 'Ford', 'model': 'Mustang', 'year': 1964} print(thisdict) thisdict = {'brand': 'Ford', 'model': 'Mustang', 'year': 1964, 'year': 2020} print(thisdict) thisdict = {'brand': 'Ford', 'electric': False, 'year': 1964, 'colors': ['red', 'white', 'blue']} child1 = {'name': 'Emil', 'year': 2004} child2 = {...
''' e. and use all methods ''' ''' also try different exception like java file,array,string,numberformat ''' ''' user define exception ''' try: raise Exception('spam,','eggs') except Exception as inst: print("Type of instance : ",type(inst)) # the exception instance print("Arguments of instance : ",inst.ar...
""" e. and use all methods """ ' also try different exception like java file,array,string,numberformat ' ' user define exception ' try: raise exception('spam,', 'eggs') except Exception as inst: print('Type of instance : ', type(inst)) print('Arguments of instance : ', inst.args) print('Instance print :...
def is_palindrome_number(number): return number == int(str(number)[::-1]) def infinite_sequence(): num = 0 while True: yield num num += 1 for number in infinite_sequence(): if is_palindrome_number(number): print(number) def countdown_from(number): print(f"Starting to co...
def is_palindrome_number(number): return number == int(str(number)[::-1]) def infinite_sequence(): num = 0 while True: yield num num += 1 for number in infinite_sequence(): if is_palindrome_number(number): print(number) def countdown_from(number): print(f'Starting to count ...
TEST_ROOT_TABLES = { "tenders": ["/tender"], "awards": ["/awards"], "contracts": ["/contracts"], "planning": ["/planning"], "parties": ["/parties"], } TEST_COMBINED_TABLES = { "documents": [ "/planning/documents", "/tender/documents", "/awards/documents", "/contra...
test_root_tables = {'tenders': ['/tender'], 'awards': ['/awards'], 'contracts': ['/contracts'], 'planning': ['/planning'], 'parties': ['/parties']} test_combined_tables = {'documents': ['/planning/documents', '/tender/documents', '/awards/documents', '/contracts/documents', '/contracts/implementation/documents'], 'mile...
"""Diagnose audio and other input data for ML pipelines >>> print('hello') hello """
"""Diagnose audio and other input data for ML pipelines >>> print('hello') hello """
def pattern_nineteen(steps): ''' Pattern nineteen 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24...
def pattern_nineteen(steps): """ Pattern nineteen 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36...
n1 = float(input('qual a primeira nota? ')) n2 = float(input('qual a segunda nota? ')) soma = n1 + n2 media = (n1 + n2) / 2 print('a soma das notas foi {:.2f}, e a sua media foi de {:.2f}'.format(soma, media))
n1 = float(input('qual a primeira nota? ')) n2 = float(input('qual a segunda nota? ')) soma = n1 + n2 media = (n1 + n2) / 2 print('a soma das notas foi {:.2f}, e a sua media foi de {:.2f}'.format(soma, media))
''' 02 - Creating dummy variables As Andy discussed in the video, scikit-learn does not accept non-numerical features. You saw in the previous exercise that the 'Region' feature contains very useful information that can predict life expectancy. For example: Sub-Saharan Africa has a lower life expectancy compar...
""" 02 - Creating dummy variables As Andy discussed in the video, scikit-learn does not accept non-numerical features. You saw in the previous exercise that the 'Region' feature contains very useful information that can predict life expectancy. For example: Sub-Saharan Africa has a lower life expectancy compar...
# Given three colinear points p, q, r, the function checks if # point q lies on line segment 'pr' def onSegment(p, q, r): if ( (q.position[0] <= max(p.position[0], r.position[0])) and (q.position[0] >= min(p.position[0], r.position[0])) and (q.position[1] <= max(p.position[1], r.position[1])) and ...
def on_segment(p, q, r): if q.position[0] <= max(p.position[0], r.position[0]) and q.position[0] >= min(p.position[0], r.position[0]) and (q.position[1] <= max(p.position[1], r.position[1])) and (q.position[1] >= min(p.position[1], r.position[1])): return True return False def orientation(p, q, r): ...
class SystemCallFault(Exception): def __init__(self): pass def __str__(self): return 'System not give expect response.' class NecessaryLibraryNotFound(Exception): def __init__(self,value = '?'): self.value = value def __str__(self): return 'Necessary library \'%s\' n...
class Systemcallfault(Exception): def __init__(self): pass def __str__(self): return 'System not give expect response.' class Necessarylibrarynotfound(Exception): def __init__(self, value='?'): self.value = value def __str__(self): return "Necessary library '%s' not ...
string = "Character" print(string[2]) # string[2] = 'A' not change it # string.replace('a','A') we can replace it but it cannot change the our string variables. new_string = string.replace('a','A') print(new_string)
string = 'Character' print(string[2]) new_string = string.replace('a', 'A') print(new_string)
## CvAltRoot ## ## Tells BUG where to locate its files when it cannot find them normally. ## This is common when using the /AltRoot Civ4 feature or sometimes on ## non-English operating systems and Windows Vista. ## ## HOW TO USE ## ## 1. Change the text in the quotes below to match the full path to the ## ...
root_dir = 'C:/Documents and Settings/[UserName]/My Documents/My Games/Beyond the Sword'
####################################################################### # Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) # # Permission given to modify the code as long as you keep this # # declaration at the top # ################################...
class Config: q_target = 0 expected_sarsa_target = 1 def __init__(self): self.task_fn = None self.optimizer_fn = None self.actor_optimizer_fn = None self.critic_optimizer_fn = None self.network_fn = None self.actor_network_fn = None self.critic_networ...
# question 1 A = 3 B = 3 C = (-5) X = 8.8 Y = 3.5 Z = (-5.2) print(A % C) print(A * B / C) print((A * C) % C) print(X / Y) print(X / (X + Y)) print(int(X) % int(Y)) # question 2 A = float(input("the number you want to round off:")) print(round(A)) # question 3 A = float(input("length in CM:")) B = float(input("length...
a = 3 b = 3 c = -5 x = 8.8 y = 3.5 z = -5.2 print(A % C) print(A * B / C) print(A * C % C) print(X / Y) print(X / (X + Y)) print(int(X) % int(Y)) a = float(input('the number you want to round off:')) print(round(A)) a = float(input('length in CM:')) b = float(input('length in CM:')) c = A / (12 * 5 / 2) d = B * 5 / 2 p...
# coding=utf-8 setThrowException(True) class Nautilus: REMOTE = 0 LOCAL = 1 _tab = None _dirs = {} def __init__(self): self._dirs = {self.LOCAL: [], self.REMOTE: []} self._startNautilus() self._initWebdav() sleep(1) self._initLocal() def _startNautilus(self): ...
set_throw_exception(True) class Nautilus: remote = 0 local = 1 _tab = None _dirs = {} def __init__(self): self._dirs = {self.LOCAL: [], self.REMOTE: []} self._startNautilus() self._initWebdav() sleep(1) self._initLocal() def _start_nautilus(self): ...
def policy_threshold(threshold, belief, loc): """ chooses whether to switch side based on whether the belief on the current site drops below the threshold Args: threshold (float): the threshold of belief on the current site, when the belief is lower than the threshold, switch si...
def policy_threshold(threshold, belief, loc): """ chooses whether to switch side based on whether the belief on the current site drops below the threshold Args: threshold (float): the threshold of belief on the current site, when the belief is lower than the threshold, switch ...
print((2**64).to_bytes(9, "little",signed=False)) #signed shall be False by default print((2**64).to_bytes(9, "little")) # test min/max signed value for i in [10]: v = 2**(i*8 - 1) - 1 print(v) vbytes = v.to_bytes(i, "little") print(vbytes) print(int.from_bytes(vbytes,"little")) v = - (2**(i*8...
print((2 ** 64).to_bytes(9, 'little', signed=False)) print((2 ** 64).to_bytes(9, 'little')) for i in [10]: v = 2 ** (i * 8 - 1) - 1 print(v) vbytes = v.to_bytes(i, 'little') print(vbytes) print(int.from_bytes(vbytes, 'little')) v = -2 ** (i * 8 - 1) print(v) vbytes = v.to_bytes(i, 'littl...
x = int(input('Podaj pierwsza liczbe calkowita: ')) y = int(input('Podaj druga liczbe calkowita: ')) print() print(x%y) print(y%x) print() print(x//y) print(y//x)
x = int(input('Podaj pierwsza liczbe calkowita: ')) y = int(input('Podaj druga liczbe calkowita: ')) print() print(x % y) print(y % x) print() print(x // y) print(y // x)
SEAL_CHECKER = 9300535 SEAL_OF_TIME_1 = 2159363 SEAL_OF_TIME_2 = 2159364 SEAL_OF_TIME_3 = 2159365 SEAL_OF_TIME_4 = 2159366 sm.giveSkill(20041222) sm.setFuncKeyByScript(True, 20041222, 42) sm.spawnMob(SEAL_CHECKER, 550, -298, False) sm.spawnMob(SEAL_CHECKER, 107, -508, False) sm.spawnMob(SEAL_CHECKER, -195, -508, Fals...
seal_checker = 9300535 seal_of_time_1 = 2159363 seal_of_time_2 = 2159364 seal_of_time_3 = 2159365 seal_of_time_4 = 2159366 sm.giveSkill(20041222) sm.setFuncKeyByScript(True, 20041222, 42) sm.spawnMob(SEAL_CHECKER, 550, -298, False) sm.spawnMob(SEAL_CHECKER, 107, -508, False) sm.spawnMob(SEAL_CHECKER, -195, -508, False)...
"""testpackagepypi - test""" __version__ = '0.1.0' __author__ = 'Dominik Haitz <dominik.haitz at ...>' __all__ = []
"""testpackagepypi - test""" __version__ = '0.1.0' __author__ = 'Dominik Haitz <dominik.haitz at ...>' __all__ = []
description = 'minimal NICOS startup setup' group = 'lowlevel' sysconfig = dict( cache = 'tofhw.toftof.frm2:14869', )
description = 'minimal NICOS startup setup' group = 'lowlevel' sysconfig = dict(cache='tofhw.toftof.frm2:14869')
class BaseStrategy(object): def get_next_move(self, board): raise NotImplementedError class MoveFirst(BaseStrategy): pass
class Basestrategy(object): def get_next_move(self, board): raise NotImplementedError class Movefirst(BaseStrategy): pass
"""Code generated by gazelle. DO NOT EDIT.""" load("@bazel_gazelle//:deps.bzl", "go_repository") def go_dependencies(): """go_dependencies.""" go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", sum = "h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=", ...
"""Code generated by gazelle. DO NOT EDIT.""" load('@bazel_gazelle//:deps.bzl', 'go_repository') def go_dependencies(): """go_dependencies.""" go_repository(name='co_honnef_go_tools', importpath='honnef.co/go/tools', sum='h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=', version='v0.0.1-2020.1.4') go_repos...
""" The `~certbot_dns_rrpproxy.dns_rrpproxy` plugin automates the process of completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and subsequently removing, TXT records using the RRPproxy API. Named Arguments --------------- ======================================== =============================...
""" The `~certbot_dns_rrpproxy.dns_rrpproxy` plugin automates the process of completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and subsequently removing, TXT records using the RRPproxy API. Named Arguments --------------- ======================================== =============================...
VERSION = "1.0.0-beta.15" LANGUAGE = "python" PROJECT = "versionhelper" _p = "versionhelper.libvh." API = {_p + "version_helper" : {"arguments" : ("filename str", ), "keywords" : {"directory" : "directory str", "version" : "str", ...
version = '1.0.0-beta.15' language = 'python' project = 'versionhelper' _p = 'versionhelper.libvh.' api = {_p + 'version_helper': {'arguments': ('filename str',), 'keywords': {'directory': 'directory str', 'version': 'str', 'prerelease': 'str', 'build_metadata': 'str', 'db': 'filename str', 'checker': 'filename str', '...
#Build a Bus/Air/Rail Booking System where the user can choose a source and destination from the list given and enter the information passenger wise, depending on the distance cost shall be computed. #Bus,Rail and Air systems will have different fares for different classes.You should be able to think of the system as ...
mode = input('Hello! Welcome to the automated ticket system. Please enter a method how you would like to travel (Bus, Air or Rail): ').lower() transport = {'bus': 500, 'air': 4000, 'rail': 1500} cost = 0 place = {'mumbai': 1000, 'hydrabad': 900, 'chennai': 1200, 'bangalore': 950} if mode == 'bus' or mode == 'air' or mo...
''' Author: Shuailin Chen Created Date: 2021-08-17 Last Modified: 2021-08-17 content: ''' _base_= [ '../_base_/models/bit_pos_s4_dd8.py', '../_base_/datasets/s2looking.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' ] data = dict( samples_per_gpu=8, workers_per_g...
""" Author: Shuailin Chen Created Date: 2021-08-17 Last Modified: 2021-08-17 content: """ _base_ = ['../_base_/models/bit_pos_s4_dd8.py', '../_base_/datasets/s2looking.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'] data = dict(samples_per_gpu=8, workers_per_gpu=8) evaluation = dict(metric...
#need prompt for pet type #build pet dictionary #give toys, feed pet, let game loop, while printing menu pet = {"name":"", "type": "", "age": 0, "hunger": 0, "playfulness" : 0, "toys": []} pettoys = {"cat": ["String", "Cardboard Box", "Scratching Post"], "dog": ["Frisbee","Tennis Ball", "Stick"], "fish": ["Underse...
pet = {'name': '', 'type': '', 'age': 0, 'hunger': 0, 'playfulness': 0, 'toys': []} pettoys = {'cat': ['String', 'Cardboard Box', 'Scratching Post'], 'dog': ['Frisbee', 'Tennis Ball', 'Stick'], 'fish': ['Undersea Castle', 'Buried Treasure', 'Coral']} def quitsim(): print("That's the end of the game! Thank you for ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def middleNode(self, head): """ :type head: ListNode :rtype: ListNode """ val_list = [head.val] node = head ...
class Solution: def middle_node(self, head): """ :type head: ListNode :rtype: ListNode """ val_list = [head.val] node = head node_count = 1 while node.next: node = node.next val_list.append(node.val) node_count += 1...
RAWDATA_DIR = '/staging/as/skchoudh/rna-seq-datasets/single/gallus_gallus/SRP007412' OUT_DIR = '/staging/as/skchoudh/rna-seq-output/gallus_gallus/SRP007412' CDNA_FA_GZ = '/home/cmb-panasas2/skchoudh/genomes/gallus_gallus/cdna/Gallus_gallus.Gallus_gallus-5.0.cdna.all.fa.gz' CDNA_IDX = '/home/cmb-panasas2/skchoudh/g...
rawdata_dir = '/staging/as/skchoudh/rna-seq-datasets/single/gallus_gallus/SRP007412' out_dir = '/staging/as/skchoudh/rna-seq-output/gallus_gallus/SRP007412' cdna_fa_gz = '/home/cmb-panasas2/skchoudh/genomes/gallus_gallus/cdna/Gallus_gallus.Gallus_gallus-5.0.cdna.all.fa.gz' cdna_idx = '/home/cmb-panasas2/skchoudh/genome...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- TIME_WIND...
time_window = u'Microsoft.TimeWindow' percentage = u'Microsoft.Percentage' targeting = u'Microsoft.Targeting'
def check_rewrite_data(data, data_path): with open(data_path, 'w') as output_data: first_is_name = False need_line = False seq_num = 0 for x in data: x = x.strip() if not x: continue if x[0] == '>': x = ada...
def check_rewrite_data(data, data_path): with open(data_path, 'w') as output_data: first_is_name = False need_line = False seq_num = 0 for x in data: x = x.strip() if not x: continue if x[0] == '>': x = adapt_pe_pfor...
n, min_val, max_val = int(input('n=')), int(input('minimum=')), int(input('maximum=')) c = i = 0 while True: i, sq = i+1, i**n if sq in range(min_val, max_val+1): c += 1 if sq > max_val: break print(f'{c} values raised to the power {n} lie in the range {min_val}, {max_val}')
(n, min_val, max_val) = (int(input('n=')), int(input('minimum=')), int(input('maximum='))) c = i = 0 while True: (i, sq) = (i + 1, i ** n) if sq in range(min_val, max_val + 1): c += 1 if sq > max_val: break print(f'{c} values raised to the power {n} lie in the range {min_val}, {max_val}')
_base_ = [ '../_base_/models/fpn_r50.py', '../_base_/datasets/FoodSeg103.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' ] model = dict(pretrained='./pretrained_model/R50_ReLeM.pth', backbone=dict(type='ResNet'), decode_head=dict(num_classes=104)) optimizer...
_base_ = ['../_base_/models/fpn_r50.py', '../_base_/datasets/FoodSeg103.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'] model = dict(pretrained='./pretrained_model/R50_ReLeM.pth', backbone=dict(type='ResNet'), decode_head=dict(num_classes=104)) optimizer_config = dict() runner = dict(type='I...
def me(**kwargs): for key, value in kwargs.items(): print("{0}=={1}". format(key, value)) me(name="Rahim", ID=18) me(name="Ariful", age=109) me(age=10)
def me(**kwargs): for (key, value) in kwargs.items(): print('{0}=={1}'.format(key, value)) me(name='Rahim', ID=18) me(name='Ariful', age=109) me(age=10)
class Query: """ Class representing a single query to be executed on the database. """ def __init__(self): self.__select = "*" self.__from = None self.__where = None self.__group_by = None self.__having = None self.__order_by = None self.__limit = ...
class Query: """ Class representing a single query to be executed on the database. """ def __init__(self): self.__select = '*' self.__from = None self.__where = None self.__group_by = None self.__having = None self.__order_by = None self.__limit =...
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Adekunle Oliver Adebajo\n", "### 20120612016\n", "### adekunle.adebajo@pau.edu.ng\n", "### the following codes consist of class exercises involving problem solving" ] }, { "cell_type": "code", "execution_co...
{'cells': [{'cell_type': 'markdown', 'metadata': {}, 'source': ['### Adekunle Oliver Adebajo\n', '### 20120612016\n', '### adekunle.adebajo@pau.edu.ng\n', '### the following codes consist of class exercises involving problem solving']}, {'cell_type': 'code', 'execution_count': 17, 'metadata': {}, 'outputs': [{'name': '...
# Standard tuning of each string GUITAR_STAFF: dict = {0: 'E', 1: 'A', 2: 'D', 3: 'G', 4: 'B', 5: 'E'} UKULELE_STAFF: dict = {0: 'G', 1: 'C', 2: 'E', 3: 'A'} # Number of strings GUITAR_STRING = 6 UKULELE_STRING = 4 # MIDI metadata TIME_SIGNATURE = 'time_signature' NOTE_ON = 'note_on' NOTE_OFF = 'note_off' HALF_NOTE =...
guitar_staff: dict = {0: 'E', 1: 'A', 2: 'D', 3: 'G', 4: 'B', 5: 'E'} ukulele_staff: dict = {0: 'G', 1: 'C', 2: 'E', 3: 'A'} guitar_string = 6 ukulele_string = 4 time_signature = 'time_signature' note_on = 'note_on' note_off = 'note_off' half_note = 'half' whole_note = 'whole' quarter_note = 'quarter' eighth_note = 'ei...
#divide 2 numbers x = int(input("Enter first number :")) y = int(input("Enter second number :")) answer = int(x/y) remainder = x % y print("{} divided by {} is {} with a remainder of {}".format(x,y,answer,remainder))
x = int(input('Enter first number :')) y = int(input('Enter second number :')) answer = int(x / y) remainder = x % y print('{} divided by {} is {} with a remainder of {}'.format(x, y, answer, remainder))
def return_true(): return True if __name__ == "__main__": print("shipit")
def return_true(): return True if __name__ == '__main__': print('shipit')
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root node @param L: an integer @param R: an integer @return: the sum """ def rangeSumBST(self, root, L, R): ...
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root node @param L: an integer @param R: an integer @return: the sum """ def range_sum_bst(self, root, L, R): ...
#!python3.6 #encoding: utf-8 # https://teratail.com/questions/52151 class Deco: def __init__(self): self.value = 'value' def deco(func): def wrapper(self, *args, **kwargs): print('----- start -----') print('self.value =', self.value) # AttributeError: 'C' object has no attribute ...
class Deco: def __init__(self): self.value = 'value' def deco(func): def wrapper(self, *args, **kwargs): print('----- start -----') print('self.value =', self.value) ret = func(self, *args, **kwargs) print('----- end -----') return r...
expected_output = { "Mgmt-intf": { "address_family": { "ipv4 unicast": { "flags": "0x0", "table_id": "0x1", "vrf_label": {"allocation_mode": "per-prefix"}, } }, "cli_format": "New", "flags": "0x1808", "in...
expected_output = {'Mgmt-intf': {'address_family': {'ipv4 unicast': {'flags': '0x0', 'table_id': '0x1', 'vrf_label': {'allocation_mode': 'per-prefix'}}}, 'cli_format': 'New', 'flags': '0x1808', 'interface': {'GigabitEthernet1': {'vrf': 'Mgmt-intf'}}, 'interfaces': ['GigabitEthernet1'], 'support_af': 'multiple address-f...
#MenuTitle: Control Characters # -*- coding: utf-8 -*- __doc__=""" Creates a new tab with selected glyphs between control characters. """ Font = Glyphs.font tab = '' # supports latin, greek and cyrillic uppercase = ["A", "Aacute", "Abreve", "Abreveacute", "Abrevedotbelow", "Abrevegrave", "Abrevehookabove", "Abrevetil...
__doc__ = '\nCreates a new tab with selected glyphs between control characters.\n' font = Glyphs.font tab = '' uppercase = ['A', 'Aacute', 'Abreve', 'Abreveacute', 'Abrevedotbelow', 'Abrevegrave', 'Abrevehookabove', 'Abrevetilde', 'Acaron', 'Acircumflex', 'Acircumflexacute', 'Acircumflexdotbelow', 'Acircumflexgrave', '...
# # Collective Knowledge (indexing through ElasticSearch) # # See CK LICENSE.txt for licensing details # See CK COPYRIGHT.txt for copyright details # # Developer: Grigori Fursin # cfg = {} # Will be updated by CK (meta description of this module) work = {} # Will be updated by CK (temporal data) ck = None # Will be...
cfg = {} work = {} ck = None def init(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ return {'return': 0} def on(i): """...
class Solution: def longestDupSubstring(self, s: str) -> str: kMod = int(1e9) + 7 bestStart = -1 l = 1 r = len(s) def val(c: str) -> int: return ord(c) - ord('a') # k := length of hashed substring def getStart(k: int) -> Optional[int]: maxPow = pow(26, k - 1, kMod) hash...
class Solution: def longest_dup_substring(self, s: str) -> str: k_mod = int(1000000000.0) + 7 best_start = -1 l = 1 r = len(s) def val(c: str) -> int: return ord(c) - ord('a') def get_start(k: int) -> Optional[int]: max_pow = pow(26, k - 1, ...
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = "rightASSIGNrightNOTnonassocLESSEQ<=left+-left*/rightISVOIDleft~left@left.ASSIGN CASE CLASS COMMENT ELSE ESAC FALSE FI ID IF IN INHERITS INT ISVOID LESSEQ LET LOOP NEW N...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = "rightASSIGNrightNOTnonassocLESSEQ<=left+-left*/rightISVOIDleft~left@left.ASSIGN CASE CLASS COMMENT ELSE ESAC FALSE FI ID IF IN INHERITS INT ISVOID LESSEQ LET LOOP NEW NOT OF POOL RET STRING THEN TRUE TYPE WHILEprogram : class_listclass_list : class ';' class_lis...
class Truss(Element,IDisposable): """ Represents all kinds of Trusses. """ def AttachChord(self,attachToElement,location,forceRemoveSketch): """ AttachChord(self: Truss,attachToElement: Element,location: TrussChordLocation,forceRemoveSketch: bool) Attach a truss's specific chord to a specified element,th...
class Truss(Element, IDisposable): """ Represents all kinds of Trusses. """ def attach_chord(self, attachToElement, location, forceRemoveSketch): """ AttachChord(self: Truss,attachToElement: Element,location: TrussChordLocation,forceRemoveSketch: bool) Attach a truss's specific chord to a specifi...
# This is a simple example script for FL # It should represent a webshop, or at least part of it cart = {} def addToCart(product): if(product not in cart.keys()): cart[str(product)] = 1 else: cart[str(product)] = cart[(str(product))] + 2 # bug -> should be 1 def removeFromCart(product): ...
cart = {} def add_to_cart(product): if product not in cart.keys(): cart[str(product)] = 1 else: cart[str(product)] = cart[str(product)] + 2 def remove_from_cart(product): if product in cart.keys(): if cart[str(product)] > 1: cart[str(product)] = cart[str(product)] - 1 ...
# # PySNMP MIB module EXTRAHOP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTRAHOP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:53:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ...
# -*- encoding: utf-8 -*- """Common exceptions for the inventory manager. """ class ExistingMACAddress(Exception): code = 409 message = u'A server with the MAC address %(address)s already exists.' def __init__(self, address, message=None, **kwargs): """ :param address: The conflicting M...
"""Common exceptions for the inventory manager. """ class Existingmacaddress(Exception): code = 409 message = u'A server with the MAC address %(address)s already exists.' def __init__(self, address, message=None, **kwargs): """ :param address: The conflicting MAC address. :param me...
# ============================================================================== # ARSC (A Relatively Simple Computer) License # ============================================================================== # # ARSC is distributed under the following BSD-style license: # # Copyright (c) 2016-2017 Dzanan Bajgoric # A...
class Symboltable: def __init__(self): self.symbols = dict() def add_entry(self, symbol, addr): if symbol in self.symbols: raise key_error('Symbol "%s" already exists' % symbol) try: self.symbols[symbol] = int(addr) except ValueError: raise v...
def SymbolToFromAtomicNumber(ATOM): atoms = [ [1,"H"],[2,"He"],[3,"Li"],[4,"Be"],[5,"B"],[6,"C"],[7,"N"],[8,"O"],[9,"F"],[10,"Ne"], \ [11,"Na"],[12,"Mg"],[13,"Al"],[14,"Si"],[15,"P"],[16,"S"],[17,"Cl"],[18,"Ar"],[19,"K"],[20,"Ca"], \ [21,"Sc"],[22,"Ti"],[23,"V"],[24,"Cr"],[25,"Mn"],[26,"Fe"],[27...
def symbol_to_from_atomic_number(ATOM): atoms = [[1, 'H'], [2, 'He'], [3, 'Li'], [4, 'Be'], [5, 'B'], [6, 'C'], [7, 'N'], [8, 'O'], [9, 'F'], [10, 'Ne'], [11, 'Na'], [12, 'Mg'], [13, 'Al'], [14, 'Si'], [15, 'P'], [16, 'S'], [17, 'Cl'], [18, 'Ar'], [19, 'K'], [20, 'Ca'], [21, 'Sc'], [22, 'Ti'], [23, 'V'], [24, 'Cr']...
#!/usr/bin/python3 list = ["Binwalk","bulk-extractor","Capstone","chntpw","Cuckoo", "dc3dd","ddrescue","DFF","diStorm3","Dumpzilla","extundelete", "Foremost","Galleta","Guymager","iPhone Backup Analyzer","p0f", "pdf-parser","pdfid","pdgmail","peepdf","RegRipper","Volatility","Xplico"]
list = ['Binwalk', 'bulk-extractor', 'Capstone', 'chntpw', 'Cuckoo', 'dc3dd', 'ddrescue', 'DFF', 'diStorm3', 'Dumpzilla', 'extundelete', 'Foremost', 'Galleta', 'Guymager', 'iPhone Backup Analyzer', 'p0f', 'pdf-parser', 'pdfid', 'pdgmail', 'peepdf', 'RegRipper', 'Volatility', 'Xplico']
""" DNS Record Types """ # https://en.wikipedia.org/wiki/List_of_DNS_record_types DNS_RECORD_TYPES = { 1: "A", 28: "AAAA", 18: "AFSDB", 42: "APL", 257: "CAA", 60: "CDNSKEY", 59: "CDS", 37: "CERT", 5: "CNAME", 62: "CSYNC", 49: "DHCID", 32769: "DLV", 39: "DNAME", 4...
""" DNS Record Types """ dns_record_types = {1: 'A', 28: 'AAAA', 18: 'AFSDB', 42: 'APL', 257: 'CAA', 60: 'CDNSKEY', 59: 'CDS', 37: 'CERT', 5: 'CNAME', 62: 'CSYNC', 49: 'DHCID', 32769: 'DLV', 39: 'DNAME', 48: 'DNSKEY', 43: 'DS', 55: 'HIP', 45: 'IPSECKEY', 25: 'KEY', 36: 'KX', 29: 'LOC', 15: 'MX', 35: 'NAPTR', 2: 'NS', 4...
# # PySNMP MIB module CISCOSB-STACK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-STACK-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:23:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
def config_fgsm(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' fgsm_params = {yname: adv_ys, 'eps': 0.3, 'clip_min': 0., 'clip_max': 1.} return fgsm_params def config_bim(targeted, adv_ys): if ta...
def config_fgsm(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' fgsm_params = {yname: adv_ys, 'eps': 0.3, 'clip_min': 0.0, 'clip_max': 1.0} return fgsm_params def config_bim(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y'...
n = int(input()) for i in range(1,n+1): if ((n % i) == 0): print(i,end=" ")
n = int(input()) for i in range(1, n + 1): if n % i == 0: print(i, end=' ')
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py' ] # model setting model = dict( backbone=dict( init_cfg=None ), roi_head=dict( bbox_head=dict( num_class...
_base_ = ['../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'] model = dict(backbone=dict(init_cfg=None), roi_head=dict(bbox_head=dict(num_classes=1))) dataset_type = 'CocoDataset' classes = ('target',) data_root = '../d...
# 24. Swap Nodes in Pairs # Runtime: 24 ms, faster than 96.60% of Python3 online submissions for Swap Nodes in Pairs. # Memory Usage: 14 MB, less than 92.32% of Python3 online submissions for Swap Nodes in Pairs. # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # ...
class Solution: def swap_pairs(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head else: (head.val, head.next.val) = (head.next.val, head.val) self.swapPairs(head.next.next) return head
''' Created on 11 Apr 2020 @author: dkr85djo ''' class md: MAXCARDS = 106 class MDColourSet: def __init__(self, value, names, hexcolour=b'#000000'): self.value = value self.names = names self.hexcolour = hexcolour def size(self): return len(self.na...
""" Created on 11 Apr 2020 @author: dkr85djo """ class Md: maxcards = 106 class Mdcolourset: def __init__(self, value, names, hexcolour=b'#000000'): self.value = value self.names = names self.hexcolour = hexcolour def size(self): return len(self.names) class Mdcard: ...
class Stack: Top = -1 def __init__(self,size): self.stack = [0 for i in range(size)] def push(self, value): if (Stack.Top!=len(self.stack)-1): Stack.Top += 1 self.stack[Stack.Top] = value else: print("Overflow: Stack is Full") def pop(self): if (Stack.Top == -1): pri...
class Stack: top = -1 def __init__(self, size): self.stack = [0 for i in range(size)] def push(self, value): if Stack.Top != len(self.stack) - 1: Stack.Top += 1 self.stack[Stack.Top] = value else: print('Overflow: Stack is Full') def pop(sel...
BASIC_PLUGINS = [ { "name": "kubejobs", "source": "", "component": "manager", "plugin_source": "", "module": "kubejobs" }, { "name": "kubejobs", "source": "", "component": "controller", "p...
basic_plugins = [{'name': 'kubejobs', 'source': '', 'component': 'manager', 'plugin_source': '', 'module': 'kubejobs'}, {'name': 'kubejobs', 'source': '', 'component': 'controller', 'plugin_source': '', 'module': 'kubejobs'}, {'name': 'kubejobs', 'source': '', 'component': 'monitor', 'plugin_source': '', 'module': 'kub...
refTable = [{'desc': 'Freedom of Movement', 'templates': ['free'], 'weight': 1.0}, {'desc': 'Visa not Required', 'templates': ['yes', 'yes '], 'weight': 0.9}, {'desc': 'Visa on Arrival', 'templates': ['Optional', 'yes-no'], 'weight': 0.7}, {'desc': 'Electronic Visa', 'templates': ['yes2'], 'weight': 0.5}, {'des...
ref_table = [{'desc': 'Freedom of Movement', 'templates': ['free'], 'weight': 1.0}, {'desc': 'Visa not Required', 'templates': ['yes', 'yes '], 'weight': 0.9}, {'desc': 'Visa on Arrival', 'templates': ['Optional', 'yes-no'], 'weight': 0.7}, {'desc': 'Electronic Visa', 'templates': ['yes2'], 'weight': 0.5}, {'desc': 'Vi...
# builtins stub used in boolean-related test cases. class object: def __init__(self) -> None: pass class type: pass class bool: pass class int: pass
class Object: def __init__(self) -> None: pass class Type: pass class Bool: pass class Int: pass
"""Information regarding crosstool-supported architectures.""" # Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
"""Information regarding crosstool-supported architectures.""" osx_tools_non_device_archs = ['darwin_x86_64', 'darwin_arm64', 'darwin_arm64e', 'ios_i386', 'ios_x86_64', 'watchos_i386', 'watchos_x86_64', 'tvos_x86_64'] osx_tools_archs = ['ios_armv7', 'ios_arm64', 'ios_arm64e', 'watchos_armv7k', 'watchos_arm64_32', 'tvos...
{ '%Y-%m-%d':'%Y-%m-%d', '%Y-%m-%d %H:%M:%S':'%Y-%m-%d %H:%M:%S', '%s rows deleted':'%s records cancellati', '%s rows updated':'*** %s records modificati', 'Hello World':'Salve Mondo', 'Invalid Query':'Query invalida', 'Sure you want to delete this object?':'Sicuro che vuoi cancellare questo oggetto?', 'Welcome to web2...
{'%Y-%m-%d': '%Y-%m-%d', '%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S', '%s rows deleted': '%s records cancellati', '%s rows updated': '*** %s records modificati', 'Hello World': 'Salve Mondo', 'Invalid Query': 'Query invalida', 'Sure you want to delete this object?': 'Sicuro che vuoi cancellare questo oggetto?', 'Welcome t...
def clean_split(text, delim=','): text = text.strip() return map(lambda o: o.strip(), text.split(delim)) def read_notes(file): notes = {} for line in file: split = clean_split(line, ',')[:-1] if split[-1] == '': continue notes[(split[0], int(split[1]))] = float(spli...
def clean_split(text, delim=','): text = text.strip() return map(lambda o: o.strip(), text.split(delim)) def read_notes(file): notes = {} for line in file: split = clean_split(line, ',')[:-1] if split[-1] == '': continue notes[split[0], int(split[1])] = float(split[2...
# Game Objects class Space(object): def __init__(self,name): self.name = name def get_name(self): return self.name class Property(Space): set_houses = { "Violet":2, "Light blue":3, "Purple":3, "Orange":3, ...
class Space(object): def __init__(self, name): self.name = name def get_name(self): return self.name class Property(Space): set_houses = {'Violet': 2, 'Light blue': 3, 'Purple': 3, 'Orange': 3, 'Red': 3, 'Yellow': 3, 'Green': 3, 'Blue': 2} def __init__(self, name, color, price, rent,...
class Hourly: def __init__(self, temp, feels_like, pressure, humidity, wind_speed, date, city, weather): self.temp=temp; self.feels_like=feels_like; self.pressure=pressure; self.humidity=humidity; self.wind_speed=wind_speed; self.date=date; self.city=city; ...
class Hourly: def __init__(self, temp, feels_like, pressure, humidity, wind_speed, date, city, weather): self.temp = temp self.feels_like = feels_like self.pressure = pressure self.humidity = humidity self.wind_speed = wind_speed self.date = date self.city = ...
class InvalidQNameError(RuntimeError): def __init__(self, qname): message = "Invalid qname: " + qname super(InvalidQNameError, self).__init__(message)
class Invalidqnameerror(RuntimeError): def __init__(self, qname): message = 'Invalid qname: ' + qname super(InvalidQNameError, self).__init__(message)
# selection sort algorithm # time complexity O(n^2) # space complexity O(1) def selectionsort(list, comp): for x in range(len(list)): curr = x for y in range(x, len(list)): if (comp(list[curr], list[y]) > 0): curr = y swap = list[x] list[x] = li...
def selectionsort(list, comp): for x in range(len(list)): curr = x for y in range(x, len(list)): if comp(list[curr], list[y]) > 0: curr = y swap = list[x] list[x] = list[curr] list[curr] = swap return list
def rpn_eval(tokens): def op(symbol, a, b): return { '+': lambda a, b: a + b, '-': lambda a, b: a - b, '*': lambda a, b: a * b, '/': lambda a, b: a / b }[symbol](a, b) stack = [] for token in tokens: if isinstance(token, float): ...
def rpn_eval(tokens): def op(symbol, a, b): return {'+': lambda a, b: a + b, '-': lambda a, b: a - b, '*': lambda a, b: a * b, '/': lambda a, b: a / b}[symbol](a, b) stack = [] for token in tokens: if isinstance(token, float): stack.append(token) else: a = st...
class Solution: def oddEvenList(self, head: ListNode) -> ListNode: odd = head even = head.next even_head = head.next while even and even.next: odd.next = odd.next.next even.next = even.next.next odd = odd.next even = even.next ...
class Solution: def odd_even_list(self, head: ListNode) -> ListNode: odd = head even = head.next even_head = head.next while even and even.next: odd.next = odd.next.next even.next = even.next.next odd = odd.next even = even.next ...
# Represents a single space within the board. class Tile(): # Initializes the tile. # By default, each tile is a wall until a board is built def __init__(self): self.isWall = True # Renders the object character in this tile def render(self): if self.isWall == True: return '0'; # Represents the game board...
class Tile: def __init__(self): self.isWall = True def render(self): if self.isWall == True: return '0' class Board: def __init__(self, width, height): self.width = width self.height = height self.board = [] for y in range(0, self.height): ...
__title__ = 'dtanys' __description__ = 'Python structured data parser.' __url__ = 'https://github.com/luxuncang/dtanys' __version__ = '1.0.5' __author__ = 'ShengXin Lu' __author_email__ = 'luxuncang@qq.com' __license__ = 'MIT' __copyright__ = 'Copyright 2021 ShengXin Lu'
__title__ = 'dtanys' __description__ = 'Python structured data parser.' __url__ = 'https://github.com/luxuncang/dtanys' __version__ = '1.0.5' __author__ = 'ShengXin Lu' __author_email__ = 'luxuncang@qq.com' __license__ = 'MIT' __copyright__ = 'Copyright 2021 ShengXin Lu'
class Clock: def __init__(self, hour, minute): self.total: int = hour * 60 + minute # in minutes def __repr__(self): hour, minute = (self.total // 60) % 24, self.total % 60 return '{:02d}:{:02d}'.format(hour, minute) def __eq__(self, other): return repr(self) == repr(oth...
class Clock: def __init__(self, hour, minute): self.total: int = hour * 60 + minute def __repr__(self): (hour, minute) = (self.total // 60 % 24, self.total % 60) return '{:02d}:{:02d}'.format(hour, minute) def __eq__(self, other): return repr(self) == repr(other) def ...
file=open("circulations.txt") data=[] date=int(input()) for line in file: [book,member,due]=line.strip().split() if date>int(due): data.append([book,member,due]) i=0 while i<len(data)-1: j=0 while j<len(data)-1: if int(data[j][2])>int(data[j+1][2]): data[j], data[j+1] = ...
file = open('circulations.txt') data = [] date = int(input()) for line in file: [book, member, due] = line.strip().split() if date > int(due): data.append([book, member, due]) i = 0 while i < len(data) - 1: j = 0 while j < len(data) - 1: if int(data[j][2]) > int(data[j + 1][2]): ...
BASE_URL = "https://api.stlouisfed.org" SERIES_ENDPOINT = "fred/series/observations" SERIES = ["GDPC1", "UMCSENT", "UNRATE"] FILE_TYPE = "json"
base_url = 'https://api.stlouisfed.org' series_endpoint = 'fred/series/observations' series = ['GDPC1', 'UMCSENT', 'UNRATE'] file_type = 'json'
""" Module: 'uasyncio.__init__' on micropython-rp2-1.15 """ # MCU: {'family': 'micropython', 'sysname': 'rp2', 'version': '1.15.0', 'build': '', 'mpy': 5637, 'port': 'rp2', 'platform': 'rp2', 'name': 'micropython', 'arch': 'armv7m', 'machine': 'Raspberry Pi Pico with RP2040', 'nodename': 'rp2', 'ver': '1.15', 'release'...
""" Module: 'uasyncio.__init__' on micropython-rp2-1.15 """ class Cancellederror: """""" class Event: """""" def clear(): pass def is_set(): pass def set(): pass wait = None class Ioqueue: """""" def _dequeue(): pass def _enqueue(): pas...
f90 = {} cxx = {} cc = {} is_arch_valid = 1 flags_arch = '-g -pg -O3 -Wall' # -lpthread: not needed? # -rdynamic: required for backtraces balancer = 'RotateLB' flags_prec_single = '-fdefault-real-4 -fdefault-double-8' flags_prec_double = '-fdefault-real-8 -fdefault-double-8' flags_cxx_charm = '-balancer '...
f90 = {} cxx = {} cc = {} is_arch_valid = 1 flags_arch = '-g -pg -O3 -Wall' balancer = 'RotateLB' flags_prec_single = '-fdefault-real-4 -fdefault-double-8' flags_prec_double = '-fdefault-real-8 -fdefault-double-8' flags_cxx_charm = '-balancer ' + balancer flags_link_charm = '-rdynamic -module ' + balancer cc = 'gcc' f9...
"""Holds cerberus validation schemals for each yml parsed by any of the sheetwork system.""" config_schema = { "sheets": { "required": True, "type": "list", "schema": { "type": "dict", "schema": { "sheet_name": {"required": True, "type": "string"}, ...
"""Holds cerberus validation schemals for each yml parsed by any of the sheetwork system.""" config_schema = {'sheets': {'required': True, 'type': 'list', 'schema': {'type': 'dict', 'schema': {'sheet_name': {'required': True, 'type': 'string'}, 'sheet_key': {'required': True, 'type': 'string'}, 'worksheet': {'required'...
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def removeZeroSumSublists(self, head: ListNode) -> ListNode: ptr = ListNode(-1) ptr.next = head current = head head = ptr ...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def remove_zero_sum_sublists(self, head: ListNode) -> ListNode: ptr = list_node(-1) ptr.next = head current = head head = ptr while head: s...
#!/usr/bin/env python """ Library of functions to help output data in reStructuredText format """ ## functions def print_rest_table_contents(columns,items,withTrailing=True): """ function needs to be turned into a class """ row = "+" head = "+" for col in columns: row += "-"*col+"-+" ...
""" Library of functions to help output data in reStructuredText format """ def print_rest_table_contents(columns, items, withTrailing=True): """ function needs to be turned into a class """ row = '+' head = '+' for col in columns: row += '-' * col + '-+' head += '=' * col + '=+...
add_library('opencv_processing') src = loadImage("test.jpg") size(src.width, src.height, P2D) opencv = OpenCV(this, src) opencv.findCannyEdges(20, 75) canny = opencv.getSnapshot() opencv.loadImage(src) opencv.findScharrEdges(OpenCV.HORIZONTAL) scharr = opencv.getSnapshot() opencv.loadImage(src) opencv.findSobelEdge...
add_library('opencv_processing') src = load_image('test.jpg') size(src.width, src.height, P2D) opencv = open_cv(this, src) opencv.findCannyEdges(20, 75) canny = opencv.getSnapshot() opencv.loadImage(src) opencv.findScharrEdges(OpenCV.HORIZONTAL) scharr = opencv.getSnapshot() opencv.loadImage(src) opencv.findSobelEdges(...