content
stringlengths
7
1.05M
def create(size, memory_buffer, temporary_directory, destination_directory, threads, buckets, bitfield, chia_location='chia', temporary2_directory=None, farmer_public_key=None, pool_public_key=None, exclude_final_directory=False): flags = dict( k=size, b=memory_buffer, ...
''' 3. Design an ATM Interviewers would want to see you discuss things like: Overdrawing: What would you do when the ATM doesn’t have any cash left? Pin Verification: What if a user enters a wrong PIN multiple times? Card Reading: How would you detect if the card has been correctly inserted or not? '''
#! /usr/bin/env python """ Warnings informing that something went differently that intended. Does not include messages before exiting with code 1 """ CONFIG_OPEN_FAIL = """ Failed to find or open {} config file. Using default. """ NO_TAX_FILE_FOUND = """ WARNING!!! No proper tax.summary file found. The analysis will ...
class StreamerDoesNotExistException(Exception): pass class StreamerIsOfflineException(Exception): pass class WrongCookiesException(Exception): pass
def solution(A): """ Codility - https://app.codility.com/demo/results/trainingKC23TS-77G/ 100% Idea is to maintain the start and end point marker for each disc/circle Sort by start position of disc/circle On each start position count the active circle/disc On each end position reduc...
class CollectionParams: def __init__(self, dataset_count_map, system_count_map, dataset_collection_count, dataset_collection_count_map, system_collection_count, system_collection_count_map, collection_count): self.dataset_count_map = dataset_count_map self.system_count_map = system_...
class Links(object) : def __init__(self, links=None) : """initialize with a set of links default to none""" self._links = [] if None != links: self.add(links) def add(self, links) : """links contains a map or array of maps in link-format""" ...
#https://atcoder.jp/contests/abc072/tasks/arc082_b N = int(input()) p = list(map(int,input().split())) now = count = 0 while(now<N): if p[now]==now+1: if now+1 != N: tmp = p[now] p[now] = p[now+1] p[now+1] = tmp now -= 1 count += 1 co...
""" In this chapter, we used the dictionary value {'1h': 'bking', '6c': 'wqueen', '2g': 'bbishop', '5h': 'bqueen', '3e': 'wking'} to represent a chess board. Write a function named isValidChessBoard() that takes a dictionary argument and returns True or False depending on if the board is valid. A valid board will hav...
#!/bin/python3 for j in range(int(input())): st = input() print(st[::2], st[1::2])
class Solution(object): def strStr(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ if not needle: return 0 for i in range(len(haystack)): if haystack[i]==needle[0] and haystack[i:i+len(needle...
serial = 9221 def get_power(position): rackID = position[0] + 10 power = rackID * position[1] power += serial power *= rackID power = (abs(power)%1000)//100 power -= 5 return(power) def get_square(tlpos, size=3): total = 0 for x in range(tlpos[0], tlpos[0]+size): for y in r...
BASE91_ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_`{|}~"' MASK1 = 2**13 - 1 MASK2 = 2**14 - 1 MASK3 = 2**8 - 1 def b91encode(num): encoded = "" n = 0 b = 0 for digit in num.encode('latin-1'): b |= (digit << n) n += 8 if n >...
DOMAIN = "modernforms" DEVICES = "devices" COORDINATORS = "coordinators" CONF_FAN_HOST = "fan_host" CONF_FAN_NAME = "fan_name" CONF_ENABLE_LIGHT = "enable_fan_light" SERVICE_REBOOT = "reboot"
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A, B): L = len(A) P_MOD = (1 << max(B)) - 1 # 2 ** max(B) - 1 sequenceSolution = [] fiboSeq = [0] * (L + 2) fiboSeq[1] = 1 for i in range(2, L + 2): fiboSeq[i] = (fiboSeq[i - 1] +...
''' Desafio CPF CPF = 168.995.350-09 -------------------- 1 * 10 = 10 # 1 * 11 = 11 6 * 9 = 12 # 6 * 10 = 60 8 * 8 = 24 # 8 * 9 = 72 9 * 7 = 63 # 9 * 8 = 72 9 * 6 = 54 # 9 * 7 = 63 5 * 5 = 25 # 5 * 6 = 30 3 * 4 = 12 # 3 * 5 = 15 5 * 3 = 1...
dict={"be":"b","before":"b4","are":"r","you":"u","please":"plz","people":"ppl","really":"rly","have":"haz","know":"no","fore":"4","for":"4","to":"2","too":"2"} def n00bify(text): text=text.replace("'","").replace(",","").replace(".","") res=text.split() for i,j in enumerate(res): for k in range(len(...
n1 = int(input('Digite o primeiro valor: ')) n2 = int(input('Digite o segundo valor: ')) if n1 > n2: print('O primeiro valor é o maior!') elif n2 > n1: print('O segundo valor é o maior!') else: print('Os dois valores são iguais!')
# Checks if the provided char is at least 5 chars long def validateMinCharLength(field): if len(field) >= 5: return True else: return False # validates that the value provided by the user is a float value above 0 def validateValue(value): if isinstance(value, float): if value > 0.0:...
def sortByBinaryOnes (numList): binary = [str((bin(i)[2:])) for i in numList] ones = [i.count("1") for i in binary] sorting = sorted(list(zip(ones, numList, binary))) sorting.sort(key=lambda k: (k[0], -k[1]), reverse=True) numList = [i[1] for i in sorting] return numList sortByBinaryOnes([1,1...
# 44. Wildcard Matching # --------------------- # # Given an input string (`s`) and a pattern (`p`), implement wildcard pattern matching with support for `'?'` and `'*'` # where: # # * `'?'` Matches any single character. # * `'*'` Matches any sequence of characters (including the empty sequence). # # The matching s...
def grid_traveller_basic(n, m): if n == 0 or m == 0: return 0 if n < 2 and m < 2: return min(n, m) return grid_traveller_basic(n - 1, m) + grid_traveller_basic(n, m - 1) def grid_traveller_memo(n, m, memo=dict()): if n == 0 or m == 0: return 0 if n < 2 and m < 2: ...
""" @title: Winter is coming @author: DSAghicha (Darshaan Aghicha) @access: public """ def mandatory_courses(course: list[list[int]],answer: list[list[int]]) -> list[bool]: result: list[bool] = [] indirect_dependency: list[int] = [] for i in range(len(course)): if i + 1 < len(course) and course[i][1...
[ { 'date': '2019-01-01', 'description': 'Nieuwjaar', 'locale': 'nl-BE', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2019-04-21', 'description': 'Pasen', 'locale': 'nl-BE', 'notes': '', 'region': '', 't...
class NotEnoughSpace(Exception): pass class UnknownNodeType(Exception): def __init__(self, expr): self.expr = expr def __str__(self): attrs = ', '.join('%s=%s' % (a, getattr(self.expr, a)) for a in dir(self.expr) if not a.startswith('_...
default_min_token = -9223372036854775808 default_max_token = 9223372036854775807 split_q_size = 20000 worker_q_size = 20000 mapper_q_size = 20000 reducer_q_size = 20000 results_q_size = 20000 stats_q_size = 20000 # you can also specify your database credentials here # when specified here, they will take precedence over...
class Solution(): def missingNumber(self, nums): """ :type nums: List[int] :rtype: int note: the max num in nums is len(nums) """ n = len(nums) return (n * (n + 1) // 2) - sum(nums)
image_queries = { "pixel": {"filename": "pixel.gif", "media_type": "image/gif"}, "gif": {"filename": "badge.gif", "media_type": "image/gif"}, "flat": {"filename": "badge-flat.svg", "media_type": "image/svg+xml"}, "flat-gif": {"filename": "badge-flat.gif", "media_type": "image/gif"}, "other": {"filen...
# 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. # @lint-ignore-every BUCKRESTRICTEDSYNTAX """ shape.bzl provides a convenient strongly-typed bridge from Buck bzl parse time to Python runtim...
h = input() j = int(h)**2 kl = h[::-1] kll = int(kl)**2 h1 = str(kll)[::-1] if str(j) == h1: print("Adam number") else: print("Yeet")
# Copyright (c) 2017, Softbank Robotics Europe # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of condition...
class PenHandler: EAST_DEGREES = 0 NORTH_DEGREES = 90 WEST_DEGREES = 180 SOUTH_DEGREES = 270 DRAW_MULTIPLIER = 50 def __init__(self): self.pens = {} self.pen_current = None self.pen_active = False def draw(self, distance, degrees): if not self.pen_active: ...
load("@scala_things//:dependencies/dependencies.bzl", "java_dependency", "scala_dependency", "scala_fullver_dependency", "make_scala_versions", "apply_scala_version", "apply_scala_fullver_version") load("@rules_jvm_external//:defs.bzl", "maven_install") scala_versions = make_scala_versions( "2", "13", "6",...
def same_structure_as(original, other): if not type(original) == type(other): return False if not len(original) == len(other): return False def get_structure(lis, struct=[]): for i in range(len(lis)): if type(lis[i]) == list: struct.append(s...
ENDPOINTS = { 'auction': '/auctions/{auction_id}', 'contract': '/auctions/{auction_id}/contracts/{contract_id}', 'contracts': '/auctions/{auction_id}/contracts', 'item': '/auctions/{auction_id}/items/{item_id}', 'items': '/auctions/{auction_id}/items', }
__version__ = '1.0.0' __author__ = 'Steven Huang' __all__ = ["file", "basic", "geo_math", "geo_transformation"]
# -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland # # 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.apac...
#!/usr/bin/env python # coding: utf-8 # In[ ]: n = int(input()) for i in range(1, n+1): if i % 2 == 0: print('{}^2 = {}'.format(i, i**2))
# 执行用时 : 48 ms # 内存消耗 : 13.4 MB # 方案:n 是奇数就生成n个a; n 是偶数就生成n-1个a和一个b class Solution: def generateTheString(self, n: int) -> str: # n 是奇数就生成n个a # n 是偶数就生成n-1个a和一个b if n % 2 == 0: return "a" * (n - 1) + "b" return "a" * n
class Solution: def subdomainVisits(self, cpdomains): """ :type cpdomains: List[str] :rtype: List[str] """ class Node: def __init__(self): self.visits = 0 self.children = {} def traverse(name, node, output): ...
# Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. num = int(input("Input an integer : ")) n1 = int( "%s" % num ) n2 = int( "%s%s" % (num,num) ) n3 = int( "%s%s%s" % (num,num,num) ) print (n1+n2+n3)
''' example of models and GPU distribution sampler. To run models demo, you need to download data files 'mnist_gray.mat'&'TREC.pkl' and put it under pydpm.example.data data url: https://1drv.ms/u/s!AlkDawhaUUBWtHRWuNESEdOsDz7V?e=LQlGLW '''
class Solution(object): def pivotIndex(self, nums): """ :type nums: List[int] :rtype: int """ total_sum = sum(nums) sum_so_far = 0 for i in range(len(nums)): if sum_so_far * 2 + nums[i] == total_sum: return i else: ...
class DefaultConfig(object): DEBUG = False TESTING = False class TestConfig(DefaultConfig): TESTING = True class DebugConfig(DefaultConfig): DEBUG = True
def mac2ipv6(mac): # only accept MACs separated by a colon parts = mac.split(":") # modify parts to match IPv6 value parts.insert(3, "ff") parts.insert(4, "fe") parts[0] = "%x" % (int(parts[0], 16) ^ 2) # format output ipv6Parts = [] for i in range(0, len(parts), 2): ipv6Pa...
name = "sample_module" """sample_module - Sample control test module demonstrating required functions """ def match(request): """match(request) - Match conditions in order for module to be run """ if request.method == "PUT": return True return False def run(request): """run(request) - Execute module and return...
############################ # Patch to implement pcNN for VASP ver. 5.4.4. written by Ryo Nagai # email: r-nag@issp.u-tokyo.ac.jp # # This add-on is only available to owners of a valid VASP license. # This add-on is distributed under an agreement from VASP Software GmbH. # - This add-on comes without any waranty. # ...
class Error(Exception): pass class WrappedError(Error): BASE_MESSAGE = 'WrappedError' def __init__(self, *args, origin_error=None, **kwargs): self._origin_error = origin_error if self._origin_error: message = self.BASE_MESSAGE + ': ' + str(self._origin_error) else: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 28 09:12:46 2019 @author: Brandon """ class nhcOutlooks(): def __init__(self, name, year, advisory_num): self.name = name self.yr = int(year) self.adv_n = str(advisory_num) self._check_inputs() ...
def convert_iso_to_json(dateString): tempDateObject = dateString.split("-") return { "year": tempDateObject[0], "month": tempDateObject[1], "day": tempDateObject[2] } def convert_json_to_iso(json): return "{0}-{1}-{2}".format(int(json['year']), int(json['month']), int(json['day'...
# # Copyright © 2022 Christos Pavlatos, George Rassias, Christos Andrikos, # Evangelos Makris, Aggelos Kolaitis # # 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 rest...
def define_env(env): env.variables["SHELLCHECK"] = "[ShellCheck](https://github.com/koalaman/shellcheck)" env.variables["BLACK"] = "[black](https://black.readthedocs.io/)" env.variables["ISORT"] = "[isort](https://pycqa.github.io/isort/)" env.variables["FLAKE8"] = "[flake8](https://flake8.pycqa.org/)" ...
# # PySNMP MIB module WWP-LEOS-USER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-USER-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:38:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
print('{:-^30}'.format(' Conversor de Temperatura ')) cel = float(input('Digite a temperatura em Celsius: ')) #formula para conversão: F=1,8C+32 far = ((1.8 * cel) + 32) print(f'\nA temperatura de {cel:.2f}°C equivale a {far:.2f}°F')
REGISTERED_PLATFORMS = {} def register_class(cls): REGISTERED_PLATFORMS[cls.BASENAME] = cls return cls
# 064_Tratando_varios_valores_v1.py num = j = soma = 0 num = int(input("Entre com um número: ")) while (num != 9999): soma += num j += 1 num = int(input("Entre com um número: ")) print("Fim") print(f"Você digitou {j} e a soma foi {soma}")
# 7. Световен рекорд по плуване # Иван решава да подобри Световния рекорд по плуване на дълги разстояния. На конзолата се въвежда рекордът в секунди, # който Иван трябва да подобри, разстоянието в метри, което трябва да преплува и времето в секунди, за което плува разстояние от 1 м. # Да се напише програма, която изчи...
class Pessoa: olhos = 2 def __init__(self, *filhos, nome=None, idade=49): self.idade = idade self.nome = nome self.filhos = list(filhos) def cumprimentar(self): return f'Olá {id(self)}' if __name__ == '__main__': henrique = Pessoa(nome='Henrique') gerarda = Pessoa(h...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def kthSmallest(self, root: TreeNode, k: int) -> int: global counter, res counter = 0 res = 0 def dfs(root, k): if not root: ...
# sito eratostenesa def sito(num): x = 2 tab = [False, False] + [True for i in range(x, num+1)] while x * x <= num: if tab[x]: for i in range(x*x, num+1, x): tab[i] = False x += 1 else: x += 1 return tab if __name__ == '__main__': ...
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
def user_information_helper(data) -> dict: return { "id": str(data["_id"]), "name": data["timePredict"], "email": data["email"], "phoneNumber": data["phoneNumber"], "weight": data["weight"], "createAt": str(data["createAt"]), "updateAt": str(data["updateAt"]),...
def odd_and_even_sums(numbers): even_sum = 0 odd_sum = 0 for digit in numbers: if int(digit) % 2 == 0: even_sum += int(digit) else: odd_sum += int(digit) return f"Odd sum = {odd_sum}, Even sum = {even_sum}" numbers = input() answer = odd_and_even_sums(numbers) ...
def selection(x): n = len(x) for i in range(0, n-1): for j in range(i+1, n): if x[i]>x[j]: x[i], x[j] = x[j], x[i] print('''{} - {} - {}'''.format(i, j, x)) return x x = [2, 7, 8, 1, 3, 6] print(selection(x))
""" spider.supervised_learning sub-package __init__.py @author: zeyu sun Supervised Learning primitives difines the model index """ __all__ = [ "OWLRegression", ]
class Solution: def countUnivalSubtrees(self, root: Optional[TreeNode]) -> int: ans = 0 def isUnival(root: Optional[TreeNode], val: int) -> bool: nonlocal ans if not root: return True if isUnival(root.left, root.val) & isUnival(root.right, root.val): ans += 1 return...
def subsitute_object(file, obj) -> str: """Subsitute fields of dictionatry into a copy of a file. This function will seek out all the keys in the form of {key} within the file, then it will subsitute the value into them. Returns a string, does not create nor edit files """ template_file = open(f...
POSITION_IMAGE_LEFT = 'image-left' POSITION_IMAGE_RIGHT = 'image-right' POSITION_CHOICES = ( (POSITION_IMAGE_LEFT, 'Image Left'), (POSITION_IMAGE_RIGHT, 'Image Right'), )
""" 14928. 큰 수 (BIG) 작성자: xCrypt0r 언어: Python 3 사용 메모리: 31,336 KB 소요 시간: 6,280 ms 해결 날짜: 2020년 9월 13일 """ def main(): print(int(input()) % 20000303) if __name__ == '__main__': main()
# coding: utf-8 class Item: def __init__(self, name, price): self.name = name self.price = price im = Item('鼠标', 28.9) print(im.__dict__) # ① # 通过__dict__访问name属性 print(im.__dict__['name']) # 通过__dict__访问price属性 print(im.__dict__['price']) im.__dict__['name'] = '键盘' im.__dict__['price'] = 32.8 ...
def setup(): size(1000, 500) smooth() strokeWeight(30) stroke(100) def draw(): background(0) line(frameCount, 300,100 + frameCount,400) line(100 + frameCount, 300, frameCount, 400)
# -*- encoding=utf-8 -*- # Copyright 2016 David Cary; licensed under the Apache License, Version 2.0 """ Unit tests """
class Customer: def __init__(self, name, age, phone_no): self.name = name self.age = age self.phone_no = phone_no def purchase(self, payment): if payment.type == "card": print("Paying by card") elif payment.type == "e-wallet": print("Paying by wal...
#!/usr/bin/env python # -- Content-Encoding: UTF-8 -- """ Event beans for Pelix. :author: Thomas Calmant :copyright: Copyright 2020, Thomas Calmant :license: Apache License 2.0 :version: 1.0.1 .. Copyright 2020 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "License"); you may not us...
''' YTV.su Playlist Downloader Plugin configuration file ''' # Channels url url = 'http://ytv.su/tv/channels'
""" constant values for the pygaro module """ ENDPOINT_RFID = "rest/chargebox/rfid" DEFAULT_PORT = 2222 # api methods currently supported METHOD_GET = "GET" METHOD_POST = "POST" METHOD_DELETE = "DELETE" # status code HTTP_OK = 200
add2 = addN(2) add2 add2(7) 9
#!/usr/bin/env python def times(x, y): return x * y z = times(2, 3) print("2 times 3 is " + str(z));
# Copyright 2020 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
# Scrapy settings for chuansong project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/latest/topics/downloader-mid...
a={} def fib(n): if n==0: return 0 if n==1: return 1 if n in a: return a[n] else: ans=fib(n-1)+fib(n-2) d[n]=ans return ans print(fib(int(input('Enter n : '))))
# Programowanie I R # Operacje na plikach: zapis # W celu przeprowadzenia operacji zapisu do pliku musimy otworzyć ten plik w trybie # zapisu (w), dołączania (a), tworzenia (x) lub edycji (r+). # Należy zachować ostrożność przy stosowaniu trybu zapisu (w), ponieważ jeśli plik # już istnieje, cała jego zawartość zosta...
# This is a placeholder version of this file; in an actual installation, it # is generated from scratch by the installer. The constants defined here # are exposed by constants.py DEFAULT_DATABASE_HOST = None # XXX DEFAULT_PROXYCACHE_HOST = None # XXX MASTER_MANAGER_HOST = None # XXX - used to define BUNDLES_SRC...
""" 출처: https://www.acmicpc.net/problem/2565 """ size = int(input()) nums = [list(map(int, input().split())) for _ in range(size)] nums.sort(key=lambda x: x[0]) __to = [nums[i][1] for i in range(size)] dp = [1] * size for i in range(size): for j in range(i): if __to[i] > __to[j]: dp[i] = max...
class Solution: def maxChunksToSorted(self, arr: [int]) -> int: stack = [] for num in arr: if stack and num < stack[-1]: head = stack.pop() while stack and num < stack[-1]: stack.pop() stack.append(head) else: stack.append(num)...
""" Asked by: Stripe. Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. For example, the input [3, 4, -1, 1] shou...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
def insertion_sort(arr): """Performs an Insertion Sort on the array arr.""" for i in range(1, len(arr)): key = arr[i] j = i-1 # 2 5 while key < arr[j] and j >= 0: # swap(key, j, arr) # 6 5 arr[j+1] = arr[j] ...
def water_depth_press(wd: "h_l", rho_water, g=9.81) -> "p_e": p_e = rho_water * g * abs(wd) return p_e
def aumentar(au=0, taxa=0, show=False): au = au + ((au * taxa) / 100) if show == True: au = moeda(au) return au def diminuir(di=0, taxa=0, show=False): di = di - ((di * taxa) / 100) if show == True: di = moeda(di) return di def dobro(do=0, show=False): do *= 2 if show...
""" Sponge Knowledge Base Test - KB from an archive file """ class Action2FromArchive(Action): def onCall(self, arg): return arg.lower()
class Card(object): def __init__(self): self.fields = [] for i in range (0, 5): self.fields.append([]) for j in range(0, 5): self.fields[i].append(Field()) class Field(object): def __init__(self): self.number = -1 self.marked = False def ...
class Solution: def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: if sum(gas) - sum(cost) < 0: return -1 tank = start = total = 0 for i in range(len(gas)): tank += gas[i] - cost[i] if tank < 0: start = i + 1 total +=...
# -*- coding: utf-8 -*- ''' Created on 1983. 08. 09. @author: Hye-Churn Jang, CMBU Specialist in Korea, VMware [jangh@vmware.com] ''' name = 'VirtualPrivateZone' # custom resource name sdk = 'vra' # imported SDK at common directory inputs = { 'create': { 'VraManager': 'constant' }, ...
def to_dict_tools(target): data = dict() attribute = dir(target) if 'public_info' in attribute: public_info = getattr(target, 'public_info') attribute = dir(target) for item in attribute: item = str(item) if not item.startswith('_') and item in public_info: data[i...
class Person: population: int = 0 def __new__(cls): cls.population += 1 print(f'DBG: new Person created, {cls.population=}') return object.__new__(cls) def __repr__(self) -> str: return f'{self.__class__.__name__} {id(self)=} {self.population=}' def main(): people = ...
root = 'data/eval_det' train = dict( type='IcdarDataset', ann_file=f'{root}/instances_training.json', img_prefix=f'{root}/imgs', pipeline=None) test = dict( type='IcdarDataset', img_prefix=f'{root}/imgs', ann_file=f'{root}/instances_test.json', pipeline=None, test_mode=True) train...
P = ("Rafael","Beto","Carlos") for k in range(int(input())): x, y = tuple(map(int,input().split())) players = (9*x*x + y*y, 2*x*x + 25*y*y, -100*x + y*y*y) winner = players.index(max(players)) print("{0} ganhou".format(P[winner]))
""" Author: Huaze Shen Date: 2019-07-09 """ def remove_duplicates(nums): if nums is None or len(nums) == 0: return 0 length = 1 for i in range(1, len(nums)): if nums[i] == nums[i - 1]: continue length += 1 nums[length - 1] = nums[i] return length if __name...
test = { 'name': 'q3_1_2', 'points': 1, 'suites': [ { 'cases': [ {'code': '>>> type(event_result) in set([np.ndarray])\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> # Your list should have 5 elements.;\n>>> len(event_result) == 5\nTrue', 'hidden': False, 'lo...