content
stringlengths
7
1.05M
# O(NlogM) / O(1) class Solution: def shipWithinDays(self, weights: List[int], D: int) -> int: def count(t): ans, cur = 1, 0 for w in weights: cur += w if cur > t: ans += 1 cur = w return ans l, r = max(weights), sum(weights) + 1 while l < r: m = l + (r - l) // 2 if count(m) <= D: r = m else: l = m + 1 return l
x=oi() q=x z(q)
# 점프와 순간이동 def solution(n): ans = 0 while n > 0: if n % 2 != 0: ans+= 1 n //= 2 return ans ''' 채점을 시작합니다. 정확성 테스트 테스트 1 〉 통과 (0.00ms, 10.2MB) 테스트 2 〉 통과 (0.00ms, 10.1MB) 테스트 3 〉 통과 (0.00ms, 10.2MB) 테스트 4 〉 통과 (0.00ms, 10.2MB) 테스트 5 〉 통과 (0.01ms, 10.2MB) 테스트 6 〉 통과 (0.00ms, 10.2MB) 테스트 7 〉 통과 (0.00ms, 10.3MB) 테스트 8 〉 통과 (0.00ms, 10.3MB) 테스트 9 〉 통과 (0.01ms, 10.1MB) 테스트 10 〉 통과 (0.01ms, 10.2MB) 테스트 11 〉 통과 (0.00ms, 10.2MB) 테스트 12 〉 통과 (0.00ms, 10.2MB) 테스트 13 〉 통과 (0.00ms, 10.2MB) 테스트 14 〉 통과 (0.01ms, 10.1MB) 테스트 15 〉 통과 (0.00ms, 10.1MB) 테스트 16 〉 통과 (0.00ms, 10.2MB) 테스트 17 〉 통과 (0.00ms, 10.2MB) 테스트 18 〉 통과 (0.00ms, 10.2MB) 효율성 테스트 테스트 1 〉 통과 (0.01ms, 10.2MB) 테스트 2 〉 통과 (0.01ms, 10.2MB) 테스트 3 〉 통과 (0.01ms, 10.2MB) 테스트 4 〉 통과 (0.01ms, 10.2MB) 테스트 5 〉 통과 (0.01ms, 10.2MB) 테스트 6 〉 통과 (0.01ms, 10.1MB) 테스트 7 〉 통과 (0.01ms, 10.2MB) 테스트 8 〉 통과 (0.01ms, 10.2MB) 테스트 9 〉 통과 (0.01ms, 10.2MB) 테스트 10 〉 통과 (0.01ms, 10.3MB) 채점 결과 정확성: 60.0 효율성: 40.0 합계: 100.0 / 100.0 '''
#!/usr/bin/env python """ Author: Gianluca Biccari Description: Implementation of an Hash Table with string keys """ class HashTable(object): """ Do-it by yourself implemenation in case you don't want to use the built in data structure dictionary. """ def __init__(self): # number of slots per hast table self.size = 11 self.__load_factor_threshold = 100 # count the element stored in the hash table, to cotroll the load # factor and eventually you could resize the table size. self.count = 0 # conflicts resolution with chaining, we use a list per each slot self.table = [[] for i in range(1, self.size + 1)] def hash_function(self, key): # raise an error if the key is not a string if not isinstance(key, str): raise KeyError('Key for hash table must be a string') # hash value is build usin the reminder operator. we sum up the ordinal # value of each char using position to weight the value to avoid # collision on a palindrome sum = 0 for i, char in enumerate(key): sum = sum + ord(char) * (i+1) return sum % self.size def put(self, key, value): hash_value = self.hash_function(key) hash_list = self.table[hash_value] # we store in the hash table a tuple, including the original key. This # is necessary for implementing the remove method. hash_data = (key, value) hash_keys = [k for (k, v) in hash_list] if key in hash_keys: # we have already a value with that key, replace it index = hash_keys.index(key) hash_list[index] = hash_data else: # append the new value: hash_list.append(hash_data) self.count = self.count + 1 if self.__load_factor() > self.__load_factor_threshold: print('Collision density warning - ', self.__load_factor()) def get(self, key): hash_value = self.hash_function(key) hash_list = self.table[hash_value] hash_keys = [k for (k, v) in hash_list] if key in hash_keys: index = hash_keys.index(key) return hash_list[index][1] else: return None def remove(self, key): hash_value = self.hash_function(key) hash_list = self.table[hash_value] hash_keys = [k for (k, v) in hash_list] if key in hash_keys: index = hash_keys.index(key) hash_list.pop(index) self.count = self.count - 1 else: return None def __load_factor(self): """ __load_factor := (total input) / size To signal the level of collisions present in the table at the moment. Geometrically is the min(H) where Area = (H x Size) of the hash table rectangle. """ return self.count / self.size # special class methods (to make it prettier) def __getitem__(self, value): return self.get(value) def __setitem__(self, key, item): return self.put(key, item) def __len__(self): return self.count def __delitem__(self, key): self.remove(key) def __repr__(self): return str(self.table)
class Output: def __init__(self, race_nr, winner, loser, ): self.race_nr = race_nr self.winner = winner self.loser = loser def get_output_template(self): if self.winner == 'O' or 'X': results = f'\nRace {self.race_nr}: car {self.winner} - WIN, car {self.loser} - LOSE\n' return results else: results = f'\nRace {self.race_nr}: was a tie\n' return results def score_save(self): with open("race_results.txt", "w", encoding='utf-8') as f: f.write(self.get_output_template())
#-*- coding:utf-8 -*- # <component_name>.<environment>[.<group_number>] HostGroups = { 'web.dev': ['web.dev.example.com'], 'ap.dev': ['ap.dev.example.com'], 'web.prod.1': ['web001.example.com'], 'web.prod.2': ['web{:03d}.example.com'.format(n) for n in range(2,4)], 'web.prod.3': ['web{:03d}.example.com'.format(n) for n in range(4,6)], 'ap.prod.1': ['ap001.example.com'], 'ap.prod.2': ['ap{:03d}.example.com'.format(n) for n in range(2,4)], 'ap.prod.3': ['ap{:03d}.example.com'.format(n) for n in range(4,6)] } def get_environment_list(): return ['dev', 'prod'] def get_host_groups(): global HostGroups return HostGroups
class NewsValidator: def __init__(self, config): self._config = config def validate_news(self, news): news = news.as_dict() assert self.check_languages(news), "Wrong language!" assert self.check_null_values(news), "Null values!" assert self.check_description_length(news), "Short description!" def check_null_values(self, news): news_values = list(news.values()) return all(news_values) def check_description_length(self, news): description_length = self._config.get("description_length") return len(news.get("description")) >= description_length def check_languages(self, news): languages = self._config.get("languages") lang = news.get("language") return any( filter(lambda x: x == lang, languages) )
# -*- coding: utf-8 -*- """ Created on Tue Dec 12 01:33:05 2017 @author: Mayur """ # ============================================================================= # Exercise: coordinate # # Consider the following code from the last lecture video: # # class Coordinate(object): # def __init__(self, x, y): # self.x = x # self.y = y # # def getX(self): # # Getter method for a Coordinate object's x coordinate. # # Getter methods are better practice than just accessing an attribute # # directly # return self.x # # def getY(self): # # Getter method for a Coordinate object's y coordinate # return self.y # # def __str__(self): # return '<' + str(self.getX()) + ',' + str(self.getY()) + '>' # Your task is to define the following two methods for the Coordinate class: # # Add an __eq__ method that returns True if coordinates refer to same point in # the plane (i.e., have the same x and y coordinate). # # Define __repr__, a special method that returns a string that looks like a valid # Python expression that could be used to recreate an object with the same value. # In other words, eval(repr(c)) == c given the definition of __eq__ from part 1. # # ============================================================================= #code class Coordinate(object): def __init__(self,x,y): self.x = x self.y = y def getX(self): # Getter method for a Coordinate object's x coordinate. # Getter methods are better practice than just accessing an attribute # directly return self.x def getY(self): # Getter method for a Coordinate object's y coordinate return self.y def __str__(self): return '<' + str(self.getX()) + ',' + str(self.getY()) + '>' def __eq__(self, other): return self.getX() == other.getX() and self.getY() == other.getY() def __repr__(self): return "Coordinate(" + str(self.getX()) + "," + str(self.getY()) + ")"
#https://programmers.co.kr/learn/courses/30/lessons/42860 def solution(name): answer = 0 name_length = len(name) move = [1 if name[i]=='A' else 0 for i in range(name_length)] for i in range(name_length): now_str = name[i] answer += get_move_num_alphabet(now_str, 'A') answer += get_move_num_cursor(move) return answer def get_move_num_alphabet(str1, str2): return min(abs(ord(str1) - ord(str2)), 26 - abs(ord(str1) - ord(str2))) def get_move_num_cursor(move): cursor_pos = 0 move_num = 0 move[cursor_pos] = 1 while sum(move) != len(move): now_move = [move[i%len(move)] for i in range(cursor_pos, len(move)+cursor_pos)] move_right = now_move[1:][:(len(move)-1)//2] move_left = now_move[1:][::-1][:(len(move)-1)//2] is_right_direction = check_direction(move_right, move_left) if is_right_direction: cursor_pos += 1 else: cursor_pos -= 1 move_num += 1 move[cursor_pos] = 1 return move_num def check_direction(right, left): assert len(right) == len(left), "len(right) == len(left) but differnt" right_direction = True left_direction = False for i in range(len(right)): r = right[i] l = left[i] if r == 0 and l == 1: return right_direction elif r == 1 and l == 0: return left_direction elif r == 0 and l == 0: for j in range(i+1, len(right)): r_ = right[j] l_ = left[j] if r_ == 1 and l_ == 0: return right_direction elif r_ == 0 and l_ == 1: return left_direction return right_direction
#code def SelectionSort(arr,n): for i in range(0,n): minpos = i for j in range(i,n): if(arr[j]<arr[minpos]): minpos = j arr[i],arr[minpos] = arr[minpos],arr[i] #or #temp = arr[minpos] #arr[minpos] = arr[i] #arr[i] = temp #driver arr = [5,2,8,6,9,1,4] n = len(arr) SelectionSort(arr,n) print("Sorted array is :") for i in range(n): print(arr[i],end=" ")
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-pseudocap_go' ES_DOC_TYPE = 'gene' API_PREFIX = 'pseudocap_go' API_VERSION = ''
def aumentar(numero, taxa=10, f=False): numero += ((numero * taxa)/100) if f==True: return moeda(numero) else: return numero def diminuir(numero, taxa=10, f=False): numero-=((numero*taxa)/100) if f == True: return moeda(numero) else: return numero def metade(numero, f=False): numero = numero/2 if f == True: return moeda(numero) else: return numero def dobro(numero, f=False): numero += numero if f == True: return moeda(numero) else: return numero def moeda(numero=0, moeda='R$'): return str(f'{moeda} {numero:.2f}'.replace('.',',')) def resumo(numero, aumento, desconto): print('-'*30) print('RESUMO DO VALOR'.center(30)) print('-'*30) print(f'Preço analisado: \t{moeda(numero)}') print(f'Dobro do preço é \t{dobro(numero,True)}') print(f'Metade do preço é \t{metade(numero,True)}') print(f'{aumento}% de aumento \t\t{aumentar(numero, aumento,True)}') print(f'{desconto}% de desconto \t{diminuir(numero, desconto,True)}') print('-'*30)
# V1.43 messages # PID advanced # does not include feedforward data or vbat sag comp or thrust linearization # pid_advanced = b"$M>2^\x00\x00\x00\x00x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x007\x00\xfa\x00\xd8\x0e\x00\x00\x00\x00\x01\x01\x00\n\x14H\x00H\x00H\x00\x00\x15\x1a\x00(\x14\x00\xc8\x0fd\x04\x00\xb1" pid_advanced = b'$M>2^\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x007\x00\xfa\x00\xd8\x0e\x00\x00\x00\x00\x01\x01\x00\n\x14H\x00H\x00H\x00\x00\x15\x1a\x00(\x14\x00\xc8\x0fd\x04\x00\xb1' # PID coefficient pid = b"$M>\x0fp\x16D\x1f\x1aD\x1f\x1dL\x0457K(\x00\x00G" fc_version = b"$M>\x03\x03\x01\x0c\x15\x18" fc_version_2 = b"$M>\x03\x01\x00\x01\x15\x16" api_version = b"$M>\x03\x01\x00\x01\x15\x16" status_response = b"$M>\x16e}\x00\x00\x00!\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x1a\x04\x01\x01\x00\x004" status_ex_response = ( b"$M>\x16\x96}\x00\x00\x00!\x00\x00\x00\x00\x00\x00\x05\x00\x03\x00\x00\x1a\x04\x01\x01\x00\x00\xc4" ) sensor_alignment = b"$M>\x07~\x01\x01\x00\x01\x00\x01\x01x" # status_ex_response = ( # b'$M>\x16\x96}\x00\x00\x00!\x00\x00\x00\x00\x00\x00\x05\x00\x03\x04\x00\x1a\x04\x00\x00\x00\x00\xc0' # ) rc_tuning = b"$M>\x17od\x00FFFA2\x00F\x05\x00dd\x00\x00d\xce\x07\xce\x07\xce\x07\x00\xc7" rx_tuning2 = ( b"$M>\x02l\x07\xdc\x05\x1a\x04\x00u\x03C\x08\x02\x13\xe2\x04\x00\x00\x00\x00\x00\x00(\x02\x01\x00\x00\x01\x03\x00" ) board_info = b"$M>J\x04S405\x00\x00\x027\tSTM32F405\nCLRACINGF4\x04CLRA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x02@\x1f\x00\x00\x00\x00\r" # MSP.ATTITUDE attitude_response = b"$M>\x06l`\x02\xaa\xff\x0e\x00S" # MSP.BOXNAMES box_names_response = ( b"$M>\xfft\x0b\x01ARM;ANGLE;HORIZON;HEADFREE;FAILSAFE;HEADADJ;BEEPER;" b"OSD DISABLE SW;BLACKBOX;FPV ANGLE MIX;BLACKBOX ERASE (>30s);CAMERA CONTROL 1;" b"CAMERA CONTROL 2;CAMERA CONTROL 3;FLIP OVER AFTER CRASH;PREARM;VTX PIT MODE;" b"PARALYZE;USER1;ACRO TRAINER;DISABLE VTX CONTROL;LA" ) # MSP.BOXIDS box_names_response = b'$M>\x16w\x00\x01\x02\x06\x1b\x07\r\x13\x1a\x1e\x1f !"#$\'-(/01U' # MSP.FEATURE_CONFIG feature_config_response = b'$M>\x04$\x00 D0t'
N = int(input()) swifts = [int(n) for n in input().split(' ')] semaphores = [int(n) for n in input().split(' ')] swift_sum = 0 semaphore_sum = 0 largest = 0 for k in range(N): swift_sum += swifts[k] semaphore_sum += semaphores[k] if swift_sum == semaphore_sum: largest = k + 1 print(largest)
"""Firehose resource for AWS Cloudformation.""" __version__ = "0.0.6" __author__ = "German Gomez-Herrero, FindHotel BV"
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 17 09:54:02 2020 @author: AzureD Formatting tools for displaying HELP inside the MUD clients. """ def docstring_to_help(name: str, docstring: str): """ Converts a function docstring to a more viewable format for MUD clients. Mainly used inside `src/mud/commands` commands for quick help documentation in-code. """ split_doc = docstring.split('\n') # split by newline # generate the header of the help, and the footer, examples: # ------ [ name #help ] --------------------------- # ------------------------------------------------- header = f"""------ [ {name} #help ] -""".ljust(70, "-") footer = "".ljust(70, "-") split_doc.insert(0, header) split_doc.append(footer) return "\r\n".join(split_doc) # ensure compatibility with carriage return aswell as newline
# Iterate over the enitre array. Insert counts only if != 1. Pop repeated occurances of characters. class Solution: def compress(self, chars: List[str]) -> int: run = 1 prev = chars[0] i = 1 while i<len(chars): c = chars[i] if c==prev: run += 1 chars.pop(i) # this makes up for incrementing i else: if run>1: # insert run only if > 1 for r in str(run): chars.insert(i, r) # Insert run digit at i and increment i i += 1 prev = c # now lookout for the new char run = 1 # which has run of 1 i += 1 # increment i for jumping to the next itereation if run>1: # Add the last run to the result for r in str(run): chars.append(r) return len(chars)
# 字符模拟二进制计算 class Solution: def addBinary(self, a: str, b: str) -> str: # 1补齐长度 # 2从尾部到头部模拟加法 # 3进位处理、头部进位 # 4输出切片 d = abs(len(a) - len(b)) if len(a) > len(b): b = '0' * d + b else: a = '0' * d + a l = len(a) s = '' up = 0 for i in range(-1, -l - 1, -1): sums = int(a[i]) + int(b[i]) + up if sums >= 2: s = str(sums % 2) + s up = sums // 2 else: s = str(sums) + s up = 0 if up == 1: s = '1' + s return s # pythonic做法 class Solution1: def addBinary(self, a: str, b: str) -> str: return bin(int('0b'+a,2)+int('0b'+b,2))[2:] # 异或运算,不具备通用性 class Solution2: def addBinary(self, a: str, b: str) -> str: flag = 0 result = '' max_len = max(len(a), len(b)) a = a.zfill(max_len) b = b.zfill(max_len) for i in range(-1, -max_len - 1, -1): result = str(int(a[i]) ^ int(b[i]) ^ flag) + result if a[i] == '0' and b[i] == '0': flag = 0 elif a[i] == '1' and b[i] == '1': flag = 1 if flag == 1: result = '1' + result return result if __name__=='__main__': a=Solution() print(a.addBinary('11110','101'))
# Escriba un programa que calcule el máximo y el mínimo de dos números usando funciones. # Con tal fin, proceda como sigue: # • Escriba un procedimiento Leer que lea un número. # • Escriba una función que dados dos números, devuelva el máximo de ellos. # • Escriba una función que dados dos números, devuelva el mínimo de ellos. # • Escriba el programa principal que lea dos números, obtenga el mayor y el menor de # ellos, y muestre el resultado en pantalla. def leerNumero(): return float(input('Ingrese un numero: ')) def numeroMayor(numero1, numero2): if numero1 > numero2: return numero1 return numero2 def numeroMenor( numero1, numero2): if numero1>numero2: return numero2 return numero1 if __name__ == "__main__": valor1 = leerNumero() valor2 = leerNumero() print("El numero mayor es: " + str(numeroMayor(valor1, valor2))) print("El numero menor es: " + str(numeroMenor(valor1, valor2)))
{ "targets": [{ "target_name": "pifacecad", "sources": ["piface.cc"], "include_dirs": ["./src/"], "link_settings": { "libraries": [ "../lib/libpifacecad.a", "../lib/libmcp23s17.a" ] }, "cflags": ["-std=c++11"] }] }
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: pre = ListNode(0) pre.next = head head1, head2 = pre, pre for i in range(n): head2 = head2.next if not head2: return head while head2.next is not None: head1 = head1.next head2 = head2.next head1.next = head1.next.next return pre.next def removeNthFromEnd2(self, head: ListNode, n: int) -> ListNode: p = ListNode(-1) p.next = head a, b = p, p while n > 0 and b: n = n - 1 b = b.next if not b: return head while b.next: b = b.next a = a.next a.next = a.next.next return p.next ''' for i in range(n): head2 = head2.next while head2.next is not None: head1 = head1.next head2 = head2.next print(head2.val, head1.val) print(head1.val, "*******", head1.next.next.val) head1.next = head1.next.next return pre.next ''' head = ListNode(1) head.next = ListNode(2) head.next.next = ListNode(3) head.next.next.next = ListNode(4) head.next.next.next.next = ListNode(5) head.next.next.next.next.next = ListNode(6) slu = Solution() neddle = slu.removeNthFromEnd(head, 2) while neddle: print(neddle.val) neddle = neddle.next
with open("day10/input.txt", encoding='utf-8') as file: data = file.read().splitlines() opening_chars = '([{<' closing_chars = ')]}>' sum_of_corrupted = 0 mapping_dict = {'(' : [')', 3], '[' : [']', 57], '{' : ['}', 1197], '<' : ['>', 25137]} mapping_dict_sums = {')' : 3, ']' : 57, '}' : 1197, '>' : 25137} mapping_dict_part2 = {'(' : 1, '[' : 2, '{' : 3, '<' : 4} total_points = [] for line in data: empty_array = [] for key, char in enumerate(line): if char in closing_chars: last_char = empty_array.pop(-1) if char != mapping_dict[last_char][0]: empty_array = [] break else: empty_array.insert(len(empty_array), char) acc = 0 for score in empty_array[::-1]: acc = acc * 5 + mapping_dict_part2[score] if len(empty_array) != 0: total_points.append(acc) middle_key = int(len(total_points)/2) middle_score = sorted(total_points)[middle_key] print(middle_score)
class StairsEditScope(EditScope,IDisposable): """ StairsEditScope allows user to maintain a stairs-editing session. StairsEditScope(document: Document,transactionName: str) """ def Dispose(self): """ Dispose(self: EditScope,A_0: bool) """ pass def ReleaseUnmanagedResources(self,*args): """ ReleaseUnmanagedResources(self: EditScope,disposing: bool) """ pass def Start(self,*__args): """ Start(self: StairsEditScope,baseLevelId: ElementId,topLevelId: ElementId) -> ElementId Creates a new empty stairs element with a default stairs type in the specified levels and then starts stairs edit mode and editing the new stairs. baseLevelId: The base level on which the stairs is to be placed. topLevelId: The top level where the stairs is to reach. Returns: ElementId of the new stairs. Start(self: StairsEditScope,stairsId: ElementId) -> ElementId Starts an stairs edit mode for an existing Stairs element stairsId: The stairs element to be edited. Returns: ElementId of the editing stairs. It should be the same as the input stairsId """ pass def __enter__(self,*args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self,*args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self,document,transactionName): """ __new__(cls: type,document: Document,transactionName: str) """ pass IsPermitted=property(lambda self: object(),lambda self,v: None,lambda self: None) """Tells if the StairsEditScope is permitted to start. Get: IsPermitted(self: StairsEditScope) -> bool """
{ 'application':{ 'type':'Application', 'name':'Template', 'backgrounds': [ { 'type':'Background', 'name':'bgTemplate', 'title':'Standard Template with File->Exit menu', 'size':( 400, 300 ), 'style':['resizeable'], 'statusBar':0, 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit', 'command':'exit', } ] } ] }, 'components': [ ] } ] } }
def menu_selection_error(a): """if input is not a valid menu choice, throw an error""" print("'\033[91m'ERROR:'\033[92m'Invalid input! Please select from the menu'\033[0m'") def handle_division(a): """makes sure number is not zero""" if a == 0: print("'\033[91m'ERROR:'\033[92m'Cannot divide by zero!'\033[0m'")
class ErosionStatus: is_running: bool # signalize that the erosion (usually in other thread) should stop stop_requested: bool = False progress: int def __init__(self, is_running: bool = False, progress: int = 0): self.is_running = is_running self.progress = progress
# 1. Quais são os dados de entrada necessários? #   * um valor de reais N do tipo float(). # 2. Que devo fazer com estes dados? #   * converter no formato de cédulas e moedas. # 3. Quais são as restrições deste problema? #   * entrada em float(). # 4. Qual é o resultado esperado? #   * NOTAS: # * ? nota(s) de R$ ###.## #   * ... #   * MOEDAS: #   * ? moeda(s) de R$ #.## #   * ... # 5. Qual é a sequência de passos a ser feitas para chegar ao resultado esperado? #   * #https://www.urionlinejudge.com.br/judge/pt/problems/view/1021 N = float(input()) C_100 = N // 100 C_50 = N % 100 // 50 C_20 = N % 100 % 50 // 20 C_10 = N % 100 % 50 % 20 // 10 C_5 = N % 100 % 50 % 20 % 10 // 5 C_2 = N % 100 % 50 % 20 % 10 % 5 // 2 M_1 = N % 100 % 50 % 20 % 10 % 5 % 2 // 1 M_50 = N % 100 % 50 % 20 % 10 % 5 % 2 % 1 // 0.5 M_25 = N % 100 % 50 % 20 % 10 % 5 % 2 % 1 % 0.5 // 0.2 M_10 = N % 100 % 50 % 20 % 10 % 5 % 2 % 1 % 0.5 % 0.2 // 0.1 M_05 = N % 100 % 50 % 20 % 10 % 5 % 2 % 1 % 0.5 % 0.2 % 0.1 // 0.05 M_01 = N % 100 % 50 % 20 % 10 % 5 % 2 % 1 % 0.5 % 0.2 % 0.1 % 0.05 // 0.01 print("""NOTAS: {:.0f} nota(s) de R$ 100.00 {:.0f} nota(s) de R$ 50.00 {:.0f} nota(s) de R$ 20.00 {:.0f} nota(s) de R$ 10.00 {:.0f} nota(s) de R$ 5.00 {:.0f} nota(s) de R$ 2.00 MOEDAS: {:.0f} nota(s) de R$ 1.00 {:.0f} nota(s) de R$ 0.50 {:.0f} nota(s) de R$ 0.25 {:.0f} nota(s) de R$ 0.10 {:.0f} nota(s) de R$ 0.05 {:.0f} nota(s) de R$ 0.01""".format(C_100, C_50, C_20, C_10, C_5, C_2, M_1, M_50, M_25, M_10, M_05, M_05, M_01))
# Any recipe starts with a list of ingredients. Below is an extract # from a cookbook with the ingredients for some dishes. Write a # program that tells you what recipe you can make based on the # ingredient you have. # The input format: # A name of some ingredient. # The ouput format: # A message that says "food time!" where "food" stands for the # dish that contains this ingredient. For example, "pizza time!". If # the ingredient is featured in several recipes, write about all of # then in the order they're featured in the cook book. pasta = "tomato, basil, garlic, salt, pasta, olive oil" apple_pie = "apple, sugar, salt, cinnamon, flour, egg, butter" ratatouille = "aubergine, carrot, onion, tomato, garlic, olive oil, pepper, salt" chocolate_cake = "chocolate, sugar, salt, flour, coffee, butter" omelette = "egg, milk, bacon, tomato, salt, pepper" ingredient = input() if ingredient in pasta: print("pasta time!") if ingredient in apple_pie: print("apple pie time!") if ingredient in ratatouille: print("ratatouille time!") if ingredient in chocolate_cake: print("chocolate cake time!") if ingredient in omelette: print("omelette time!")
PROXIES = [ {'protocol':'http', 'ip_port':'118.193.26.18:8080'}, {'protocol':'http', 'ip_port':'213.136.77.246:80'}, {'protocol':'http', 'ip_port':'198.199.127.16:80'}, {'protocol':'http', 'ip_port':'103.78.213.147:80'}, {'protocol':'https', 'ip_port':'61.90.73.10:8080'}, {'protocol':'http', 'ip_port':'36.83.78.184:80'}, {'protocol':'http', 'ip_port':'66.119.180.101:80'}, {'protocol':'https', 'ip_port':'142.44.135.148:8080'}, {'protocol':'http', 'ip_port':'80.211.181.37:3128'}, {'protocol':'http', 'ip_port':'36.79.15.169:80'}, {'protocol':'https', 'ip_port':'140.227.81.53:3128'}, {'protocol':'http', 'ip_port':'47.52.231.140:8080'}, {'protocol':'https', 'ip_port':'185.93.3.123:8080'}, {'protocol':'http', 'ip_port':'121.121.125.55:80'}, {'protocol':'https', 'ip_port':'191.252.92.198:8080'}, {'protocol':'http', 'ip_port':'213.136.89.121:80'}, {'protocol':'http', 'ip_port':'36.83.82.36:80'}, {'protocol':'https', 'ip_port':'163.44.165.165:8080'}, {'protocol':'https', 'ip_port':'191.252.186.52:80'}, {'protocol':'https', 'ip_port':'140.227.78.54:3128'}, {'protocol':'http', 'ip_port':'36.75.254.142:80'}, {'protocol':'https', 'ip_port':'178.57.44.159:44331'}, {'protocol':'http', 'ip_port':'80.48.119.28:8080'}, {'protocol':'https', 'ip_port':'103.241.205.66:8080'}, {'protocol':'http', 'ip_port':'36.83.77.39:80'}, {'protocol':'https', 'ip_port':'149.56.45.68:10000'}, {'protocol':'http', 'ip_port':'177.67.83.134:3128'}, {'protocol':'https', 'ip_port':'167.99.224.142:8080'}, {'protocol':'http', 'ip_port':'66.70.190.244:8080'}, {'protocol':'http', 'ip_port':'36.83.93.62:80'}, {'protocol':'https', 'ip_port':'178.136.225.96:53281'}, {'protocol':'https', 'ip_port':'212.77.86.103:80'}, {'protocol':'https', 'ip_port':'158.69.150.164:8080'}, {'protocol':'http', 'ip_port':'66.119.180.104:80'}, {'protocol':'https', 'ip_port':'66.70.146.227:3128'}, {'protocol':'https', 'ip_port':'110.164.181.164:8080'}, {'protocol':'http', 'ip_port':'88.99.215.14:80'}, {'protocol':'https', 'ip_port':'124.120.105.127:3128'}, {'protocol':'http', 'ip_port':'159.65.63.23:80'}, {'protocol':'http', 'ip_port':'66.119.180.103:80'}, {'protocol':'http', 'ip_port':'18.130.46.39:80'}, {'protocol':'http', 'ip_port':'81.22.54.60:53281'}, {'protocol':'http', 'ip_port':'45.115.39.139:7777'}, {'protocol':'http', 'ip_port':'60.49.97.65:53281'}, {'protocol':'http', 'ip_port':'176.15.169.70:53281'}, {'protocol':'http', 'ip_port':'81.211.23.6:3128'}, {'protocol':'http', 'ip_port':'190.12.58.187:53281'}, {'protocol':'http', 'ip_port':'196.61.28.125:53281'}, {'protocol':'http', 'ip_port':'47.89.30.82:8118'}, {'protocol':'http', 'ip_port':'109.76.229.164:8080'}, {'protocol':'http', 'ip_port':'199.195.119.37:80'}, {'protocol':'http', 'ip_port':'122.54.105.143:53281'}, {'protocol':'http', 'ip_port':'62.43.201.40:53281'}, {'protocol':'http', 'ip_port':'41.204.84.182:53281'}, {'protocol':'http', 'ip_port':'196.202.194.127:62225'}, {'protocol':'http', 'ip_port':'159.224.176.205:53281'}, {'protocol':'http', 'ip_port':'136.169.141.254:8080'}, {'protocol':'http', 'ip_port':'125.162.211.20:80'}, {'protocol':'http', 'ip_port':'60.250.79.187:80'}, {'protocol':'http', 'ip_port':'165.90.11.18:8080'}, {'protocol':'http', 'ip_port':'111.93.64.113:80'}, {'protocol':'https', 'ip_port':'147.135.210.114:54566'}, {'protocol':'http', 'ip_port':'184.172.231.86:80'}, {'protocol':'https', 'ip_port':'89.236.17.106:3128'}, {'protocol':'http', 'ip_port':'175.139.252.193:80'}, {'protocol':'http', 'ip_port':'187.60.253.78:3128'}, {'protocol':'http', 'ip_port':'109.74.75.61:80'}, {'protocol':'http', 'ip_port':'14.136.246.173:3128'}, {'protocol':'http', 'ip_port':'198.1.122.29:80'}, {'protocol':'http', 'ip_port':'159.65.182.63:80'}, {'protocol':'http', 'ip_port':'129.213.76.9:3128'}, {'protocol':'https', 'ip_port':'189.115.92.71:80'}, {'protocol':'http', 'ip_port':'74.209.243.116:3128'}, {'protocol':'https', 'ip_port':'191.252.120.198:8080'}, {'protocol':'http', 'ip_port':'115.249.145.202:80'}, {'protocol':'https', 'ip_port':'94.130.20.85:31288'}, {'protocol':'https', 'ip_port':'185.65.192.36:8080'}, {'protocol':'http', 'ip_port':'185.70.79.131:3128'}, {'protocol':'https', 'ip_port':'77.120.72.235:53281'}, {'protocol':'https', 'ip_port':'191.252.194.156:3128'}, {'protocol':'https', 'ip_port':'71.13.112.152:3128'}, {'protocol':'http', 'ip_port':'5.189.133.231:80'}, {'protocol':'http', 'ip_port':'91.205.239.120:8080'}, {'protocol':'http', 'ip_port':'121.254.214.219:80'}, {'protocol':'http', 'ip_port':'185.229.224.61:80'}, {'protocol':'http', 'ip_port':'34.201.72.254:80'}, {'protocol':'http', 'ip_port':'163.172.86.64:3128'}, {'protocol':'http', 'ip_port':'46.4.62.108:80'}, {'protocol':'http', 'ip_port':'47.89.41.164:80'}, {'protocol':'http', 'ip_port':'34.244.2.143:80'}, {'protocol':'http', 'ip_port':'177.21.115.43:20183'}, {'protocol':'http', 'ip_port':'190.109.32.251:8080'}, {'protocol':'http', 'ip_port':'177.21.109.90:20183'}, {'protocol':'http', 'ip_port':'89.169.88.169:8080'}, {'protocol':'http', 'ip_port':'167.99.28.176:8080'}, {'protocol':'http', 'ip_port':'128.199.129.5:80'}, {'protocol':'http', 'ip_port':'192.141.206.176:20183'}, {'protocol':'http', 'ip_port':'85.109.69.223:9090'}, {'protocol':'http', 'ip_port':'103.18.180.1:8080'}, {'protocol':'http', 'ip_port':'36.65.187.232:8080'}, {'protocol':'http', 'ip_port':'103.41.96.186:8080'}, {'protocol':'http', 'ip_port':'186.94.179.162:8080'}, {'protocol':'http', 'ip_port':'93.143.193.34:8080'}, {'protocol':'http', 'ip_port':'4.35.210.222:8181'}, {'protocol':'http', 'ip_port':'87.118.208.125:8080'}, {'protocol':'http', 'ip_port':'103.26.54.21:8080'}, {'protocol':'http', 'ip_port':'80.245.117.133:8080'}, {'protocol':'http', 'ip_port':'123.49.53.210:8080'}, {'protocol':'http', 'ip_port':'201.249.49.105:8080'}, {'protocol':'http', 'ip_port':'201.44.187.67:20183'}, {'protocol':'http', 'ip_port':'103.25.155.5:8080'}, {'protocol':'http', 'ip_port':'193.150.117.61:8000'}, {'protocol':'http', 'ip_port':'62.69.195.249:8080'}, {'protocol':'http', 'ip_port':'103.35.168.14:8080'}, {'protocol':'http', 'ip_port':'74.83.246.125:8081'}, {'protocol':'http', 'ip_port':'27.123.0.153:8080'}, {'protocol':'http', 'ip_port':'5.13.254.175:8080'}, {'protocol':'http', 'ip_port':'103.216.144.17:8080'}, {'protocol':'http', 'ip_port':'5.40.227.209:8080'}, {'protocol':'http', 'ip_port':'182.18.200.92:8080'}, {'protocol':'http', 'ip_port':'170.79.200.233:20183'}, {'protocol':'http', 'ip_port':'52.128.58.102:8080'}, {'protocol':'http', 'ip_port':'103.218.24.41:8080'}, {'protocol':'http', 'ip_port':'221.187.134.102:8080'}, {'protocol':'http', 'ip_port':'103.111.228.2:8080'}, {'protocol':'http', 'ip_port':'103.218.25.33:8080'}, {'protocol':'http', 'ip_port':'61.8.78.130:8080'}, {'protocol':'http', 'ip_port':'177.36.208.121:3128'}, {'protocol':'http', 'ip_port':'45.125.223.145:8080'}, {'protocol':'http', 'ip_port':'193.19.135.1:8080'}, {'protocol':'http', 'ip_port':'103.48.70.193:8080'}, {'protocol':'http', 'ip_port':'81.34.18.159:8080'}, {'protocol':'http', 'ip_port':'175.209.132.102:808'}, {'protocol':'http', 'ip_port':'177.74.247.59:3128'}, {'protocol':'http', 'ip_port':'1.179.181.17:8081'}, {'protocol':'http', 'ip_port':'80.72.66.212:8081'}, {'protocol':'http', 'ip_port':'91.237.240.70:8080'}, {'protocol':'http', 'ip_port':'200.122.209.78:8080'}, {'protocol':'http', 'ip_port':'36.66.103.63:3128'}, {'protocol':'http', 'ip_port':'122.54.20.216:8090'}, {'protocol':'http', 'ip_port':'203.154.82.34:8080'}, {'protocol':'http', 'ip_port':'66.96.237.133:8080'}, {'protocol':'http', 'ip_port':'177.36.131.200:20183'}, {'protocol':'http', 'ip_port':'200.122.211.26:8080'}, {'protocol':'http', 'ip_port':'103.35.171.93:8080'}, {'protocol':'http', 'ip_port':'2.138.25.150:8080'}, {'protocol':'http', 'ip_port':'177.204.155.131:3128'}, {'protocol':'http', 'ip_port':'103.206.254.190:8080'}, {'protocol':'http', 'ip_port':'177.220.186.11:8080'}, {'protocol':'http', 'ip_port':'177.47.243.74:8088'}, {'protocol':'http', 'ip_port':'177.21.109.69:20183'}, {'protocol':'http', 'ip_port':'1.179.185.253:8080'}, {'protocol':'http', 'ip_port':'182.23.28.186:3128'}, {'protocol':'http', 'ip_port':'80.87.176.16:8080'}, {'protocol':'http', 'ip_port':'202.169.252.73:8080'}, {'protocol':'http', 'ip_port':'154.72.81.45:8080'}, {'protocol':'http', 'ip_port':'190.201.95.84:8080'}, {'protocol':'http', 'ip_port':'195.228.210.245:8080'}, {'protocol':'http', 'ip_port':'91.237.240.4:8080'}, {'protocol':'http', 'ip_port':'202.137.15.93:8080'}, {'protocol':'http', 'ip_port':'87.249.205.103:8080'}, {'protocol':'http', 'ip_port':'189.8.93.173:20183'}, {'protocol':'http', 'ip_port':'177.21.104.205:20183'}, {'protocol':'http', 'ip_port':'172.245.211.188:5836'}, {'protocol':'http', 'ip_port':'88.255.101.175:8080'}, {'protocol':'http', 'ip_port':'131.161.124.36:3128'}, {'protocol':'http', 'ip_port':'182.16.171.26:53281'}, {'protocol':'http', 'ip_port':'45.123.43.158:8080'}, {'protocol':'http', 'ip_port':'94.45.49.170:8080'}, {'protocol':'http', 'ip_port':'177.22.91.71:20183'}, {'protocol':'http', 'ip_port':'181.129.33.218:62225'}, {'protocol':'http', 'ip_port':'190.109.169.41:53281'}, {'protocol':'https', 'ip_port':'204.48.22.184:3432'}, {'protocol':'https', 'ip_port':'198.50.137.181:3128'}, {'protocol':'http', 'ip_port':'173.212.202.65:443'}, {'protocol':'https', 'ip_port':'170.78.23.245:8080'}, {'protocol':'https', 'ip_port':'158.69.143.77:8080'}, {'protocol':'http', 'ip_port':'103.87.16.2:80'}, {'protocol':'https', 'ip_port':'18.222.124.59:8080'}, {'protocol':'http', 'ip_port':'47.254.22.115:8080'}, {'protocol':'http', 'ip_port':'118.69.34.21:8080'}, {'protocol':'http', 'ip_port':'138.117.115.249:53281'}, {'protocol':'http', 'ip_port':'190.4.4.204:3128'}, {'protocol':'http', 'ip_port':'42.112.208.124:53281'}, {'protocol':'http', 'ip_port':'188.120.232.181:8118'}, {'protocol':'https', 'ip_port':'177.52.250.126:8080'}, {'protocol':'http', 'ip_port':'218.50.2.102:8080'}, {'protocol':'http', 'ip_port':'54.95.211.163:8080'}, {'protocol':'http', 'ip_port':'35.200.69.141:8080'}, {'protocol':'http', 'ip_port':'181.49.24.126:8081'}, {'protocol':'https', 'ip_port':'96.9.69.230:53281'}, {'protocol':'https', 'ip_port':'192.116.142.153:8080'}, {'protocol':'http', 'ip_port':'171.244.32.140:8080'}, {'protocol':'https', 'ip_port':'195.133.220.18:43596'}, {'protocol':'https', 'ip_port':'209.190.4.117:8080'}, {'protocol':'http', 'ip_port':'39.109.112.111:8080'}, {'protocol':'http', 'ip_port':'176.53.2.122:8080'}, {'protocol':'https', 'ip_port':'200.255.53.2:8080'}, {'protocol':'http', 'ip_port':'125.26.98.165:8080'}, {'protocol':'http', 'ip_port':'212.90.167.90:55555'}, {'protocol':'https', 'ip_port':'125.25.202.139:3128'}, {'protocol':'http', 'ip_port':'83.238.100.226:3128'}, {'protocol':'http', 'ip_port':'103.87.170.105:42421'}, {'protocol':'http', 'ip_port':'195.138.83.218:53281'}, {'protocol':'http', 'ip_port':'185.237.87.240:80'}, {'protocol':'http', 'ip_port':'188.0.138.147:8080'}, {'protocol':'http', 'ip_port':'181.211.166.105:54314'}, {'protocol':'http', 'ip_port':'87.185.153.132:8080'}, {'protocol':'http', 'ip_port':'67.238.124.52:8080'}, {'protocol':'http', 'ip_port':'159.192.206.10:8080'}, {'protocol':'http', 'ip_port':'159.65.168.7:80'}, {'protocol':'http', 'ip_port':'108.61.203.146:8118'}, {'protocol':'http', 'ip_port':'173.212.209.59:80'}, {'protocol':'http', 'ip_port':'88.205.171.222:8080'}, {'protocol':'http', 'ip_port':'38.103.239.2:44372'}, {'protocol':'http', 'ip_port':'182.16.171.18:53281'}, {'protocol':'http', 'ip_port':'177.21.108.222:20183'}, {'protocol':'http', 'ip_port':'182.253.139.36:65301'}, {'protocol':'https', 'ip_port':'200.7.205.198:8081'}, {'protocol':'https', 'ip_port':'41.169.67.242:53281'}, {'protocol':'http', 'ip_port':'41.190.33.162:8080'}, {'protocol':'https', 'ip_port':'94.130.14.146:31288'}, {'protocol':'https', 'ip_port':'88.99.149.188:31288'}, {'protocol':'https', 'ip_port':'80.211.151.246:8145'}, {'protocol':'https', 'ip_port':'136.169.225.53:3128'}, {'protocol':'http', 'ip_port':'47.252.1.152:80'}, {'protocol':'https', 'ip_port':'61.7.175.138:41496'}, {'protocol':'http', 'ip_port':'52.214.181.43:80'}, {'protocol':'https', 'ip_port':'67.205.148.246:8080'}, {'protocol':'https', 'ip_port':'176.31.250.164:3128'}, {'protocol':'http', 'ip_port':'109.195.243.177:8197'}, {'protocol':'http', 'ip_port':'46.105.51.183:80'}, {'protocol':'https', 'ip_port':'94.141.157.182:8080'}, {'protocol':'https', 'ip_port':'14.207.100.203:8080'}, {'protocol':'http', 'ip_port':'163.172.181.29:80'}, {'protocol':'https', 'ip_port':'54.36.162.123:10000'}, {'protocol':'http', 'ip_port':'52.87.190.26:80'}, {'protocol':'http', 'ip_port':'212.98.150.50:80'}, {'protocol':'https', 'ip_port':'66.82.144.29:8080'}, {'protocol':'http', 'ip_port':'188.166.223.181:80'}, {'protocol':'http', 'ip_port':'180.251.80.119:8080'}, {'protocol':'http', 'ip_port':'94.21.75.9:8080'}, {'protocol':'http', 'ip_port':'177.105.252.133:20183'}, {'protocol':'http', 'ip_port':'61.7.138.109:8080'}, {'protocol':'http', 'ip_port':'110.78.155.27:8080'}, {'protocol':'http', 'ip_port':'178.49.139.13:80'}, {'protocol':'https', 'ip_port':'146.158.30.192:53281'}, {'protocol':'https', 'ip_port':'171.255.199.129:80'}, {'protocol':'http', 'ip_port':'92.222.74.221:80'}, {'protocol':'http', 'ip_port':'170.79.202.23:20183'}, {'protocol':'http', 'ip_port':'179.182.63.63:20183'}, {'protocol':'http', 'ip_port':'212.14.166.26:3128'}, {'protocol':'https', 'ip_port':'103.233.118.83:808'}, {'protocol':'http', 'ip_port':'110.170.150.52:8080'}, {'protocol':'http', 'ip_port':'181.143.129.180:3128'}, {'protocol':'http', 'ip_port':'181.119.115.2:53281'}, {'protocol':'http', 'ip_port':'185.8.158.149:8080'}, {'protocol':'http', 'ip_port':'103.39.251.241:8080'}, {'protocol':'http', 'ip_port':'46.229.252.61:8080'}, {'protocol':'http', 'ip_port':'93.182.72.36:8080'}, {'protocol':'http', 'ip_port':'201.54.5.117:3128'}, {'protocol':'http', 'ip_port':'78.140.6.68:53281'}, {'protocol':'http', 'ip_port':'177.184.83.162:20183'}, {'protocol':'http', 'ip_port':'143.202.75.240:20183'}, {'protocol':'http', 'ip_port':'31.145.83.202:8080'}, {'protocol':'http', 'ip_port':'177.101.181.33:20183'}, {'protocol':'http', 'ip_port':'144.76.190.233:3128'}, {'protocol':'http', 'ip_port':'134.0.63.134:8000'}, {'protocol':'http', 'ip_port':'38.103.239.13:35617'}, {'protocol':'http', 'ip_port':'110.78.168.138:62225'}, {'protocol':'http', 'ip_port':'198.58.123.138:8123'}, {'protocol':'http', 'ip_port':'190.78.8.120:8080'}, {'protocol':'http', 'ip_port':'190.23.68.39:8080'}, {'protocol':'http', 'ip_port':'191.55.10.27:3128'}, {'protocol':'http', 'ip_port':'200.71.146.146:8080'}, {'protocol':'http', 'ip_port':'103.102.248.56:3128'}, {'protocol':'http', 'ip_port':'37.110.74.231:8181'}, {'protocol':'http', 'ip_port':'191.5.183.120:20183'}, {'protocol':'http', 'ip_port':'154.68.195.8:8080'}, {'protocol':'http', 'ip_port':'182.53.201.240:8080'}, {'protocol':'http', 'ip_port':'177.21.115.164:20183'}, {'protocol':'http', 'ip_port':'201.49.238.77:20183'}, {'protocol':'http', 'ip_port':'101.109.64.19:8080'}, {'protocol':'http', 'ip_port':'36.81.21.226:8080'}, {'protocol':'http', 'ip_port':'37.60.209.54:8081'}, {'protocol':'http', 'ip_port':'143.0.141.96:80'}, {'protocol':'http', 'ip_port':'201.49.238.28:20183'}, {'protocol':'http', 'ip_port':'175.107.208.74:8080'}, {'protocol':'http', 'ip_port':'80.211.226.156:80'}, {'protocol':'http', 'ip_port':'119.42.72.139:31588'}, {'protocol':'http', 'ip_port':'61.5.101.56:3128'}, {'protocol':'http', 'ip_port':'180.183.223.47:8080'}, {'protocol':'http', 'ip_port':'197.159.16.2:8080'}, {'protocol':'http', 'ip_port':'27.147.142.146:8080'}, {'protocol':'http', 'ip_port':'201.76.125.107:20183'}, {'protocol':'http', 'ip_port':'103.78.74.170:3128'}, {'protocol':'http', 'ip_port':'85.130.3.136:53281'}, {'protocol':'http', 'ip_port':'213.144.123.146:80'}, {'protocol':'http', 'ip_port':'182.253.179.230:8080'}, {'protocol':'http', 'ip_port':'170.79.202.162:20183'}, ]
""" GTSAM Copyright 2010-2020, Georgia Tech Research Corporation, Atlanta, Georgia 30332-0415 All Rights Reserved See LICENSE for the license information Various common utilities. Author: Varun Agrawal """ def collect_namespaces(obj): """ Get the chain of namespaces from the lowest to highest for the given object. Args: obj: Object of type Namespace, Class, InstantiatedClass, or Enum. """ namespaces = [] ancestor = obj.parent while ancestor and ancestor.name: namespaces = [ancestor.name] + namespaces ancestor = ancestor.parent return [''] + namespaces
def notas(*n, sit=False): """ -> Funcao para analisar notas e situacoes de alunos :param n: uma ou mais notas de alunos :param sit: valor opcional, indicando se deve ou nao adicionar a situacao :return: dicionario com varias informacoes sobre a situacao da turma """ r = dict() r['total'] = len(n) r['maior'] = max(n) r['menor'] = min(n) r['media'] = sum(n)/len(n) if sit: if r['media'] >= 7: r['situacao'] = 'BOA' elif r['media'] >= 5: r['situacao'] = 'RAZOAVEL' else: r['situacao'] = 'RUIM' return r resp = notas(5.5,9.5,10,6.5,sit=True) print(resp) help(notas)
""" This package is for adding officially supported integrations with other libraries. The goal of the integrations is to make it easy to get started with dbx combined with other frameworks. Features that an integration might add are: - automatic loggic - automatic checkpoints - pause/resume functionality integrated with that of the other framework - imports to from another framework format to dbx format (e.g. tensorboard to dbx) - exports from dbx format to another framework format (e.g. dbx to tensorboard) - and more. Currently we only have a callback class for torchbearer which adds automatic logging of some events. More integrations will be added in the future, depending on user demand. Are you using dbx or dbxlogger with other library or framework? Please share back your work so others can benefit from it too. Simply sharing your experience is also great so we can investigate together on how to create the best integration. """
def dict_words(string): dict_word={} list_words=string.split() for word in list_words: if(dict_word.get(word)!=None): dict_word[word]+=1 else: dict_word[word]=1 return dict_word def main(): with open('datasets/rosalind_ini6.txt') as input_file: string=input_file.read().strip() dict_word=dict_words(string) for key, value in dict_word.items(): print(str(key)+' '+str(value)) with open('solutions/rosalind_ini6.txt', 'w') as output_file: for key, value in dict_word.items(): output_file.write(str(key)+' '+str(value)+'\n') if(__name__=='__main__'): main()
SORTIE_PREFIXE = "God save" def get_enfants(parent, liens_parente, morts): return [f for p, f in liens_parente if (p == parent) and (f not in morts)] def get_parent(fils, liens_parente): for p, f in liens_parente: if f == fils: return p def get_heritier(mec_mort, liens_parente, morts): enfants = get_enfants(mec_mort, liens_parente, morts) if len(enfants) > 0: if enfants[0] not in morts: return enfants[0] else: return get_heritier(enfants[0], liens_parente, morts) else: pere = get_parent(mec_mort, liens_parente) return get_heritier(pere, liens_parente, morts) def main(): mec_mort = input() N = int(input()) liens_parente = [input().split() for _ in range(N - 1)] D = int(input()) morts = [input() for _ in range(D)] print(SORTIE_PREFIXE, get_heritier(mec_mort, liens_parente, morts)) if __name__ == '__main__': main()
############################################### # # # Created by Youssef Sully # # Beginner python # # While Loops 3 # # # ############################################### # 1. in while loop we have to INITIALIZE the variable (iterator = 0) # 2. execute the below command until this statement is (iterator < 10) TRUE print("\n{} {} {}\n".format("-" * 9, "While loop", "-" * 9)) iterator = 0 while iterator < 10: print("{} ".format(iterator), end='') # means the new iterator = old iterator + 1 ---> the new value of the iterator is 1 # # also can be written as ---> iterator += 1 iterator = iterator + 1 print("\n") print("{} {} {}\n".format("-" * 9, "Using break", "-" * 9)) # break used to break out of the loop iterator = 0 while iterator < 10: if iterator == 4: print("Number 4 is reached the loop stopped due to break") break print("{} ".format(iterator), end='') iterator += 1 print("\n{} {} {}\n".format("-" * 9, "Infinite loop", "-" * 9)) # Infinite loop needs a BREAK condition otherwise is going to run forever! iterator = 0 while True: if iterator == 4: print("Number 4 is reached the loop stopped due to break") break print("{} ".format(iterator), end='') iterator += 1
""" Desenvolva um programa que leia o primeiro termo e a razão de uma PA. No final, mostre os 10 primeiros termos dessa progressão. """ ptermo = int(input('Digite o primeiro termo da PA: ')) razao = int(input('Digite a razão: ')) for c in range(ptermo, ptermo + (10 * razao), razao): print(c, end=' ')
class Solution: def findOcurrences(self, text: str, first: str, second: str) -> List[str]: text = text.split(' ') return [text[i] for i in range(2, len(text)) if text[i - 2] == first and text[i - 1] == second]
## Python INTRO for TD Users ## Kike Ramírez ## May, 2018 ## Understanding string variables concatenation ## CASE 1 ## Declare two string variables a = "Hola " b = "Barcelona!" ## Concatenate it using + operator print(a+b) ## CASE 2 ## BUT! Declare to number variables a = 99 b = 1.326584 ## Not concatenation, but sum!!! print(a+b) ## CASE 3 ## BUT! Declare a number and a string variable a = "Hola " b = 3 ## Convert to string and concatenate it using + operator print(a+str(b)) ## CASE 4 ## BUT! Declare a number and a string variable a = "0.33333333" b = 3 ## Convert to float and sum it using + operator print(float(a)+b) ## CASE 5 ## Convert to int and sum it using + operator print(int(float(a))+b) ## CASE ERROR ## BUT! Declare a number and a string variable a = "Hola " b = 3 ## It throws an ERROR in console print(a+b)
# Swap Pairs using Recursion ''' Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself may be changed. Example: Given 1->2->3->4, you should return the list as 2->1->4->3. ''' # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def swapPairs(self, head: ListNode) -> ListNode: if not head or not head.next: return head temp = head head = head.next temp.next = head.next head.next = temp head.next.next = self.swapPairs(head.next.next) return head
# coding=utf-8 class ListMetaclass(type): # 定义一个元类,类名默认以Metaclass结尾;元类是由“type”衍生而出,所以必须从type类型派生 def __new__(mcs, name, bases, attrs): # 自定义__new__()方法 attrs['add'] = lambda self, value: self.append(value) return super().__new__(mcs, name, bases, attrs) # 返回新创建的类 # return type.__new__(cls, name, bases, attrs) class MyList(list, metaclass=ListMetaclass): # 第一个参数是父类,第二个参数是metaclass指示使用元类来定制类 pass L = MyList() # 这里Python解释器在创建MyList时,实际通过ListMetaclass.__new__()来创建 L.add(123) # 普通的List类型没有add()方法 L.add(456) L.add(789) print(L) # ### 元类(metaclass) # 元类(metaclass)是用来动态创建类的可调用对象,先定义metaclass,然后根据metaclass创建类,最后根据类对象创建实例; # 简而言之,元类是类的模板,类是实例对象的模板;也就是说,元类创建类,调用类对象的__new__方法就可以创建出这个类的实例对象; # 一般情况下,使用类作为元类,通过使用元类,可以控制类的创建行为,自动地改变类; # 元类会隐式地继承到子类,即使没有显示地在子类使用“__metaclass__”; # # ### 特殊方法“__new__” # 元类的操作在特殊方法“__new__”中完成; # “__new__”用来创建对象并返回创建后的对象,在“__init__”之前被调用,参数解释如下: # - cls:将要创建的类; # - name:类的名字; # - bases:类的父类集合; # - attrs:类的属性和方法,是一个字典; # # ### 动态修改的意义 # 一般情况下不会使用动态修改,只适用于某些特殊的场景,能够极大地精简代码,例如编写ORM框架;
class BaseMixin(object): @property def blocks(self): return self.request.GET.getlist('hierarchy_block', []) @property def awcs(self): return self.request.GET.getlist('hierarchy_awc', []) @property def gp(self): return self.request.GET.getlist('hierarchy_gp', None) def _safeint(value): try: return int(value) except (ValueError, TypeError): return 0 def format_percent(x, y): y = _safeint(y) percent = (y or 0) * 100 / (x or 1) if percent < 33: color = 'red' elif 33 <= percent <= 67: color = 'orange' else: color = 'green' return "<span style='display: block; text-align:center; color:%s;'>%d<hr style='margin: 0;border-top: 0; border-color: black;'>%d%%</span>" % (color, y, percent) def normal_format(value): if not value: value = 0 return "<span style='display: block; text-align:center;'>%d<hr style='margin: 0;border-top: 0; border-color: black;'></span>" % value
n, k = input().strip().split(' ') n, k = int(n), int(k) imp_contests = 0 imp = [] nimp = [] for i in range(n): l, t = input().strip().split(' ') l, t = int(l), int(t) if t == 1: imp.append([l,t]) else: nimp.append([l,t]) imp.sort() ans = 0 ans_subtract = 0 for i in range(len(imp)-k): ans_subtract += imp[i][0] del imp[i] for i in range(len(imp)): ans += imp[i][0] for i in range(len(nimp)): ans += nimp[i][0] print(ans-ans_subtract)
def f(a): s = 0 for i in range(1,a): if a%i == 0: s+=i return "Perfect" if s==a else ("Abundant" if s > a else "Deficient") T = int(input()) L = list(map(int,input().split())) for i in L: print(f(i))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 13 19:35:17 2019 @author: abhijithneilabraham """ name='katran'
#!/usr/bin/python class Block(object): def __init__(self): print("Block") class Chain(object): def __init__(self): print("Chain") def main(): b = Block() c = Chain() if __name__ == "__main__": main()
class Config: DEBUG = True SQLALCHEMY_DATABASE_URI = "mysql+mysqldb://taewookim:1234@173.194.86.171:3306/roompi2_db" SQLALCHEMY_TRACK_MODIFICATION = True @classmethod def init_app(cls, app): # config setting for flask app instance app.config.from_object(cls) return app
""" Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the directory up a level, and any multiple consecutive slashes (i.e. '//') are treated as a single slash '/'. For this problem, any other format of periods such as '...' are treated as file/directory names. The canonical path should have the following format: The path starts with a single slash '/'. Any two directories are separated by a single slash '/'. The path does not end with a trailing '/'. The path only contains the directories on the path from the root directory to the target file or directory (i.e., no period '.' or double period '..') Return the simplified canonical path. Example 1: Input: path = "/home/" Output: "/home" Explanation: Note that there is no trailing slash after the last directory name. Example 2: Input: path = "/../" Output: "/" Explanation: Going one level up from the root directory is a no-op, as the root level is the highest level you can go. Example 3: Input: path = "/home//foo/" Output: "/home/foo" Explanation: In the canonical path, multiple consecutive slashes are replaced by a single one. Example 4: Input: path = "/a/./b/../../c/" Output: "/c" Constraints: 1 <= path.length <= 3000 path consists of English letters, digits, period '.', slash '/' or '_'. path is a valid absolute Unix path. """ # e.g. : # path = "/../a/b/c/./.. " # -- > output = "/a/b" # TRICK : # IF ".." , then stack pop # IF "." , then do nothing # ELSE , push to stack # STEP 1. "/" : root directory # STEP 2. ".." : to the upper directory, since it is blank, so still stay at root directory # STEP 3. "a" : to sub directory a, now at "/a" # STEP 4. "b" : to sub directory a, now at "/a/b" # STEP 5. "c" : to sub directory a, now at "/a/b/c" # STEP 6. "." : current directory, do nothing. still at "/a/b/c" # STEP 7. ".." : back to the upper directory, stay at "/a/b" finally # V0 class Solution(object): def simplifyPath(self, path): stack = [] dirs = path.split('/') for dir in dirs: if not dir or dir == '.': continue if dir == '..': if stack: stack.pop() else: stack.append(dir) return '/' + '/'.join(stack) # V0' class Solution(object): def simplifyPath(self, path): s_final = [] # note this trick _path = path.split("/") for p in _path: if p == "." or p == "": ## NOTE : use continue here # the continue will SKIP REST OF THE CODE IN THE LOOP # https://www.programiz.com/python-programming/break-continue continue elif p == "..": if s_final: # attay has this method s_final.pop() else: s_final.append(p) return "/" + "/".join(s_final) # V1 # https://blog.csdn.net/fuxuemingzhu/article/details/80812350 # https://www.cnblogs.com/zuoyuan/p/3777289.html # IDEA : SIMULATE THE PROCESS class Solution(object): def simplifyPath(self, path): """ :type path: str :rtype: str """ stack = list() dirs = path.split('/') for dir in dirs: if not dir or dir == '.': continue if dir == '..': if stack: stack.pop() else: stack.append(dir) return '/' + '/'.join(stack) # output : # In [54]: Solution().simplifyPath(path) # ...: # token : # stack : [] # token : a # stack : ['a'] # token : . # stack : ['a'] # token : b # stack : ['a', 'b'] # token : .. # stack : ['a'] # token : .. # stack : [] # token : c # stack : ['c'] # token : # stack : ['c'] # Out[54]: '/c' # V2 # Time: O(n) # Space: O(n) class Solution(object): # @param path, a string # @return a string def simplifyPath(self, path): stack, tokens = [], path.split("/") for token in tokens: if token == ".." and stack: stack.pop() elif token != ".." and token != "." and token: stack.append(token) return "/" + "/".join(stack)
# -*- coding: utf-8 -*- # segundo link: dobro do terceiro # segundo link: metade do primeiro clicks_on_3 = int(input()) clicks_on_2 = clicks_on_3 * 2 clicks_on_1 = clicks_on_2 * 2 print(clicks_on_1)
#Coded by Ribhu Sengupta. def solveKnightMove(board, n, move_no, currRow, currCol): #solveKnightMove(board, dimesion of board, Moves_already_done, currRoe, currCol) if move_no == n*n: #Lets say n=8, if no of moves knight covered 64 then it will stop further recursion. return True rowDir = [+2, +1, -1, -2, -2, -1, +2, +2] #x or Row Co-ordinates where knight can be placed in respective to its current co-ordinate. colDir = [+1, +2, +2, +1, -1, -2, -2, -1] #y or Column Co-ordinates where knight can be placed in respective to its current co-ordinate. for index in range(0, len(rowDir)): #Loop among row and column coordinates nextRow = currRow + rowDir[index] nextCol = currCol + colDir[index] if canPlace(board, n, nextRow, nextCol) is True: #checking weather next move is valid and not covered till yet. board[nextRow][nextCol] = move_no+1 isSuccessfull = solveKnightMove(board, n, move_no+1, nextRow, nextCol) # can predict that the next valid move could cover all the cells of chess board or not. if isSuccessfull is True: return True board[nextRow][nextCol] = 0 return False def canPlace(board, n, row, col): # Can Check the next moves of knight if row>=0 and row<n and col>=0 and col<n: if board[row][col] == 0: return True return False return False def printBoard(board, n): #printing the board. for index1 in range(0, n): for index2 in range(0, n): print(board[index1][index2]) print('\n') n = int(input("Enter a Dimension of board: ")) #creation of chess Board board = [[]] for index in range(0, n): for index2 in range(0, n): board[index].append(0) board.append([]) board.pop(index+1) # end of creation of chess board board[0][0] = 1 ans = solveKnightMove(board, n, 1, 0, 0) #solveKnightMove(board, dimesion, Moves_already_done, currRoe, currCol) if ans is True: printBoard(board, n) print(board) else: print("Not able to solve the board.")
# https://leetcode.com/problems/jewels-and-stones/description/ # input: J = "aA" | S = "aAAbbbb" # output: 3 # input: J = "z", S = "ZZ" # output: 0 # Solution: O(N^2) def num_jewels_in_stones(J, S): jewels = 0 for j in J: for s in S: if s == j: jewels += 1 return jewels print(num_jewels_in_stones("aA", "aAAbbbb")) print(num_jewels_in_stones("z", "ZZ")) # Solution: O(N) def num_jewels_in_stones_opt(J, S): number_by_chars = {} counter = 0 for char in J: if char in number_by_chars: number_by_chars[char] += 1 else: number_by_chars[char] = 1 for char in S: if char in number_by_chars: counter += number_by_chars[char] return counter print(num_jewels_in_stones_opt("aA", "aAAbbbb")) print(num_jewels_in_stones_opt("z", "ZZ"))
def writeList(l,name): wptr = open(name,"w") wptr.write("%d\n" % len(l)) for i in l: wptr.write("%d\n" % i) wptr.close()
# DEFAULT ROUTE ROUTE_SANDBOX = 'https://sandbox.boletobancario.com/api-integration' ROUTE_SANDBOX_AUTORIZATION_SERVER = "https://sandbox.boletobancario.com/authorization-server/oauth/token" ROUTE_PRODUCAO = 'https://api.juno.com.br' ROUTE_PRODUCAO_AUTORIZATION_SERVER = "https://api.juno.com.br/authorization-server/oauth/token"
user_input = input("Enter maximum number: ") number = int(user_input) spaces_amount = number // 2 f = open("my_tree.txt", "w") while (spaces_amount >= 0): if (spaces_amount*2 == number): spaces_amount -= 1 continue for j in range(spaces_amount): f.write(" ") # print(" ", sep="", end="") for j in range((number - (spaces_amount * 2))): f.write("*") # print("*", sep="", end="") spaces_amount -= 1 f.write("\n") # print() f.close()
# Copyright (c) 2020. JetBrains s.r.o. # Use of this source code is governed by the MIT license that can be found in the LICENSE file. # from .corr import * # from .im import * # __all__ = (im.__all__ + # corr.__all__) # 'bistro' packages must be imported explicitly. __all__ = []
"""This class is a *very basic* way of building and manipulating CNF formulas and helps to output them in the DIMACS-format. This file is part of the concealSATgen project. Copyright (c) 2021 Jan-Hendrik Lorenz and Florian Wörz Institute of Theoretical Computer Science Ulm University, Germany """ class CNF(object): def __init__(self, n): # Initial the CNF is empty self.clauses = [] self.n = n self.header = "Default header" # # Implementation of class methods # def __len__(self): """Number of clauses in the formula """ return len(self.clauses) # # Methods for building the CNF # def add_clause(self, clause): """Adds a clause to the CNF object. """ if not hasattr(clause, '__iter__'): raise TypeError("Invalid clause. A clauses must be iterable.") if not all((type(lit) is int) and (type(truth) is bool) for (truth, lit) in clause): raise TypeError("All literals have to be integers.") if any((lit > self.n) or (lit == 0) for (_, lit) in clause): raise ValueError(f"Invalid clause. The clause may only contain positive/negative integers up to {self.n}/{-self.n}.") if len( set( [lit for (_, lit) in clause] ) ) != len(clause): raise ValueError("This class does not accept tautological clauses or clauses with reappearing literals.") clause_list = [lit if truth else -lit for (truth, lit) in clause] self.clauses.append(clause_list) def dimacs(self): """Converts the CNF file to the DIMACS format. """ output = "" # Write header for header_line in self.header.split("\n"): output += "c " + header_line + "\n" # Write formula specification output += f"p cnf {self.n} {len(self.clauses)}\n" # Write clauses for cls in self.clauses: clause_string = ' '.join([str(lit) for lit in cls]) clause_string += " 0\n" output += clause_string return output
if __name__ == "__main__": net_amount=0 while(True): person = input("Enter the amount that you want to Deposit/Withdral ? ") transaction = person.split(" ") type = transaction[0] amount =int( transaction[1]) if type =="D" or type =='d': net_amount += amount print("Your Net_amount is :-",net_amount) elif type == 'W' or 'w': net_amount -= amount if net_amount>0: print("Your Net_amount is :-",net_amount) else: print("Insufficient Balance!!!!!!!") else: pass ext = input("Want to Continue (Y for yes and N for no)") if not (ext=='Y' or ext=='y'): break
# Put the token you got from https://discord.com/developers/applications/ here token = 'x' # Choose the prefix you'd like for your bot prefix = "?" # Copy your user id on Discord to set you as the owner of this bot myid = 0 # Change None to the id of your logschannel (if you want one) logschannelid = None # Change 0 to your server's id (if you have one) myserverid = 0
# course = "Python's course for Beginners" # print(course[0]) # print(course[-1]) # print(course[-2]) # print(course[0:3]) # print(course[0:]) # print(course[1:]) # print(course[:5]) # print(course[:]) # copy string # # another = course[:] # print(another) ####################################### # first_name = 'Jennifer' # print(first_name[1:-1]) ####################################### # Formatted Strings # first = 'john' # last = 'Smith' # john [smith] is a coder # message = first + ' [' + last + '] ' + 'is a coder' # # print(message) # # msg = f'{first} [{last}] is a coder' # # print(msg) ####################################### # string Methods course = "Python's course for Beginners" # print(len(course)) # count number of chars # print(course.upper()) # print(course.lower()) print(course.find('p')) # prints -1 means not exist print(course.find('P')) print(course.find('o')) print(course.find('Beginners')) print(course.replace('Beginners', 'Absolute Beginners')) print('Python' in course) print(course.title()) # to capitalize the first letter of every word
class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' # default load test intervals, in milliseconds INTERVAL_DEFAULT = 200 # load test speed, txs per second TXS_PER_SEC_NORMAL = 100 TXS_PER_SEC_SLOW = 10 # broadcast mode TxCommit = 1 TxSync = 2 TxAsync = 3
# -*- coding: utf-8 -*- # @Time : 2020/1/23 13:38 # @Author : jwh5566 # @Email : jwh5566@aliyun.com # @File : if_example.py def check_if(): a = int(input("Enter a number \n")) if (a == 100): print("a is equal 100") else: print("a is not equal 100") return a
amount_of_dancers = int(input()) amount_of_points = float(input()) season = input() place = input() money_left = 0 charity = 0 dancers_point_won = amount_of_dancers * amount_of_points dancers_point_won_aboard = dancers_point_won + (dancers_point_won * 0.50) money_per_dancer = 0 if place == "Bulgaria": if season == "summer": dancers_point_won = dancers_point_won - (dancers_point_won * 0.05) charity = dancers_point_won * 0.75 money_left = dancers_point_won - charity elif season == "winter": dancers_point_won = dancers_point_won - (dancers_point_won * 0.08) charity = dancers_point_won * 0.75 money_left = dancers_point_won - charity if place == "Abroad": if season == "summer": dancers_point_won_aboard = dancers_point_won_aboard - (dancers_point_won_aboard * 0.10) charity = dancers_point_won_aboard * 0.75 money_left = dancers_point_won_aboard - charity elif season == "winter": dancers_point_won_aboard = dancers_point_won_aboard - (dancers_point_won_aboard * 0.15) charity = dancers_point_won_aboard * 0.75 money_left = dancers_point_won_aboard - charity money_per_dancer = money_left / amount_of_dancers print(f"Charity - {charity:.2f} ") print(f"Money per dancer - {money_per_dancer:.2f}")
nome = input("Qual seu nome: ") idade = int(input("Qual sua idade: ")) altura = float(input("Qual sua altura: ")) peso = float(input("Qual seu peso: ")) op= int(input("Estado civil:\n1.Casado\n2.Solteiro\n")) if op==1: op = True else: op = False eu = [nome, idade, altura, peso, op] for c in eu: print(c, "\n")
#Example: grocery = 'Milk\nChicken\r\nBread\rButter' print(grocery.splitlines()) print(grocery.splitlines(True)) grocery = 'Milk Chicken Bread Butter' print(grocery.splitlines())
class Document: # general info about document class Info: def __init__(self): self.author = "unknown" self.producer = "unknown" self.subject = "unknown" self.title = "unknown" self.table_of_contents = [] def __init__(self, path: str, is_pdf: bool): self.is_pdf = is_pdf self.info = Document.Info() self.path = path self.ocr_path = path self.num_pages = None self.images = [] self.tables = [] self.paragraphs = [] self.extractable = False self.filename = None def document_info_to_string(self): return "Author: " + self.info.author + "\n" \ + "Producer: " + self.info.producer + "\n" \ + "Subject: " + self.info.subject + "\n" \ + "Title: " + self.info.title + "\n" \ + "Number of Pages: " + str(self.num_pages) def table_of_contents_to_string(self): output_string = "" for tup in self.info.table_of_contents: output_string += str(tup[0]) + ': ' + tup[1] + '\n' return output_string
class Solution: def removeElement(self, nums: [int], val: int) -> int: i = 0 j = len(nums) while i < j: if nums[i] == val: nums[i] = nums[j - 1] j -= 1 else: i += 1 return i
class Solution: def findItinerary(self, tickets: List[List[str]]) -> List[str]: def dfs(graph, u, res): while(len(graph[u])): dfs(graph, graph[u].pop(), res) res.append(u) graph = defaultdict(list) res = [] for ticket in tickets: graph[ticket[0]].append(ticket[1]) for k in graph: graph[k].sort(reverse=True) u = "JFK" dfs(graph, u, res) res.reverse() return res
SKULLTAG_FREQS = [ 0.14473691, 0.01147017, 0.00167522, 0.03831121, 0.00356579, 0.03811315, 0.00178254, 0.00199644, 0.00183511, 0.00225716, 0.00211240, 0.00308829, 0.00172852, 0.00186608, 0.00215921, 0.00168891, 0.00168603, 0.00218586, 0.00284414, 0.00161833, 0.00196043, 0.00151029, 0.00173932, 0.00218370, 0.00934121, 0.00220530, 0.00381211, 0.00185456, 0.00194675, 0.00161977, 0.00186680, 0.00182071, 0.06421956, 0.00537786, 0.00514019, 0.00487155, 0.00493925, 0.00503143, 0.00514019, 0.00453520, 0.00454241, 0.00485642, 0.00422407, 0.00593387, 0.00458130, 0.00343687, 0.00342823, 0.00531592, 0.00324890, 0.00333388, 0.00308613, 0.00293776, 0.00258918, 0.00259278, 0.00377105, 0.00267488, 0.00227516, 0.00415997, 0.00248763, 0.00301555, 0.00220962, 0.00206990, 0.00270369, 0.00231694, 0.00273826, 0.00450928, 0.00384380, 0.00504728, 0.00221251, 0.00376961, 0.00232990, 0.00312574, 0.00291688, 0.00280236, 0.00252436, 0.00229461, 0.00294353, 0.00241201, 0.00366590, 0.00199860, 0.00257838, 0.00225860, 0.00260646, 0.00187256, 0.00266552, 0.00242641, 0.00219450, 0.00192082, 0.00182071, 0.02185930, 0.00157439, 0.00164353, 0.00161401, 0.00187544, 0.00186248, 0.03338637, 0.00186968, 0.00172132, 0.00148509, 0.00177749, 0.00144620, 0.00192442, 0.00169683, 0.00209439, 0.00209439, 0.00259062, 0.00194531, 0.00182359, 0.00159096, 0.00145196, 0.00128199, 0.00158376, 0.00171412, 0.00243433, 0.00345704, 0.00156359, 0.00145700, 0.00157007, 0.00232342, 0.00154198, 0.00140730, 0.00288807, 0.00152830, 0.00151246, 0.00250203, 0.00224420, 0.00161761, 0.00714383, 0.08188576, 0.00802537, 0.00119484, 0.00123805, 0.05632671, 0.00305156, 0.00105584, 0.00105368, 0.00099246, 0.00090459, 0.00109473, 0.00115379, 0.00261223, 0.00105656, 0.00124381, 0.00100326, 0.00127550, 0.00089739, 0.00162481, 0.00100830, 0.00097229, 0.00078864, 0.00107240, 0.00084409, 0.00265760, 0.00116891, 0.00073102, 0.00075695, 0.00093916, 0.00106880, 0.00086786, 0.00185600, 0.00608367, 0.00133600, 0.00075695, 0.00122077, 0.00566955, 0.00108249, 0.00259638, 0.00077063, 0.00166586, 0.00090387, 0.00087074, 0.00084914, 0.00130935, 0.00162409, 0.00085922, 0.00093340, 0.00093844, 0.00087722, 0.00108249, 0.00098598, 0.00095933, 0.00427593, 0.00496661, 0.00102775, 0.00159312, 0.00118404, 0.00114947, 0.00104936, 0.00154342, 0.00140082, 0.00115883, 0.00110769, 0.00161112, 0.00169107, 0.00107816, 0.00142747, 0.00279804, 0.00085922, 0.00116315, 0.00119484, 0.00128559, 0.00146204, 0.00130215, 0.00101551, 0.00091756, 0.00161184, 0.00236375, 0.00131872, 0.00214120, 0.00088875, 0.00138570, 0.00211960, 0.00094060, 0.00088083, 0.00094564, 0.00090243, 0.00106160, 0.00088659, 0.00114514, 0.00095861, 0.00108753, 0.00124165, 0.00427016, 0.00159384, 0.00170547, 0.00104431, 0.00091395, 0.00095789, 0.00134681, 0.00095213, 0.00105944, 0.00094132, 0.00141883, 0.00102127, 0.00101911, 0.00082105, 0.00158448, 0.00102631, 0.00087938, 0.00139290, 0.00114658, 0.00095501, 0.00161329, 0.00126542, 0.00113218, 0.00123661, 0.00101695, 0.00112930, 0.00317976, 0.00085346, 0.00101190, 0.00189849, 0.00105728, 0.00186824, 0.00092908, 0.00160896, ] class HuffmanObject(object): def __init__(self, freqs): self.huffman_freqs = freqs self.huffman_tree = [] self.huffman_table = [None] * 256 self.__build_binary_tree() self.__binary_tree_to_lookup_table(self.huffman_tree) def __build_binary_tree(self): """ Create the huffman tree from frequency list found in the current object. """ # Create starting leaves for i in range(256): self.huffman_tree.append({ 'frq': self.huffman_freqs[i], 'asc': i, }) # Pair leaves and branches based on frequency until there is a # single root for i in range(255): lowest_key1 = -1 lowest_key2 = -1 lowest_frq1 = 1e30 lowest_frq2 = 1e30 # Find two lowest frequencies for j in range(256): if not self.huffman_tree[j]: continue if self.huffman_tree[j]['frq'] < lowest_frq1: lowest_key2 = lowest_key1 lowest_frq2 = lowest_frq1 lowest_key1 = j lowest_frq1 = self.huffman_tree[j]['frq'] elif self.huffman_tree[j]['frq'] < lowest_frq2: lowest_key2 = j lowest_frq2 = self.huffman_tree[j]['frq'] # Join the two together under a new branch self.huffman_tree[lowest_key1] = { 'frq': lowest_frq1 + lowest_frq2, '0': self.huffman_tree[lowest_key2], '1': self.huffman_tree[lowest_key1], } self.huffman_tree[lowest_key2] = None # Make the root the list self.huffman_tree = self.huffman_tree[lowest_key1] def __binary_tree_to_lookup_table(self, branch, binary_path = ''): """ Recursively create the lookup table used to encode a message. """ # Go through a branch finding leaves while tracking the path taken if '0' in branch: self.__binary_tree_to_lookup_table(branch['0'], binary_path + '0') self.__binary_tree_to_lookup_table(branch['1'], binary_path + '1') else: self.huffman_table[branch['asc']] = binary_path def encode(self, data_string): """ Encode a string into a huffman-coded string. """ if type(data_string) is not bytes: raise ValueError('Must pass bytes to encode') binary_string = '' # Match ASCII to entries in the lookup table for byte in data_string: binary_string += self.huffman_table[byte] # Convert binary string into ASCII encoded_string = b''; for i in range(0, len(binary_string), 8): binary = binary_string[i:i+8] encoded_string += bytes([int(binary[::-1], 2)]) # If the huffman-coded string is longer than the original # string, return the original string instead. Putting an # ASCII value 0xff where the padding bit should be signals to # the decoder that the message is not encoded. if len(data_string) <= len(encoded_string): return b'\xff' + data_string # In the first byte, store the number of padding bits padding_value = (8 - (len(binary_string) % 8)) % 8 encoded_string = bytes([padding_value]) + encoded_string return encoded_string def decode(self, data_string): """ Decode a huffman-coded string into a string. """ if type(data_string) is not bytes: raise ValueError('Must pass bytes to decode') # Obtain and remove the number of padding bits stored in the # first byte. padding_length = data_string[0] data_string = data_string[1:] # If the padding bit is set to 0xff the message is not encoded. if padding_length == 0xff: return data_string # Convert ascii string into binary string binary_string = '' for byte in data_string: binary_string += '{0:08b}'.format(byte)[::-1] # Remove padding bits from the end binary_string = binary_string[:len(binary_string) - padding_length] # Match binary to entries in the huffman tree decoded_string = b''; tree_node = self.huffman_tree for bit in binary_string: if bit in tree_node: tree_node = tree_node[bit] else: decoded_string += bytes([tree_node['asc']]) tree_node = self.huffman_tree[bit] decoded_string += bytes([tree_node['asc']]) return decoded_string
''' Description: X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone. A number is valid if each digit remains a digit after rotation. 0, 1, and 8 rotate to themselves; 2 and 5 rotate to each other; 6 and 9 rotate to each other, and the rest of the numbers do not rotate to any other number and become invalid. Now given a positive number N, how many numbers X from 1 to N are good? Example: Input: 10 Output: 4 Explanation: There are four good numbers in the range [1, 10] : 2, 5, 6, 9. Note that 1 and 10 are not good numbers, since they remain unchanged after rotating. Note: N will be in range [1, 10000]. ''' class Solution: def rotatedDigits(self, N: int) -> int: counter = 0 for i in range(1, N+1): # convert number i to digit character array str_num_list = list( str(i) ) # flag for good number judgement is_good_number = False for digit in str_num_list: if digit in {'3','4','7'}: # invalid number after rotation is_good_number = False break elif digit in {'2','5','6','9'}: is_good_number = True if is_good_number: # update conter for good number counter += 1 return counter # n : input value of N ## Time Complexity: O( n log n ) # # The overhead in time is the outer for loop and inner for loop. # The outer for loop, iterating on i, takes O( n ) # The inner for loop, iterating on digit, takes O( log n ) # It takes O( n log n ) in total ## Space Complexity: O( log n ) # # The overhead in space is the storage for buffer, str_num_list, which is of O( log n ) def test_bench(): test_data = [10,20,30,50,100] # expected output: ''' 4 9 15 16 40 ''' for n in test_data: print( Solution().rotatedDigits(n) ) return if __name__ == '__main__': test_bench()
# Python - 2.7.6 Test.describe('Basic tests') Test.assert_equals(logical_calc([True, False], 'AND'), False) Test.assert_equals(logical_calc([True, False], 'OR'), True) Test.assert_equals(logical_calc([True, False], 'XOR'), True) Test.assert_equals(logical_calc([True, True, False], 'AND'), False) Test.assert_equals(logical_calc([True, True, False], 'OR'), True) Test.assert_equals(logical_calc([True, True, False], 'XOR'), False)
# -*- coding: utf-8 -*- class INITIALIZE(object): def __init__(self, ALPHANUMERIC=' ', NUMERIC=0): self.alphanumeric = ALPHANUMERIC self.numeric = NUMERIC def __call__(self, obj): self.initialize(obj) def initialize(self, obj): if isinstance(obj, dict): for k, v in obj.items(): if isinstance(v, dict): self.initialize(obj[k]) elif isinstance(v, list): for l in v: self.initialize(l) elif k.startswith('FILLER'): continue elif isinstance(v, str): obj[k] = self.alphanumeric elif isinstance(v, int): obj[k] = self.numeric elif isinstance(v, float): obj[k] = float(self.numeric) elif isinstance(obj, list): for l in obj: self.initialize(l)
class User: userdetail = ["layersony","Samuel", "Maingi", "0796727706", "sm@gmail.com", "123456", '123456'] """ class for register user have to firstname, lastname, phonenumber, email, password, confirm password """ def __init__(self, username ,first_name, last_name, phone_number, email, password, con_pass): ''' initialize the class user when called ''' self.username = username self.first_name = first_name self.last_name = last_name self.phone_number = phone_number self.email = email self.password = password self.con_pass = con_pass @classmethod def checkUserExist(cls, usrname, password): ''' this method checks the username and password provided by user input if it exists in the file or not ''' with open("userlocker.txt", "r") as handle: data = handle.read() fulldata = data.split("|") if usrname == fulldata[0] and password == fulldata[-1]: return True else: return False def saveUser(inputtype, mood): ''' method to save data that is provide by user during registration ''' with open("userlocker.txt", mood) as handle: handle.write(inputtype)
#!/usr/bin/env python # Created by Bruce yuan on 18-1-31. # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def isPalindrome(self, head): """ 这题我想不到怎么 O(1) space :type head: ListNode :rtype: bool """ current = head count = 0 while current: count += 1 current = current.next if count == 1: return True # 把她重新用作中位数 count = count // 2 if count % 2 == 0 else count // 2 + 1 current = head for _ in range(count): current = current.next # 123 4 321 0 0 current = self.reverse_list(current) # print(current.val) # print(head.val) while current and head: # print('test test') if current.val != head.val: return False current = current.next head = head.next # print(current) # print(head) return True @staticmethod def reverse_list(head): pre = None # 这就是头插法,竟然都忘记了。简直了 while head: next_ = head.next head.next = pre pre = head head = next_ return pre def main(): head = ListNode(0) next_ = ListNode(0) head.next = next_ solution = Solution() result = solution.isPalindrome(head) print(result) if __name__ == '__main__': main()
class Config: SECRET_KEY = 'hard to guess string' SQLALCHEMY_COMMIT_ON_TEARDOWN = True MAIL_SERVER = 'smtp.qq.com' MAIL_PORT = 465 MAIL_USE_TLS = False MAIL_USE_SSL = True MAIL_USERNAME = '536700549@qq.com' MAIL_PASSWORD = 'mystery123.' FLASKY_MAIL_SUBJECT_PREFIX = '[Flasky]' FLASKY_MAIL_SENDER = '536700549@qq.com' FLASKY_ADMIN = '536700549@qq.com' FLASKY_POSTS_PER_PAGE = 20 FLASKY_FOLLOWERS_PER_PAGE = 50 FLASKY_COMMENTS_PER_PAGE = 30 @staticmethod def init_app(app): pass class DevelopmentConfig(Config): DEBUG = True SQLALCHEMY_DATABASE_URI = 'mysql://root:root@localhost/finaldev' class TestingConfig(Config): TESTING = True SQLALCHEMY_DATABASE_URI = 'mysql://root:root@localhost/finaltest' class ProductionConfig(Config): SQLALCHEMY_DATABASE_URI = 'mysql://root:root@localhost/finalpro' config = { 'development': DevelopmentConfig, 'testing': TestingConfig, 'production': ProductionConfig, 'default': DevelopmentConfig }
""" This script learns about escape characters. Even more practice on the document string """ SPLIT_STRING = "This string has been \nsplit over\nseveral\nlines" print(SPLIT_STRING) TABBED_STRING = "1\t2\t3\t4\t5" print(TABBED_STRING) print('The pet shop owner said "No, no, \'e\'s uh,...he\'s resting".') # or print("The pet shop owner said \"No, no, 'e's uh,...he's resting\".") print("""The pet shop owner said "No, no, \ 'e's uh,...he's resting". """) ANOTHER_SPLIT_STRING = """This string has been \ split over \ several \ lines""" print(ANOTHER_SPLIT_STRING) print("C:\\Users\\tjgyy\\notes.txt") print(r"C:\Users\jgyy\notes.txt")
numeros = [1,3,6,9] while True: numero = int( input("Escribe un número del 0 al 9: ")) if numero >= 0 and numero <= 9: break if numero in numeros: print("El número", numero, "se encuentra en la lista", numeros) else: print("El número", numero, "no se encuentra en la lista", numeros)
n = int(input()) lst = [float('inf') for _ in range(n+1)] lst[1] = 0 for i in range(1,n): if 3*i<=n:lst[3*i]=min(lst[3*i],lst[i]+1) if 2*i<=n:lst[2*i]=min(lst[2*i],lst[i]+1) lst[i+1]=min(lst[i+1],lst[i]+1) print(lst[n])
Till=int(input("Enter the upper limit\n")) From=int(input("Enter the lower limit\n")) i=1 print("\n") while(From<=Till): if((From%4==0)and(From%100!=0))or(From%400==0): print(From) From+=1 input()
class BaseKeyMap(): """docstring for BaseKeyMap.""" def __init__(self, arg): self.arg = arg
class Square: piece = None promoting = False def __init__(self, promoting=False): self.promoting = promoting def set_piece(self, piece): self.piece = piece def remove_piece(self): self.piece = None def get_piece(self): return self.piece def is_empty(self): return self.piece is None def is_promoting(self): return self.promoting def to_string(self): return self.piece.to_string() if self.piece is not None else ' '
# -*- coding: utf-8 -*- # @Time : 2022/2/14 13:50 # @Author : ZhaoXiangPeng # @File : __init__.py class Monitor: def update(self): pass
print("Welcome to the tip calculator!!") total_bill = float(input("What was the total bill? ")) percent = int(input("What percentage tip you would like to give: 10%, 12%, or 15%? ")) people = int(input("How many people to split the bill? ")) pay = round((total_bill/people) + ((total_bill*percent)/100)/people,2) print(f"Each person should pay {pay}")
''' Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: 21 22 23 24 25 20 7 8 9 10 19 6 1 2 11 18 5 4 3 12 17 16 15 14 13 It can be verified that the sum of the numbers on the diagonals is 101. What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way? ''' def spiral_diagonal_sum(n): _sum = 0 for side in range(1, n-1, 2): step = (side+2) - 1 _sum += sum(range(side**2, (side+2)**2, step)) return _sum + n**2 spiral_diagonal_sum(1001)
__version__ = "0.19.2" # NOQA if __name__ == "__main__": print(__version__)
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'depot_tools/bot_update', 'depot_tools/gclient', 'depot_tools/infra_paths', 'infra_checkout', 'recipe_engine/buildbucket', 'recipe_engine/json', 'recipe_engine/path', 'recipe_engine/platform', 'recipe_engine/properties', 'recipe_engine/python', 'recipe_engine/step', ] def RunSteps(api): patch_root = 'infra-data-master-manager' co = api.infra_checkout.checkout( gclient_config_name='infradata_master_manager', patch_root=patch_root, internal=True) co.gclient_runhooks() api.python('master manager configuration test', co.path.join('infra', 'run.py'), ['infra.services.master_manager_launcher', '--verify', '--ts-mon-endpoint=none', '--json-file', co.path.join( 'infra-data-master-manager', 'desired_master_state.json')]) def GenTests(api): yield ( api.test('master_manager_config') + api.buildbucket.ci_build( project='infra', builder='infradata_config', git_repo=( 'https://chrome-internal.googlesource.com/' 'infradata/master-manager'))) yield ( api.test('master_manager_config_patch') + api.buildbucket.try_build( project='infra', builder='infradata_config', git_repo=( 'https://chrome-internal.googlesource.com/' 'infradata/master-manager')))
input_image = itk.imread('data/BrainProtonDensitySlice.png', itk.ctype('unsigned char')) isolated_connected = itk.IsolatedConnectedImageFilter.New(input_image) isolated_connected.SetSeed1([98, 112]) isolated_connected.SetSeed2([98, 136]) isolated_connected.SetUpperValueLimit( 245 ) isolated_connected.FindUpperThresholdOff(); isolated_connected.Update() view(isolated_connected)
number=0 list1=[] wnumber=0 lnumber=0 while number<7: winnumber=input().upper() number+=1 list1.append(winnumber) for i in list1: if 'W' == i: wnumber+=1 else: lnumber+=1 if wnumber>=5: print('1') elif wnumber<=4 and wnumber>=3: print('2') elif wnumber<=2 and wnumber>=1: print('3') else: print('-1')
#!/usr/bin/env python3 steps = 316 circ_buffer = [0] pos = 0 num = 0 for cnt in range(1, 50000001): pos = (pos + steps) % cnt if pos == 0: num = cnt pos += 1 print(num)
# 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 writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. class DbColumn: def __init__(self, name: str, type: str, description: str = None, ordinal_position: int = None): self.name = name self.type = type self.description = description self.ordinal_position = ordinal_position def __eq__(self, other): return self.name == other.name and \ self.type == other.type and \ self.description == other.description and \ self.ordinal_position == other.ordinal_position def __repr__(self): return f"DbColumn({self.name!r},{self.type!r}, \ {self.description!r},{self.ordinal_position!r})" class DbTableName: def __init__(self, value: str): parts = value.strip().split('.') if len(parts) > 3: raise ValueError( f"Expected 'database.schema.table', found '{value}'." ) self.database = self._get_database(parts) self.schema = self._get_schema(parts) self.name = self._get_table(parts) self.qualified_name = self._get_qualified_name() def has_database(self) -> bool: return self.database is not None def has_schema(self) -> bool: return self.schema is not None def _get_database(self, parts) -> str: # {database.schema.table} return parts[0] if len(parts) == 3 else None def _get_schema(self, parts) -> str: # {database.schema.table) or {schema.table} return parts[1] if len(parts) == 3 else ( parts[0] if len(parts) == 2 else None ) def _get_table(self, parts) -> str: # {database.schema.table} or {schema.table} or {table} return parts[2] if len(parts) == 3 else ( parts[1] if len(parts) == 2 else parts[0] ) def _get_qualified_name(self) -> str: return ( f"{self.database}.{self.schema}.{self.name}" if self.has_database() else ( f"{self.schema}.{self.name}" if self.has_schema() else None ) ) def __eq__(self, other): return self.database == other.database and \ self.schema == other.schema and \ self.name == other.name and \ self.qualified_name == other.qualified_name def __repr__(self): # Return the string representation of the instance return ( f"DbTableName({self.database!r},{self.schema!r}," f"{self.name!r},{self.qualified_name!r})" ) def __str__(self): # Return the fully qualified table name as the string representation # of this object, otherwise the table name only return ( self.qualified_name if (self.has_database() or self.has_schema()) else self.name ) class DbTableSchema: def __init__(self, schema_name: str, table_name: DbTableName, columns: [DbColumn]): self.schema_name = schema_name self.table_name = table_name self.columns = columns def __eq__(self, other): return self.schema_name == other.schema_name and \ self.table_name == other.table_name and \ self.columns == other.columns def __repr__(self): return f"DbTableSchema({self.schema_name!r},{self.table_name!r}, \ {self.columns!r})"
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Sum of Odd Numbers #Problem level: 7 kyu def row_sum_odd_numbers(n): return n**3
# # @lc app=leetcode id=854 lang=python3 # # [854] K-Similar Strings # # @lc code=start class Solution: ''' 思路: 1. 此题最开始我想用DFS来实现,问题在于不一定能保证最短路径,超时 2. 使用BFS+MEMO来实现,通过记录看到过的替换字符串,避免重复计算 3. 在进行替换的时候只需要找到第一个不同的字符,同时找到后续所有满足j位置上不直接和Bj相等的元素生成替换字符串 4. 见到B被生成出来,即刻返回答案 5. BFS保证路径最短 其难度在于寻找BFS过程中新的state的生成模式,需要思考 ''' def kSimilarity(self, A: str, B: str) -> int: if A == B: return 0 res = 0 q = collections.deque([A]) seen = set([A]) while q: res += 1 new_q = collections.deque() while q: s = q.popleft() i = 0 while s[i] == B[i]: i+=1 for j in range(i+1, len(B)): if s[j] == B[j] or B[i] != s[j]: continue new_s = s[:i]+s[j]+s[i+1:j]+s[i]+s[j+1:] if new_s not in seen: seen.add(new_s) new_q.append(new_s) if new_s == B: return res q = new_q return res # @lc code=end
class Solution: def XXX(self, nums: List[int]) -> None: rgb = [0, 0, 0] for i in nums: rgb[i] += 1 nums[:rgb[0]] = [0 for _ in range(rgb[0])] nums[rgb[0]:rgb[0] + rgb[1]] = [1 for _ in range(rgb[1])] nums[rgb[0] + rgb[1]:] = [2 for _ in range(rgb[2])]
new_occupations = [ {'occupation': 'Språkstödjare', 'concept_id': '6gi1_3Ss_E8c'}, {'occupation': 'Elkraftingenjör', 'concept_id': '7Yn2_NLJ_oa2'}, {'occupation': 'Special Effects Artist/SFX Artist', 'concept_id': 'YBxu_4hV_dNB'}, {'occupation': 'Forskare, agronomi', 'concept_id': 'aeJj_czs_5Tq'}, {'occupation': 'Dataregistrerare/Registrerare', 'concept_id': 'jqVE_Ux3_VMN'}, {'occupation': 'Campingvärd', 'concept_id': 'RC1C_apS_oGB'}, {'occupation': 'Kontrollanläggningstekniker', 'concept_id': 'iXyv_E2W_cqc'}, {'occupation': 'Forskare, ekonomi', 'concept_id': 'syYF_66W_KyY'}, {'occupation': 'PKC-operatör', 'concept_id': 'H9PY_BoJ_mn9'}, {'occupation': 'Kontrollanläggningsingenjör, elkraft', 'concept_id': 'fYBk_dfW_DJc'}, {'occupation': 'VA-ingenjör', 'concept_id': 'UMkU_jge_4mH'}, {'occupation': 'Geodatasamordnare', 'concept_id': '54qK_bhx_bc5'}, {'occupation': 'Forskare, språk', 'concept_id': 'WrM5_fTS_37j'}, {'occupation': 'Koordinator: kultur, media, film, dataspel', 'concept_id': 'SV22_7W1_pFT'}, {'occupation': 'Forskare, pedagogik', 'concept_id': 'SA7K_jqY_K81'}, {'occupation': 'HR business partner', 'concept_id': '23nR_PXa_9br'}, {'occupation': 'Underhållsanalytiker, elkraft', 'concept_id': 'Yyn9_wQV_Wb8'}, {'occupation': 'Mobilutvecklare/Apputvecklare', 'concept_id': 'n2kJ_qFK_x2K'}, {'occupation': 'Forskare, medicin', 'concept_id': 'MqSM_PXs_d8P'}, {'occupation': 'Forskare, jordbruk', 'concept_id': 'oRBx_v9Q_vH2'}, {'occupation': 'Energiingenjör', 'concept_id': 'Gnrd_Brt_15j'}, {'occupation': 'Rehabiliteringskoordinator/Rehabkoordinator', 'concept_id': 'HUyu_wSa_Fhh'}, {'occupation': 'Yogainstruktör/Yogalärare', 'concept_id': '6Smf_Gqg_cv8'}, {'occupation': 'Barberare', 'concept_id': 'hDzC_BF5_Wz2'}, {'occupation': 'Avfallsspecialist', 'concept_id': 'VwH7_tvk_ief'}, {'occupation': 'Elkvalitetsanalytiker, elkraft', 'concept_id': 'p4vQ_Dpo_d6a'}, {'occupation': 'Hållbarhetschef', 'concept_id': 'czC6_fEK_A17'}, {'occupation': 'Visuell grafisk kommunikatör', 'concept_id': 'qrqz_uUw_so5'}, {'occupation': 'Sminkör', 'concept_id': 'xUwN_SAt_vGg'}, {'occupation': 'Forskare, bioteknik', 'concept_id': 'Nihf_tgV_ueT'}, {'occupation': 'Packmästare, flytt', 'concept_id': 'ifxC_6uZ_pE5'}, {'occupation': 'B-fotograf/Focus puller', 'concept_id': 'kViB_zQA_Qrn'}, {'occupation': 'Featurechef', 'concept_id': 'yyM2_7Vy_Fda'}, {'occupation': 'Dataskyddsombud', 'concept_id': 'hN4f_6jN_eZQ'}, {'occupation': 'Webbanalytiker', 'concept_id': 'Tr7k_cwB_2T4'}, {'occupation': 'Forskare, omvårdnad', 'concept_id': 'VxJK_e3F_n9f'}, {'occupation': 'Hälso- och sjukvårdskurator', 'concept_id': 'UVvg_XmH_CA4'}, {'occupation': 'Arkivutredare', 'concept_id': '1Cjx_ooE_HT9'}, {'occupation': 'Publikchef', 'concept_id': 'DBuv_W9M_5rt'}, {'occupation': 'Hårdvarutestare', 'concept_id': 'CTqd_fc6_MG5'}, {'occupation': 'Forskare, virologi', 'concept_id': '5RkB_Zeq_aH6'}, {'occupation': 'Moderator', 'concept_id': 'LYdh_6qh_9Kr'}, {'occupation': 'Agil coach/Agile coach', 'concept_id': 'xJQz_S3z_vab'}, {'occupation': 'Forskare, odontologi', 'concept_id': '59gf_eKP_pEW'}, {'occupation': 'Psykologiskt ledningsansvarig psykolog/PLA', 'concept_id': 'zRLw_Aid_zDh'}, {'occupation': 'Attraktionsförare', 'concept_id': 'RKi4_MXW_RJ3'}, {'occupation': 'Briefing Officer, luftfart', 'concept_id': 'YtDb_3jB_j3C'}, {'occupation': 'Environment artist', 'concept_id': 'Qrbr_LWo_Pqt'}, {'occupation': 'Forskare, bakteriologi', 'concept_id': 'ms96_qce_p79'}, {'occupation': 'Förlagschef, tidning', 'concept_id': 'M4Ld_18g_XzK'}, {'occupation': 'Forskare, cell- och molekylärbiologi', 'concept_id': '41dT_obG_dFc'}, {'occupation': 'Solenergiprojektör/Solcellsprojektör', 'concept_id': 'ApfX_5Ak_gpe'}, {'occupation': 'Hälsocoach', 'concept_id': 'EyYy_NBz_aei'}, {'occupation': 'Produktionsteknisk samordnare', 'concept_id': 'soMb_U4k_fzo'}, {'occupation': 'Fransstylist/Frans- och brynstylist', 'concept_id': 'ji2k_iAz_GWY'}, {'occupation': 'Köksarkitekt', 'concept_id': 'Lxbb_BUJ_sxw'}, {'occupation': 'Ateljerista', 'concept_id': 'r8Cv_UQf_sS9'}, {'occupation': 'Terminolog', 'concept_id': 'm9vB_abw_GZ3'}, {'occupation': 'Butikskock', 'concept_id': 'wJyz_qqM_dX4'}, {'occupation': 'Ekologisk hudvårdsterapeut', 'concept_id': 'VDPL_pKt_otU'}, {'occupation': 'Forskare, mikroelektronik', 'concept_id': 'NbhD_gbP_tHm'}, {'occupation': 'Arbetsledare, terminal', 'concept_id': 'xrfp_Jx6_8pZ'}, {'occupation': 'F&B Manager/Food and beverage manager', 'concept_id': 'Bfn9_6FK_iaY'}, {'occupation': 'Drönaroperatör/Drönarpilot', 'concept_id': 'XUsX_DaN_meJ'}, {'occupation': 'Solcellsinstallatör', 'concept_id': '8qCg_sxp_6fq'}, {'occupation': 'Produktutvecklingschef', 'concept_id': '4chG_ayZ_cPA'}, {'occupation': 'Dekan/Dekanus', 'concept_id': 'AR9u_x9n_nGa'}, {'occupation': 'Internrevisionschef', 'concept_id': 'b288_Hx5_KYy'}, {'occupation': 'Databasanalytiker', 'concept_id': 'vpAN_viS_cFV'}, {'occupation': 'SIUS-konsulent', 'concept_id': 'tFfE_tZV_9u5'}, {'occupation': 'Sprängingenjör', 'concept_id': '9NVr_Rdx_8Ay'}, {'occupation': 'Livsmedelsarbetare, charkuteri', 'concept_id': 'PBVy_ccB_Uhh'}, {'occupation': 'Klippassistent', 'concept_id': 'r32c_vMU_Zot'}, {'occupation': 'Cargo surveyor', 'concept_id': 'EB6b_fRU_tA5'}, {'occupation': 'VA-chef', 'concept_id': 'RR3M_q3V_GYu'}, {'occupation': 'Watch Supervisor, flygledning', 'concept_id': 'tkGT_kPC_L3S'}, {'occupation': 'Modersmålslärare, förskola', 'concept_id': 'kbCX_1s6_vqh'}, {'occupation': 'Forskare, immunologi', 'concept_id': 'uygD_Smj_a7w'}, {'occupation': 'Piercare', 'concept_id': 'GBys_6Zx_25W'}, {'occupation': 'HR-strateg', 'concept_id': '1aZz_LY7_QYN'}, {'occupation': 'Kontaktsjuksköterska', 'concept_id': 'P255_NB8_Aa7'}, {'occupation': 'Production designer/Produktionsdesigner', 'concept_id': '5Qqn_KZq_jFR'}, {'occupation': 'Engine programmer', 'concept_id': 'C3GL_ZyV_ZPw'}, {'occupation': 'Gyminstruktör', 'concept_id': 'KuqL_bsD_Zqd'}, {'occupation': 'Bussvärd', 'concept_id': 'o5p1_ZUZ_pab'}, {'occupation': 'Handläggare, intresseorganisation/Utredare, intresseorganisation', 'concept_id': 'TgpF_4Nq_eTw'}, {'occupation': 'UI-designer', 'concept_id': '3GKG_7xX_AcT'}, {'occupation': 'Lotsoperatör', 'concept_id': '4itw_Zm3_2YB'}, {'occupation': 'Teknikpedagog', 'concept_id': 'LQDq_hXy_t7W'}, {'occupation': 'Concept artist', 'concept_id': 'pxgV_uM9_SaZ'}, {'occupation': 'Teknisk redaktör', 'concept_id': 'zNEo_54u_hSC'}, {'occupation': 'Mediatextare', 'concept_id': 'S2QW_12u_Pj1'}, {'occupation': 'Big data analyst/Stordata-analytiker', 'concept_id': 'Ggze_QQS_jZi'}, {'occupation': 'Eventkoordinator', 'concept_id': 'gFRe_kD3_jPc'}, {'occupation': 'Forskare, mikrobiologi', 'concept_id': 'keVJ_c38_DLa'}, {'occupation': 'Fartygsoperatör', 'concept_id': 'WYkE_arW_7Z1'}, {'occupation': 'Skatterådgivare', 'concept_id': '6UAM_i1i_RYb'}, {'occupation': 'Hållbarhetsutvecklare', 'concept_id': '1naX_kwP_nzG'}, {'occupation': 'Forskare, trafiksäkerhet', 'concept_id': '3MDV_uBQ_6oG'}, {'occupation': 'Forskare, miljö', 'concept_id': 'P3mE_DHj_fw3'}, {'occupation': 'Braskaminmontör', 'concept_id': 'ARsW_UZi_n1d'}, {'occupation': 'Onlinemarknadsförare', 'concept_id': 'XiJJ_yXL_TC7'}, {'occupation': 'Språkkonsult', 'concept_id': 'arJK_xQM_qou'}, {'occupation': 'Handläggare, flygledning', 'concept_id': 'u46u_NZb_ck3'}, {'occupation': 'Servicedesigner/Tjänstedesigner', 'concept_id': '96k5_qy6_PQv'}, {'occupation': 'Forskare, kriminalvård', 'concept_id': 'WA7T_de5_P3h'}, {'occupation': 'Gameplay programmer', 'concept_id': 'uo9D_Kkk_xuh'}, {'occupation': 'Köp- och försäljningsmäklare, fartyg', 'concept_id': '77vi_dL6_FZR'}, {'occupation': 'Processoperatör, metallproduktion', 'concept_id': 'RF7q_DSJ_FbY'}, {'occupation': 'Fytoterapeut/Örtterapeut', 'concept_id': 'dZts_e4s_C98'}, {'occupation': 'Testutvecklare', 'concept_id': 'TU7g_mwa_VzB'}, {'occupation': 'Personaldirektör', 'concept_id': 'FZ8o_uu3_WzS'}, {'occupation': 'Chief Digital Officer/CDO', 'concept_id': 'rxZf_XT6_5xt'}, {'occupation': 'Prefekt', 'concept_id': 'mXmV_TJr_eQ3'}, {'occupation': 'Supply chain manager/SCM manager', 'concept_id': 'Gj5E_c7b_YHD'}, {'occupation': 'Beredskapsdirektör', 'concept_id': 'cB4Q_Cx9_2Lw'}, {'occupation': 'Civil brottsutredare', 'concept_id': 'aY7W_GJ6_o62'}, {'occupation': 'Lunchkock', 'concept_id': 'wRGm_fJA_5y6'}, {'occupation': 'Åklagaraspirant', 'concept_id': 'B7rt_Gcd_YEP'}, {'occupation': 'Character artist', 'concept_id': '1qgf_mXF_5Xp'}, {'occupation': 'Förlagschef, bokförlag', 'concept_id': 'zD7L_ZqX_cqz'}, {'occupation': 'Scenografassistent', 'concept_id': 'qb2W_NZ4_fFL'}, {'occupation': 'Fakir', 'concept_id': '3p1G_X4E_cy1'}, {'occupation': 'Forskare, beräkningsbiologi', 'concept_id': '8xAv_A7E_Gix'}, {'occupation': 'Vårdkoordinator/Vårdplatskoordinator', 'concept_id': 'DoPr_sD1_H9y'}, {'occupation': 'HR-controller', 'concept_id': 'TMQA_DYj_srP'}, {'occupation': 'Mjukvarutestare', 'concept_id': '843H_Mp1_EVL'}, {'occupation': 'Korsordsmakare/Korsordskonstruktör', 'concept_id': '9HaV_n46_t88'}, {'occupation': 'Beredare, elkraft', 'concept_id': 'DE7c_vm2_LTA'}, {'occupation': 'Specialistpsykolog', 'concept_id': 'SEhy_kME_xFW'}, {'occupation': 'Tech and Tools programmer', 'concept_id': 'GwC6_k7B_ByV'}, {'occupation': 'Game programmer', 'concept_id': 'TpGL_8kr_6K1'}, {'occupation': 'Leveranskoordinator, IT', 'concept_id': 'VP3m_hRz_c5H'}, {'occupation': 'Scrum master', 'concept_id': '1UTZ_bS9_kUD'}, {'occupation': 'Teknisk skribent', 'concept_id': 'AeQ7_cBs_xkT'}, {'occupation': 'Gardinmakare', 'concept_id': 'gTv7_73C_L1H'}, {'occupation': 'Verksamhetsutvecklare', 'concept_id': 'fUJp_V4d_ueo'}, {'occupation': 'Anslutningsingenjör, elkraft', 'concept_id': 'f7tc_ShL_bvM'}, {'occupation': 'Forskare, läkemedel', 'concept_id': 'g1U8_c99_Zry'}, {'occupation': 'Arbetsledare, kundservice/Gruppledare, kundservice', 'concept_id': 'bRZS_esN_X1Y'}, {'occupation': 'Forskare, filmvetenskap', 'concept_id': '4Phz_zGz_JKi'}, {'occupation': 'Vicerektor', 'concept_id': 'uV8X_VNM_XsF'}, {'occupation': 'Elnätsspecialist', 'concept_id': 'JoHF_EK9_4He'}, {'occupation': 'Attributmakare', 'concept_id': 'Xoxs_REs_gmK'}, {'occupation': 'Dataanalytiker', 'concept_id': 'eTVL_hfE_Lyh'}, {'occupation': 'Nationalparkschef', 'concept_id': 'wLC4_eWh_wvD'}, {'occupation': 'Stadsutvecklare/Samhällsstrateg', 'concept_id': 'fCPi_bZh_PBa'}, {'occupation': 'Fullstack-utvecklare', 'concept_id': '71Ji_irM_rSJ'}, {'occupation': 'Musikbibliotekarie', 'concept_id': 'N1NW_zL4_2LA'}, {'occupation': 'Arbetsledare, säkerhetsarbete/Gruppledare, säkerhetsarbete', 'concept_id': 'iwLT_P7W_9RZ'}, {'occupation': 'Director of photography/DoP/Filmfotograf', 'concept_id': 'ud3i_sVp_QPh'}, {'occupation': 'Forskare, zoologi', 'concept_id': 'nWmN_VPm_kot'}, {'occupation': 'Postdoktor/Postdoc', 'concept_id': 'kR6N_46L_Hc9'}, {'occupation': 'Naturvårdare', 'concept_id': '4fuh_Uf7_NAA'}, {'occupation': 'Elnätsanalytiker', 'concept_id': 'hJhQ_Fxc_Mjp'}, {'occupation': 'Strålskyddstekniker', 'concept_id': '77wX_fg5_rMa'}, {'occupation': 'HR-generalist/HR-partner', 'concept_id': 'ds7X_mdp_bPc'}, {'occupation': 'Funktionschef, offentlig förvaltning', 'concept_id': 'NCRd_JSd_X94'}, {'occupation': 'Nattchef, redaktion', 'concept_id': 'WYdq_yJR_JnE'}, {'occupation': 'Forskare, statskunskap', 'concept_id': 'UCjr_cqw_SHj'}, {'occupation': 'Konferensplanerare', 'concept_id': 'TaUi_uMx_WrZ'}, {'occupation': 'Forskare, kulturgeografi', 'concept_id': 'dhfK_iio_46c'}, {'occupation': 'Forskare, trädgårdsvetenskap', 'concept_id': 'Co7T_yKa_Zb1'}, {'occupation': 'Forskare, genetik', 'concept_id': 'SrQv_qDW_cLW'}, {'occupation': 'Viltforskare', 'concept_id': 'VT9M_Ppq_pDM'}, {'occupation': 'Nät- och kraftsystemsanalytiker, elkraft', 'concept_id': 'cYb5_hmF_Q9u'}, {'occupation': 'VTS-operatör', 'concept_id': 'F1CJ_eRU_TBg'}, {'occupation': 'Lärare i grundskolan, årskurs 1-6', 'concept_id': 'VZoJ_4oe_xyR'}, {'occupation': 'Fältgeotekniker', 'concept_id': 'qKE5_dUi_zg9'}, {'occupation': 'E-commerce manager', 'concept_id': 'PtwA_N8T_GTo'}, {'occupation': 'Casting Director/Castare/Rollsättare', 'concept_id': 'ibyU_Nhq_GxK'}, {'occupation': 'Forskare, växt- och djurbiologi', 'concept_id': 'q9ix_gkf_HP7'}, {'occupation': 'Förrättningsassistent', 'concept_id': 'DN4Q_kDe_zvR'}, {'occupation': 'Beredskapssamordnare/Krisberedskapssamordnare', 'concept_id': 'g41i_MsZ_2Ga'}, {'occupation': 'Forskare, sociologi', 'concept_id': 'piAi_ChR_W97'}, {'occupation': 'HSEQ Manager/KMA-samordnare', 'concept_id': 'KvsU_QLE_dXW'}, {'occupation': 'Maskör', 'concept_id': 'febp_FvM_dkW'}, {'occupation': 'Forskare, rättsvetenskap', 'concept_id': 'Jb37_fkg_yeu'}, {'occupation': 'Eventpersonal', 'concept_id': '1r5s_qHw_84e'}, {'occupation': 'Naturvårdshandläggare', 'concept_id': 'Zme8_ZCs_itg'}, {'occupation': 'TV-fotograf', 'concept_id': 'JfyC_gDr_U4e'}, {'occupation': 'UX-designer', 'concept_id': 'iwJU_gW4_SxT'}, {'occupation': 'Chief Operations/CO, flygledning', 'concept_id': 'Z1sb_ZS4_hNz'}, {'occupation': 'Vältförare', 'concept_id': 'bf92_EVy_5NP'}, {'occupation': 'Chief Data Officer/CDO', 'concept_id': 'LF9w_UCf_gow'}, {'occupation': 'Forskare, etnologi', 'concept_id': 'umy7_L5w_5AJ'}, {'occupation': 'Technical artist', 'concept_id': 'pnt9_PEs_zZy'}, {'occupation': 'Speltestare/QA', 'concept_id': 'TQKD_b9Y_57Z'} ] new_occupations_with_hits = [ {'label': 'Elkraftingenjör', 'concept_id': '7Yn2_NLJ_oa2', 'hits': ['24645107', '24602558', '24572890', '24512446', '24507851', '24445999']}, {'label': 'Kontrollanläggningstekniker', 'concept_id': 'iXyv_E2W_cqc', 'hits': ['24641497', '24623380', '24623314']}, {'label': 'Koordinator: kultur, media, film, dataspel', 'concept_id': 'SV22_7W1_pFT', 'hits': ['24674944', '24641084']}, {'label': 'Underhållsanalytiker, elkraft', 'concept_id': 'Yyn9_wQV_Wb8', 'hits': ['24637940', '24509354']}, {'label': 'F&B Manager/Food and beverage manager', 'concept_id': 'Bfn9_6FK_iaY', 'hits': ['24649158']} ]
"""Constants used in the library.""" EMAIL_HEADER_SUBJECT = "email-header-subject" EMAIL_HEADER_DATE = "email-header-date"
def main(): # 単位ベクトル (一次元タプル) identity_vector = (1, 0, 0) print(identity_vector) # 単位行列 (多次元タプル) identity_matrix = ( (1, 0, 0), (0, 1, 0), (0, 0, 1), ) print(identity_matrix) if __name__ == '__main__': main()
v = float(input('Qual é a velocidade do carro? ')) if v > 80: print('MULTADO! Você excedeu o limite permitido que é de 80km/h!') m = (v - 80) * 7 print('Você deve pagar uma multa de R${:.2f}'.format(m)) else: print('Tenha um bom dia, dirija com segurança!')
num = int(input('Digite qualquer número:')) a = num - 1 s = num + 1 print('O antecessor de', num, 'é,', a, 'e seu sucessor é', s, '.')
def orelse(*iters): found = False for iter in iters: for elem in iter: found = True yield elem if found: break def extract(it, pred): extracted = [] def filtered_it(): nonlocal extracted for elem in it: if pred(elem): extracted.append(elem) else: yield elem return filtered_it(), extracted
# -*- coding: utf-8 -*- competidores, n_voltas = list(map(int, input().split())) competidor_1 = list(map(int, input().split())) melhor_tempo = sum(competidor_1) vencedor = 1 for i in range(1, competidores): competidor_i = list(map(int, input().split())) tempo_i = sum(competidor_i) if (tempo_i < melhor_tempo): melhor_tempo = tempo_i vencedor = i + 1 print(vencedor)
CURSOR_TO_BOTTOM = 0 CURSOR_TO_CENTER = 1 CURSOR_TO_TOP = 2 VIEWPORT_LINE_UP = 3 VIEWPORT_LINE_DOWN = 4 HERE = 0 ELSEWHERE = 1 class ViewportNote(object): pass class ViewportContextChange(ViewportNote): def __init__(self, context, change_source): """`change_source` is either HERE or ELSEWHERE; the difference matters in what we try to keep stationary when multiple elements on the screen change: the cursor, the viewport, or something else? HERE: If the user is navigating through or editing in the editor we want the viewport to remain stationary, and the user's cursor to move within it. ELSEWHERE: If changes are coming from another source (potentially: same person editing in another window) we want the last explicit viewport-change at the present window to be determining what remains in view. If the last explicit viewport-change was MoveViewportRelativeToCursor, we want to keep the cursor stationary; moving the viewport around it if required; if the last explicit viewport-change was ScrollToFraction we want to stay at that fraction. Both of these cases only indicate a preference; e.g. bounding-by-window takes precedence to that preference. """ self.context = context self.change_source = change_source def __repr__(self): return "ViewportContextChange(%s, %s)" % (self.context, self.change_source) class MoveViewportRelativeToCursor(ViewportNote): def __init__(self, relative_move): self.relative_move = relative_move def __repr__(self): return "MoveViewportRelativeToCursor(%s)" % self.relative_move class ScrollToFraction(ViewportNote): def __init__(self, fraction): self.fraction = fraction def __repr__(self): return "ScrollToFraction(%s)" % self.fraction
#-*- coding: utf-8 -*- swiftsure_item = { "description": u"Земля для військовослужбовців", "classification": { "scheme": u"CPV", "id": u"66113000-5", "description": u"Земельні ділянки" }, "additionalClassifications": [{ "scheme": "CAV", "id": "39513200-3", "description": "папір і картон гофровані, паперова й картонна тара" }], "unit": { "name": u"item", "code": u"44617100-9" }, "quantity": 5.12345678, "registrationDetails": { "status": "unknown", }, "address": { "countryName": u"Україна", "postalCode": "79000", "region": u"м. Київ", "locality": u"м. Київ", "streetAddress": u"вул. Банкова 1" } } dgf_item = { "description": "Земля для військовослужбовців", "classification": { "scheme": "CAV", "description": "Земельні ділянки", "id": "06000000-2" }, "address": { "postalCode": "79000", "countryName": "Україна", "streetAddress": "вул. Банкова 1", "region": "м. Київ", "locality": "м. Київ" }, "unit": { "code": "44617100-9", "name": "item" }, "quantity": 5 }