content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def threeSumClosest(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ nums.sort() rls = nums[0] + nums[1] + nums[2] for i in range(len(nums)-2): j, k = i+1, len(nums)-1 while j < k:...
class Solution: def three_sum_closest(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ nums.sort() rls = nums[0] + nums[1] + nums[2] for i in range(len(nums) - 2): (j, k) = (i + 1, len(nums) - 1) ...
# A mapping between model field internal datatypes and sensible # client-friendly datatypes. In virtually all cases, client programs # only need to differentiate between high-level types like number, string, # and boolean. More granular separation be may desired to alter the # allowed operators or may infer a different...
simple_types = {'auto': 'key', 'foreignkey': 'key', 'biginteger': 'number', 'decimal': 'number', 'float': 'number', 'integer': 'number', 'positiveinteger': 'number', 'positivesmallinteger': 'number', 'smallinteger': 'number', 'nullboolean': 'boolean', 'char': 'string', 'email': 'string', 'file': 'string', 'filepath': '...
constants = { # --- ASSETS FILE NAMES AND DELAY BETWEEN FOOTAGE "CALIBRATION_CAMERA_STATIC_PATH": "assets/cam1 - static/calibration.mov", "CALIBRATION_CAMERA_MOVING_PATH": "assets/cam2 - moving light/calibration.mp4", "COIN_1_VIDEO_CAMERA_STATIC_PATH": "assets/cam1 - static/coin1.mov", "COIN_1_VIDEO...
constants = {'CALIBRATION_CAMERA_STATIC_PATH': 'assets/cam1 - static/calibration.mov', 'CALIBRATION_CAMERA_MOVING_PATH': 'assets/cam2 - moving light/calibration.mp4', 'COIN_1_VIDEO_CAMERA_STATIC_PATH': 'assets/cam1 - static/coin1.mov', 'COIN_1_VIDEO_CAMERA_MOVING_PATH': 'assets/cam2 - moving light/coin1.mp4', 'COIN_2_V...
def timeConversion(s): if "P" in s: s = s.split(":") if s[0] == '12': s = s.split(":") s[2] = s[2][:2] print(":".join(s)) else: s[0] = str(int(s[0])+12) s[2] = s[2][:2] print(":".join(s)) else: s = s.split(":...
def time_conversion(s): if 'P' in s: s = s.split(':') if s[0] == '12': s = s.split(':') s[2] = s[2][:2] print(':'.join(s)) else: s[0] = str(int(s[0]) + 12) s[2] = s[2][:2] print(':'.join(s)) else: s = s.split...
def for_loop4(str, x): result = 0 for i in str: if i == x: result += 1 return result def main(): print(for_loop4('athenian', 'e')) print(for_loop4('apples', 'a')) print(for_loop4('hello', 'a')) print(for_loop4('alphabet', 'h')) print(for_loop4('aaaaa', 'b')) if __...
def for_loop4(str, x): result = 0 for i in str: if i == x: result += 1 return result def main(): print(for_loop4('athenian', 'e')) print(for_loop4('apples', 'a')) print(for_loop4('hello', 'a')) print(for_loop4('alphabet', 'h')) print(for_loop4('aaaaa', 'b')) if __nam...
""" Tuples - iterable - immutable - strings are also immutable """ car = ('honda', 'city', 'white', 'DL09671', '78878GFG', 2016) print(car) print(type(car)) print(len(car)) for item in car: print(item) print(car[0])
""" Tuples - iterable - immutable - strings are also immutable """ car = ('honda', 'city', 'white', 'DL09671', '78878GFG', 2016) print(car) print(type(car)) print(len(car)) for item in car: print(item) print(car[0])
# Author : Nekyz # Date : 30/06/2015 # Project Euler Challenge 3 # Largest palindrome of 2 three digit number def is_palindrome (n): # Reversing n to see if it's the same ! Extended slice are fun if str(n) == (str(n))[::-1]: return True return False max = 0 for i in range(999,100,-1): fo...
def is_palindrome(n): if str(n) == str(n)[::-1]: return True return False max = 0 for i in range(999, 100, -1): for j in range(999, 100, -1): product = i * j if is_palindrome(product): if product > max: max = product print(i, ' * ', j, ' = ...
# -*- coding: utf-8 -*- def remove_duplicate_elements(check_list): func = lambda x,y:x if y in x else x + [y] return reduce(func, [[], ] + check_list)
def remove_duplicate_elements(check_list): func = lambda x, y: x if y in x else x + [y] return reduce(func, [[]] + check_list)
class LightingSource(Enum, IComparable, IFormattable, IConvertible): """ Indicates the lighting scheme type in rendering settings. enum LightingSource,values: ExteriorArtificial (23),ExteriorSun (21),ExteriorSunAndArtificial (22),InteriorArtificial (26),InteriorSun (24),InteriorSunAndArtificial (25) "...
class Lightingsource(Enum, IComparable, IFormattable, IConvertible): """ Indicates the lighting scheme type in rendering settings. enum LightingSource,values: ExteriorArtificial (23),ExteriorSun (21),ExteriorSunAndArtificial (22),InteriorArtificial (26),InteriorSun (24),InteriorSunAndArtificial (25) """ ...
# coding: utf-8 mail_conf = { "host": "", "sender": "boom_run raise error", "username": "", "passwd": "", "mail_postfix": "", "recipients": [ "", ] } redis_conf = { "host": "127.0.0.1", "port": 6379, }
mail_conf = {'host': '', 'sender': 'boom_run raise error', 'username': '', 'passwd': '', 'mail_postfix': '', 'recipients': ['']} redis_conf = {'host': '127.0.0.1', 'port': 6379}
# # PySNMP MIB module BEGEMOT-PF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BEGEMOT-PF-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:37:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
# -*- coding:utf-8 -*- p = raw_input("Escribe una frase: ") for letras in p: print(p.upper())
p = raw_input('Escribe una frase: ') for letras in p: print(p.upper())
def find_words_in_phone_number(): phone_number = "3662277" words = ["foo", "bar", "baz", "foobar", "emo", "cap", "car", "cat"] lst = [] cmap = dict(a=2, b=2, c=2, d=3, e=3, f=3, g=4, h=4, i=4, j=5, k=5, l=5, m=6, n=6, o=6, p=7, q=7, r=7, s=7, t=8, u=8, v=8, w=9, x=9, y=9, z=9) for w...
def find_words_in_phone_number(): phone_number = '3662277' words = ['foo', 'bar', 'baz', 'foobar', 'emo', 'cap', 'car', 'cat'] lst = [] cmap = dict(a=2, b=2, c=2, d=3, e=3, f=3, g=4, h=4, i=4, j=5, k=5, l=5, m=6, n=6, o=6, p=7, q=7, r=7, s=7, t=8, u=8, v=8, w=9, x=9, y=9, z=9) for word in words: ...
CMarketRspInfoField = { "ErrorID": "int", "ErrorMsg": "string", } CMarketReqUserLoginField = { "UserId": "string", "UserPwd": "string", "UserType": "string", "MacAddress": "string", "ComputerName": "string", "SoftwareName": "string", "SoftwareVersion": "string", "AuthorCode": "s...
c_market_rsp_info_field = {'ErrorID': 'int', 'ErrorMsg': 'string'} c_market_req_user_login_field = {'UserId': 'string', 'UserPwd': 'string', 'UserType': 'string', 'MacAddress': 'string', 'ComputerName': 'string', 'SoftwareName': 'string', 'SoftwareVersion': 'string', 'AuthorCode': 'string', 'ErrorDescription': 'string'...
# cook your dish here print("137=2(2(2)+2+2(0))+2(2+2(0))+2(0)") print("1315=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)") print("73=2(2(2)+2)+2(2+2(0))+2(0)") print("136=2(2(2)+2+2(0))+2(2+2(0))") print("255=2(2(2)+2+2(0))+2(2(2)+2)+2(2(2)+2(0))+2(2(2))+2(2+2(0))+2(2)+2+2(0)") print("1384=2(2(2+2(0))+2)+2(2(2+2(0)...
print('137=2(2(2)+2+2(0))+2(2+2(0))+2(0)') print('1315=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)') print('73=2(2(2)+2)+2(2+2(0))+2(0)') print('136=2(2(2)+2+2(0))+2(2+2(0))') print('255=2(2(2)+2+2(0))+2(2(2)+2)+2(2(2)+2(0))+2(2(2))+2(2+2(0))+2(2)+2+2(0)') print('1384=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2)+2(2(2)+2(...
#!/usr/bin/env python """ Copyright 2012 GroupDocs. 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...
""" Copyright 2012 GroupDocs. 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 w...
def get_current_players(current_room): host_user = current_room['host_user'] users = current_room['game']['users'] players = [player for player in users] players.append(host_user) return players
def get_current_players(current_room): host_user = current_room['host_user'] users = current_room['game']['users'] players = [player for player in users] players.append(host_user) return players
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
{'name': 'Helpdesk', 'category': 'Customer Relationship Management', 'version': '1.0', 'description': '\nHelpdesk Management.\n====================\n\nLike records and processing of claims, Helpdesk and Support are good tools\nto trace your interventions. This menu is more adapted to oral communication,\nwhich is not n...
class DuckyScriptParser: ''' This class is a parser for the DuckyScript language. It allows to generate a sequence of frame to inject keystrokes according to the provided script. ''' def __init__(self,content="",filename=""): if content != "": self.content = content else: self.content = open(filename,"r"...
class Duckyscriptparser: """ This class is a parser for the DuckyScript language. It allows to generate a sequence of frame to inject keystrokes according to the provided script. """ def __init__(self, content='', filename=''): if content != '': self.content = content else: ...
def Awana_Academy(name, age): ## say to python that all the code that come after that line is going to be in d function print("Hello " + name + "you are " + age + "years old ") Awana_Academy("Alex " , "45") Awana_Academy("Donald ", "12")
def awana__academy(name, age): print('Hello ' + name + 'you are ' + age + 'years old ') awana__academy('Alex ', '45') awana__academy('Donald ', '12')
# https://www.codewars.com/kata/55d2aee99f30dbbf8b000001/ ''' Details : A new school year is approaching, which also means students will be taking tests. The tests in this kata are to be graded in different ways. A certain number of points will be given for each correct answer and a certain number of points will be ...
""" Details : A new school year is approaching, which also means students will be taking tests. The tests in this kata are to be graded in different ways. A certain number of points will be given for each correct answer and a certain number of points will be deducted for each incorrect answer. For ommitted answers, p...
# https://open.kattis.com/problems/babybites n = int(input()) inp = input().split() for i in range(0, n): if inp[i].isdigit(): if int(inp[i]) != i + 1: print('something is fishy') break else: print('makes sense')
n = int(input()) inp = input().split() for i in range(0, n): if inp[i].isdigit(): if int(inp[i]) != i + 1: print('something is fishy') break else: print('makes sense')
#Let's use tuples to store information about a file: its name, #its type and its size in bytes. #Fill in the gaps in this code to return the size in kilobytes (a kilobyte is 1024 bytes) up to 2 decimal places. #Code: def file_size(file_info): name, type, size= file_info return("{:.2f}".format(size / 1024)) print...
def file_size(file_info): (name, type, size) = file_info return '{:.2f}'.format(size / 1024) print(file_size(('Class Assignment', 'docx', 17875))) print(file_size(('Notes', 'txt', 496))) print(file_size(('Program', 'py', 1239)))
class DictToObj(object): """ transform a dict to a object """ def __init__(self, d): for a, b in d.items(): if type(a) is bytes: attr = a.decode() else: attr = a if isinstance(b, (list, tuple)): setattr(self, att...
class Dicttoobj(object): """ transform a dict to a object """ def __init__(self, d): for (a, b) in d.items(): if type(a) is bytes: attr = a.decode() else: attr = a if isinstance(b, (list, tuple)): setattr(self, ...
""" Given an array nums of 0s and 1s and an integer k, return True if all 1's are at least k places away from each other, otherwise return False. Input: nums = [1,0,0,0,1,0,0,1], k = 2 Output: true Explanation: Each of the 1s are at least 2 places away from each other. Input: nums = [1,1,1,1,1], k = 0 Output: true ""...
""" Given an array nums of 0s and 1s and an integer k, return True if all 1's are at least k places away from each other, otherwise return False. Input: nums = [1,0,0,0,1,0,0,1], k = 2 Output: true Explanation: Each of the 1s are at least 2 places away from each other. Input: nums = [1,1,1,1,1], k = 0 Output: true ""...
"""Clean Code in Python - Chapter 7: Using Generators > The Interface for Iteration * Distinguish between iterable objects and iterators * Create iterators """ class SequenceIterator: """ >>> si = SequenceIterator(1, 2) >>> next(si) 1 >>> next(si) 3 >>> next(si) ...
"""Clean Code in Python - Chapter 7: Using Generators > The Interface for Iteration * Distinguish between iterable objects and iterators * Create iterators """ class Sequenceiterator: """ >>> si = SequenceIterator(1, 2) >>> next(si) 1 >>> next(si) 3 >>> next(si) 5 """ ...
def safe_repr(obj): """Returns a repr of an object and falls back to a minimal representation of type and ID if the call to repr raised an error. :param obj: object to safe repr :returns: repr string or '(type<id> repr error)' string :rtype: str """ try: obj_repr = repr(obj) exc...
def safe_repr(obj): """Returns a repr of an object and falls back to a minimal representation of type and ID if the call to repr raised an error. :param obj: object to safe repr :returns: repr string or '(type<id> repr error)' string :rtype: str """ try: obj_repr = repr(obj) exc...
"""These SESSION commands are used to enter and exit the various processors in the program. """ class ProcessorEntry: def aux2(self, **kwargs): """Enters the binary file dumping processor. APDL Command: /AUX2 Notes ----- Enters the binary file dumping processor (ANSYS aux...
"""These SESSION commands are used to enter and exit the various processors in the program. """ class Processorentry: def aux2(self, **kwargs): """Enters the binary file dumping processor. APDL Command: /AUX2 Notes ----- Enters the binary file dumping processor (ANSYS aux...
""" .. module:: data_series :synopsis: Defines the DataSeries class. .. moduleauthor:: Scott W. Fleming <fleming@stsci.edu> """ #-------------------- class DataSeries(object): """ Defines a Data Series object, which contains the data (plot series) and plot labels for those series. """ def __i...
""" .. module:: data_series :synopsis: Defines the DataSeries class. .. moduleauthor:: Scott W. Fleming <fleming@stsci.edu> """ class Dataseries(object): """ Defines a Data Series object, which contains the data (plot series) and plot labels for those series. """ def __init__(self, mission, o...
class AdaptiveComponentInstanceUtils(object): """ An interface for Adaptive Component Instances. """ @staticmethod def CreateAdaptiveComponentInstance(doc, famSymb): """ CreateAdaptiveComponentInstance(doc: Document,famSymb: FamilySymbol) -> FamilyInstance Creates a FamilyInstan...
class Adaptivecomponentinstanceutils(object): """ An interface for Adaptive Component Instances. """ @staticmethod def create_adaptive_component_instance(doc, famSymb): """ CreateAdaptiveComponentInstance(doc: Document,famSymb: FamilySymbol) -> FamilyInstance Creates a FamilyInstance of A...
def gmaps_url_to_coords(url): gmaps_coords = url.split('=') coords = (0.0, 0.0) # defaults to 0,0 if len(gmaps_coords) == 2: gmaps_coords = gmaps_coords[1] coords = tuple(map(lambda c: float(c), gmaps_coords.split(','))) return coords
def gmaps_url_to_coords(url): gmaps_coords = url.split('=') coords = (0.0, 0.0) if len(gmaps_coords) == 2: gmaps_coords = gmaps_coords[1] coords = tuple(map(lambda c: float(c), gmaps_coords.split(','))) return coords
# Copyright 2014 Google Inc. All rights reserved. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE filters or at # https://developers.google.com/open-source/licenses/bsd { 'includes': [ '../../common.gypi', ], 'targets': [ { 'target_name': 'filters',...
{'includes': ['../../common.gypi'], 'targets': [{'target_name': 'filters', 'type': '<(component)', 'sources': ['avc_decoder_configuration.cc', 'avc_decoder_configuration.h', 'decoder_configuration.cc', 'decoder_configuration.h', 'ec3_audio_util.cc', 'ec3_audio_util.h', 'h264_byte_to_unit_stream_converter.cc', 'h264_byt...
def no_teen_sum(a, b, c): retSum = 0 for i in [a, b, c]: if i <= 19 and i >= 13 and i != 15 and i != 16: continue retSum += i return retSum
def no_teen_sum(a, b, c): ret_sum = 0 for i in [a, b, c]: if i <= 19 and i >= 13 and (i != 15) and (i != 16): continue ret_sum += i return retSum
"""Python implementation for doubly-linked list data structure.""" class DoublyLinkedList(object): """Sets properties and methods of a doubly-linked list.""" def __init__(self): """Create new instance of DoublyLinkedList.""" self.tail = None self.head = None self._length = 0 ...
"""Python implementation for doubly-linked list data structure.""" class Doublylinkedlist(object): """Sets properties and methods of a doubly-linked list.""" def __init__(self): """Create new instance of DoublyLinkedList.""" self.tail = None self.head = None self._length = 0 ...
def read_input(filename): with open(filename, 'r') as file: N, k = file.readline().strip().split() N, k = int(N), int(k) X = [] clusters = [] for _ in range(N): buffers = file.readline().strip().split() X.append([float(v) for v in buffers]) f...
def read_input(filename): with open(filename, 'r') as file: (n, k) = file.readline().strip().split() (n, k) = (int(N), int(k)) x = [] clusters = [] for _ in range(N): buffers = file.readline().strip().split() X.append([float(v) for v in buffers]) ...
def func(): yield 1 yield 2 yield 3 def main(): for item in func(): print(item) # print(func()) #<generator object func at 0x7f227f3ae3b8> obj1 = (1,2,3,) obj = (i for i in range(10)) print (obj) # print(obj[1]) # 'generator' object is not subscriptable obj2 ...
def func(): yield 1 yield 2 yield 3 def main(): for item in func(): print(item) obj1 = (1, 2, 3) obj = (i for i in range(10)) print(obj) obj2 = [i for i in range(10)] print(obj2) print(obj2[1]) mygenerator = (x * x for x in range(3)) print(mygenerator) print(...
def is_palindrome(str, length): is_pali = True length -= 1 for i in range (0, length//2): if (str[i] != str[length - i]): is_pali = False break return is_pali str = input('please enter a string\n') message = "Palindrome!" if is_palindrome(str, len(str)) else "not pali" p...
def is_palindrome(str, length): is_pali = True length -= 1 for i in range(0, length // 2): if str[i] != str[length - i]: is_pali = False break return is_pali str = input('please enter a string\n') message = 'Palindrome!' if is_palindrome(str, len(str)) else 'not pali' pri...
# TODO -- co.api.InvalidResponse is used in (client) public code. This should # move to private. class ClientError(Exception): def __init__(self, status_code, message): Exception.__init__(self) self.status_code = status_code self.message = message def to_dict(self): return {"...
class Clienterror(Exception): def __init__(self, status_code, message): Exception.__init__(self) self.status_code = status_code self.message = message def to_dict(self): return {'message': self.message}
groups_dict = { -1001384861110: "expresses" } log_file = "logs.log" database_file = "Couples.sqlite" couples_delta = 60 * 60 * 4
groups_dict = {-1001384861110: 'expresses'} log_file = 'logs.log' database_file = 'Couples.sqlite' couples_delta = 60 * 60 * 4
def sample_service(name=None): """ This is a sample service. Give it your name and prepare to be greeted! :param name: Your name :type name: basestring :return: A greeting or an error """ if name: return { 'hello': name} else: return {"error": "what's your name?"}
def sample_service(name=None): """ This is a sample service. Give it your name and prepare to be greeted! :param name: Your name :type name: basestring :return: A greeting or an error """ if name: return {'hello': name} else: return {'error': "what's your name?"}
class Solution: def reverseStr(self, s: str, k: int) -> str: if not s or not k or k < 0: return "" s = list(s) for i in range(0, len(s), 2 * k): s[i: i+k] = reversed(s[i:i+k]) return ''.join(s)
class Solution: def reverse_str(self, s: str, k: int) -> str: if not s or not k or k < 0: return '' s = list(s) for i in range(0, len(s), 2 * k): s[i:i + k] = reversed(s[i:i + k]) return ''.join(s)
d1, d2 = map(int, input().split()) s = d1 + d2 dic = {} for i in range(2, s + 1): dic[i] = 0 for i in range(1, d1 + 1): for j in range(1, d2 + 1): dic[i + j] += 1 top = 0 out = [] for key in dic: if dic[key] == top: out.append(key) elif dic[key] > top: top = dic[key] out ...
(d1, d2) = map(int, input().split()) s = d1 + d2 dic = {} for i in range(2, s + 1): dic[i] = 0 for i in range(1, d1 + 1): for j in range(1, d2 + 1): dic[i + j] += 1 top = 0 out = [] for key in dic: if dic[key] == top: out.append(key) elif dic[key] > top: top = dic[key] ou...
''' PARTIAL DEARRANGEMENTS A partial dearrangement is a dearrangement where some points are fixed. That is, given a number n and a number k, we need to find count of all such dearrangements of n numbers, where k numbers are fixed in their position. ''' mod = 1000000007 def nCr(n, r, mod): if n < r: retur...
""" PARTIAL DEARRANGEMENTS A partial dearrangement is a dearrangement where some points are fixed. That is, given a number n and a number k, we need to find count of all such dearrangements of n numbers, where k numbers are fixed in their position. """ mod = 1000000007 def n_cr(n, r, mod): if n < r: retur...
#!/usr/bin/env python3 class Color(): black = "\u001b[30m" red = "\u001b[31m" green = "\u001b[32m" yellow = "\u001b[33m" blue = "\u001b[34m" magenta = "\u001b[35m" cyan = "\u001b[36m" white = "\u001b[37m" reset = "\u001b[0m"
class Color: black = '\x1b[30m' red = '\x1b[31m' green = '\x1b[32m' yellow = '\x1b[33m' blue = '\x1b[34m' magenta = '\x1b[35m' cyan = '\x1b[36m' white = '\x1b[37m' reset = '\x1b[0m'
# Classic crab rave text filter def apply_filter(input_stream, overlay_text, font_file, font_color, font_size): text_lines = overlay_text.split("\n") text_shadow = int(font_size / 16) # ffmpeg does not support multiline text with vertical align if len(text_lines) >= 2: video_stream = input_stre...
def apply_filter(input_stream, overlay_text, font_file, font_color, font_size): text_lines = overlay_text.split('\n') text_shadow = int(font_size / 16) if len(text_lines) >= 2: video_stream = input_stream.video.drawtext(x='(w-text_w)/2', y='(h-text_h)/2-text_h', text=text_lines[0], fontfile=font_fil...
class ElementableError(Exception): pass class InvalidElementError(KeyError, ElementableError): def __init__(self, msg): msg = f"Element {msg} is not supported" super().__init__(msg)
class Elementableerror(Exception): pass class Invalidelementerror(KeyError, ElementableError): def __init__(self, msg): msg = f'Element {msg} is not supported' super().__init__(msg)
NTIPAliasFlag = {} NTIPAliasFlag["identified"]="0x10" NTIPAliasFlag["eth"]="0x400000" NTIPAliasFlag["ethereal"]="0x400000" NTIPAliasFlag["runeword"]="0x4000000"
ntip_alias_flag = {} NTIPAliasFlag['identified'] = '0x10' NTIPAliasFlag['eth'] = '0x400000' NTIPAliasFlag['ethereal'] = '0x400000' NTIPAliasFlag['runeword'] = '0x4000000'
for _ in range(int(input())): word = input() if len(word) > 10: print(word[0]+str(len(word)-2)+word[-1]) else: print(word)
for _ in range(int(input())): word = input() if len(word) > 10: print(word[0] + str(len(word) - 2) + word[-1]) else: print(word)
xmin, ymin, xmax, ymax = 100, 100, 1000, 800 # Bit code (0001, 0010, 0100, 1000 and 0000) LEFT, RIGHT, BOT, TOP = 1, 2, 4, 8 INSIDE = 0 print(f"Xmin: {xmin}\nYmin: {ymin}\nXmax: {xmax}\nYmax: {ymax}") x1 = float(input("Enter x: ")) y1 = float(input("Enter y: ")) x2 = float(input("Enter x2: ")) y2 = float(input("...
(xmin, ymin, xmax, ymax) = (100, 100, 1000, 800) (left, right, bot, top) = (1, 2, 4, 8) inside = 0 print(f'Xmin: {xmin}\nYmin: {ymin}\nXmax: {xmax}\nYmax: {ymax}') x1 = float(input('Enter x: ')) y1 = float(input('Enter y: ')) x2 = float(input('Enter x2: ')) y2 = float(input('Enter y2: ')) def compute_code(x, y): c...
class Solution(object): def firstMissingPositive(self, nums): size = len(nums) for i in range(size): v = nums[i] if v<1 or v > size: nums[i]=size+10 for i in range(size): v = abs(nums[i]) if v >0 and v<=size and nums[v-1]>0: ...
class Solution(object): def first_missing_positive(self, nums): size = len(nums) for i in range(size): v = nums[i] if v < 1 or v > size: nums[i] = size + 10 for i in range(size): v = abs(nums[i]) if v > 0 and v <= size and (num...
# -*- coding: utf-8 -*- class DbRouter(object): external_db_models = ['cdr', 'numbers'] def db_for_read(self, model, **hints): """ Use original asterisk Db tables for read """ if model._meta.model_name.lower() in self.external_db_models: return 'asterisk' ...
class Dbrouter(object): external_db_models = ['cdr', 'numbers'] def db_for_read(self, model, **hints): """ Use original asterisk Db tables for read """ if model._meta.model_name.lower() in self.external_db_models: return 'asterisk' return None def db_for...
{ "targets": [ { "target_name": "index" } ] }
{'targets': [{'target_name': 'index'}]}
def countingSort(array): size = len(array) output = [0] * size count = [0] * 10 for i in range(0, size): count[array[i]] += 1 for j in range(1,10): count[j] += count[j-1] a = size-1 while a >= 0: output[count[array[a]]-1] = array[a] count[arra...
def counting_sort(array): size = len(array) output = [0] * size count = [0] * 10 for i in range(0, size): count[array[i]] += 1 for j in range(1, 10): count[j] += count[j - 1] a = size - 1 while a >= 0: output[count[array[a]] - 1] = array[a] count[array[a]] -= ...
# Uses python3 def calc_fib(n): fib_nums = [] fib_nums.append(0) fib_nums.append(1) for i in range(2, n + 1): fib_nums.append(fib_nums[i - 1] + fib_nums[i - 2]) return fib_nums[n] n = int(input()) print(calc_fib(n))
def calc_fib(n): fib_nums = [] fib_nums.append(0) fib_nums.append(1) for i in range(2, n + 1): fib_nums.append(fib_nums[i - 1] + fib_nums[i - 2]) return fib_nums[n] n = int(input()) print(calc_fib(n))
# -*- coding: utf-8 -*- """ State engine for django models. Define a state graph for a model and remember the state of each object. State transitions can be logged for objects. """ #: The version list VERSION = (2, 0, 1) #: The actual version number, used by python (and shown in sentry) __version__ = '.'.join(map(st...
""" State engine for django models. Define a state graph for a model and remember the state of each object. State transitions can be logged for objects. """ version = (2, 0, 1) __version__ = '.'.join(map(str, VERSION)) __all__ = ['__version__']
#Narcissistic Number: (find all this kinds of number fromm 100~999) #example: 153 = 1**3 + 5**3 + 3**3 #................method 1............................ # for x in range(100, 1000): # digit_3 = x//100 # digit_2 = x%100//10 # digit_1 = x%10 # if x == digit_3**3 + digit_2**3 + digit_1**3: # ...
for digit_3 in range(1, 10): for digit_2 in range(10): for digit_1 in range(10): x = 100 * digit_3 + 10 * digit_2 + digit_1 if x == digit_3 ** 3 + digit_2 ** 3 + digit_1 ** 3: print(x)
""" Copyright 2021 - Giovanni (iGio90) Rocca 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, publish, dist...
""" Copyright 2021 - Giovanni (iGio90) Rocca 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, publish, dist...
status = True print(status) print(type(status)) status = False print(status) print(type(status)) soda = 'coke' print(soda == 'coke') print(soda == 'pepsi') print(soda == 'Coke') print(soda != 'root beer') names = ['mike', 'john', 'mary'] mike_status = 'mike' in names bill_status = 'bill' in names print(mike_status) ...
status = True print(status) print(type(status)) status = False print(status) print(type(status)) soda = 'coke' print(soda == 'coke') print(soda == 'pepsi') print(soda == 'Coke') print(soda != 'root beer') names = ['mike', 'john', 'mary'] mike_status = 'mike' in names bill_status = 'bill' in names print(mike_status) pri...
def pytest_assertrepr_compare(op, left, right): # add one more line for "assert ..." return ( [''] + ['---'] + ['> ' + _.text for _ in left] + ['---'] + ['> ' + _.text for _ in right] ) def pytest_addoption(parser): parser.addoption('--int', type='int') def ...
def pytest_assertrepr_compare(op, left, right): return [''] + ['---'] + ['> ' + _.text for _ in left] + ['---'] + ['> ' + _.text for _ in right] def pytest_addoption(parser): parser.addoption('--int', type='int') def pytest_generate_tests(metafunc): if 'int_test' in metafunc.fixturenames: tests = ...
def solution(s): answer = [] str_idx = 0 for cont in s: if cont.isalpha() == True: if str_idx % 2 == 0: answer.append(cont.upper()) else: answer.append(cont.lower()) str_idx = str_idx + 1 else: ...
def solution(s): answer = [] str_idx = 0 for cont in s: if cont.isalpha() == True: if str_idx % 2 == 0: answer.append(cont.upper()) else: answer.append(cont.lower()) str_idx = str_idx + 1 else: if cont == ' ': ...
MAX_ROWS_DISPLAYABLE = 60 MAX_COLS_DISPLAYABLE = 80 cmap_freq = 'viridis' cmap_grouping = 'copper' # 'Greys' grouping_text_color = 'white' grouping_text_color_background = 'grey' grouping_fontweight = 'bold'
max_rows_displayable = 60 max_cols_displayable = 80 cmap_freq = 'viridis' cmap_grouping = 'copper' grouping_text_color = 'white' grouping_text_color_background = 'grey' grouping_fontweight = 'bold'
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ for s in [*open(0)][1:]: n,m=map(int,s.split()) print(0-(-n*m)//2)
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ for s in [*open(0)][1:]: (n, m) = map(int, s.split()) print(0 - -n * m // 2)
class AccelerationException(Exception): def __init__(self, message='This is neither acceleration nor deceleration... Go away and program Java, BooN'): self.message = message super().__init__(self.message) class NoMemberException(Exception): def __init__(self, message='This truck is not a convoy...
class Accelerationexception(Exception): def __init__(self, message='This is neither acceleration nor deceleration... Go away and program Java, BooN'): self.message = message super().__init__(self.message) class Nomemberexception(Exception): def __init__(self, message='This truck is not a conv...
class InvalidValueError(Exception): pass class NotFoundError(Exception): pass
class Invalidvalueerror(Exception): pass class Notfounderror(Exception): pass
c = get_config() c.ContentsManager.root_dir = "/root/" c.NotebookApp.allow_root = True c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.open_browser = False c.NotebookApp.port = 8888 # Comment out this line or first hash your own password #c.NotebookApp.password = u'sha1:1234567abcdefghi' c.ContentsManager.allow_hidden = Tru...
c = get_config() c.ContentsManager.root_dir = '/root/' c.NotebookApp.allow_root = True c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.open_browser = False c.NotebookApp.port = 8888 c.ContentsManager.allow_hidden = True
r,c=map(int,input('enter number of rows and columns of matrix: ').split()) m1=[] m2=[] a=[] print('<<<<< enter element of matrix1 >>>>>') for i in range(r): l=[] for j in range(c): l.append(int(input(f"enter in m1[{i}][{j}]: "))) m1.append(l) print('<<<<< enter element of matrix2 >>>>>') for i in range(r): l=[] ...
(r, c) = map(int, input('enter number of rows and columns of matrix: ').split()) m1 = [] m2 = [] a = [] print('<<<<< enter element of matrix1 >>>>>') for i in range(r): l = [] for j in range(c): l.append(int(input(f'enter in m1[{i}][{j}]: '))) m1.append(l) print('<<<<< enter element of matrix2 >>>>>...
## Find peak element in an array class Solution: def findPeakElement(self, nums: List[int]) -> int: ## Iterative Binary Search l, r = 0, len(nums)-1 while l<r: mid = (l+r)//2 if nums[mid] > nums[mid+1]: r = mid ...
class Solution: def find_peak_element(self, nums: List[int]) -> int: (l, r) = (0, len(nums) - 1) while l < r: mid = (l + r) // 2 if nums[mid] > nums[mid + 1]: r = mid else: l = mid + 1 return l
class Solution: def numberOfWeeks(self, milestones: List[int]) -> int: k = sorted(milestones,reverse = True) t = sum(k) - k[0] if k[0] <= t+1: return sum(k) else: return 2*t+ 1
class Solution: def number_of_weeks(self, milestones: List[int]) -> int: k = sorted(milestones, reverse=True) t = sum(k) - k[0] if k[0] <= t + 1: return sum(k) else: return 2 * t + 1
# from geometry_msgs.msg import PoseStamped # from geometry_msgs.msg import TwistStamped # from autoware_msgs.msg import DetectedObjectArray # from derived_object_msgs.msg import ObjectArray # from carla_msgs.msg import CarlaEgoVehicleStatus # from grid_map_msgs.msg import GridMap PERCISION = 4 """ Ego: pos: (x, y...
percision = 4 '\nEgo:\n\tpos: \t\t(x, y),\n\theading: \t(x, y ,z, w),\n\tvelocity:\t(x, y),\n\taccel:\t\t(x, y)\n\n\nGroundTruth:\n\ttag:\t\tstring,\n\tpos:\t\t(x, y),\n\theading:\t(x, y, x, w),\n\tvelocity:\t(x, y),\n\tsize:\t\t(x, y ,z)\n\n\nPerception:\n\tpos:\t\t(x, y),\n\theading:\t(x, y, x, w),\n\tvelocity:\t(x, ...
class FilterModule(object): ''' Ansible core jinja2 filters ''' def filters(self): return { 'infer_address' : self.infer_address } def infer_address(self, hostname, hostvars): for t in ('ansible_ssh_host', 'ansible_host', 'inventory_hostname'): if t in hos...
class Filtermodule(object): """ Ansible core jinja2 filters """ def filters(self): return {'infer_address': self.infer_address} def infer_address(self, hostname, hostvars): for t in ('ansible_ssh_host', 'ansible_host', 'inventory_hostname'): if t in hostvars[hostname]: ...
def check_log(recognition_log): pair = recognition_log.split(",") filename_tested = pair[0].split("/")[-1] filename_result = pair[1].split("/")[-1] no_extension_tested = filename_tested.split(".")[0] no_extension_result = filename_result.split(".")[0] check = no_extension_tested == no_extensio...
def check_log(recognition_log): pair = recognition_log.split(',') filename_tested = pair[0].split('/')[-1] filename_result = pair[1].split('/')[-1] no_extension_tested = filename_tested.split('.')[0] no_extension_result = filename_result.split('.')[0] check = no_extension_tested == no_extension_...
class ResponseError(Exception): """Raised when the bittrex API returns an error in the message response""" class RequestError(Exception): """Raised when the request towards the bittrex API is incorrect or fails"""
class Responseerror(Exception): """Raised when the bittrex API returns an error in the message response""" class Requesterror(Exception): """Raised when the request towards the bittrex API is incorrect or fails"""
def cw_distance(az1: float, az2: float) -> float: """ Calculates the 'clockwise' distance between two azimuths, where 0 = North and the direction of increasing angle is clockwise. :param az1: Azimuth 1. :type az1: float :param az2: Azimuth 2. :type az2: float :returns: The angular dista...
def cw_distance(az1: float, az2: float) -> float: """ Calculates the 'clockwise' distance between two azimuths, where 0 = North and the direction of increasing angle is clockwise. :param az1: Azimuth 1. :type az1: float :param az2: Azimuth 2. :type az2: float :returns: The angular dista...
#!/usr/bin/env python3 def mod_sum(n): return sum([x for x in range(n) if (x % 3 == 0) or (x % 5 == 0)])
def mod_sum(n): return sum([x for x in range(n) if x % 3 == 0 or x % 5 == 0])
class Detector(object): """detection algorithm to be implemented by sub class input parameters: self and frame to be worked with Must return frame after being processed and radius""" def __init__(self): """init function""" pass def detection_algo(self, frame): """To b...
class Detector(object): """detection algorithm to be implemented by sub class input parameters: self and frame to be worked with Must return frame after being processed and radius""" def __init__(self): """init function""" pass def detection_algo(self, frame): """To be impl...
def display(summary, *args): args = list(args) usage = "" example = "" details = "" delimiter = "=" try: usage = args.pop(0) example = args.pop(0) details = args.pop(0) except IndexError: # End of arg list pass for x in range(1, len(summary)): ...
def display(summary, *args): args = list(args) usage = '' example = '' details = '' delimiter = '=' try: usage = args.pop(0) example = args.pop(0) details = args.pop(0) except IndexError: pass for x in range(1, len(summary)): delimiter = delimiter ...
# -*- coding: utf-8 -*- ''' Created on Mar 12, 2012 @author: hathcox Copyright 2012 Root the Box 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/lice...
""" Created on Mar 12, 2012 @author: hathcox Copyright 2012 Root the Box 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 Un...
print(" _________ _____ ______ _________ ____ ______ ___________ ________ _________ ") print(" | | | | / \ | | | | | ") print(" | | | | /______\ | |...
print(' _________ _____ ______ _________ ____ ______ ___________ ________ _________ ') print(' | | | | / \\ | | | | | ') print(' | | | | /______\\ | |...
def Cron_Practice_help(): helpHand = """Hey There Some useful commands - fab - To Favorite Questios for Today tasks - To see the questions that are scheduled for today compile - To compile the tasks into a CSV File""" print(helpHand) def Cron_Practice_invalid(): print("Sorry Invalid Command !") Cron_Pract...
def cron__practice_help(): help_hand = 'Hey There\n\n\tSome useful commands - \n\tfab - To Favorite Questios for Today\n\ttasks - To see the questions that are scheduled for today\n\tcompile - To compile the tasks into a CSV File' print(helpHand) def cron__practice_invalid(): print('Sorry Invalid Command !...
# Write your code here n,k = [int(x) for x in input().split()] l = [] while n > 0 : a = int(input()) l.append(a) n -= 1 while(l[0] <= k) : l.pop(0) l = l[::-1] while (l[0] <= k) : l.pop(0) #print(l) print(len(l))
(n, k) = [int(x) for x in input().split()] l = [] while n > 0: a = int(input()) l.append(a) n -= 1 while l[0] <= k: l.pop(0) l = l[::-1] while l[0] <= k: l.pop(0) print(len(l))
def find_2020th_number_spoken(starting_numbers): num_list = [] starting_numbers = [ int(num) for num in starting_numbers.split(',') ] for i in range(0, 2020): #print(f'i:{i}, num_list: {num_list}') if i < len(starting_numbers): #print(f'Still in starting numbers') num...
def find_2020th_number_spoken(starting_numbers): num_list = [] starting_numbers = [int(num) for num in starting_numbers.split(',')] for i in range(0, 2020): if i < len(starting_numbers): num_list.append(starting_numbers[i]) else: last_num = num_list[i - 1] ...
# used for template multi_assignment_list_modal class MultiVideoAssignmentData: def __init__(self, name, count, video_id, set_id): self.name = name self.count = count self.video_id = video_id self.set_id = set_id
class Multivideoassignmentdata: def __init__(self, name, count, video_id, set_id): self.name = name self.count = count self.video_id = video_id self.set_id = set_id
first_number= 1 sec_number= 2 sum= 0 while (first_number < 4000000): new= first_number + sec_number first_number= sec_number sec_number= new if(first_number % 2== 0): sum= sum+first_number print(sum)
first_number = 1 sec_number = 2 sum = 0 while first_number < 4000000: new = first_number + sec_number first_number = sec_number sec_number = new if first_number % 2 == 0: sum = sum + first_number print(sum)
start_position = { (1, 2): "y", (1, 3): "", (1, 5): "y'", (1, 6): "y2", (2, 1): "z' y'", (2, 3): "z'", (2, 4): "z' y", (2, 6): "z' y2", (3, 1): "x y2", (3, 2): "x y", (3, 4): "x", (3, 5): "x y'", (4, 2): "z2 y'", (4, 3): "z2", (4, 5): "z2 y", (4, 6): "x2", (5, 1): "z y", (5, 3): "z", (5, 4): "z y'",...
start_position = {(1, 2): 'y', (1, 3): '', (1, 5): "y'", (1, 6): 'y2', (2, 1): "z' y'", (2, 3): "z'", (2, 4): "z' y", (2, 6): "z' y2", (3, 1): 'x y2', (3, 2): 'x y', (3, 4): 'x', (3, 5): "x y'", (4, 2): "z2 y'", (4, 3): 'z2', (4, 5): 'z2 y', (4, 6): 'x2', (5, 1): 'z y', (5, 3): 'z', (5, 4): "z y'", (5, 6): 'z y2', (6, ...
sink_db = 'gedcom' sink_tbl = { "person": "person", "family": "family" }
sink_db = 'gedcom' sink_tbl = {'person': 'person', 'family': 'family'}
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Sapphire.Combine') def gem(): require_gem('Sapphire.Parse') require_gem('Sapphire.SymbolTable') variables = [ 0, # 0 = copyright ] query = variables.__getitem__ write = ...
@gem('Sapphire.Combine') def gem(): require_gem('Sapphire.Parse') require_gem('Sapphire.SymbolTable') variables = [0] query = variables.__getitem__ write = variables.__setitem__ qc = method(query, 0) wc = method(write, 0) wc0 = method(wc, 0) empty_indentation__function = conjure_inde...
class Solution(object): def checkPossibility(self, nums): """ :type nums: List[int] :rtype: bool """ is_modified = False for i in xrange(len(nums) - 1): if nums[i] > nums[i + 1]: if is_modified: return False ...
class Solution(object): def check_possibility(self, nums): """ :type nums: List[int] :rtype: bool """ is_modified = False for i in xrange(len(nums) - 1): if nums[i] > nums[i + 1]: if is_modified: return False ...
def diag(kp): nk = [] for x in xrange(len(kp)): l = [] for y in xrange(len(kp)): l.append(kp[y][x]) nk.append("".join(l)) return tuple(nk) def parse_line(line): left, right = line.strip().split(" => ") a = tuple(left.split("/")) b = right.split("/") return a, b def parse_input(puzzle_input...
def diag(kp): nk = [] for x in xrange(len(kp)): l = [] for y in xrange(len(kp)): l.append(kp[y][x]) nk.append(''.join(l)) return tuple(nk) def parse_line(line): (left, right) = line.strip().split(' => ') a = tuple(left.split('/')) b = right.split('/') ret...
EXPECTED_RESPONSE_OF_JWKS_ENDPOINT = { 'keys': [ { 'kty': 'RSA', 'n': 'tSKfSeI0fukRIX38AHlKB1YPpX8PUYN2JdvfM-XjNmLfU1M74N0V' 'mdzIX95sneQGO9kC2xMIE-AIlt52Yf_KgBZggAlS9Y0Vx8DsSL2H' 'vOjguAdXir3vYLvAyyHin_mUisJOqccFKChHKjnk0uXy_38-1r17' ...
expected_response_of_jwks_endpoint = {'keys': [{'kty': 'RSA', 'n': 'tSKfSeI0fukRIX38AHlKB1YPpX8PUYN2JdvfM-XjNmLfU1M74N0VmdzIX95sneQGO9kC2xMIE-AIlt52Yf_KgBZggAlS9Y0Vx8DsSL2HvOjguAdXir3vYLvAyyHin_mUisJOqccFKChHKjnk0uXy_38-1r17_cYTp76brKpU1I4kM20M__dbvLBWjfzyw9ehufr74aVwr-0xJfsBVr2oaQFww_XHGz69Q7yHK6DbxYO4w4q2sIfcC4pT8XTP...
# # Modify `remove_html_markup` so that it actually works! # def remove_html_markup(s): tag = False quote = False quoteSign = '"' out = "" for c in s: # print c, tag, quote if c == '<' and not quote: tag = True elif c == '>' and not quote: tag = ...
def remove_html_markup(s): tag = False quote = False quote_sign = '"' out = '' for c in s: if c == '<' and (not quote): tag = True elif c == '>' and (not quote): tag = False elif (c == '"' or c == "'") and tag: if quote == False or quoteSig...
features_dict = { "Name":{ "Description":"String", "Pre_Action":''' ''', "Post_Action":''' ''', "Equip":''' ''', "Unequip":''' ''' }, "Dual Wielding":{ "Description":"You can use this weapon in your Off Hand (if availab...
features_dict = {'Name': {'Description': 'String', 'Pre_Action': '\n\n ', 'Post_Action': '\n\n ', 'Equip': '\n\n ', 'Unequip': '\n\n '}, 'Dual Wielding': {'Description': 'You can use this weapon in your Off Hand (if available) and attack for -1 AP but with no Techinques. ', 'Pre_Action':...
tiles = [ # track example in Marin Headlands, a member of Bay Area Ridge Trail, a regional network # https://www.openstreetmap.org/way/12188550 # https://www.openstreetmap.org/relation/2684235 [12, 654, 1582] ] for z, x, y in tiles: assert_has_feature( z, x, y, 'roads', {'highway': ...
tiles = [[12, 654, 1582]] for (z, x, y) in tiles: assert_has_feature(z, x, y, 'roads', {'highway': 'track'})
class Readfile(): def process(self, utils, logger): filenames = utils.check_input() words = [] for filename in filenames: with open(utils.indir + filename, 'r') as f: for line in f: words.append(line.strip()) return words
class Readfile: def process(self, utils, logger): filenames = utils.check_input() words = [] for filename in filenames: with open(utils.indir + filename, 'r') as f: for line in f: words.append(line.strip()) return words
# -*- coding: utf-8 -*- # Copyright (C) 2009-2010, Luis Pedro Coelho <luis@luispedro.org> # vim: set ts=4 sts=4 sw=4 expandtab smartindent: # Software Distributed under the MIT License ''' Value types: An hierarchy of value types. Hierarchy: vtype |- numeric | |-ordinal | | |- ordinalrange | | ...
""" Value types: An hierarchy of value types. Hierarchy: vtype |- numeric | |-ordinal | | |- ordinalrange | | - boolean | | - integer | -continuous - categorical - boolean """ class Vtype(object): def __init__(self, name): self.name = name class Numer...
"""Module entrypoint.""" def main() -> None: """Execute package entrypoint.""" print("Test") if __name__ == "__main__": main()
"""Module entrypoint.""" def main() -> None: """Execute package entrypoint.""" print('Test') if __name__ == '__main__': main()
def letter_to_number(letter): if letter == 'A': return 10 if letter == 'B': return 11 if letter == 'C': return 12 if letter == 'D': return 13 if letter == 'E': return 14 if letter == 'F': return 15 else: return int(letter) def int_to_...
def letter_to_number(letter): if letter == 'A': return 10 if letter == 'B': return 11 if letter == 'C': return 12 if letter == 'D': return 13 if letter == 'E': return 14 if letter == 'F': return 15 else: return int(letter) def int_to_c...
def returned(reduction): if reduction is not None: return r""" Returns ------- torch.Tensor If `reduction` is left as default {} is taken and single value returned. Otherwise whatever `reduction` returns. """.format( reduction ) return r""" Returns ------- torch....
def returned(reduction): if reduction is not None: return '\nReturns\n-------\ntorch.Tensor\n If `reduction` is left as default {} is taken and single value returned.\n Otherwise whatever `reduction` returns.\n\n '.format(reduction) return '\nReturns\n-------\ntorch.Tensor\n Scalar `...
p = int(input()) total = 0 numbers = [] for i in range(p): cod, quant = input().split(' ') cod = int(cod) quant = int(quant) if(cod == 1001): total = quant*1.50 elif(cod==1002): total = quant*2.50 elif(cod==1003): total = quant*3.50 elif(cod==1004): total = q...
p = int(input()) total = 0 numbers = [] for i in range(p): (cod, quant) = input().split(' ') cod = int(cod) quant = int(quant) if cod == 1001: total = quant * 1.5 elif cod == 1002: total = quant * 2.5 elif cod == 1003: total = quant * 3.5 elif cod == 1004: tot...
""" Code examples for common DevOps tasks cmd.py : Running comand line utils from python script archive.py : tar/zip archives management """ __author__ = "Oleg Merzlyakov" __license__ = "MIT" __email__ = "contact@merzlyakov.me"
""" Code examples for common DevOps tasks cmd.py : Running comand line utils from python script archive.py : tar/zip archives management """ __author__ = 'Oleg Merzlyakov' __license__ = 'MIT' __email__ = 'contact@merzlyakov.me'
ENV_NAMES = [ "coinrun", "starpilot", "caveflyer", "dodgeball", "fruitbot", "chaser", "miner", "jumper", "leaper", "maze", "bigfish", "heist", "climber", "plunder", "ninja", "bossfight", ] HARD_GAME_RANGES = { 'coinrun': [5, 10], 'starpilot': [1.5...
env_names = ['coinrun', 'starpilot', 'caveflyer', 'dodgeball', 'fruitbot', 'chaser', 'miner', 'jumper', 'leaper', 'maze', 'bigfish', 'heist', 'climber', 'plunder', 'ninja', 'bossfight'] hard_game_ranges = {'coinrun': [5, 10], 'starpilot': [1.5, 35], 'caveflyer': [2, 13.4], 'dodgeball': [1.5, 19], 'fruitbot': [-0.5, 27....