content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def runUserScript(func, params, paramTypes): if (len(params) != len(paramTypes)): onParameterError() newParams = [] for i, val in enumerate(params): newParams.append(parseParameter(i, paramTypes[i], val)) func(*newParams) class Node: def __init__(self, val, left, right,...
def run_user_script(func, params, paramTypes): if len(params) != len(paramTypes): on_parameter_error() new_params = [] for (i, val) in enumerate(params): newParams.append(parse_parameter(i, paramTypes[i], val)) func(*newParams) class Node: def __init__(self, val, left, right, next)...
def readlines(fname): try: with open(fname, 'r') as fpt: return fpt.readlines() except: return [] def convert(data): for i in range(len(data)): try: data[i] = float(data[i]) except ValueError: continue def csv_lst(fname): l = readli...
def readlines(fname): try: with open(fname, 'r') as fpt: return fpt.readlines() except: return [] def convert(data): for i in range(len(data)): try: data[i] = float(data[i]) except ValueError: continue def csv_lst(fname): l = readline...
def functionA(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: ## TODO for students output = A.sum(axis = 0) * B.sum() return output def functionB(C: torch.Tensor) -> torch.Tensor: # TODO flatten the tensor C C = C.flatten() # TODO create the idx tensor to be concatenated to C # here we're going ...
def function_a(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: output = A.sum(axis=0) * B.sum() return output def function_b(C: torch.Tensor) -> torch.Tensor: c = C.flatten() idx_tensor = torch.arange(0, len(C)) output = torch.cat([idx_tensor.unsqueeze(0), C.unsqueeze(0)], axis=1) return out...
minimum_points = 100 data_points = 150 if data_points >= minimum_points: print("There are enough data points!") if data_points < minimum_points: print("Keep collecting data.")
minimum_points = 100 data_points = 150 if data_points >= minimum_points: print('There are enough data points!') if data_points < minimum_points: print('Keep collecting data.')
class Hand: def __init__(self): self.cards = [] self.value = 0 def add_card(self, card): self.cards.append(card) def calculate_value(self): self.value = 0 has_ace = False for card in self.cards: if card.value.isnumeric(): self.val...
class Hand: def __init__(self): self.cards = [] self.value = 0 def add_card(self, card): self.cards.append(card) def calculate_value(self): self.value = 0 has_ace = False for card in self.cards: if card.value.isnumeric(): self.va...
# # PySNMP MIB module GSM7312-QOS-ACL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GSM7312-QOS-ACL-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:20:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
settings = { "ARCHIVE" : True, "MAX_POSTS" : 5000 }
settings = {'ARCHIVE': True, 'MAX_POSTS': 5000}
def minim(lst): min = 100000 minI = 99999 for i in range(len(lst)): if lst[i]<min: min = lst[i] minI=i return min,minI lst = list(map(int, input().split())) lst2 = len(lst)*[0] min = lst[1] for i in range(len(lst)): x,y = minim(lst) lst2.append(x) # print(minim...
def minim(lst): min = 100000 min_i = 99999 for i in range(len(lst)): if lst[i] < min: min = lst[i] min_i = i return (min, minI) lst = list(map(int, input().split())) lst2 = len(lst) * [0] min = lst[1] for i in range(len(lst)): (x, y) = minim(lst) lst2.append(x)
class CapacityMixin: @staticmethod def get_capacity(capacity, amount): if amount > capacity: return "Capacity reached!" return capacity - amount
class Capacitymixin: @staticmethod def get_capacity(capacity, amount): if amount > capacity: return 'Capacity reached!' return capacity - amount
# Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'program', 'type': 'executable', 'msvs_cygwin_shell': 0, 'sources': [ 'program.c',...
{'targets': [{'target_name': 'program', 'type': 'executable', 'msvs_cygwin_shell': 0, 'sources': ['program.c'], 'actions': [{'action_name': 'make-prog1', 'inputs': ['make-prog1.py'], 'outputs': ['<(INTERMEDIATE_DIR)/prog1.c'], 'action': ['python', '<(_inputs)', '<@(_outputs)'], 'process_outputs_as_sources': 1}, {'actio...
print("Enter Num 1 : ") num1 = int(input()) print("Enter Num 2 : ") num2 = int(input()) print("Sum = ", num1+num2) print("This is important")
print('Enter Num 1 : ') num1 = int(input()) print('Enter Num 2 : ') num2 = int(input()) print('Sum = ', num1 + num2) print('This is important')
UI={ 'new_goal':{ 't':'Send me the name of your goal' } }
ui = {'new_goal': {'t': 'Send me the name of your goal'}}
#if customizations are required when doing the update of the code of the jpackage def main(j,jp,force=False): recipe=jp.getCodeMgmtRecipe() recipe.update(force=force)
def main(j, jp, force=False): recipe = jp.getCodeMgmtRecipe() recipe.update(force=force)
def maximo(x, y): if x > y: return x else: return y
def maximo(x, y): if x > y: return x else: return y
######## # PART 1 def get_layers(data, width = 25, height = 6): layers = [] while data: layer = [] for _ in range(width * height): layer.append(data.pop(0)) layers.append(layer) return layers def count_digit_on_layer(layer, digit): return sum([1 for val in layer if v...
def get_layers(data, width=25, height=6): layers = [] while data: layer = [] for _ in range(width * height): layer.append(data.pop(0)) layers.append(layer) return layers def count_digit_on_layer(layer, digit): return sum([1 for val in layer if val == digit]) def get...
# System phrases started: str = "Bot {} started" closed: str = "Bot disabled" loaded_cog: str = "Load cog - {}" loading_failed: str = "Failed to load cog - {}\n{}" kill: str = "Bot disabled" # System errors not_owner: str = "You have to be bot's owner to use this command" # LanguageService lang_changed: str = "Langua...
started: str = 'Bot {} started' closed: str = 'Bot disabled' loaded_cog: str = 'Load cog - {}' loading_failed: str = 'Failed to load cog - {}\n{}' kill: str = 'Bot disabled' not_owner: str = "You have to be bot's owner to use this command" lang_changed: str = 'Language has been changed'
wordlist = [ "a's", "able", "about", "above", "according", "accordingly", "across", "actually", "after", "afterwards", "again", "against", "ain't", "all", "allow", "allows", "almost", "alone", "along", "already", "also", "although",...
wordlist = ["a's", 'able', 'about', 'above', 'according', 'accordingly', 'across', 'actually', 'after', 'afterwards', 'again', 'against', "ain't", 'all', 'allow', 'allows', 'almost', 'alone', 'along', 'already', 'also', 'although', 'always', 'am', 'among', 'amongst', 'an', 'and', 'another', 'any', 'anybody', 'anyhow', ...
sample_trajectory = [[[8.29394929e-01, 2.94382693e-05, 1.24370992e+00], [0.8300607, 0.00321705, 1.24627523], [0.83197002, 0.01345206, 1.25535293], [0.83280536, 0.02711211, 1.26502481], [0.83431212, 0.04126721, 1.27488879], [0.83557291, 0.05575593, 1.28517274], ...
sample_trajectory = [[[0.829394929, 2.94382693e-05, 1.24370992], [0.8300607, 0.00321705, 1.24627523], [0.83197002, 0.01345206, 1.25535293], [0.83280536, 0.02711211, 1.26502481], [0.83431212, 0.04126721, 1.27488879], [0.83557291, 0.05575593, 1.28517274], [0.83835516, 0.07094685, 1.29766037], [0.84018236, 0.0848757, 1.30...
#-*- coding: utf-8 -*- # https://github.com/Kodi-vStream/venom-xbmc-addons class iHoster: def getDisplayName(self): raise NotImplementedError() def setDisplayName(self, sDisplayName): raise NotImplementedError() def setFileName(self, sFileName): raise NotImplementedError() d...
class Ihoster: def get_display_name(self): raise not_implemented_error() def set_display_name(self, sDisplayName): raise not_implemented_error() def set_file_name(self, sFileName): raise not_implemented_error() def get_file_name(self): raise not_implemented_error() ...
expected_output={ "drops":{ "IN_US_CL_V4_PKT_FAILED_POLICY":{ "drop_type":8, "packets":11019, }, "IN_US_V4_PKT_SA_NOT_FOUND_SPI":{ "drop_type":4, "p...
expected_output = {'drops': {'IN_US_CL_V4_PKT_FAILED_POLICY': {'drop_type': 8, 'packets': 11019}, 'IN_US_V4_PKT_SA_NOT_FOUND_SPI': {'drop_type': 4, 'packets': 67643}, 'OCT_GEN_NOTIFY_SOFT_EXPIRY': {'drop_type': 66, 'packets': 159949980}, 'OCT_PKT_HIT_INVALID_SA': {'drop_type': 68, 'packets': 2797}, 'OUT_OCT_HARD_EXPIRY...
# # PySNMP MIB module FASTPATH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:12:15 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,...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_size_constraint, value_range_constraint) ...
# Time: O(1) # Space: O(1) # # Write a function to delete a node (except the tail) in a singly linked list, # given only access to that node. # # Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node # with value 3, the linked list should become 1 -> 2 -> 4 after calling your function. # # Defi...
class Solution: def delete_node(self, node): if node and node.next: node_to_delete = node.next node.val = node_to_delete.val node.next = node_to_delete.next del node_to_delete
#sum in python ''' weight = float(input("Weight:")) height = float(input("height")) total = weight + height print(total) ''' #cal monthly salary ''' import math age= 17 pi= 3.14 print(type(age),age) print(type(pi),pi) print(math.pi) salary = float(input('Salary: ')) #float convert text(string) to number with decima...
""" weight = float(input("Weight:")) height = float(input("height")) total = weight + height print(total) """ '\nimport math\n\nage= 17\npi= 3.14\nprint(type(age),age)\nprint(type(pi),pi)\n\nprint(math.pi)\n\nsalary = float(input(\'Salary: \')) #float convert text(string) to number with decimal place\nbonus = float(inp...
nonverified_users = ['calvin klein','ralph lauren','christian dior','donna karran'] verified_users = [] #verifying if there are new users and moving them to a verified list while nonverified_users: current_user = nonverified_users.pop() print(f"\nVerifying user: {current_user}") verified_users.append(curre...
nonverified_users = ['calvin klein', 'ralph lauren', 'christian dior', 'donna karran'] verified_users = [] while nonverified_users: current_user = nonverified_users.pop() print(f'\nVerifying user: {current_user}') verified_users.append(current_user) for user in verified_users: print(f'\n\t{user.title()}...
# from ..interpreter import model # Commented out to make static node recovery be used # @model('map_server', 'map_server') def map_server(c): c.read('~frame_id', 'map') c.read('~negate', 0) c.read('~occupied_thresh', 0.65) c.read('~free_thresh', 0.196) c.provide('static_map', 'nav_msgs/GetMap') ...
def map_server(c): c.read('~frame_id', 'map') c.read('~negate', 0) c.read('~occupied_thresh', 0.65) c.read('~free_thresh', 0.196) c.provide('static_map', 'nav_msgs/GetMap') c.pub('map_metadata', 'nav_msgs/MapMetaData') c.pub('map', 'nav_msgs/OccupancyGrid')
def func1(): def func2(): return True return func2() if(func1()): print("Acabou")
def func1(): def func2(): return True return func2() if func1(): print('Acabou')
fname = input('Enter File: ') if len(fname) < 1: fname = 'clown.txt' hand = open(fname) di = dict() for lin in hand: lin = lin.rstrip() wds = lin.split() #print(wds) for w in wds: # if the key is not there the count is zero #print(w) #print('**',w,di.get(w,-99)) #...
fname = input('Enter File: ') if len(fname) < 1: fname = 'clown.txt' hand = open(fname) di = dict() for lin in hand: lin = lin.rstrip() wds = lin.split() for w in wds: di[w] = di.get(w, 0) + 1 largest = -1 theword = None for (k, v) in di.items(): if v > largest: largest = v ...
''' Square Root of Integer Asked in: Facebook Amazon Microsoft Given an integar A. Compute and return the square root of A. If A is not a perfect square, return floor(sqrt(A)). DO NOT USE SQRT FUNCTION FROM STANDARD LIBRARY Input Format The first and only argument given is the integer A. Output Format Return ...
""" Square Root of Integer Asked in: Facebook Amazon Microsoft Given an integar A. Compute and return the square root of A. If A is not a perfect square, return floor(sqrt(A)). DO NOT USE SQRT FUNCTION FROM STANDARD LIBRARY Input Format The first and only argument given is the integer A. Output Format Return ...
# buildifier: disable=module-docstring load("//bazel/platform:transitions.bzl", "risc0_transition") # https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/common/cc/cc_library.bzl CC_TOOLCHAIN_TYPE = "@bazel_tools//tools/cpp:toolchain_type" def _get_compilation_contexts_from_deps(deps): ...
load('//bazel/platform:transitions.bzl', 'risc0_transition') cc_toolchain_type = '@bazel_tools//tools/cpp:toolchain_type' def _get_compilation_contexts_from_deps(deps): compilation_contexts = [] for dep in deps: if CcInfo in dep: compilation_contexts.append(dep[CcInfo].compilation_context) ...
class Solution: def findLHS(self, nums: List[int]) -> int: d=collections.defaultdict(lambda:0) for i in range(0,len(nums)): d[nums[i]]+=1 maxi=0 for i in d.keys(): if(d.get(i+1,"E")!="E"): maxi=max(maxi,d[i]+d[i+1]) return maxi
class Solution: def find_lhs(self, nums: List[int]) -> int: d = collections.defaultdict(lambda : 0) for i in range(0, len(nums)): d[nums[i]] += 1 maxi = 0 for i in d.keys(): if d.get(i + 1, 'E') != 'E': maxi = max(maxi, d[i] + d[i + 1]) ...
model_config = {} # alpha config model_config['alpha_jump_mode'] = "linear" model_config['iter_alpha_jump'] = [] model_config['alpha_jump_vals'] = [] model_config['alpha_n_jumps'] = [0, 600, 600, 600, 600, 600, 600, 600, 600] model_config['alpha_size_jumps'] = [0, 32, 32, 32, 32, 32, 32, 32, 32, 32] # base config mod...
model_config = {} model_config['alpha_jump_mode'] = 'linear' model_config['iter_alpha_jump'] = [] model_config['alpha_jump_vals'] = [] model_config['alpha_n_jumps'] = [0, 600, 600, 600, 600, 600, 600, 600, 600] model_config['alpha_size_jumps'] = [0, 32, 32, 32, 32, 32, 32, 32, 32, 32] model_config['max_iter_at_scale'] ...
class LineItem(object): def __init__(self, description, weight, price): self.description = description self.set_weight(weight) self.price = price def subtotal(self): return self.get_weight() * self.price def get_weight(self): return self.__weight def set_weigh...
class Lineitem(object): def __init__(self, description, weight, price): self.description = description self.set_weight(weight) self.price = price def subtotal(self): return self.get_weight() * self.price def get_weight(self): return self.__weight def set_weigh...
_out_ = "" _in_ = "" _err_ = "" _root_ = ""
_out_ = '' _in_ = '' _err_ = '' _root_ = ''
class FrontMiddleBackQueue: def __init__(self): self.queue = [] def pushFront(self, val: int): self.queue.insert(0,val) def pushMiddle(self, val: int): self.queue.insert(len(self.queue) // 2,val) def pushBack(self, val: int): self.queue.append(val) d...
class Frontmiddlebackqueue: def __init__(self): self.queue = [] def push_front(self, val: int): self.queue.insert(0, val) def push_middle(self, val: int): self.queue.insert(len(self.queue) // 2, val) def push_back(self, val: int): self.queue.append(val) def pop_f...
# alternative characters T = input() lst = [] results = [] if T >= 1 and T <= 10: for i in range(T): lst.append(raw_input()) lst = filter(lambda x: len(x) >= 1 and len(x) <= 10**5, lst) for cst in lst: delct = 0 for j in range(len(cst)-1): if cst[j] == cst[j+1]: ...
t = input() lst = [] results = [] if T >= 1 and T <= 10: for i in range(T): lst.append(raw_input()) lst = filter(lambda x: len(x) >= 1 and len(x) <= 10 ** 5, lst) for cst in lst: delct = 0 for j in range(len(cst) - 1): if cst[j] == cst[j + 1]: delct += 1 ...
a = int(input()) c = int(input()) s = True for b in range(a - 1): if int(input()) >= c: s = False if s: print("YES") else: print("NO")
a = int(input()) c = int(input()) s = True for b in range(a - 1): if int(input()) >= c: s = False if s: print('YES') else: print('NO')
n, m = map(int, input().split()) shops = [tuple(map(int, input().split())) for _ in range(n)] shops.sort(key=lambda x: x[0]) ans = 0 for a, b in shops: if m <= b: ans += a * m break else: ans += a * b m -= b print(ans)
(n, m) = map(int, input().split()) shops = [tuple(map(int, input().split())) for _ in range(n)] shops.sort(key=lambda x: x[0]) ans = 0 for (a, b) in shops: if m <= b: ans += a * m break else: ans += a * b m -= b print(ans)
''' Power of Two Solution Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Output: true Explanation: 24 = 16 Example 3: Input: 218 Output: false''' n = int(input()) if n <= 0 : print('false')...
""" Power of Two Solution Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Output: true Explanation: 24 = 16 Example 3: Input: 218 Output: false""" n = int(input()) if n <= 0: print('false') while n % 2 == 0: ...
# Copyright 2017 Lawrence Kesteloot # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
class Photo(object): def __init__(self, id, hash_back, rotation, rating, date, display_date, label): self.id = id self.hash_back = hash_back self.rotation = rotation self.rating = rating self.date = date self.display_date = display_date self.label = label ...
# eerste negen cijfers van ISBN-10 code inlezen en omzetten naar integers x1 = int(input()) x2 = int(input()) x3 = int(input()) x4 = int(input()) x5 = int(input()) x6 = int(input()) x7 = int(input()) x8 = int(input()) x9 = int(input()) # controlecijfer berekenen x10 = (x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 + 6 * x6 +...
x1 = int(input()) x2 = int(input()) x3 = int(input()) x4 = int(input()) x5 = int(input()) x6 = int(input()) x7 = int(input()) x8 = int(input()) x9 = int(input()) x10 = (x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 + 6 * x6 + 7 * x7 + 8 * x8 + 9 * x9) % 11 print(x10)
def get_attr_or_callable(obj, name): target = getattr(obj, name) if callable(target): return target() return target
def get_attr_or_callable(obj, name): target = getattr(obj, name) if callable(target): return target() return target
# These are the "Tableau 20" colors as RGB. tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), (227, 119, 1...
tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), (227, 119, 194), (247, 182, 210), (127, 127, 127), (199, 199, 199), (188, 189, 34), (219, 219, 141), (23, 190, ...
# -*- coding: utf-8 -*- # Which templates don't you want to generate? (You can use regular expressions here!) # Use strings (with single or double quotes), and separate each template/regex in a line terminated with a comma. IGNORE_JINJA_TEMPLATES = [ '.*base.jinja', '.*tests/.*' ] # Do you have any additional...
ignore_jinja_templates = ['.*base.jinja', '.*tests/.*'] extra_variables = {'test_type': 'Array', 'name': 'float', 'dim': 3, 'type': 'float', 'suffix': 'f', 'extends': '[3]'} output_options = {'extension': '3_arr.cpp', 'remove_double_extension': False}
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: results = [] def dfs (elements, start: int, k: int): if k == 0: results.append(elements[:]) for i in range (start, n+1): elements....
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: results = [] def dfs(elements, start: int, k: int): if k == 0: results.append(elements[:]) for i in range(start, n + 1): elements.append(i) dfs(elements, i ...
text = 'Writing to a file which\n' fileis = open('hello.txt', 'w') fileis.write(text) fileis.close()
text = 'Writing to a file which\n' fileis = open('hello.txt', 'w') fileis.write(text) fileis.close()
def gcd(p, q): pTrue = isinstance(p,int) qTrue = isinstance(q,int) if pTrue and qTrue: if q == 0: return p r = p%q return gcd(q,r) else: print("Error!") return 0
def gcd(p, q): p_true = isinstance(p, int) q_true = isinstance(q, int) if pTrue and qTrue: if q == 0: return p r = p % q return gcd(q, r) else: print('Error!') return 0
# -*- coding: utf-8 -*- keywords = { "abbrev", "abs", "abstime", "abstimeeq", "abstimege", "abstimegt", "abstimein", "abstimele", "abstimelt", "abstimene", "abstimeout", "abstimerecv", "abstimesend", "aclcontains", "aclinsert", "aclitemeq", "aclitemin...
keywords = {'abbrev', 'abs', 'abstime', 'abstimeeq', 'abstimege', 'abstimegt', 'abstimein', 'abstimele', 'abstimelt', 'abstimene', 'abstimeout', 'abstimerecv', 'abstimesend', 'aclcontains', 'aclinsert', 'aclitemeq', 'aclitemin', 'aclitemout', 'aclremove', 'acos', 'add_months', 'aes128', 'aes256', 'age', 'all', 'alloc_r...
# 231A - Team # http://codeforces.com/problemset/problem/231/A n = int(input()) c = 0 for i in range(n): arr = [x for x in input().split() if int(x) == 1] if len(arr) >= 2: c += 1 print(c)
n = int(input()) c = 0 for i in range(n): arr = [x for x in input().split() if int(x) == 1] if len(arr) >= 2: c += 1 print(c)
description = 'XCCM' group = 'basic' includes = [ # 'source', # 'table', # 'detector', 'virtual_sample_motors', 'virtual_detector_motors', 'virtual_optic_motors', 'virtual_IOcard', 'optic_tool_switch', 'virtual_capillary_motors', 'capillary_selector' ]
description = 'XCCM' group = 'basic' includes = ['virtual_sample_motors', 'virtual_detector_motors', 'virtual_optic_motors', 'virtual_IOcard', 'optic_tool_switch', 'virtual_capillary_motors', 'capillary_selector']
def triplewise(it): try: a, b = next(it), next(it) except StopIteration: return for c in it: yield a, b, c a, b = b, c def inc_count(values): last = None count = 0 for v in values: if last is not None and v > last: count += 1 last = v...
def triplewise(it): try: (a, b) = (next(it), next(it)) except StopIteration: return for c in it: yield (a, b, c) (a, b) = (b, c) def inc_count(values): last = None count = 0 for v in values: if last is not None and v > last: count += 1 ...
definitions = { "StringArray": { "type": "array", "items": { "type": "string", } }, "AudioEncoding": { "type": "string", "enum": ["LINEAR16", "ALAW", "MULAW", "LINEAR32F", "RAW_OPUS", "MPEG_AUDIO"] }, "VoiceActivityDetectionConfig": { "type...
definitions = {'StringArray': {'type': 'array', 'items': {'type': 'string'}}, 'AudioEncoding': {'type': 'string', 'enum': ['LINEAR16', 'ALAW', 'MULAW', 'LINEAR32F', 'RAW_OPUS', 'MPEG_AUDIO']}, 'VoiceActivityDetectionConfig': {'type': 'object', 'properties': {'min_speech_duration': {'type': 'number'}, 'max_speech_durati...
def isEscapePossible(self, blocked, source, target): blocked = set(map(tuple, blocked)) def dfs(x, y, target, seen): if ( not (0 <= x < 10 ** 6 and 0 <= y < 10 ** 6) or (x, y) in blocked or (x, y) in seen ): return False seen.add((x, y)) ...
def is_escape_possible(self, blocked, source, target): blocked = set(map(tuple, blocked)) def dfs(x, y, target, seen): if not (0 <= x < 10 ** 6 and 0 <= y < 10 ** 6) or (x, y) in blocked or (x, y) in seen: return False seen.add((x, y)) if len(seen) > 20000 or [x, y] == targe...
def compute(dna_string1: str, dna_string2: str) -> int: hamming_distance = 0 for index in range(0, len(dna_string1)): if dna_string1[index] is not dna_string2[index]: hamming_distance += 1 return hamming_distance
def compute(dna_string1: str, dna_string2: str) -> int: hamming_distance = 0 for index in range(0, len(dna_string1)): if dna_string1[index] is not dna_string2[index]: hamming_distance += 1 return hamming_distance
class Graph(): def __init__(self): self.numberOfNodes = 0 self.adjacentList = {} def __str__(self): return str(self.__dict__) def addVertex(self, node): self.adjacentList[node] = [] self.numberOfNodes += 1 def addEdge(self, nodeA, nodeB): self.adjacentList[nodeA].append(nodeB) self.adjacentList[no...
class Graph: def __init__(self): self.numberOfNodes = 0 self.adjacentList = {} def __str__(self): return str(self.__dict__) def add_vertex(self, node): self.adjacentList[node] = [] self.numberOfNodes += 1 def add_edge(self, nodeA, nodeB): self.adjacent...
message = "zulkepretest make simpletes cpplest" translate = '' i = len(message) - 1 while i >= 0: translate = translate + message[i] i = i - 1 print("enc message is :"+ translate) print("message :"+ message)
message = 'zulkepretest make simpletes cpplest' translate = '' i = len(message) - 1 while i >= 0: translate = translate + message[i] i = i - 1 print('enc message is :' + translate) print('message :' + message)
def whats_up_world(): print("What's up world?") if __name__ == "__main__": whats_up_world()
def whats_up_world(): print("What's up world?") if __name__ == '__main__': whats_up_world()
# -*- coding: utf-8 -*- featureInfo = dict() featureInfo['m21']=[ ['P22','Quality','Set to 0 if the key signature indicates that a recording is major, set to 1 if it indicates that it is minor and set to 0 if key signature is unknown. Music21 addition: if no key mode is found in the piece, analyze the piece to discove...
feature_info = dict() featureInfo['m21'] = [['P22', 'Quality', 'Set to 0 if the key signature indicates that a recording is major, set to 1 if it indicates that it is minor and set to 0 if key signature is unknown. Music21 addition: if no key mode is found in the piece, analyze the piece to discover what mode it is mos...
class Animal: def __init__(self, age, name): self.age = age # public attribute self.name = name # public attribute def saluda(self, saludo='Hola', receptor = 'nuevo amigo'): print(saludo + " " + receptor) @staticmethod def add(a, b): if isinstance(a, int) and isinstance(...
class Animal: def __init__(self, age, name): self.age = age self.name = name def saluda(self, saludo='Hola', receptor='nuevo amigo'): print(saludo + ' ' + receptor) @staticmethod def add(a, b): if isinstance(a, int) and isinstance(b, int): return a + b ...
class Filenames: class models: base = './res/models/player/' player = base + 'bicycle.obj' base = './res/models/oponents/' player = base + 'bicycle.obj' class textures: base = './res/textures/' floor_tile = base + 'floor.png' ...
class Filenames: class Models: base = './res/models/player/' player = base + 'bicycle.obj' base = './res/models/oponents/' player = base + 'bicycle.obj' class Textures: base = './res/textures/' floor_tile = base + 'floor.png' wall_tile = base + 'rim_wall...
class Recursion: def PalindromeCheck(self, strVal, i, j): if i>j: return True return self.PalindromeCheck(strVal, i + 1, j - 1) if strVal[i] == strVal[j] else False strVal = "q2eeeq" obj = Recursion() print(obj.PalindromeCheck(strVal, 0, len(strVal)-1))
class Recursion: def palindrome_check(self, strVal, i, j): if i > j: return True return self.PalindromeCheck(strVal, i + 1, j - 1) if strVal[i] == strVal[j] else False str_val = 'q2eeeq' obj = recursion() print(obj.PalindromeCheck(strVal, 0, len(strVal) - 1))
# Identity vs. Equality # - is vs. == # - working with literals # - isinstance() a = 1 b = 1.0 c = "1" print(a == b) print(a is b) print(c == "1") print(c is "1") print(b == 1) print(b is 1) print(b == 1 and isinstance(b, int)) print(a == 1 and isinstance(a, int)) # d = 100000000000000000000000000000000 d = float...
a = 1 b = 1.0 c = '1' print(a == b) print(a is b) print(c == '1') print(c is '1') print(b == 1) print(b is 1) print(b == 1 and isinstance(b, int)) print(a == 1 and isinstance(a, int)) d = float(10) e = float(10) print(id(d)) print(id(e)) print(d == e) print(d is e) b = int(b) print(b) print(b == 1 and isinstance(b, int...
age=input("How old ara you?") height=input("How tall are you?") weight=input("How much do you weigth?") print("So ,you're %r old , %r tall and %r heavy ." %(age,height,weight))
age = input('How old ara you?') height = input('How tall are you?') weight = input('How much do you weigth?') print("So ,you're %r old , %r tall and %r heavy ." % (age, height, weight))
def compute_bag_of_words(dataset,lang,domain_stopwords=[]): d = [] for index,row in dataset.iterrows(): text = row['title'] #texto do evento text2 = remove_stopwords(text, lang,domain_stopwords) text3 = stemming(text2, lang) d.append(text3) matrix = CountVectorizer(max_features=1000) X = m...
def compute_bag_of_words(dataset, lang, domain_stopwords=[]): d = [] for (index, row) in dataset.iterrows(): text = row['title'] text2 = remove_stopwords(text, lang, domain_stopwords) text3 = stemming(text2, lang) d.append(text3) matrix = count_vectorizer(max_features=1000) ...
def generator(): try: yield except RuntimeError as e: print(e) yield 'hello after first yield' g = generator() next(g) result = g.throw(RuntimeError, 'Broken') assert result == 'hello after first yield'
def generator(): try: yield except RuntimeError as e: print(e) yield 'hello after first yield' g = generator() next(g) result = g.throw(RuntimeError, 'Broken') assert result == 'hello after first yield'
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
x = layers.Conv2D(32, (3, 3), strides=(2, 2), padding='same')(input) x = layers.Conv2D(32, (3, 3), strides=(1, 1), padding='same')(x) x = layers.Conv2D(64, (3, 3), strides=(1, 1), padding='same')(x) x = layers.MaxPooling2D((3, 3), strides=(2, 2), padding='same')(x) x = layers.Conv2D(80, (1, 1), strides=(1, 1), padding=...
favorite_fruits = ['apple', 'orange', 'pineapple'] if 'apple' in favorite_fruits: print("You really like apples!") if 'grapefruit' in favorite_fruits: print("You really like grapefruits!") else: print("Why don't you like grapefruits?") if 'orange' not in favorite_fruits: print("Why don't you like ora...
favorite_fruits = ['apple', 'orange', 'pineapple'] if 'apple' in favorite_fruits: print('You really like apples!') if 'grapefruit' in favorite_fruits: print('You really like grapefruits!') else: print("Why don't you like grapefruits?") if 'orange' not in favorite_fruits: print("Why don't you like orange...
expected_output = { "vrf": { "default": { "local_label": { 24: { "outgoing_label_or_vc": { "No Label": { "prefix_or_tunnel_id": { "10.23.120.0/24": { ...
expected_output = {'vrf': {'default': {'local_label': {24: {'outgoing_label_or_vc': {'No Label': {'prefix_or_tunnel_id': {'10.23.120.0/24': {'outgoing_interface': {'GigabitEthernet2.120': {'next_hop': '10.12.120.2', 'bytes_label_switched': 0}, 'GigabitEthernet3.120': {'next_hop': '10.13.120.3', 'bytes_label_switched': ...
#============================================================= # modules for HSPICE sim #============================================================= #============================================================= # varmap definition #------------------------------------------------------------- # This ...
class Varmap: def __init__(self): self.n_smlcycle = 1 self.last = 0 self.smlcy = 0 self.vv = 0 self.vf = 1 self.nvar = 0 def get_var(self, name, start, end, step): if self.nvar == 0: self.map = [None] self.comblist = [None] ...
print("Programa que imprime a tabuada") numero = 5 while numero <= 255: print("\n\n\n") for n in range(1, 11): resultado = numero * n print(numero, "X", n, "=", resultado) numero = numero + 1 print("Fim do programa")
print('Programa que imprime a tabuada') numero = 5 while numero <= 255: print('\n\n\n') for n in range(1, 11): resultado = numero * n print(numero, 'X', n, '=', resultado) numero = numero + 1 print('Fim do programa')
# This sample tests the special-case handle of the multi-parameter # form of the built-in "type" call. # pyright: strict X1 = type("X1", (object,), {}) X2 = type("X2", (object,), {}) class A(X1): ... class B(X2, A): ... # This should generate an error because the first arg is not a stri...
x1 = type('X1', (object,), {}) x2 = type('X2', (object,), {}) class A(X1): ... class B(X2, A): ... x3 = type(34, (object,)) x4 = type('X4', 34) x5 = type('X5', (3,))
#!/usr/bin/env python3 # Python 3.5.3 (default, Jan 19 2017, 14:11:04) # [GCC 6.3.0 20170118] on linux def fibo(n): W = [1, 1] for i in range(n): W.append(W[i] + W[i+1]) return(W) def inpt(): n = int(input("steps: ")) print(fibo(n)) inpt()
def fibo(n): w = [1, 1] for i in range(n): W.append(W[i] + W[i + 1]) return W def inpt(): n = int(input('steps: ')) print(fibo(n)) inpt()
'''Find the area of the largest rectangle inside histogram''' def pop_stack(current_max, pos, stack): '''Remove item from stack and return area and start position''' start, height = stack.pop() return max(current_max, height * (pos - start)), start def largest_rectangle(hist): '''Find area of largest ...
"""Find the area of the largest rectangle inside histogram""" def pop_stack(current_max, pos, stack): """Remove item from stack and return area and start position""" (start, height) = stack.pop() return (max(current_max, height * (pos - start)), start) def largest_rectangle(hist): """Find area of larg...
# MIT License # ----------- # Copyright (c) 2021 Sorn Zupanic Maksumic (https://www.usn.no) # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitatio...
class Vector2: def __init__(self, x, y): self.x = x self.y = y def magnitude(self): return pow(self.x * self.x + self.y * self.y, 0.5) def __sub__(self, other): return vector2(self.x - other.x, self.y - other.y) def dot(self, other): return self.x * other.x + ...
pd = int(input()) num = pd while True : rev = 0 temp = num + 1 while temp>0 : rem = temp%10; rev = rev*10 + rem temp = temp//10 if rev == num+1 : print(num+1) break num += 1
pd = int(input()) num = pd while True: rev = 0 temp = num + 1 while temp > 0: rem = temp % 10 rev = rev * 10 + rem temp = temp // 10 if rev == num + 1: print(num + 1) break num += 1
n=int(input()) count=n sumnum=0 if n==0: print("No Data") else: while count>0: num=float(input()) sumnum+=num count-=1 print(sumnum/n)
n = int(input()) count = n sumnum = 0 if n == 0: print('No Data') else: while count > 0: num = float(input()) sumnum += num count -= 1 print(sumnum / n)
__config_version__ = 1 GLOBALS = { 'serializer': '{{major}}.{{minor}}.{{patch}}{{status if status}}', } FILES = [{ 'path': 'README.rst', 'serializer': '{{major}}.{{minor}}.{{patch}}'}, 'docs/conf.py', 'setup.py', 'src/oemof/tabular/__init__.py'] VERSION = ['major', 'minor', 'patch', ...
__config_version__ = 1 globals = {'serializer': '{{major}}.{{minor}}.{{patch}}{{status if status}}'} files = [{'path': 'README.rst', 'serializer': '{{major}}.{{minor}}.{{patch}}'}, 'docs/conf.py', 'setup.py', 'src/oemof/tabular/__init__.py'] version = ['major', 'minor', 'patch', {'name': 'status', 'type': 'value_list',...
__version__ = '0.1.2' NAME = 'atlasreader' MAINTAINER = 'Michael Notter' EMAIL = 'michaelnotter@hotmail.com' VERSION = __version__ LICENSE = 'MIT' DESCRIPTION = ('A toolbox for generating cluster reports from statistical ' 'maps') LONG_DESCRIPTION = ('') URL = 'http://github.com/miykael/{name}'.format(n...
__version__ = '0.1.2' name = 'atlasreader' maintainer = 'Michael Notter' email = 'michaelnotter@hotmail.com' version = __version__ license = 'MIT' description = 'A toolbox for generating cluster reports from statistical maps' long_description = '' url = 'http://github.com/miykael/{name}'.format(name=NAME) download_url ...
def apply_mode(module, mode): if mode == 'initialize' and 'reset_parameters' in dir(module): module.reset_parameters() for param in module.parameters(): if mode == 'freeze': param.requires_grad = False elif mode in ['fine-tune', 'initialize']: param.requires_grad...
def apply_mode(module, mode): if mode == 'initialize' and 'reset_parameters' in dir(module): module.reset_parameters() for param in module.parameters(): if mode == 'freeze': param.requires_grad = False elif mode in ['fine-tune', 'initialize']: param.requires_grad ...
reactions_irreversible = [ # FIXME Automatic irreversible for: Cl- {"CaCl2": -1, "Ca++": 1, "Cl-": 2, "type": "irrev", "id_db": -1}, {"NaCl": -1, "Na+": 1, "Cl-": 1, "type": "irrev", "id_db": -1}, {"KCl": -1, "K+": 1, "Cl-": 1, "type": "irrev", "id_db": -1}, {"KOH": -1, "K+": 1, "OH-": 1, "type": "i...
reactions_irreversible = [{'CaCl2': -1, 'Ca++': 1, 'Cl-': 2, 'type': 'irrev', 'id_db': -1}, {'NaCl': -1, 'Na+': 1, 'Cl-': 1, 'type': 'irrev', 'id_db': -1}, {'KCl': -1, 'K+': 1, 'Cl-': 1, 'type': 'irrev', 'id_db': -1}, {'KOH': -1, 'K+': 1, 'OH-': 1, 'type': 'irrev', 'id_db': -1}, {'MgCl2': -1, 'Mg++': 1, 'Cl-': 2, 'type...
class FirstOrderFilter: # first order filter def __init__(self, x0, rc, dt, initialized=True): self.x = x0 self.dt = dt self.update_alpha(rc) self.initialized = initialized def update_alpha(self, rc): self.alpha = self.dt / (rc + self.dt) def update(self, x): if self.initialized: ...
class Firstorderfilter: def __init__(self, x0, rc, dt, initialized=True): self.x = x0 self.dt = dt self.update_alpha(rc) self.initialized = initialized def update_alpha(self, rc): self.alpha = self.dt / (rc + self.dt) def update(self, x): if self.initialize...
# Move to the treasure room and defeat all the ogres. while True: hero.moveUp(4) hero.moveRight(4) hero.moveDown(3) hero.moveLeft() enemy = hero.findNearestEnemy() hero.attack(enemy) hero.attack(enemy) enemy2 = hero.findNearestEnemy() hero.attack(enemy2) hero.attack(enemy2) e...
while True: hero.moveUp(4) hero.moveRight(4) hero.moveDown(3) hero.moveLeft() enemy = hero.findNearestEnemy() hero.attack(enemy) hero.attack(enemy) enemy2 = hero.findNearestEnemy() hero.attack(enemy2) hero.attack(enemy2) enemy3 = hero.findNearestEnemy() hero.attack(enemy3...
# SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries # # SPDX-License-Identifier: MIT # This file is where you keep secret settings, passwords, and tokens! # If you put them in the code you risk committing that info or sharing it secrets = { # tuples of name, sekret key, color 't...
secrets = {'totp_keys': [('Github', 'JBSWY3DPEHPK3PXP', 8860328), ('Discord', 'JBSWY3DPEHPK3PXQ', 3319966), ('Slack', 'JBSWY5DZEHPK3PXR', 16549406), ('Basecamp', 'JBSWY6DZEHPK3PXS', 5620300), ('Gmail', 'JBSWY7DZEHPK3PXT', 3156479), None, None, None, None, ('Hello Kitty', 'JBSWY7DZEHPK3PXU', 15537743), None, None]}
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def python3(): http_archive( name = "python3", build_file...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_file') def python3(): http_archive(name='python3', build_file='//bazel/deps/python3:build.BUILD', sha256='36592ee2910b399c68bf0ddad1625f2c6a359ab9a8253d676d44531500e475d4', strip_prefix='...
# Python program that uses classes and objects to represent realworld entities class Book(): # A class is a custom datatype template or blueprint title="" # Attribute author="" pages=0 book1 = Book() # An object is an instance of a class book2 = Book() book1.title = "Harry Potter" # The objects attribute ...
class Book: title = '' author = '' pages = 0 book1 = book() book2 = book() book1.title = 'Harry Potter' book1.author = 'JK Rowling' book1.pages = 500 book2.title = 'Lord of the Rings' book2.author = 'Tolkien' book2.pages = 700 print('\nTitle:\t', book1.title, '\nAuthor:\t', book1.author, '\nPages:\t', book1...
# INSERTION OF NODE AT END , BEGGINING AND AT GIVEN POS VALUE class linkedListNode: def __init__(self, value, nextNode=None): self.value = value self.nextNode = nextNode class linkedList: def __init__(self, head=None): self.head = head def printList(self): currentNode =...
class Linkedlistnode: def __init__(self, value, nextNode=None): self.value = value self.nextNode = nextNode class Linkedlist: def __init__(self, head=None): self.head = head def print_list(self): current_node = self.head while currentNode is not None: ...
# -*- coding: utf-8 -*- # This file is generated from NI-FAKE API metadata version 1.2.0d9 functions = { 'Abort': { 'codegen_method': 'public', 'documentation': { 'description': 'Aborts a previously initiated thingie.' }, 'parameters': [ { 'dir...
functions = {'Abort': {'codegen_method': 'public', 'documentation': {'description': 'Aborts a previously initiated thingie.'}, 'parameters': [{'direction': 'in', 'documentation': {'description': 'Identifies a particular instrument session.'}, 'name': 'vi', 'type': 'ViSession'}], 'returns': 'ViStatus'}, 'AcceptListOfDur...
word = "Python" assert "Python" == word[:2] + word[2:] assert "Python" == word[:4] + word[4:] assert "Py" == word[:2] assert "on" == word[4:] assert "on" == word[-2:] assert "Py" == word[:-4] # assert "Py" == word[::2] assert "Pto" == word[::2] assert "yhn" == word[1::2] assert "Pt" == word[:4:2] assert "yh" == word...
word = 'Python' assert 'Python' == word[:2] + word[2:] assert 'Python' == word[:4] + word[4:] assert 'Py' == word[:2] assert 'on' == word[4:] assert 'on' == word[-2:] assert 'Py' == word[:-4] assert 'Pto' == word[::2] assert 'yhn' == word[1::2] assert 'Pt' == word[:4:2] assert 'yh' == word[1:4:2]
a=input() a=a.lower() if(a==a[::-1]): print("String is a PALINDROME") else: print("String NOT a PALINDROME")
a = input() a = a.lower() if a == a[::-1]: print('String is a PALINDROME') else: print('String NOT a PALINDROME')
# GIS4WRF (https://doi.org/10.5281/zenodo.1288569) # Copyright (c) 2018 D. Meyer and M. Riechert. Licensed under MIT. geo_datasets = { "topo_10m": ("USGS GTOPO DEM", 0.16666667), "topo_5m": ("USGS GTOPO DEM", 0.08333333), "topo_2m": ("USGS GTOPO DEM", 0.03333333), "topo_30s": ("USGS GTOPO DEM", 0.00833...
geo_datasets = {'topo_10m': ('USGS GTOPO DEM', 0.16666667), 'topo_5m': ('USGS GTOPO DEM', 0.08333333), 'topo_2m': ('USGS GTOPO DEM', 0.03333333), 'topo_30s': ('USGS GTOPO DEM', 0.00833333), 'topo_gmted2010_30s': ('USGS GMTED2010 DEM', 0.03333333), 'lake_depth': ('Lake Depth', 0.03333333), 'landuse_10m': ('24-category U...
class Solution: def minRemoveToMakeValid(self, s: str) -> str: # step 1: 1st pass, traverse the string from left to right lcounter = 0 rcounter = 0 marker = 0 toremove1 = [] for i,char in enumerate(s): if char == '(': lcou...
class Solution: def min_remove_to_make_valid(self, s: str) -> str: lcounter = 0 rcounter = 0 marker = 0 toremove1 = [] for (i, char) in enumerate(s): if char == '(': lcounter += 1 elif char == ')': rcounter += 1 ...
a = int(input()) b = int(input()) r = a * b while True: if b == 0: break print(a * (b % 10)) b //= 10 print(r)
a = int(input()) b = int(input()) r = a * b while True: if b == 0: break print(a * (b % 10)) b //= 10 print(r)
# Interface for the data source used in queries. # Currently only includes query capabilities. class Source: def __init__(self): None def isQueryable(self): return False # Check if the source will support the execution of an expression, # given that clauses have already been pushed into it. def su...
class Source: def __init__(self): None def is_queryable(self): return False def supports(self, clauses, expr, visible_vars): return False class Rdbmstable(Source): def is_queryable(self): return True
# me - this DAT # par - the Par object that has changed # val - the current value # prev - the previous value # # Make sure the corresponding toggle is enabled in the Parameter Execute DAT. def onValueChange(par, prev): if par.name == 'Heartbeatrole': parent().Role_setup(par) else: pass return def onPuls...
def on_value_change(par, prev): if par.name == 'Heartbeatrole': parent().Role_setup(par) else: pass return def on_pulse(par): return def on_expression_change(par, val, prev): return def on_export_change(par, val, prev): return def on_enable_change(par, val, prev): return ...
def fibonacci(n): if n == 0: return 0 elif n == 1: return 1 fn1 = 0 fn2 = 1 for i in range(1, n): tmp = fn2 fn2 = fn1 + fn2 fn1 = tmp return fn2 if __name__ == '__main__': print(fibonacci(100))
def fibonacci(n): if n == 0: return 0 elif n == 1: return 1 fn1 = 0 fn2 = 1 for i in range(1, n): tmp = fn2 fn2 = fn1 + fn2 fn1 = tmp return fn2 if __name__ == '__main__': print(fibonacci(100))
# -*- coding: utf-8 -*- # Settings_Export: control which project settings are exposed to templates # See: https://github.com/jakubroztocil/django-settings-export SETTINGS_EXPORT = [ "SITE_NAME", "DEBUG", "ENV" ] # Settings can be accessed in templates via `{{ '{{' }} settings.<KEY> {{ '}}' }}`.
settings_export = ['SITE_NAME', 'DEBUG', 'ENV']
# Dataset information LABELS = [ 'Atelectasis', 'Cardiomegaly', 'Effusion', 'Infiltration', 'Mass', 'Nodule', 'Pneumonia', 'Pneumothorax', 'Consolidation', 'Edema', 'Emphysema', 'Fibrosis', 'Pleural_Thickening', 'Hernia' ] USE_COLUMNS = ['Image Index', 'Finding Labels', 'Patient ID'] N_CLASSES = len(LABELS)...
labels = ['Atelectasis', 'Cardiomegaly', 'Effusion', 'Infiltration', 'Mass', 'Nodule', 'Pneumonia', 'Pneumothorax', 'Consolidation', 'Edema', 'Emphysema', 'Fibrosis', 'Pleural_Thickening', 'Hernia'] use_columns = ['Image Index', 'Finding Labels', 'Patient ID'] n_classes = len(LABELS) random_seed = 42 dataset_image_size...
#!/bin/python3 DISK_SIZE = 272 INIT_STATE = '00111101111101000' def fill_disk(state, max_size): if len(state) > max_size: return state[:max_size] temp_state = state state += '0' for i in range(1, len(temp_state)+1): state += str(abs(int(temp_state[-i])-1)) return fill_disk(state...
disk_size = 272 init_state = '00111101111101000' def fill_disk(state, max_size): if len(state) > max_size: return state[:max_size] temp_state = state state += '0' for i in range(1, len(temp_state) + 1): state += str(abs(int(temp_state[-i]) - 1)) return fill_disk(state, max_size) de...
## Valid Phone Number Checker def num_only(): ''' returns the user inputed phone number in the form of only ten digits, and prints the string 'Thanks!' if the number is inputted in a correct format or prints the string 'Invalid number.' if the input is not in correct form num_only: None -> Str...
def num_only(): """ returns the user inputed phone number in the form of only ten digits, and prints the string 'Thanks!' if the number is inputted in a correct format or prints the string 'Invalid number.' if the input is not in correct form num_only: None -> Str examples: >>> num...
envs_dict = { # "Standard" Mujoco Envs "halfcheetah": "gym.envs.mujoco.half_cheetah:HalfCheetahEnv", "ant": "gym.envs.mujoco.ant:AntEnv", "hopper": "gym.envs.mujoco.hopper:HopperEnv", "walker": "gym.envs.mujoco.walker2d:Walker2dEnv", "humanoid": "gym.envs.mujoco.humanoid:HumanoidEnv", "swimm...
envs_dict = {'halfcheetah': 'gym.envs.mujoco.half_cheetah:HalfCheetahEnv', 'ant': 'gym.envs.mujoco.ant:AntEnv', 'hopper': 'gym.envs.mujoco.hopper:HopperEnv', 'walker': 'gym.envs.mujoco.walker2d:Walker2dEnv', 'humanoid': 'gym.envs.mujoco.humanoid:HumanoidEnv', 'swimmer': 'gym.envs.mujoco.swimmer:SwimmerEnv', 'inverteddo...
# This file MUST be configured in order for the code to run properly # Make sure you put all your input images into an 'assets' folder. # Each layer (or category) of images must be put in a folder of its own. # CONFIG is an array of objects where each object represents a layer # THESE LAYERS MUST BE ORDERED. # Each...
config = [{'id': 1, 'name': 'asset1', 'directory': 'asset1', 'required': True, 'rarity_weights': [20, 16, 17, 8, 18, 15, 9, 6]}, {'id': 2, 'name': 'asset2', 'directory': 'asset2', 'required': True, 'rarity_weights': [8, 24, 16, 20, 13, 19, 6]}, {'id': 3, 'name': 'asset3', 'directory': 'asset3', 'required': True, 'rarit...