content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Calculator: def __init__(self): self.calculation = 0 self.operation = None def plus(self, num): self.calculation += num def minus(self, num): self.calculation -= num def multiply(self, num): self.calculation *= num def divide(self, num): ...
class Calculator: def __init__(self): self.calculation = 0 self.operation = None def plus(self, num): self.calculation += num def minus(self, num): self.calculation -= num def multiply(self, num): self.calculation *= num def divide(self, num): sel...
# Apache License Version 2.0 # # Copyright (c) 2021., Redis Labs Modules # All rights reserved. # def create_extract_arguments(parser): parser.add_argument( "--redis-url", type=str, default="redis://localhost:6379", help="The url for Redis connection", ) parser.add_argum...
def create_extract_arguments(parser): parser.add_argument('--redis-url', type=str, default='redis://localhost:6379', help='The url for Redis connection') parser.add_argument('--output-tags-json', type=str, default='extracted_tags.json', help='output filename containing the extracted tags from redis.') parse...
#################################################################### # # Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # # Filename - globaldefinesrsaformat.py # Description - This file contains global defines used in the RSA # F...
param_mod = 1 param_priv_exp = 2 param_exp = 3 pem_start = '-----BEGIN RSA PRIVATE KEY-----\n' pem_end = '\n-----END RSA PRIVATE KEY-----\n' pem_header_size_bytes = 4 pem_version_size_bytes = 3 param_header_integer_type = 2 param_length_indication_bit = 7 param_length_indication = 1 << PARAM_LENGTH_INDICATION_BIT param...
""" Entradas salario --> int --> s categoria --> int --> c Salidas aumento --> int --> a salario nuevo --> int --> sn """ s = int (input ( "Digotar el salario:" )) c = int (input ( " Digitar categoria del 1 al 5: ")) if ( c == 1 ): a = s * .10 if ( c == 2 ): a = s * .15 if ( c == 3 ): a == s * .20 ...
""" Entradas salario --> int --> s categoria --> int --> c Salidas aumento --> int --> a salario nuevo --> int --> sn """ s = int(input('Digotar el salario:')) c = int(input(' Digitar categoria del 1 al 5: ')) if c == 1: a = s * 0.1 if c == 2: a = s * 0.15 if c == 3: a == s * 0.2 if c == 4: a = s ...
class Trie(object): def __init__(self): self.child = {} def insert(self, word): word = word.strip() current = self.child for l in word: if l not in current: current[l] = {} current = current[l] current['#']=1 def search(self, word): word = wo...
class Trie(object): def __init__(self): self.child = {} def insert(self, word): word = word.strip() current = self.child for l in word: if l not in current: current[l] = {} current = current[l] current['#'] = 1 def search(sel...
def SB_BinaryStats(y,binaryMethod = 'diff'): yBin = BF_Binarize(y,binaryMethod) N = len(yBin) outDict = {} outDict['pupstat2'] = np.sum((yBin[math.floor(N /2):] == 1)) / np.sum((yBin[:math.floor(N /2)] == 1)) stretch1 = [] stretch0 = [] count = 1 for i in range(1,N): if...
def sb__binary_stats(y, binaryMethod='diff'): y_bin = bf__binarize(y, binaryMethod) n = len(yBin) out_dict = {} outDict['pupstat2'] = np.sum(yBin[math.floor(N / 2):] == 1) / np.sum(yBin[:math.floor(N / 2)] == 1) stretch1 = [] stretch0 = [] count = 1 for i in range(1, N): if yBin[...
"""Basic memory stream with random sampling.""" class MemoryStream(object): def __init__(self, size): self.memory = deque([]) def add(self, item): self.memory.append(item) if len(self.memory) > size: memory.popleft() def sample(self, shape): return np.random.s...
"""Basic memory stream with random sampling.""" class Memorystream(object): def __init__(self, size): self.memory = deque([]) def add(self, item): self.memory.append(item) if len(self.memory) > size: memory.popleft() def sample(self, shape): return np.random.s...
""" Custom exceptions for Clinical Research Study Manager package """ class MyException(ValueError): def __init__(self, msg): super().__init__(msg) class HeaderException(MyException): def __init__(self, msg): super().__init__(msg) class InputException(MyException): """ Exceptions fo...
""" Custom exceptions for Clinical Research Study Manager package """ class Myexception(ValueError): def __init__(self, msg): super().__init__(msg) class Headerexception(MyException): def __init__(self, msg): super().__init__(msg) class Inputexception(MyException): """ Exceptions fo...
""" Copyright (C) 2018 SunSpec Alliance 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 limitation the rights to use, copy, modify, merg...
""" Copyright (C) 2018 SunSpec Alliance 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 limitation the rights to use, copy, modify, merge...
# # PySNMP MIB module LINKSYS-WLAN-ACCESS-POINT-REF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LINKSYS-WLAN-ACCESS-POINT-REF-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:07:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ...
print("The variable Pp/Ptot, i.e. the fraction of paused polymerases, seems to provide the best contrast between its minimal and maximal values as K_3 varies, regardless of the values of K_1 and K_2. In this example, it is not very surprising. Sometimes it is more difficult to find which model output is the most sensit...
print('The variable Pp/Ptot, i.e. the fraction of paused polymerases, seems to provide the best contrast between its minimal and maximal values as K_3 varies, regardless of the values of K_1 and K_2. In this example, it is not very surprising. Sometimes it is more difficult to find which model output is the most sensit...
def F(): a,b = 0,1 while True: yield a a, b = b, a + b def SubFib(startNumber, endNumber): for cur in F(): if cur > endNumber: return if cur >= startNumber: yield cur # for i in SubFib(10, 200): # print(i) def fib(x): if x < 2: return [i for i...
def f(): (a, b) = (0, 1) while True: yield a (a, b) = (b, a + b) def sub_fib(startNumber, endNumber): for cur in f(): if cur > endNumber: return if cur >= startNumber: yield cur def fib(x): if x < 2: return [i for i in range(x + 1)] a...
#!/usr/bin/python3 Rectangle = __import__('2-rectangle').Rectangle my_rectangle = Rectangle(2, 4) print("Area: {} - Perimeter: {}".format(my_rectangle.area(), my_rectangle.perimeter())) print("--") my_rectangle.width = 10 my_rectangle.height = 3 print("Area: {} - Perimeter: {}".format(my_rectangle.area(), my_rectang...
rectangle = __import__('2-rectangle').Rectangle my_rectangle = rectangle(2, 4) print('Area: {} - Perimeter: {}'.format(my_rectangle.area(), my_rectangle.perimeter())) print('--') my_rectangle.width = 10 my_rectangle.height = 3 print('Area: {} - Perimeter: {}'.format(my_rectangle.area(), my_rectangle.perimeter()))
# -*- coding: utf-8 -*- """common/tests/__init__.py By David J. Thomas, thePortus.com, dave.a.base@gmail.com The init file for the common module tests """
"""common/tests/__init__.py By David J. Thomas, thePortus.com, dave.a.base@gmail.com The init file for the common module tests """
a = b = c = d = e = f = 12 x, y = 1, 2 # unpacking tuple print(x) print(y) print('unpack tuple - or any sequence type') data = (1, 2, 3) a, b, c = data print(a) print(b) print(c) print('unpack list - or any sequence type') data_list = [4, 5, 6] a, b, c = data_list print(a) print(b) print(c)
a = b = c = d = e = f = 12 (x, y) = (1, 2) print(x) print(y) print('unpack tuple - or any sequence type') data = (1, 2, 3) (a, b, c) = data print(a) print(b) print(c) print('unpack list - or any sequence type') data_list = [4, 5, 6] (a, b, c) = data_list print(a) print(b) print(c)
def calcu(): pass def calc_add(a,b): return a+b def calc_minus(a,b): return a-b
def calcu(): pass def calc_add(a, b): return a + b def calc_minus(a, b): return a - b
HEALTH_STATES = [] class App: def __init__(self, j): self.url = 'https://api.newrelic.com/v2/applications.json' if j: self.id = j.get('id') self.name = j.get('name') self.health_status = j.get('health_status') links = j.get('links') self....
health_states = [] class App: def __init__(self, j): self.url = 'https://api.newrelic.com/v2/applications.json' if j: self.id = j.get('id') self.name = j.get('name') self.health_status = j.get('health_status') links = j.get('links') self....
def has_cycle(head): slowref=head if not slowref or not slowref.next: return False fastref=head.next.next while slowref != fastref: slowref=slowref.next if not slowref or not slowref.next: return False fastref=fastref.next.next return True
def has_cycle(head): slowref = head if not slowref or not slowref.next: return False fastref = head.next.next while slowref != fastref: slowref = slowref.next if not slowref or not slowref.next: return False fastref = fastref.next.next return True
__title__ = 'electric' __description__ = "A package manager for Windows, MacOS And Linux!" __url__ = 'https://github.com/TheBossProSniper/Electric' __version__ = '0.0.1' __author__ = 'Electric Inc.' __credits__ = "" __license__ = """Apache License 2.0 A permissive license whose main conditions require preservation of...
__title__ = 'electric' __description__ = 'A package manager for Windows, MacOS And Linux!' __url__ = 'https://github.com/TheBossProSniper/Electric' __version__ = '0.0.1' __author__ = 'Electric Inc.' __credits__ = '' __license__ = 'Apache License 2.0\nA permissive license whose main conditions require preservation\nof c...
def main(): # input S = list(input()) # compute N = len(S) cnt = 0 while ''.join(S).count('BW') != 0: for i in range(N-1): if S[i]=='B' and S[i+1]=='W': S[i], S[i+1] = S[i+1], S[i] cnt += 1 print(cnt, ''.join(S)) # output ...
def main(): s = list(input()) n = len(S) cnt = 0 while ''.join(S).count('BW') != 0: for i in range(N - 1): if S[i] == 'B' and S[i + 1] == 'W': (S[i], S[i + 1]) = (S[i + 1], S[i]) cnt += 1 print(cnt, ''.join(S)) print(cnt) if __name_...
class Solution: def reverse(self, x: int) -> int: # get the sign of x if x == 0: return x sign = abs(x) / x x = abs(x) # reverse number num = 0 # reverse process while x != 0: temp = x % 10 num = num * 10 + temp ...
class Solution: def reverse(self, x: int) -> int: if x == 0: return x sign = abs(x) / x x = abs(x) num = 0 while x != 0: temp = x % 10 num = num * 10 + temp x = x // 10 num = int(sign * num) return num if -2 ** ...
#* Asked in Uber #? You are given a string of parenthesis. Return the minimum number of parenthesis that would need to be removed #? in order to make the string valid. "Valid" means that each open parenthesis has a matching closed parenthesis. #! Example: # "()())()" #? The following input should return 1. # ")"...
def count_invalid_parenthesis(string): count = 0 for i in string: if i == '(' or i == '[' or i == '{': count += 1 elif i == ')' or i == ']' or i == '}': count -= 1 return abs(count) print(count_invalid_parenthesis('()())()'))
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/config.ipynb (unless otherwise specified). __all__ = ['AppConfig', 'PathConfig', 'TrainConfig'] # Cell class AppConfig: SEED = 8080 NUM_CLASSES = 7 class PathConfig: # DATA_PATH = '/content/data' # IMAGE_PATH = '/content/data/images' # ...
__all__ = ['AppConfig', 'PathConfig', 'TrainConfig'] class Appconfig: seed = 8080 num_classes = 7 class Pathconfig: data_path = '/Work/Workspace/ML/HAM10000/data' image_path = DATA_PATH + '/images' csv_path = DATA_PATH + '/HAM10000_metadata.csv' class Trainconfig: batch_size = 64 epochs =...
#accessibility numbers for science. Pretty sure fosscord just hardcodes this as 128. class ACCESSIBILITY_FEATURES: SCREENREADER = 1 << 0 REDUCED_MOTION = 1 << 1 REDUCED_TRANSPARENCY = 1 << 2 HIGH_CONTRAST = 1 << 3 BOLD_TEXT = 1 << 4 GRAYSCALE = 1 << 5 INVERT_COLORS = 1 << 6 PREFERS_COLOR_SCHEME_LIGHT = 1 << 7 ...
class Accessibility_Features: screenreader = 1 << 0 reduced_motion = 1 << 1 reduced_transparency = 1 << 2 high_contrast = 1 << 3 bold_text = 1 << 4 grayscale = 1 << 5 invert_colors = 1 << 6 prefers_color_scheme_light = 1 << 7 prefers_color_scheme_dark = 1 << 8 chat_font_scale_inc...
""" Rename this file to 'secret.py' once all settings are defined """ SECRET_KEY = "..." HOSTNAME = "example.com" DATABASE_URL = "mysql://<user>:<password>@<host>/<database>" AWS_ACCESS_KEY_ID = "12345" AWS_SECRET_ACCESS_KEY = "12345"
""" Rename this file to 'secret.py' once all settings are defined """ secret_key = '...' hostname = 'example.com' database_url = 'mysql://<user>:<password>@<host>/<database>' aws_access_key_id = '12345' aws_secret_access_key = '12345'
#!/usr/bin/python # --------------------------------------- # # Cara Define Sebuah Function pada Python # # --------------------------------------- # # def functionname( parameters ): # # "function_docstring" # # function_suite # # return [expression] # # --------------------------...
def changeme(mylist): """This changes a passed list into this function""" mylist.append([1, 2, 3, 4]) print('Values inside the function: ', mylist) return mylist = [10, 20, 30] changeme(mylist) print('Values outside the function: ', mylist)
class Custom( ): pass
class Custom: pass
def primitive_triplets(): pass def triplets_in_range(): pass def is_triplet(): pass
def primitive_triplets(): pass def triplets_in_range(): pass def is_triplet(): pass
n, m = map(int, input().split()) for i in range(n): if i % 2 == 0: print('#' * m) else: if (i + 1) % 4 == 0: print('#' + '.' * (m - 1)) else: print('.' * (m - 1) + '#')
(n, m) = map(int, input().split()) for i in range(n): if i % 2 == 0: print('#' * m) elif (i + 1) % 4 == 0: print('#' + '.' * (m - 1)) else: print('.' * (m - 1) + '#')
# Binary dependencies needed for running the bash commands DEPS = ["mvn", "openssl", "awk"] # helper function to encapsulate bash commands. def _execute(ctx, command): return ctx.execute(["bash", "-c", """ set -ex %s""" % command]) # Assert that all relevant binaries are on class path #TODO(petros): how should I de...
deps = ['mvn', 'openssl', 'awk'] def _execute(ctx, command): return ctx.execute(['bash', '-c', '\nset -ex\n%s' % command]) def _check_dependencies(ctx): for dep in DEPS: if ctx.which(dep) == None: fail('%s requires %s as a dependency. Please check your PATH.' % (ctx.name, dep)) def _trans...
""" Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. Example: Input: 13 Output: 6 Explanation: Digit 1 occurred in the following numbers: 1, 10, 11, 12, 13. """ class Solution: def countDigitOne(self, n: int) -> int: cnt = 0 m...
""" Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. Example: Input: 13 Output: 6 Explanation: Digit 1 occurred in the following numbers: 1, 10, 11, 12, 13. """ class Solution: def count_digit_one(self, n: int) -> int: cnt = 0 ...
# Copyright 2015 VMware, Inc. # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
compact = 'compact' large = 'large' xlarge = 'xlarge' quadlarge = 'quadlarge' service_edge = 'service' vdr_edge = 'vdr' inter_edge_purpose = 'inter_edge_net'
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. fb_native = struct( android_aar = native.android_aar, android_app_modularity = native.android_app_modularity, android_binary = nat...
fb_native = struct(android_aar=native.android_aar, android_app_modularity=native.android_app_modularity, android_binary=native.android_binary, android_build_config=native.android_build_config, android_bundle=native.android_bundle, android_instrumentation_apk=native.android_instrumentation_apk, android_instrumentation_t...
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Education, obj[4]: Occupation, obj[5]: Bar, obj[6]: Coffeehouse, obj[7]: Restaurant20to50, obj[8]: Direction_same, obj[9]: Distance # {"feature": "Coupon", "instances": 8148, "metric_value": 0.4751, "depth": 1} if obj[2]>1: # {"feature...
def find_decision(obj): if obj[2] > 1: if obj[6] > 0.0: if obj[9] <= 2: if obj[0] <= 2: if obj[1] <= 3: if obj[5] <= 3.0: if obj[8] <= 0: if obj[4] > 0: ...
del_items(0x80124F0C) SetType(0x80124F0C, "void GameOnlyTestRoutine__Fv()") del_items(0x80124F14) SetType(0x80124F14, "int vecleny__Fii(int a, int b)") del_items(0x80124F38) SetType(0x80124F38, "int veclenx__Fii(int a, int b)") del_items(0x80124F64) SetType(0x80124F64, "void GetDamageAmt__FiPiT1(int i, int *mind, int *...
del_items(2148683532) set_type(2148683532, 'void GameOnlyTestRoutine__Fv()') del_items(2148683540) set_type(2148683540, 'int vecleny__Fii(int a, int b)') del_items(2148683576) set_type(2148683576, 'int veclenx__Fii(int a, int b)') del_items(2148683620) set_type(2148683620, 'void GetDamageAmt__FiPiT1(int i, int *mind, i...
info = { 'driver_path' : "\\\\webdriver\\\\content\\\\geckodriver.exe", 'profile_path' : "\\\\webdriver\\\\content\\\\firefox_profile", 'primary_url' : "https://web.whatsapp.com", 'send_url' : "https://web.whatsapp.com/send?phone={}&text={}", 'send_button_class_name' : "_2Ujuu" }
info = {'driver_path': '\\\\webdriver\\\\content\\\\geckodriver.exe', 'profile_path': '\\\\webdriver\\\\content\\\\firefox_profile', 'primary_url': 'https://web.whatsapp.com', 'send_url': 'https://web.whatsapp.com/send?phone={}&text={}', 'send_button_class_name': '_2Ujuu'}
class Group(object): def __init__(self, _name): self.name = _name self.groups = [] self.users = [] def add_group(self, group): self.groups.append(group) def add_user(self, user): self.users.append(user) def get_groups(self): return self.groups def ...
class Group(object): def __init__(self, _name): self.name = _name self.groups = [] self.users = [] def add_group(self, group): self.groups.append(group) def add_user(self, user): self.users.append(user) def get_groups(self): return self.groups def...
config = { "colors": { "WHITE": (255, 255, 255), "RED": (255, 0, 0), "GREEN": (0, 255, 0), "BLACK": (0, 0, 0) }, "globals": { "WIDTH": 600, "HEIGHT": 400, "BALL_RADIUS": 20, "PAD_WIDTH": 8, "PAD_HEIGHT": 80 } }
config = {'colors': {'WHITE': (255, 255, 255), 'RED': (255, 0, 0), 'GREEN': (0, 255, 0), 'BLACK': (0, 0, 0)}, 'globals': {'WIDTH': 600, 'HEIGHT': 400, 'BALL_RADIUS': 20, 'PAD_WIDTH': 8, 'PAD_HEIGHT': 80}}
"""Mel cepstral distortion (MCD) computations in python.""" # Copyright 2014, 2015, 2016, 2017 Matt Shannon # This file is part of mcd. # See `License` for details of license and warranty. __version__ = '0.5.dev1'
"""Mel cepstral distortion (MCD) computations in python.""" __version__ = '0.5.dev1'
#!/usr/bin/env python # Income Share Agreement min = 50000.0 max = 88235.3 max_pay = 30000.0 max_income = 2117647.06 monthly_increment = (max - min)/23 print('\n24 months maximum payment with a minimum of $50,000 annual income') print('Maximum income for 24 month repayment is $88,235.30\n') print('For incomes exc...
min = 50000.0 max = 88235.3 max_pay = 30000.0 max_income = 2117647.06 monthly_increment = (max - min) / 23 print('\n24 months maximum payment with a minimum of $50,000 annual income') print('Maximum income for 24 month repayment is $88,235.30\n') print('For incomes exceeding $88,235.30 see chart below,\nfor reduced pa...
# # PySNMP MIB module IANA-IPPM-METRICS-REGISTRY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IANA-IPPM-METRICS-REGISTRY-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:38:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) ...
''' Created on 1.12.2016 @author: Darren '''''' Given n, generate all structurally unique BST s (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST s shown below. 1 3 3 2 1 \ / / / \ \ ...
""" Created on 1.12.2016 @author: Darren Given n, generate all structurally unique BST s (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST s shown below. 1 3 3 2 1 \\ / / / \\ 3 2 ...
# colorsystem.py is the full list of colors that can be used to easily create themes. class Gray: B0 = '#000000' B10 = '#19232D' B20 = '#293544' B30 = '#37414F' B40 = '#455364' B50 = '#54687A' B60 = '#60798B' B70 = '#788D9C' B80 = '#9DA9B5' B90 = '#ACB1B6' B100 = '#B9BDC1' ...
class Gray: b0 = '#000000' b10 = '#19232D' b20 = '#293544' b30 = '#37414F' b40 = '#455364' b50 = '#54687A' b60 = '#60798B' b70 = '#788D9C' b80 = '#9DA9B5' b90 = '#ACB1B6' b100 = '#B9BDC1' b110 = '#C9CDD0' b120 = '#CED1D4' b130 = '#E0E1E3' b140 = '#FAFAFA' ...
# Power Drive System # Controlword common bits. IL_MC_CW_SO = (1 << 0) IL_MC_CW_EV = (1 << 1) IL_MC_CW_QS = (1 << 2) IL_MC_CW_EO = (1 << 3) IL_MC_CW_FR = (1 << 7) IL_MC_CW_H = (1 << 8) # Statusword common bits. IL_MC_SW_RTSO = (1 << 0) IL_MC_SW_SO = (1 << 1) IL_MC_SW_OE = (1 << 2) IL_MC_SW_F = (1 << 3) IL_MC_SW_VE = (1...
il_mc_cw_so = 1 << 0 il_mc_cw_ev = 1 << 1 il_mc_cw_qs = 1 << 2 il_mc_cw_eo = 1 << 3 il_mc_cw_fr = 1 << 7 il_mc_cw_h = 1 << 8 il_mc_sw_rtso = 1 << 0 il_mc_sw_so = 1 << 1 il_mc_sw_oe = 1 << 2 il_mc_sw_f = 1 << 3 il_mc_sw_ve = 1 << 4 il_mc_sw_qs = 1 << 5 il_mc_sw_sod = 1 << 6 il_mc_sw_w = 1 << 7 il_mc_sw_rm = 1 << 9 il_mc...
class base_graph_style(): NAME:str = '' class default_graph_style(base_graph_style): NAME:str = 'default' # Task Nodes: TASK_NODE_STYLE = 'filled' TASK_NODE_SHAPE = 'box3d' TASK_NODE_PENWIDTH = 1, TASK_NODE_FONTCOLOR = 'black' DISABLED_TASK_COLOR = 'dimgrey' DISABLED_TASK_FONTCOL...
class Base_Graph_Style: name: str = '' class Default_Graph_Style(base_graph_style): name: str = 'default' task_node_style = 'filled' task_node_shape = 'box3d' task_node_penwidth = (1,) task_node_fontcolor = 'black' disabled_task_color = 'dimgrey' disabled_task_fontcolor = TASK_NODE_FONT...
num1 = int(input('Enter number 1: ')) num2 = int(input('Enter number 2: ')) num3 = int(input('Enter number 3: ')) if num1 > num2 and num1 > num3: print(str(num1) + ' is the greatest!') if num2 > num3 and num2 > num1: print(str(num2) + ' is the greatest!') if num3 > num1 and num3 > num2: print(str(num3) +...
num1 = int(input('Enter number 1: ')) num2 = int(input('Enter number 2: ')) num3 = int(input('Enter number 3: ')) if num1 > num2 and num1 > num3: print(str(num1) + ' is the greatest!') if num2 > num3 and num2 > num1: print(str(num2) + ' is the greatest!') if num3 > num1 and num3 > num2: print(str(num3) + ' ...
MainWindow.clearData() MainWindow.openPost3D() PostProcess.script_openFile(-1,"Post3D","%examplesPath%/water.vtk") PostProcess.script_openFile(-1,"Post3D","%examplesPath%/platform.vtk") PostProcess.script_applyClicked(-1,"Post3D") PostProcess.script_Properties_streamline_integration_direction(-1,"Post3D",3,2) PostProce...
MainWindow.clearData() MainWindow.openPost3D() PostProcess.script_openFile(-1, 'Post3D', '%examplesPath%/water.vtk') PostProcess.script_openFile(-1, 'Post3D', '%examplesPath%/platform.vtk') PostProcess.script_applyClicked(-1, 'Post3D') PostProcess.script_Properties_streamline_integration_direction(-1, 'Post3D', 3, 2) P...
class deques(): def __init__(self): self.items = [] def addFront(self,item): return self.items.append(item) def addRear(self,item): return self.items.insert(0,item) def removeFront(self): return self.items.pop() def removeRear(self): return self.items.pop(...
class Deques: def __init__(self): self.items = [] def add_front(self, item): return self.items.append(item) def add_rear(self, item): return self.items.insert(0, item) def remove_front(self): return self.items.pop() def remove_rear(self): return self.item...
Despesas = float(input("Quanto foi gasto?")) Gorjeta = Despesas / 100 * 10 Total = Despesas + Gorjeta print("--------------------------------------- \n O total foi de R${:.2f} \n Com uma gorjeta de R${:.2f} \n --------------------------------------- ".format(Total, Gorjeta))
despesas = float(input('Quanto foi gasto?')) gorjeta = Despesas / 100 * 10 total = Despesas + Gorjeta print('--------------------------------------- \n O total foi de R${:.2f} \n Com uma gorjeta de R${:.2f} \n --------------------------------------- '.format(Total, Gorjeta))
""" Entradas Chelines-->int-->CA Dracmas-->int-->DG Pesetas-->int-->P salidas CA-->int-->P DG-->int-->FrancoFrances P-->int-->Dolares P-->int-->LirasItalianas """ #entrada CA=int(input("Ingrese la cantidad de Chelines Austriacos a cambiar: ")) DG=int(input("Ingrese la cantidad de Dracmas Griegos a cambiar: ")) P=int(in...
""" Entradas Chelines-->int-->CA Dracmas-->int-->DG Pesetas-->int-->P salidas CA-->int-->P DG-->int-->FrancoFrances P-->int-->Dolares P-->int-->LirasItalianas """ ca = int(input('Ingrese la cantidad de Chelines Austriacos a cambiar: ')) dg = int(input('Ingrese la cantidad de Dracmas Griegos a cambiar: ')) p = int(input...
def cc_lint_test_impl(ctx): args = " ".join( [ctx.expand_make_variables("cmd", arg, {}) for arg in ctx.attr.linter_args]) ctx.file_action( content = "%s %s %s" % ( ctx.executable.linter.short_path, args, " ".join([src.short_path for src in ctx.files.srcs])), ...
def cc_lint_test_impl(ctx): args = ' '.join([ctx.expand_make_variables('cmd', arg, {}) for arg in ctx.attr.linter_args]) ctx.file_action(content='%s %s %s' % (ctx.executable.linter.short_path, args, ' '.join([src.short_path for src in ctx.files.srcs])), output=ctx.outputs.executable, executable=True) return...
# pycrc -- parameterisable CRC calculation utility and C source code generator # # Copyright (c) 2017 Thomas Pircher <tehpeh-web@tty1.net> # # 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 Soft...
""" This modules simplifies an expression. import pycrc.expr as exp my_expr = exp.Xor('var', exp.Parenthesis(exp.And('0x700', 4))) print('"{}" -> "{}"'.format(my_expr, my_expr.simplify())) """ def _classify(val): """ Creates a Terminal object if the parameter is a string or an integer. """ ...
# -*- coding: utf-8 -*- """ Created on Fri Oct 12 13:16:08 2018 @author: Kenneth Collins """ """colRecoder2(dataFrame, colName, oldVal, newVal): requires: pandas dataFrame, colName must be the columns name (e.g. df.colName), not a string effects: returns a copy of the column. Does NOT mutate data. Thus must be assign...
""" Created on Fri Oct 12 13:16:08 2018 @author: Kenneth Collins """ 'colRecoder2(dataFrame, colName, oldVal, newVal):\nrequires: pandas dataFrame, colName must be the columns name (e.g. df.colName), not a string \neffects: returns a copy of the column. Does NOT mutate data.\nThus must be assigned to change data.\n' ...
fname = input('Enter a file name:') try : fhand = open('ch07\\' + fname) except : print('File cannot be opened:',fname) quit() for str in fhand : print(str.upper().rstrip()) try : fhand.close() except : pass
fname = input('Enter a file name:') try: fhand = open('ch07\\' + fname) except: print('File cannot be opened:', fname) quit() for str in fhand: print(str.upper().rstrip()) try: fhand.close() except: pass
n = int(input()) total = 1 while n != 0: total *= n n -= 1 print(n) print(total)
n = int(input()) total = 1 while n != 0: total *= n n -= 1 print(n) print(total)
""" # REMOVE NTH NODE FROM END OF LINKED LIST Given the head of a linked list, remove the nth node from the end of the list and return its head. Follow up: Could you do this in one pass? Example 1: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] Example 2: Input: head = [1], n = 1 Output: [] Example 3: Inpu...
""" # REMOVE NTH NODE FROM END OF LINKED LIST Given the head of a linked list, remove the nth node from the end of the list and return its head. Follow up: Could you do this in one pass? Example 1: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] Example 2: Input: head = [1], n = 1 Output: [] Example 3: Inpu...
#!/usr/bin/env python3 # @AUTHUR: Kingsley Nnaji <kingsley.nnaji@gmail.com> # @LICENCE: MIT # Creation Date: 02.09.2019 def fib(n): """ fib(number) -> number fib takes a number as an Argurment and returns the fibonacci value of that number >>> fib(8) -> 21 >>> fib(6) -> 8 >>> fib(0) -> 1 ""...
def fib(n): """ fib(number) -> number fib takes a number as an Argurment and returns the fibonacci value of that number >>> fib(8) -> 21 >>> fib(6) -> 8 >>> fib(0) -> 1 """ y = {} if n in y.keys(): return y[n] if n <= 2: f = 1 else: f = fib(n - 1) + fib(n ...
def cool_string(s: str) -> bool: """ Let's call a string cool if it is formed only by Latin letters and no two lowercase and no two uppercase letters are in adjacent positions. Given a string, check if it is cool. """ string_without_whitespace = ''.join(s.split()) if string_without_whitespace....
def cool_string(s: str) -> bool: """ Let's call a string cool if it is formed only by Latin letters and no two lowercase and no two uppercase letters are in adjacent positions. Given a string, check if it is cool. """ string_without_whitespace = ''.join(s.split()) if string_without_whitespace....
# https://leetcode.com/problems/matrix-diagonal-sum/ class Solution: def diagonalSum(self, mat: List[List[int]]) -> int: res = 0 i, j = 0, 0 while (j < len(mat)): #print(i,j) res += mat[i][j] i += 1 j += 1 i, j = 0, len(m...
class Solution: def diagonal_sum(self, mat: List[List[int]]) -> int: res = 0 (i, j) = (0, 0) while j < len(mat): res += mat[i][j] i += 1 j += 1 (i, j) = (0, len(mat) - 1) while j >= 0: if i != j: res += mat[i][j...
def test(): print('\nNON-NESTED BLOCK COMMENT EXAMPLE:') sample = ''' /** * Some comments * longer comments here that we can parse. * * Rahoo */ function subroutine() { a = /* inline comment */ b + c ; } /*/ <-- tricky comments */ /** * Another comment. */ function s...
def test(): print('\nNON-NESTED BLOCK COMMENT EXAMPLE:') sample = ' /**\n * Some comments\n * longer comments here that we can parse.\n *\n * Rahoo\n */\n function subroutine() {\n a = /* inline comment */ b + c ;\n }\n /*/ <-- tricky comments */\n\n /**\n * Another comment.\n */\n ...
# -*- coding: utf-8 -*- { 'name': 'Slides', 'version': '1.0', 'sequence': 145, 'summary': 'Share and Publish Videos, Presentations and Documents', 'category': 'Website', 'description': """ Share and Publish Videos, Presentations and Documents' ====================================================...
{'name': 'Slides', 'version': '1.0', 'sequence': 145, 'summary': 'Share and Publish Videos, Presentations and Documents', 'category': 'Website', 'description': "\nShare and Publish Videos, Presentations and Documents'\n======================================================\n\n * Website Application\n * Channel Manageme...
class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: window = collections.deque() ans = [] for i, num in enumerate(nums): while window and num >= window[-1][0]: window.pop() window.append((num, i)) if i - window...
class Solution: def max_sliding_window(self, nums: List[int], k: int) -> List[int]: window = collections.deque() ans = [] for (i, num) in enumerate(nums): while window and num >= window[-1][0]: window.pop() window.append((num, i)) if i - w...
#Tuples - faster Lists you can't change friends = ['John','Michael','Terry','Eric','Graham'] friends_tuple = ('John','Michael','Terry','Eric','Graham') print(friends) print(friends_tuple) print(friends[2:4]) print(friends_tuple[2:4])
friends = ['John', 'Michael', 'Terry', 'Eric', 'Graham'] friends_tuple = ('John', 'Michael', 'Terry', 'Eric', 'Graham') print(friends) print(friends_tuple) print(friends[2:4]) print(friends_tuple[2:4])
t1 = 0 t2 = 1 print(f'{t1} -> {t2} -> ', end='') for c in range(1, 21): t3 = t1 + t2 print(f'{t3} -> ', end='') t1 = t2 t2 = t3 print('FIM', end='')
t1 = 0 t2 = 1 print(f'{t1} -> {t2} -> ', end='') for c in range(1, 21): t3 = t1 + t2 print(f'{t3} -> ', end='') t1 = t2 t2 = t3 print('FIM', end='')
# COLORS = ['V', 'I', 'B', 'G', 'Y', 'O', 'R'] EMPTY = "-" # DIRS = np.array([(1, 0), (0, -1), (-1, 0), (0, 1)]) RIGHTMOST = -1 def is_color(board, x, y, color): if min(x, y) < 0: return False if x >= len(board): return False if y >= len(board[0]): return False if board[x][y] !...
empty = '-' rightmost = -1 def is_color(board, x, y, color): if min(x, y) < 0: return False if x >= len(board): return False if y >= len(board[0]): return False if board[x][y] != color: return False return True def get_group(board, x, y): color = board[x][y] ...
def solveQuestion(inputPath, minValComp, maxValComp): fileP = open(inputPath, 'r') fileLines = fileP.readlines() fileP.close() botMoves = {} botValues = {} for line in fileLines: line = line.strip('\n') isLowOutput = False isHighOutput = False if line[:...
def solve_question(inputPath, minValComp, maxValComp): file_p = open(inputPath, 'r') file_lines = fileP.readlines() fileP.close() bot_moves = {} bot_values = {} for line in fileLines: line = line.strip('\n') is_low_output = False is_high_output = False if line[:5]...
def Mergesort(arr): n= len(arr) if n > 1: mid = int(n/2) left = arr[0:mid] right = arr[mid:n] Mergesort(left) Mergesort(right) Merge(left, right, arr) def Merge(left, right, arr): i = 0 j = 0 k = 0 while i < len(left) an...
def mergesort(arr): n = len(arr) if n > 1: mid = int(n / 2) left = arr[0:mid] right = arr[mid:n] mergesort(left) mergesort(right) merge(left, right, arr) def merge(left, right, arr): i = 0 j = 0 k = 0 while i < len(left) and j < len(right): ...
a = [5, 4, 8, 3, 4, 14, 90, 45, 9, 3, 2, 4] for i in range(len(a), 0, -1): for j in range(0, i - 1): if a[j] > a[j + 1]: a[j], a[j + 1] = a[j + 1], a[j] print(a)
a = [5, 4, 8, 3, 4, 14, 90, 45, 9, 3, 2, 4] for i in range(len(a), 0, -1): for j in range(0, i - 1): if a[j] > a[j + 1]: (a[j], a[j + 1]) = (a[j + 1], a[j]) print(a)
# MEDIUM # find smallest x, largest x, draw a line to split those two value # store all points in to a set([]) # check if every point in set can be matched by mirroring the y axis class Solution: def isReflected(self, points: List[List[int]]) -> bool: print(max(points),min(points)) check = set([(...
class Solution: def is_reflected(self, points: List[List[int]]) -> bool: print(max(points), min(points)) check = set([(x, y) for (x, y) in points]) count = 0 (minx, maxx) = (float('inf'), -float('inf')) for (x, y) in points: minx = min(minx, x) maxx =...
def is_prime(num): if num <= 1: return False d = 2 while d * d <= num and num % d != 0: d += 1 return d * d > num
def is_prime(num): if num <= 1: return False d = 2 while d * d <= num and num % d != 0: d += 1 return d * d > num
#encoding=utf8 # Copyright (c) 2021 PaddlePaddle 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.apache.org/licenses/LICENSE-2.0 # Unless requi...
def get_class_stats(inputDict, className): out_stats = {} for item in inputDict: val = item[className] if val not in outStats: outStats[val] = 0 outStats[val] += 1 return outStats def build_dict_stats(inputDict, classList): loc_stats = {'total': len(inputDict)} f...
c = 0 arr = [8,7,3,2,1,8,18,9,7,3,4] for i in range(len(arr)): if arr.count(i) == 1: c += 1 print(c)
c = 0 arr = [8, 7, 3, 2, 1, 8, 18, 9, 7, 3, 4] for i in range(len(arr)): if arr.count(i) == 1: c += 1 print(c)
# coding=UTF8 # Processamento for num in range(100, 201): if num % 2 > 0: print(num)
for num in range(100, 201): if num % 2 > 0: print(num)
## https://leetcode.com/submissions/detail/230651834/ ## problem is to find the numbers between 1 and length of the ## array that aren't in the array. simple way to do that is to ## do the set difference between range(1, len(ar)+1) and the ## input numbers ## hits 98th percentile in terms of runtime, though only ...
class Solution: def find_disappeared_numbers(self, nums: List[int]) -> List[int]: return list(set(range(1, len(nums) + 1)) - set(nums))
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Math.py: Just a sample file with a function. This material is part of this post: http://raccoon.ninja/pt/dev-pt/python-importando-todos-os-arquivos-de-um-diretorio/ """ def calc_sum(a, b): return a + b
""" Math.py: Just a sample file with a function. This material is part of this post: http://raccoon.ninja/pt/dev-pt/python-importando-todos-os-arquivos-de-um-diretorio/ """ def calc_sum(a, b): return a + b
player_1_score = 0 player_2_score = 0 LOOP_UNTIL_USER_CHOOSES_TO_EXIT_AFTER_A_ROUND = True while LOOP_UNTIL_USER_CHOOSES_TO_EXIT_AFTER_A_ROUND: player_1_shape = input('[PLAYER 1]: Choose "rock", "paper", or "scissors": ') player_2_shape = input('[PLAYER 2]: Choose "rock", "paper", or "scissors": ') ROCK_S...
player_1_score = 0 player_2_score = 0 loop_until_user_chooses_to_exit_after_a_round = True while LOOP_UNTIL_USER_CHOOSES_TO_EXIT_AFTER_A_ROUND: player_1_shape = input('[PLAYER 1]: Choose "rock", "paper", or "scissors": ') player_2_shape = input('[PLAYER 2]: Choose "rock", "paper", or "scissors": ') rock_sha...
#isdecimal n1 = "947" print(n1.isdecimal()) # -- D1 n2 = "947 2" print(n2.isdecimal()) # -- D2 n3 = "abx123" print(n3.isdecimal()) # -- D3 n4 = "\u0034" print(n4.isdecimal()) # -- D4 n5 = "\u0038" print(n5.isdecimal()) # -- D5 n6 = "\u0041" print(n6.isdecimal()) # -- D6 n7 = "3.4" print(n7.isdecimal()) # -- D7 n8 = "#$...
n1 = '947' print(n1.isdecimal()) n2 = '947 2' print(n2.isdecimal()) n3 = 'abx123' print(n3.isdecimal()) n4 = '4' print(n4.isdecimal()) n5 = '8' print(n5.isdecimal()) n6 = 'A' print(n6.isdecimal()) n7 = '3.4' print(n7.isdecimal()) n8 = '#$!@' print(n8.isdecimal())
""" Package collecting modules defining discretized operators for different grids. These operators can either be used directly or they are imported by the respective methods defined on fields and grids. .. autosummary:: :nosignatures: cartesian cylindrical polar spherical """ # Package-wide constan...
""" Package collecting modules defining discretized operators for different grids. These operators can either be used directly or they are imported by the respective methods defined on fields and grids. .. autosummary:: :nosignatures: cartesian cylindrical polar spherical """ parallelization_thresho...
def memoize(f): storage = {} def wrapper(*args): key = tuple(args) if storage.has_key(key): return storage[key] else: result = f(*args) storage[key] = result return result return wrapper def test_memoize(): @memoize def sil...
def memoize(f): storage = {} def wrapper(*args): key = tuple(args) if storage.has_key(key): return storage[key] else: result = f(*args) storage[key] = result return result return wrapper def test_memoize(): @memoize def silly...
# Fitur .append() print(">>> Fitur .append()") list_makanan = ['Gado-gado', 'Ayam Goreng', 'Rendang'] list_makanan.append('Ketoprak') print(list_makanan) # Fitur .clear() print(">>> Fitur .clear()") list_makanan = ['Gado-gado', 'Ayam Goreng', 'Rendang'] list_makanan.clear() print(list_makanan) # Fitur .copy() print(">>...
print('>>> Fitur .append()') list_makanan = ['Gado-gado', 'Ayam Goreng', 'Rendang'] list_makanan.append('Ketoprak') print(list_makanan) print('>>> Fitur .clear()') list_makanan = ['Gado-gado', 'Ayam Goreng', 'Rendang'] list_makanan.clear() print(list_makanan) print('>>> Fitur .copy()') list_makanan1 = ['Gado-gado', 'Ay...
#!/usr/bin/python # coding=utf-8 class BasicGenerater(object): def __init__(self): self.first_name = 'Jack' self.last_name = 'Freeman' def my_name(self): print('.'.join((self.first_name, self.last_name))) def __del__(self): print("call del") class AdvaceGenerator(BasicGe...
class Basicgenerater(object): def __init__(self): self.first_name = 'Jack' self.last_name = 'Freeman' def my_name(self): print('.'.join((self.first_name, self.last_name))) def __del__(self): print('call del') class Advacegenerator(BasicGenerater): def __init__(self):...
# -*- coding: utf-8 -*- """ ----------Phenix Labs---------- Created on Fri Jan 29 15:42:01 2021 @author: Gyan Krishna Topic: reverse tuple """ tup =(10,20,30,40,50,60,) rev = tup[::-1] print("original tuple ::", tup) print("reversed tuple ::", rev)
""" ----------Phenix Labs---------- Created on Fri Jan 29 15:42:01 2021 @author: Gyan Krishna Topic: reverse tuple """ tup = (10, 20, 30, 40, 50, 60) rev = tup[::-1] print('original tuple ::', tup) print('reversed tuple ::', rev)
class Solution: def change(self, amount, coins): dp = [0 for i in range(amount + 1)] # for amount 0, you can have 1 combination, do not include any coin dp[0] = 1 for coin in coins: for i in range(coin, amount + 1): # add i - coin dp value, the number of c...
class Solution: def change(self, amount, coins): dp = [0 for i in range(amount + 1)] dp[0] = 1 for coin in coins: for i in range(coin, amount + 1): dp[i] += dp[i - coin] return dp[amount] def main(): my_sol = solution() print('For the coins 1, 2,...
class UI: def __init__(self): ''' ''' print('Welcome to calculator v1') def start(self, controller): ''' We ask the user for 2 numbers and add them. ''' print('Please enter number1') number1 = input() print('Please enter number2') number2 = input() result = control...
class Ui: def __init__(self): """ """ print('Welcome to calculator v1') def start(self, controller): """ We ask the user for 2 numbers and add them. """ print('Please enter number1') number1 = input() print('Please enter number2') number2 = i...
""" ID: goundsada LANG: PYTHON3 TASK: friday """ fin = open ('friday.in', 'r') fout = open ('friday.out', 'w') n = int(fin.readline().encode()) count = [0,0,0,0,0,0,0] daysInMonth = (31,28,31,30,31,30,31,31,30,31,30,31) day = 0 for i in range(n): for j in daysInMonth: count[day % 7] += 1 if (j == 2...
""" ID: goundsada LANG: PYTHON3 TASK: friday """ fin = open('friday.in', 'r') fout = open('friday.out', 'w') n = int(fin.readline().encode()) count = [0, 0, 0, 0, 0, 0, 0] days_in_month = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) day = 0 for i in range(n): for j in daysInMonth: count[day % 7] += 1 ...
DEBUG = True TESTING = False MONGODB_SETTINGS = [{ 'host':'localhost', 'port':27017, 'db':'REALTIME_APP' }]
debug = True testing = False mongodb_settings = [{'host': 'localhost', 'port': 27017, 'db': 'REALTIME_APP'}]
class Measurement: def __init__(self, x, result, elapsed, timeout_error, other_error): """ :type x: dict :type result: object :type elapsed: float :type timeout_error: bool """ if not isinstance(x, dict): raise TypeError('x should be a dictionary!') self._x = x self._result = result self._elapse...
class Measurement: def __init__(self, x, result, elapsed, timeout_error, other_error): """ :type x: dict :type result: object :type elapsed: float :type timeout_error: bool """ if not isinstance(x, dict): raise type_error('x should be a dictionary!') self._x = x ...
# Week-11 Challenge 1 And Extra Challenge x = open("Week-11/Week-11-Challenge.txt", "r") print(x.read()) x.close() print("\n-*-*-*-*-*-*") print("-*-*-*-*-*-*") print("-*-*-*-*-*-*\n") y = open("Week-11/Week-11-Challenge.txt", "a") y.write("\nThe best way we learn anything is by practice and exercise questions ") y =...
x = open('Week-11/Week-11-Challenge.txt', 'r') print(x.read()) x.close() print('\n-*-*-*-*-*-*') print('-*-*-*-*-*-*') print('-*-*-*-*-*-*\n') y = open('Week-11/Week-11-Challenge.txt', 'a') y.write('\nThe best way we learn anything is by practice and exercise questions ') y = open('Week-11/Week-11-Challenge.txt', 'r') ...
""" TODO: Add model code for your resource here. You'll want to change the file name to whatever your resource is called. To add persistence to your models, use App Engine's Datastore if you anticipate scaling to a high amount of data or traffic. The Python NDB module adds caching and some other features to Datastore. ...
""" TODO: Add model code for your resource here. You'll want to change the file name to whatever your resource is called. To add persistence to your models, use App Engine's Datastore if you anticipate scaling to a high amount of data or traffic. The Python NDB module adds caching and some other features to Datastore. ...
# # The MIT License (MIT) # # Copyright 2019 AT&T Intellectual Property. All other rights reserved. # # 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 l...
""" .. module: openc2.version :platform: Unix .. version:: $$VERSION$$ .. moduleauthor:: Michael Stair <mstair@att.com> """ __version__ = '2.0.0'
''' Note: This kata is inspired by Convert a Number to a String!. Try that one too. Description We need a function that can transform a string into a number. What ways of achieving this do you know? Note: Don't worry, all inputs will be strings, and every string is a perfectly valid representation of an integral numb...
""" Note: This kata is inspired by Convert a Number to a String!. Try that one too. Description We need a function that can transform a string into a number. What ways of achieving this do you know? Note: Don't worry, all inputs will be strings, and every string is a perfectly valid representation of an integral numb...
print(-1) print(-0) print(-(6)) print(-(12*2)) print(- -10)
print(-1) print(-0) print(-6) print(-(12 * 2)) print(--10)
# Problem Statement: https://leetcode.com/problems/valid-anagram/ class Solution: def isAnagram(self, s: str, t: str) -> bool: if len(s) != len(t): return False else: letter_cnt = {} for letter in s: if not letter in letter_cnt: ...
class Solution: def is_anagram(self, s: str, t: str) -> bool: if len(s) != len(t): return False else: letter_cnt = {} for letter in s: if not letter in letter_cnt: letter_cnt[letter] = 1 else: ...
# -*- coding: utf-8 -*- description = 'detectors' group = 'lowlevel' # is included by panda.py display_order = 70 excludes = ['qmesydaq'] tango_base = 'tango://phys.panda.frm2:10000/panda/' devices = dict( timer = device('nicos.devices.entangle.TimerChannel', tangodevice = tango_base + 'frmctr2/timer...
description = 'detectors' group = 'lowlevel' display_order = 70 excludes = ['qmesydaq'] tango_base = 'tango://phys.panda.frm2:10000/panda/' devices = dict(timer=device('nicos.devices.entangle.TimerChannel', tangodevice=tango_base + 'frmctr2/timer', visibility=()), mon1=device('nicos.devices.entangle.CounterChannel', ta...
# -*- coding: utf-8 -*- """ Created on Mon Sep 2 17:52:35 2019 @author: Sarthak """
""" Created on Mon Sep 2 17:52:35 2019 @author: Sarthak """
expected_output = { "key_chains": { "bla": { "keys": { 1: { "accept_lifetime": { "end": "always valid", "is_valid": True, "start": "always valid", }, ...
expected_output = {'key_chains': {'bla': {'keys': {1: {'accept_lifetime': {'end': 'always valid', 'is_valid': True, 'start': 'always valid'}, 'key_string': 'cisco123', 'send_lifetime': {'end': 'always valid', 'is_valid': True, 'start': 'always valid'}}, 2: {'accept_lifetime': {'end': '06:01:00 UTC Jan 1 2010', 'is_vali...
# Challenge 3 : Write a function called delete_starting_evens() that has a parameter named lst. # The function should remove elements from the front of lst until the front of the list is not even. # The function should then return lst. # Date : Sun 07 Jun 2020 07:21:17 AM IST def de...
def delete_starting_evens(lst): while len(lst) != 0 and lst[0] % 2 == 0: del lst[0] return lst print(delete_starting_evens([4, 8, 10, 11, 12, 15])) print(delete_starting_evens([4, 8, 10]))
def test(n): i = 0 res = 0 while i < n: i = i + 1 print(res) test(100)
def test(n): i = 0 res = 0 while i < n: i = i + 1 print(res) test(100)
# Online Python compiler (interpreter) to run Python online. # Write Python 3 code in this online editor and run it. vegetables = ["rucula", "tomate", "lechuga", "acelga"]; print(vegetables); print(len(vegetables)); print(str(type(vegetables))); print('-'*10); print(vegetables[0]); # Elemento 0 print(vegetables[1:]...
vegetables = ['rucula', 'tomate', 'lechuga', 'acelga'] print(vegetables) print(len(vegetables)) print(str(type(vegetables))) print('-' * 10) print(vegetables[0]) print(vegetables[1:]) print(vegetables[2:]) print(vegetables[0:10000]) print(vegetables[:]) print(vegetables[1:3][::-1]) print('-' * 10) vegetables.append('be...
class DashboardMixin(object): def getTitle(self): raise NotImplementedError("You must override this method in a child class.") def getContent(self): raise NotImplementedError("You must override this method in a child class.")
class Dashboardmixin(object): def get_title(self): raise not_implemented_error('You must override this method in a child class.') def get_content(self): raise not_implemented_error('You must override this method in a child class.')