content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def binary_to_decimal(self, n): return int(n, 2) def grayCode(self, A): num_till_now = [0, 1] if A == 1: return num_till_now results = [] for i in range(1, A): rev = num_till_now.copy() rev.reverse() num_ti...
class Solution: def binary_to_decimal(self, n): return int(n, 2) def gray_code(self, A): num_till_now = [0, 1] if A == 1: return num_till_now results = [] for i in range(1, A): rev = num_till_now.copy() rev.reverse() num_t...
def include_in_html(content_to_include, input_includename, html_filepath): with open(html_filepath, "r") as f: line_list = f.readlines() res = [] includename = None initial_spaces = 0 for line in line_list: line = line.strip("\n") if line.strip(" ")[:14] == "<!-- #includ...
def include_in_html(content_to_include, input_includename, html_filepath): with open(html_filepath, 'r') as f: line_list = f.readlines() res = [] includename = None initial_spaces = 0 for line in line_list: line = line.strip('\n') if line.strip(' ')[:14] == '<!-- #include ' o...
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
"""Defaults for rules_typescript repository not meant to be used downstream""" load('@build_bazel_rules_typescript//:defs.bzl', _karma_web_test='karma_web_test', _karma_web_test_suite='karma_web_test_suite', _ts_library='ts_library', _ts_web_test='ts_web_test', _ts_web_test_suite='ts_web_test_suite') internal_ts_librar...
class Simple(object): def __init__(self, x): self.x = x self.y = 6 def get_x(self): return self.x class WithCollection(object): def __init__(self): self.l = list() self.d = dict() def get_l(self): return self.l
class Simple(object): def __init__(self, x): self.x = x self.y = 6 def get_x(self): return self.x class Withcollection(object): def __init__(self): self.l = list() self.d = dict() def get_l(self): return self.l
""" Once in the "ready" state, Huntsman has been initialized successfully and it is safe. The goal of the ready state is to decide which of the following states to enter next: - parking - coarse_focusing - scheduling - twilight_flat_fielding """ def on_enter(event_data): """ """ pocs = event_data.model ...
""" Once in the "ready" state, Huntsman has been initialized successfully and it is safe. The goal of the ready state is to decide which of the following states to enter next: - parking - coarse_focusing - scheduling - twilight_flat_fielding """ def on_enter(event_data): """ """ pocs = event_data.model ...
s = open('input.txt','r').read() s = [k for k in s.split("\n")] aller = {} count = {} for line in s: allergens = line.split("contains ")[1].split(", ") allergens[-1] = allergens[-1][:-1] ing = line.split(" (")[0].split(" ") for i in ing: count[i] = 1 if i not in count else count[i] + 1 fo...
s = open('input.txt', 'r').read() s = [k for k in s.split('\n')] aller = {} count = {} for line in s: allergens = line.split('contains ')[1].split(', ') allergens[-1] = allergens[-1][:-1] ing = line.split(' (')[0].split(' ') for i in ing: count[i] = 1 if i not in count else count[i] + 1 for ...
t = int(input()) for i in range(t): n = input() rev_n = int(n[::-1]) print(rev_n)
t = int(input()) for i in range(t): n = input() rev_n = int(n[::-1]) print(rev_n)
courses={} while True: command=input() if command!="end": command=command.split(" : ") doesCourseExist=False for j in courses: if j==command[0]: doesCourseExist=True break if doesCourseExist==False: courses[comm...
courses = {} while True: command = input() if command != 'end': command = command.split(' : ') does_course_exist = False for j in courses: if j == command[0]: does_course_exist = True break if doesCourseExist == False: cours...
#! /usr/bin/env python # encoding: utf-8 class TimeOutError(Exception): pass class MaxRetryError(Exception): pass class GodError(Exception): """ custom exception msg class """ def __init__(self, msg="Intern Error", code=500): self.msg = msg self.code = code def __str__...
class Timeouterror(Exception): pass class Maxretryerror(Exception): pass class Goderror(Exception): """ custom exception msg class """ def __init__(self, msg='Intern Error', code=500): self.msg = msg self.code = code def __str__(self): return self.msg
def main(): object_a_mass = float(input("Object A mass: ")) object_b_mass = float(input("Object B mass: ")) distance = float(input("Distance between both: ")) G = 6.67408 * (10**11) print(G*(object_a_mass*object_b_mass)/ (distance ** 2)) if __name__ == '__main__': main()
def main(): object_a_mass = float(input('Object A mass: ')) object_b_mass = float(input('Object B mass: ')) distance = float(input('Distance between both: ')) g = 6.67408 * 10 ** 11 print(G * (object_a_mass * object_b_mass) / distance ** 2) if __name__ == '__main__': main()
PB_PACKAGE = __package__ NODE_TAG = 'p_baker_node' MATERIAL_TAG = 'p_baker_material' MATERIAL_TAG_VERTEX = 'p_baker_material_vertex' NODE_INPUTS = [ 'Color', 'Subsurface', 'Subsurface Color', 'Metallic', 'Specular', 'Specular Tint', 'Roughness', 'Anisotropic', 'Anisotropic Rotation...
pb_package = __package__ node_tag = 'p_baker_node' material_tag = 'p_baker_material' material_tag_vertex = 'p_baker_material_vertex' node_inputs = ['Color', 'Subsurface', 'Subsurface Color', 'Metallic', 'Specular', 'Specular Tint', 'Roughness', 'Anisotropic', 'Anisotropic Rotation', 'Sheen', 'Sheen Tint', 'Clearcoat', ...
def nrange(start, stop, step=1): while start < stop: yield start start += step @profile def ncall(): for i in nrange(1,1000000): pass if __name__ == "__main__": ncall()
def nrange(start, stop, step=1): while start < stop: yield start start += step @profile def ncall(): for i in nrange(1, 1000000): pass if __name__ == '__main__': ncall()
string = "abcdefgabc" string_list = [] for letter in string: string_list.append(letter) print(string_list) string_list_no_duplicate = set(string_list) string_list_no_duplicate = list(string_list_no_duplicate) string_list_no_duplicate.sort() print(string_list_no_duplicate) for letters in string_list_no_duplicate...
string = 'abcdefgabc' string_list = [] for letter in string: string_list.append(letter) print(string_list) string_list_no_duplicate = set(string_list) string_list_no_duplicate = list(string_list_no_duplicate) string_list_no_duplicate.sort() print(string_list_no_duplicate) for letters in string_list_no_duplicate: ...
# Created by sarathkaul on 14/11/19 def remove_duplicates(sentence: str) -> str: """ Reomove duplicates from sentence >>> remove_duplicates("Python is great and Java is also great") 'Java Python also and great is' """ sen_list = sentence.split(" ") check = set() for a_word in sen_list...
def remove_duplicates(sentence: str) -> str: """ Reomove duplicates from sentence >>> remove_duplicates("Python is great and Java is also great") 'Java Python also and great is' """ sen_list = sentence.split(' ') check = set() for a_word in sen_list: check.add(a_word) return ...
def load(task_id, file_id, cmds): global responses code = reverse_upload(task_id, file_id) name = cmds if agent.get_Encryption_key() == "": dynfs[name] = code else: dynfs[name] = encrypt_code(code) response = { 'task_id': task_id, "user_output": "Modul...
def load(task_id, file_id, cmds): global responses code = reverse_upload(task_id, file_id) name = cmds if agent.get_Encryption_key() == '': dynfs[name] = code else: dynfs[name] = encrypt_code(code) response = {'task_id': task_id, 'user_output': 'Module successfully added', 'comma...
for _ in range(int(input())): n = int(input()) r = [int(i) for i in input().split()] o = max(r) if r.count(o)==len(r): print(-1) continue kq = -1 for i in range(1,len(r)): if r[i]==o and (r[i]>r[i-1]): kq = i+1 for i in range(len(r)-1): if r[i]==o and(r[i]>r[i+1]): kq = i+1 print(kq)
for _ in range(int(input())): n = int(input()) r = [int(i) for i in input().split()] o = max(r) if r.count(o) == len(r): print(-1) continue kq = -1 for i in range(1, len(r)): if r[i] == o and r[i] > r[i - 1]: kq = i + 1 for i in range(len(r) - 1): ...
WIDTH = 128 HEIGHT = 128 # Must be more than ALIEN_SIZE, used to pad alien rows and columns ALIEN_BLOCK_SIZE = 8 # Alien constants are global as their spacing is used to separate them ALIENS_PER_ROW = int(WIDTH / ALIEN_BLOCK_SIZE) - 6 ALIEN_ROWS = int(HEIGHT / (2 * ALIEN_BLOCK_SIZE)) # How often to move the aliens i...
width = 128 height = 128 alien_block_size = 8 aliens_per_row = int(WIDTH / ALIEN_BLOCK_SIZE) - 6 alien_rows = int(HEIGHT / (2 * ALIEN_BLOCK_SIZE)) alien_start_time = 4 alien_time_step = 0.2 alien_minimum_time = 1 alien_start_fire_probability = 0.01 alien_fire_probability_step = 0.005 alien_maximum_fire_probability = 0....
fp = open('abcd.txt', 'r') line_offset = [] offset = 0 for line in fp: line_offset.append(offset) offset += len(line) print(line_offset) for each in line_offset: fp.seek(each) print(fp.readline()[:-1])
fp = open('abcd.txt', 'r') line_offset = [] offset = 0 for line in fp: line_offset.append(offset) offset += len(line) print(line_offset) for each in line_offset: fp.seek(each) print(fp.readline()[:-1])
# ---------------------------------------------------------------------------- # Copyright 2019-2022 Diligent Graphics LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
cxx_registered_struct = {'Version', 'RenderTargetBlendDesc', 'BlendStateDesc', 'StencilOpDesc', 'DepthStencilStateDesc', 'RasterizerStateDesc', 'InputLayoutDesc', 'LayoutElement', 'SampleDesc', 'ShaderResourceVariableDesc', 'PipelineResourceDesc', 'PipelineResourceSignatureDesc', 'SamplerDesc', 'ImmutableSamplerDesc', ...
# # PySNMP MIB module Cajun-ROOT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Cajun-ROOT # Produced by pysmi-0.3.4 at Mon Apr 29 17:08:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ...
# Add 5 to number add5 = lambda n : n + 5 print(add5(2)) print(add5(7)) print() # Square number sqr = lambda n : n * n print(sqr(2)) print(sqr(7)) print() # Next integer nextInt = lambda n : int(n) + 1 print(nextInt(2.7)) print(nextInt(7.2)) print() # Previous integer of half prevInt = lambda n : int(n // 2) print(p...
add5 = lambda n: n + 5 print(add5(2)) print(add5(7)) print() sqr = lambda n: n * n print(sqr(2)) print(sqr(7)) print() next_int = lambda n: int(n) + 1 print(next_int(2.7)) print(next_int(7.2)) print() prev_int = lambda n: int(n // 2) print(prev_int(2.7)) print(prev_int(7.2)) print() div = lambda dvsr: lambda dvdn: dvdn...
class Solution(object): def preorder(self, root): """ :type root: Node :rtype: List[int] """ if not root: return [] values = [] self.visit(root, values) return values def visit(self, root, values): values.append(root.val) for child in root.children: self.visit(child, values)
class Solution(object): def preorder(self, root): """ :type root: Node :rtype: List[int] """ if not root: return [] values = [] self.visit(root, values) return values def visit(self, root, values): values.append(root.val) for child in r...
files = { "server.py":"""#Import all your routes here from {}.routes import router from fastapi import FastAPI app = FastAPI() app.include_router(router) """, "settings.py": """#configuration for database""", "test.py":"""#implement your test here""", "models.py": """#implement your models here from pydantic impor...
files = {'server.py': '#Import all your routes here\n\nfrom {}.routes import router\nfrom fastapi import FastAPI\n\napp = FastAPI()\n\napp.include_router(router)\n', 'settings.py': '#configuration for database', 'test.py': '#implement your test here', 'models.py': '#implement your models here\nfrom pydantic import Base...
state = '10011111011011001' disk_length = 35651584 def mutate(a): b = ''.join(['1' if x == '0' else '0' for x in reversed(a)]) return a + '0' + b def checksum(a): result = '' i = 0 while i < len(a) - 1: if a[i] == a[i+1]: result += '1' else: result += '0' ...
state = '10011111011011001' disk_length = 35651584 def mutate(a): b = ''.join(['1' if x == '0' else '0' for x in reversed(a)]) return a + '0' + b def checksum(a): result = '' i = 0 while i < len(a) - 1: if a[i] == a[i + 1]: result += '1' else: result += '0' ...
x = 1 while x < 10: y = 1 while y < 10: print("%4d" % (x*y), end="") y += 1 print() x += 1
x = 1 while x < 10: y = 1 while y < 10: print('%4d' % (x * y), end='') y += 1 print() x += 1
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2011 Cisco Systems, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache...
def get_view_builder(req): base_url = req.application_url return view_builder(base_url) class Viewbuilder(object): """ViewBuilder for Credential, derived from quantum.views.networks.""" def __init__(self, base_url): """Initialize builder. :param base_url: url of the root wsgi applicat...
def saisie_liste(): cest_un_nombre=True premier_nombre = input("Entrer un nombre : ") somme=int(premier_nombre) min=int(premier_nombre) max=int(premier_nombre) nombre_int = 0 n=0 moyenne = 0 while cest_un_nombre==True: n += 1 nombre=input("Entrer un nombre : ") ...
def saisie_liste(): cest_un_nombre = True premier_nombre = input('Entrer un nombre : ') somme = int(premier_nombre) min = int(premier_nombre) max = int(premier_nombre) nombre_int = 0 n = 0 moyenne = 0 while cest_un_nombre == True: n += 1 nombre = input('Entrer un nomb...
AF_INET = 2 AF_INET6 = 10 IPPROTO_IP = 0 IPPROTO_TCP = 6 IPPROTO_UDP = 17 IP_ADD_MEMBERSHIP = 3 SOCK_DGRAM = 2 SOCK_RAW = 3 SOCK_STREAM = 1 SOL_SOCKET = 4095 SO_REUSEADDR = 4 def getaddrinfo(): pass def socket(): pass
af_inet = 2 af_inet6 = 10 ipproto_ip = 0 ipproto_tcp = 6 ipproto_udp = 17 ip_add_membership = 3 sock_dgram = 2 sock_raw = 3 sock_stream = 1 sol_socket = 4095 so_reuseaddr = 4 def getaddrinfo(): pass def socket(): pass
fixed_rows = [] with open('runs/expert/baseline_pass_full_doc_rerank', 'r') as fi: for line in fi: line = line.strip().split() if line: fixed_score = -float(line[4]) line[4] = str(fixed_score) fixed_rows.append('\t'.join(line)) with open('runs/expert/baseline_pass_full_doc_rerank', 'w') as fo: for row ...
fixed_rows = [] with open('runs/expert/baseline_pass_full_doc_rerank', 'r') as fi: for line in fi: line = line.strip().split() if line: fixed_score = -float(line[4]) line[4] = str(fixed_score) fixed_rows.append('\t'.join(line)) with open('runs/expert/baseline_pass...
def insertion_sort(l): for i in range(1, len(l)): j = i-1 key = l[i] while (l[j] > key) and (j >= 0): l[j+1] = l[j] j -= 1 l[j+1] = key numbers = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] insertion_sort(numbers) print(numbers)
def insertion_sort(l): for i in range(1, len(l)): j = i - 1 key = l[i] while l[j] > key and j >= 0: l[j + 1] = l[j] j -= 1 l[j + 1] = key numbers = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] insertion_sort(numbers) print(numbers)
# Question: https://projecteuler.net/problem=120 # The coefficients of a^(odd) cancel out, so there might be a pattern ... # n | X_n = (a-1)^n + (a+1)^n | mod a^2 #-----|----------------------------|-------- # 1 | 2a | 2a # 2 | 2a^2 + 2 | 2 # 3 | 2...
n = 1000 result = (N - 1) * N * (N + 1) // 3 - N * (N + 2) // 4 print(result)
n = int(input().strip()) for i in range(0,n): for y in range(0,n): if(y<n-i-1): print(' ', end='') elif(y>=n-i-1 and y!=n-1): print('#',end='') else: print('#')
n = int(input().strip()) for i in range(0, n): for y in range(0, n): if y < n - i - 1: print(' ', end='') elif y >= n - i - 1 and y != n - 1: print('#', end='') else: print('#')
class Node: def __init__(self, value): self.value = value self.next = None class Stack: def __init__(self): self.top = None def push(self, value): node = Node(value) if self.top: node.next = self.top self.top = node else: ...
class Node: def __init__(self, value): self.value = value self.next = None class Stack: def __init__(self): self.top = None def push(self, value): node = node(value) if self.top: node.next = self.top self.top = node else: ...
def scorify_library(library): """ The aim is to give the libraries a score, that will enable to order them later on """ NB = library[0] BD = library[2] SB = library_total_book_score(library) DR = library[1] library_scoring = (D - DR) * BD * (SB/NB) return library_scoring def libra...
def scorify_library(library): """ The aim is to give the libraries a score, that will enable to order them later on """ nb = library[0] bd = library[2] sb = library_total_book_score(library) dr = library[1] library_scoring = (D - DR) * BD * (SB / NB) return library_scoring def libra...
class Node: def __init__(self, condition, body): self.condition = condition self.body = body def visit(self, context): rvalue = None while self.condition.visit(context): rvalue = self.body.visit(context) return rvalue
class Node: def __init__(self, condition, body): self.condition = condition self.body = body def visit(self, context): rvalue = None while self.condition.visit(context): rvalue = self.body.visit(context) return rvalue
""" Quiz: Enumerate Use enumerate to modify the cast list so that each element contains the name followed by the character's corresponding height. For example, the first element of cast should change from "Barney Stinson" to "Barney Stinson 72". """ cast = [ "Barney Stinson", "Robin Scherbatsky", "Ted Mos...
""" Quiz: Enumerate Use enumerate to modify the cast list so that each element contains the name followed by the character's corresponding height. For example, the first element of cast should change from "Barney Stinson" to "Barney Stinson 72". """ cast = ['Barney Stinson', 'Robin Scherbatsky', 'Ted Mosby', 'Lily Ald...
__all__ = [ 'arch_blocks', 'get_mask', 'get_param_groups', 'logger', 'losses', 'lr_schedulers', 'optimizers_L1L2', 'tensorflow_logger', ]
__all__ = ['arch_blocks', 'get_mask', 'get_param_groups', 'logger', 'losses', 'lr_schedulers', 'optimizers_L1L2', 'tensorflow_logger']
class Solution: def solve(self, courses): n = len(courses) def helper(start): visited[start] = 1 for v in courses[start]: if visited[v]==1: return True elif visited[v]==0: if helper(v): ...
class Solution: def solve(self, courses): n = len(courses) def helper(start): visited[start] = 1 for v in courses[start]: if visited[v] == 1: return True elif visited[v] == 0: if helper(v): ...
chipper = input('Input Message: ') plain = '' for alphabet in chipper: temp = ord(alphabet)-1 plain += chr(temp) print(plain)
chipper = input('Input Message: ') plain = '' for alphabet in chipper: temp = ord(alphabet) - 1 plain += chr(temp) print(plain)
""" [2016-09-26] Challenge #285 [Easy] Cross Platform/Language Data Encoding part 1 https://www.reddit.com/r/dailyprogrammer/comments/54lu54/20160926_challenge_285_easy_cross/ We will make a binary byte oriented encoding of data that is self describing and extensible, and aims to solve the following problems: * porta...
""" [2016-09-26] Challenge #285 [Easy] Cross Platform/Language Data Encoding part 1 https://www.reddit.com/r/dailyprogrammer/comments/54lu54/20160926_challenge_285_easy_cross/ We will make a binary byte oriented encoding of data that is self describing and extensible, and aims to solve the following problems: * porta...
def dec1(def1): def exec(): print("Executing now") def1() print("Executed") return exec @dec1 def who_is_sandy(): print("Sandy is good programmer") #who_is_sandy = dec1(who_is_sandy) #Decorative function is dec1 another term is @dec1 who_is_sandy()
def dec1(def1): def exec(): print('Executing now') def1() print('Executed') return exec @dec1 def who_is_sandy(): print('Sandy is good programmer') who_is_sandy()
"""Aiohwenergy errors.""" class AiohwenergyException(Exception): """Base error for aiohwenergy.""" class RequestError(AiohwenergyException): """Unable to fulfill request. Raised when host or API cannot be reached. """ class InvalidStateError(AiohwenergyException): """Raised when the device is...
"""Aiohwenergy errors.""" class Aiohwenergyexception(Exception): """Base error for aiohwenergy.""" class Requesterror(AiohwenergyException): """Unable to fulfill request. Raised when host or API cannot be reached. """ class Invalidstateerror(AiohwenergyException): """Raised when the device is no...
# container with most water # https://leetcode.com/problems/container-with-most-water/ # the function maxArea -> take in a list of integers and return an integer # 3 variables to keep track of the current max area, left and right pointers # left pointer initialized to the first elements of the list # right pointer init...
class Solution: def max_area(self, height: list[int]) -> int: current_max_area = 0 left = 0 right = len(height) - 1 while left < right: area = (right - left) * min(height[left], height[right]) if area > current_max_area: current_max_area = are...
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT Settings file for the TestRailImporter tool. """ TESTRAIL_STATUS_IDS = { # For more info see http://docs.gurock.c...
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT Settings file for the TestRailImporter tool. """ testrail_status_ids = {'pass_id': 1, 'block_id': 2, 'untested_id':...
print("------------------------------------") print("********* Woorden switchen *********") print("------------------------------------") # Input temperatuur in Celsius woord1 = input("Woord 1: ") woord2 = input("Woord 2: ") # Output print() print("Woord 1: " + woord1.upper()) print("Woord 2: " + woord2.upper()) prin...
print('------------------------------------') print('********* Woorden switchen *********') print('------------------------------------') woord1 = input('Woord 1: ') woord2 = input('Woord 2: ') print() print('Woord 1: ' + woord1.upper()) print('Woord 2: ' + woord2.upper()) print() (woord1, woord2) = (woord2, woord1) pr...
# * ======================= # * # * Author: Matthew Moccaro # * File: Network_Programming.py # * Type: Python Source File # * # * Creation Date: 1/2/19 # * # * Description: Python # * source file for the # * network programming # * project. # * # * ====================== print("Network Programming For Python")
print('Network Programming For Python')
__author__ = 'mstipanov' class ApiRequestErrorDetails(object): messageId = "" text = "" variables = "" additionalDescription = "" def __init__(self, text=""): self.text = text def __str__(self): return "ApiRequestErrorDetails: {" \ "messageId = \"" + str(self.m...
__author__ = 'mstipanov' class Apirequesterrordetails(object): message_id = '' text = '' variables = '' additional_description = '' def __init__(self, text=''): self.text = text def __str__(self): return 'ApiRequestErrorDetails: {messageId = "' + str(self.messageId) + '", text...
""" Aim: Given an undirected graph and an integer M. The task is to determine if the graph can be colored with at most M colors such that no two adjacent vertices of the graph are colored with the same color. Intuition: We consider all the different combinations of the colors for the given graph...
""" Aim: Given an undirected graph and an integer M. The task is to determine if the graph can be colored with at most M colors such that no two adjacent vertices of the graph are colored with the same color. Intuition: We consider all the different combinations of the colors for the given graph...
# -*- coding: utf-8 -*- # Jupyter Extension points def _jupyter_nbextension_paths(): return [ dict( section="notebook", # the path is relative to the `my_fancy_module` directory src="resources/nbextension", # directory in the `nbextension/` namespace ...
def _jupyter_nbextension_paths(): return [dict(section='notebook', src='resources/nbextension', dest='nbsafety', require='nbsafety/index')] def load_jupyter_server_extension(nbapp): pass
class BatteryAndInverter: name = "battery and inverter" params = [ { "key": "capacity_dc_kwh", "label": "", "units": "kwh", "private": False, "value": 4000, "confidence": 0, "notes": "", "source": "FAKE" ...
class Batteryandinverter: name = 'battery and inverter' params = [{'key': 'capacity_dc_kwh', 'label': '', 'units': 'kwh', 'private': False, 'value': 4000, 'confidence': 0, 'notes': '', 'source': 'FAKE'}, {'key': 'capacity_dc_kw', 'label': '', 'units': 'kw', 'private': False, 'value': 4000, 'confidence': 0, 'not...
# Generate a mask for the upper triangle mask = np.zeros_like(corr, dtype=np.bool) mask[np.triu_indices_from(mask)] = True # Set up the matplotlib figure f, ax = plt.subplots(figsize=(20, 18)) # Draw the heatmap with the mask and correct aspect ratio sns.heatmap(corr, mask=mask, cmap="YlGnBu", vmax=.30, cente...
mask = np.zeros_like(corr, dtype=np.bool) mask[np.triu_indices_from(mask)] = True (f, ax) = plt.subplots(figsize=(20, 18)) sns.heatmap(corr, mask=mask, cmap='YlGnBu', vmax=0.3, center=0, square=True, linewidths=0.5, cbar_kws={'shrink': 0.5})
# -*- coding: utf-8 -*- # # 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, softwa...
class Lbaastobigip(object): def __init__(self, benchmark, benchmark_filter): self.benchmark_name = None self.benchmark = None self.benchmark_filter = None self.benchmark_projects = None self.subject_name = None self.subject = None self.subject_filter = None ...
# -*- coding: utf-8 -*- # API - cs # FileName: default.py # Version: 1.0.0 # Create: 2018-10-24 # Modify: 2018-10-27 """ Default settings and values """ """global""" BUCKET_NAME = 'BUCKET_NAME' CODING = 'utf-8' DOMAIN = 'DOMAIN' INTERNAL_DOMAIN = 'oss-cn-beijing-internal.aliyuncs.com' PREFIX = 'mosdb/...
""" Default settings and values """ 'global' bucket_name = 'BUCKET_NAME' coding = 'utf-8' domain = 'DOMAIN' internal_domain = 'oss-cn-beijing-internal.aliyuncs.com' prefix = 'mosdb/user/{0}/data/app/cs/' reserve_char = ',' reserve_char_replace = (RESERVE_CHAR, str()) 'auth' ak_id = str() ak_secret = str() 'upload' uplo...
# Declaring the gotopt2 dependencies load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_bats//:deps.bzl", "bazel_bats_dependencies") # Include this into any dependencies that want to compile gotopt2 from source. ...
load('@bazel_gazelle//:deps.bzl', 'gazelle_dependencies', 'go_repository') load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository') load('@bazel_bats//:deps.bzl', 'bazel_bats_dependencies') def gotopt2_dependencies(): go_repository(name='com_github_golang_glog', commit='23def4e6c14b', importpath='gith...
# -*- coding: utf-8 -*- """ Created on 2018/5/20 @author: susmote """ kv_dict = {} with open('../right_code.txt') as f: for value in f: value = value.strip() for i in value: kv_dict.setdefault(i, 0) kv_dict[i] += 1 print(kv_dict.keys()) print(len(kv_dict))
""" Created on 2018/5/20 @author: susmote """ kv_dict = {} with open('../right_code.txt') as f: for value in f: value = value.strip() for i in value: kv_dict.setdefault(i, 0) kv_dict[i] += 1 print(kv_dict.keys()) print(len(kv_dict))
A = [] B = [] for i in range (10): A.append(int(input())) U = int(input()) for j in range (len(A)): if A[j] == U: B.append(j) print(B)
a = [] b = [] for i in range(10): A.append(int(input())) u = int(input()) for j in range(len(A)): if A[j] == U: B.append(j) print(B)
def differentSymbolsNaive(s): diffArray = [] for i in range(len(list(s))): if list(s)[i] not in diffArray: diffArray.append(list(s)[i]) return len(diffArray)
def different_symbols_naive(s): diff_array = [] for i in range(len(list(s))): if list(s)[i] not in diffArray: diffArray.append(list(s)[i]) return len(diffArray)
s = input() s = s.upper() c = 0 for i in ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"): for j in s: if(i!=j): c = 0 else: c = 1 break if(c==0): break if c==1: print("Pangram exists") else: print("Pangram doesn't exists")
s = input() s = s.upper() c = 0 for i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': for j in s: if i != j: c = 0 else: c = 1 break if c == 0: break if c == 1: print('Pangram exists') else: print("Pangram doesn't exists")
string_variable = "Nicolas" int_variable = 24 print(string_variable) print(int_variable)
string_variable = 'Nicolas' int_variable = 24 print(string_variable) print(int_variable)
name = input("Please enter your name: ") print("{0}, Please guess a number between 0 and 10: ".format(name)) guess = int(input()) if guess != 5: if guess < 5 : print("Please guess higher") else: print("Please guess lower") guess = int(input()) if guess == 5: print("Well done, {0...
name = input('Please enter your name: ') print('{0}, Please guess a number between 0 and 10: '.format(name)) guess = int(input()) if guess != 5: if guess < 5: print('Please guess higher') else: print('Please guess lower') guess = int(input()) if guess == 5: print('Well done, {0}....
""" time: c*26 + p space: 26 + 26 (1) """ class Solution: def findAnagrams(self, s: str, p: str) -> List[int]: cntP = collections.Counter(p) cntS = collections.Counter() P = len(p) S = len(s) if P > S: return [] ans = [] for i, c in enumerate(s): ...
""" time: c*26 + p space: 26 + 26 (1) """ class Solution: def find_anagrams(self, s: str, p: str) -> List[int]: cnt_p = collections.Counter(p) cnt_s = collections.Counter() p = len(p) s = len(s) if P > S: return [] ans = [] for (i, c) in enumerat...
def do_the_thing(): with open("input.txt", "r") as f: nums = list(map(int, f.readlines())) if len(nums) < 3: return 0 count = 0 for i in range(len(nums)-3): if nums[i] < nums[i+3]: count += 1 return count # # windo...
def do_the_thing(): with open('input.txt', 'r') as f: nums = list(map(int, f.readlines())) if len(nums) < 3: return 0 count = 0 for i in range(len(nums) - 3): if nums[i] < nums[i + 3]: count += 1 return count if __name__ == '__main__': ...
_base_ = [ '../_base_/models/mask_rcnn_red50_neck_fpn_head.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x_warmup.py', '../_base_/default_runtime.py' ] optimizer_config = dict(grad_clip(dict(_delete_=True, max_norm=5, norm_type=2)))
_base_ = ['../_base_/models/mask_rcnn_red50_neck_fpn_head.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x_warmup.py', '../_base_/default_runtime.py'] optimizer_config = dict(grad_clip(dict(_delete_=True, max_norm=5, norm_type=2)))
def maxSumUsingMid(a, first, last, mid): max_left = -99999 sum1 = 0 for i in range(mid, first - 1, -1): sum1 += a[i] if sum1 > max_left: max_left = sum1 max_right = -99999 sum1 = 0 for i in range(mid + 1, last + 1): sum1 += a[i] if sum1 > max_right: ...
def max_sum_using_mid(a, first, last, mid): max_left = -99999 sum1 = 0 for i in range(mid, first - 1, -1): sum1 += a[i] if sum1 > max_left: max_left = sum1 max_right = -99999 sum1 = 0 for i in range(mid + 1, last + 1): sum1 += a[i] if sum1 > max_right:...
''' This module exists purely to check how to import test cases in the test suite ''' def ex_function(): return True
""" This module exists purely to check how to import test cases in the test suite """ def ex_function(): return True
## Command format COMMAND_SIZE_TOTAL = 14 ## Cammand size total COMMAND_SIZE_HEADER = 4 ## Cammand header size COMMAND_SIZE_CHECKSUM = 4 ## Cammand checksum size COMMAND_SIZE_OVERHEAD = 8 ...
command_size_total = 14 command_size_header = 4 command_size_checksum = 4 command_size_overhead = 8 command_start_mark = 245 command_index_command = 1 command_index_data = 2 command_set_integration_time_3_d = 0 command_set_integration_time_grayscale = 1 command_set_roi = 2 command_set_binning = 3 command_set_mode = 4 c...
class SessionEncryption: """Session Encryption types.""" NONE = 'none' TLS = 'tls'
class Sessionencryption: """Session Encryption types.""" none = 'none' tls = 'tls'
def MinNumberInsertionAndDel(a, b, x, y): dp = [[None for _ in range(y + 1)] for _ in range(x + 1)] for i in range(x + 1): for j in range(y + 1): if i == 0 or j == 0: dp[i][j] = 0 elif a[i - 1] == b[j - 1]: dp[i][j] = 1 + dp[i - 1][j - 1] ...
def min_number_insertion_and_del(a, b, x, y): dp = [[None for _ in range(y + 1)] for _ in range(x + 1)] for i in range(x + 1): for j in range(y + 1): if i == 0 or j == 0: dp[i][j] = 0 elif a[i - 1] == b[j - 1]: dp[i][j] = 1 + dp[i - 1][j - 1] ...
''' WRITTEN BY Ramon Rossi PURPOSE Two strings are anagrams if you can make one from the other by rearranging the letters. The function named is_anagram takes two strings as its parameters, returning True if the strings are anagrams and False otherwise. EXAMPLE The call is_anagram("typhoon", "opyt...
""" WRITTEN BY Ramon Rossi PURPOSE Two strings are anagrams if you can make one from the other by rearranging the letters. The function named is_anagram takes two strings as its parameters, returning True if the strings are anagrams and False otherwise. EXAMPLE The call is_anagram("typhoon", "opyt...
class VSBaseModel: IGNORED_DICT_PROPS = [ 'ignored_dict_props', 'plugin', 'plugins', 'host', 'hosts', 'finding', 'findings', 'service', 'services', 'vulnerability', 'vulnerabilities' ] def __init__(self): self...
class Vsbasemodel: ignored_dict_props = ['ignored_dict_props', 'plugin', 'plugins', 'host', 'hosts', 'finding', 'findings', 'service', 'services', 'vulnerability', 'vulnerabilities'] def __init__(self): self.id = '' self.ignored_dict_props = self.IGNORED_DICT_PROPS.copy() def to_dict(self)...
program = [] with open("input.txt", "r") as file: for line in file.readlines(): program.append(line.split()) def execute(op, arg, ic, acc): # return ic change, acc change if op == "nop": return ic+1, acc if op == "jmp": return ic+int(arg), acc if op == "acc": retur...
program = [] with open('input.txt', 'r') as file: for line in file.readlines(): program.append(line.split()) def execute(op, arg, ic, acc): if op == 'nop': return (ic + 1, acc) if op == 'jmp': return (ic + int(arg), acc) if op == 'acc': return (ic + 1, acc + int(arg)) ...
""" [Weekly #19] Looking forward into 2015 - Predictions. https://www.reddit.com/r/dailyprogrammer/comments/2rfexe/weekly_19_looking_forward_into_2015_predictions/ As we enter the new year - What are some trends/predictions you see in computer science, software engineering, programming or related fields forth coming ...
""" [Weekly #19] Looking forward into 2015 - Predictions. https://www.reddit.com/r/dailyprogrammer/comments/2rfexe/weekly_19_looking_forward_into_2015_predictions/ As we enter the new year - What are some trends/predictions you see in computer science, software engineering, programming or related fields forth coming ...
# https://leetcode.com/problems/diameter-of-binary-tree/ # Given the root of a binary tree, return the length of the diameter of the tree. # The diameter of a binary tree is the length of the longest path between any two # nodes in a tree. This path may or may not pass through the root. # The length of a path betwee...
class Solution: def diameter_of_binary_tree(self, root: TreeNode) -> int: self.ans = 0 self.longest_path(root) return self.ans def longest_path(self, node): if not node: return 0 left_longest = self.longest_path(node.left) right_longest = self.longes...
class Group: def __init__(self, group_name, group_level, protocols=None): if protocols is None: protocols = {} self.name = group_name self.level = group_level self.protocols = protocols self.group_contains = set() def __contains__(self, protocol): fl...
class Group: def __init__(self, group_name, group_level, protocols=None): if protocols is None: protocols = {} self.name = group_name self.level = group_level self.protocols = protocols self.group_contains = set() def __contains__(self, protocol): fl...
"""Calculate correlation coefficient.""" def find_corr_x_y(x, y): """Calculate the correlation between x and y.""" n = len(x) prod = [] for xi, yi in zip(x, y): prod.append(xi * yi) sum_prod_x_y = sum(prod) sum_x = sum(x) sum_y = sum(y) squared_sum_x = sum_x**2 squared_sum...
"""Calculate correlation coefficient.""" def find_corr_x_y(x, y): """Calculate the correlation between x and y.""" n = len(x) prod = [] for (xi, yi) in zip(x, y): prod.append(xi * yi) sum_prod_x_y = sum(prod) sum_x = sum(x) sum_y = sum(y) squared_sum_x = sum_x ** 2 squared_s...
VARS = { 'CLIENT_SECRET_PATH': 'res/client_secret.json', 'SCOPES': 'https://www.googleapis.com/auth/spreadsheets', 'APPLICATION_NAME': 'Google Sheets API Python Quickstart', 'DISCOVERY_URL': 'https://sheets.googleapis.com/$discovery/rest?version=v4' } CONSTANTS = { 'CREDENTIALS_FILENAME': 'sheets.go...
vars = {'CLIENT_SECRET_PATH': 'res/client_secret.json', 'SCOPES': 'https://www.googleapis.com/auth/spreadsheets', 'APPLICATION_NAME': 'Google Sheets API Python Quickstart', 'DISCOVERY_URL': 'https://sheets.googleapis.com/$discovery/rest?version=v4'} constants = {'CREDENTIALS_FILENAME': 'sheets.googleapis.com-python-qui...
def sanitize_pg_array(pg_array): """ convert a array-string to a python list PG <9.0 used comma-aperated strings as array datatype. this function will convert those to list. if pg_array is not a tring, it will not be modified """ if not type(pg_array) in (str,unicode): return pg_a...
def sanitize_pg_array(pg_array): """ convert a array-string to a python list PG <9.0 used comma-aperated strings as array datatype. this function will convert those to list. if pg_array is not a tring, it will not be modified """ if not type(pg_array) in (str, unicode): return pg_ar...
def expandX1(m): c = [1] for i in range(m): c.append(c[-1] * -(m-i) / (i+1)) return c[::-1] def isPrime(m): if m < 2: return False c = expandX1(m) c[0] += 1 return not any(mul % m for mul in c[0:-1]) #----DRIVER PROGRAM---- print('\n# [for small primes]AKS TEST GAVE THE FOLLOWING ...
def expand_x1(m): c = [1] for i in range(m): c.append(c[-1] * -(m - i) / (i + 1)) return c[::-1] def is_prime(m): if m < 2: return False c = expand_x1(m) c[0] += 1 return not any((mul % m for mul in c[0:-1])) print('\n# [for small primes]AKS TEST GAVE THE FOLLOWING AS PRIMES...
class NodeofList(object): def __init__(self, value): self.value = value self.next = None def setElement(self, value): self.value = value def getElement(self): return self.value def setNext(self, next): self.next = next def g...
class Nodeoflist(object): def __init__(self, value): self.value = value self.next = None def set_element(self, value): self.value = value def get_element(self): return self.value def set_next(self, next): self.next = next def get_next(self): retur...
# V0 # V1 # https://zhuanlan.zhihu.com/p/50564246 # IDEA : TWO POINTER class Solution: def isLongPressedName(self, name, typed): """ :type name: str :type typed: str :rtype: bool """ # name's index : idx # typed's index : i idx = 0 for i...
class Solution: def is_long_pressed_name(self, name, typed): """ :type name: str :type typed: str :rtype: bool """ idx = 0 for i in range(len(typed)): if idx < len(name) and name[idx] == typed[i]: idx += 1 elif i == 0 o...
class writeDataClass(): def writeData(self,dataFiles): fileData=open("plt.dat","w") for f in range(0,len(dataFiles)): fileData.write("%s\n" % dataFiles[f]) fileData.close()
class Writedataclass: def write_data(self, dataFiles): file_data = open('plt.dat', 'w') for f in range(0, len(dataFiles)): fileData.write('%s\n' % dataFiles[f]) fileData.close()
""" Write a function that takes in an array of integers and returns a sorted array of the three largest integers in the input array. Note that the function should return duplicate integers if necessary; for example, it should return [10, 10, 12] for an input array of [10, 5, 9, 10, 12]. Sample input: [141, 1, 17, -7, ...
""" Write a function that takes in an array of integers and returns a sorted array of the three largest integers in the input array. Note that the function should return duplicate integers if necessary; for example, it should return [10, 10, 12] for an input array of [10, 5, 9, 10, 12]. Sample input: [141, 1, 17, -7, ...
discounts = [1.0, 1.0, 0.95, 0.90, 0.80, 0.75] def add(list, element, index): if len(list) < index + 1: list.append([]) if element not in list[index]: list[index].append(element) else: add(list, element, index + 1) def price(l): a = [] total_price = 0 for book in l: ...
discounts = [1.0, 1.0, 0.95, 0.9, 0.8, 0.75] def add(list, element, index): if len(list) < index + 1: list.append([]) if element not in list[index]: list[index].append(element) else: add(list, element, index + 1) def price(l): a = [] total_price = 0 for book in l: ...
# print("Please insert a number") # a = int(input("> ")) # print("Please insert another number") # b = int(input("> ")) # print("Please insert yet another number") # c = int(input("> ")) a = 4 b = 5 c = 10 if a > b: if a > c: print(a) else: print(c) else: if b > c: print(b) ...
a = 4 b = 5 c = 10 if a > b: if a > c: print(a) else: print(c) elif b > c: print(b) else: print(c)
# raider.io api configuration RIO_MAX_PAGE = 5 # need to update in templates/stats_table.html # need to update in templates/compositions.html # need to update in templates/navbar.html RIO_SEASON = "season-sl-2" WCL_SEASON = 2 WCL_PARTITION = 1 # config RAID_NAME = "Sanctum of Domination" # late in the season, se...
rio_max_page = 5 rio_season = 'season-sl-2' wcl_season = 2 wcl_partition = 1 raid_name = 'Sanctum of Domination' min_key_level = 16 max_raid_difficulty = 'Mythic'
def cipher(text, shift, encrypt=True): """ 1. Description: The Caesar cipher is one of the simplest and most widely known encryption techniques. In short, each letter is replaced by a letter some fixed number of positions down the alphabet. Apparently, Julius Caesar used it in his private correspondence. ...
def cipher(text, shift, encrypt=True): """ 1. Description: The Caesar cipher is one of the simplest and most widely known encryption techniques. In short, each letter is replaced by a letter some fixed number of positions down the alphabet. Apparently, Julius Caesar used it in his private correspondence. ...
################################################################################ # # # #=============================================================================== class CustomDict( dict ): #--------------------------------------------------------------------------- defaultValue = 'THIS ITEM NOT AVAILABLE'...
class Customdict(dict): default_value = 'THIS ITEM NOT AVAILABLE' def __getitem__(self, name): try: return super(CustomDict, self).__getitem__(name) except KeyError: return self.defaultValue def __contains__(self, name): return True def has_key(self, na...
""" Grocery List Create a program that prompts the user to continuously enter items for a grocery list. Stop asking them for items when the user enters 'quit'. Print the grocery list in a numbered format. Ask the user to enter prices for each item in the grocery list in order. Finally, ask the user how many of each...
""" Grocery List Create a program that prompts the user to continuously enter items for a grocery list. Stop asking them for items when the user enters 'quit'. Print the grocery list in a numbered format. Ask the user to enter prices for each item in the grocery list in order. Finally, ask the user how many of each...
MIDDLEWARES = ( 'middlewares.middle_a', 'middlewares.middle_b', 'middlewares.middle_c', 'middlewares.middle_d' )
middlewares = ('middlewares.middle_a', 'middlewares.middle_b', 'middlewares.middle_c', 'middlewares.middle_d')
y=200 deadtime=0 def setup(): global xs xs=[] size(400,400) stroke(0) def draw(): global xs, deadtime, y strokeWeight(5) background(169) if keyPressed and key == " " and deadtime <=0: xs.append(0) deadtime=10 deadtime -= 1 ...
y = 200 deadtime = 0 def setup(): global xs xs = [] size(400, 400) stroke(0) def draw(): global xs, deadtime, y stroke_weight(5) background(169) if keyPressed and key == ' ' and (deadtime <= 0): xs.append(0) deadtime = 10 deadtime -= 1 if keyPressed and key == '...
def checkcolor(): return [255, 240, 255] def newcolor(a, b): return 255
def checkcolor(): return [255, 240, 255] def newcolor(a, b): return 255
roles = [ { 'name': 'GK', 'description': 'Goalkeeper' }, { 'name': 'LD', 'description': 'Left Defender' }, { 'name': 'CD', 'description': 'Central Defender' }, { 'name': 'RD', 'description': 'Right Defender' }, { ...
roles = [{'name': 'GK', 'description': 'Goalkeeper'}, {'name': 'LD', 'description': 'Left Defender'}, {'name': 'CD', 'description': 'Central Defender'}, {'name': 'RD', 'description': 'Right Defender'}, {'name': 'LM', 'description': 'Left Midfielder'}, {'name': 'CM', 'description': 'Central Midfielder'}, {'name': 'RM', ...
class A: pass var = object() if isinstance(var, A) and var: pass
class A: pass var = object() if isinstance(var, A) and var: pass
# cifar10 ##################### ci7 = {'stages': 3, 'depth': 22, 'branch': 3, 'rock': 'U', 'kldloss': False, 'layers': (3, 3, 3), 'blocks': ('D', 'D', 'S'), 'slink': ('A', 'A', 'A'), 'growth': (0, 0, 0), 'classify': (0, 0, 0), 'expand': (1 * 22, 2 * 22), 'dfunc': ('O', 'O'), 'dstyle': 'maxpool', '...
ci7 = {'stages': 3, 'depth': 22, 'branch': 3, 'rock': 'U', 'kldloss': False, 'layers': (3, 3, 3), 'blocks': ('D', 'D', 'S'), 'slink': ('A', 'A', 'A'), 'growth': (0, 0, 0), 'classify': (0, 0, 0), 'expand': (1 * 22, 2 * 22), 'dfunc': ('O', 'O'), 'dstyle': 'maxpool', 'fcboost': 'none', 'nclass': 10, 'last_branch': 1, 'las...
# -*- coding: utf-8 -*- # XEP-0072: Server Version class Version: """ process and format a version query """ def __init__(self): # init all necessary variables self.software_version = None self.target, self.opt_arg = None, None def format_result(self): # list of all possible opt_arg possible_opt_args ...
class Version: """ process and format a version query """ def __init__(self): self.software_version = None (self.target, self.opt_arg) = (None, None) def format_result(self): possible_opt_args = ['version', 'os', 'name'] name = self.software_version['name'] versio...
# https://adventofcode.com/2020/day/9 infile = open('input.txt', 'r') lines = infile.readlines() infile.close() def is_valid(a: list[int], n: int): """ Check if given list has any 2 numbers which add up to the given number :param a: the list of numbers :param n: the number we search for :return: ...
infile = open('input.txt', 'r') lines = infile.readlines() infile.close() def is_valid(a: list[int], n: int): """ Check if given list has any 2 numbers which add up to the given number :param a: the list of numbers :param n: the number we search for :return: True if the list has any 2 numbers add u...
#!/usr/bin/env python __version__ = '0.0.1' __author__ = 'Fernandes Macedo' __email__ = 'masedos@gmail.com' fruits = ["Apple", "Peach", "Pear"] for fruit in fruits: print(fruit) print(fruit + " Pie") print(fruits)
__version__ = '0.0.1' __author__ = 'Fernandes Macedo' __email__ = 'masedos@gmail.com' fruits = ['Apple', 'Peach', 'Pear'] for fruit in fruits: print(fruit) print(fruit + ' Pie') print(fruits)
wt5_3_7 = {'192.168.122.110': [5.7199, 8.4411, 8.0381, 7.3759, 7.1777, 6.9974, 6.816, 6.7848, 6.811, 6.8666, 6.7605, 7.1659, 7.1058, 7.117, 7.4091, 7.3653, 7.602, 7.5046, 7.5051, 7.4195, 7.3659, 7.2974, 7.2932, 7.4615, 7.6061, 7.7395, 7.7409, 7.699, 7.6546, 7.631, 7.5707, 7.562, 7.5218, 7.4742, 7.6148, 7.5669, 7.5131,...
wt5_3_7 = {'192.168.122.110': [5.7199, 8.4411, 8.0381, 7.3759, 7.1777, 6.9974, 6.816, 6.7848, 6.811, 6.8666, 6.7605, 7.1659, 7.1058, 7.117, 7.4091, 7.3653, 7.602, 7.5046, 7.5051, 7.4195, 7.3659, 7.2974, 7.2932, 7.4615, 7.6061, 7.7395, 7.7409, 7.699, 7.6546, 7.631, 7.5707, 7.562, 7.5218, 7.4742, 7.6148, 7.5669, 7.5131, ...
insert_sensor_schema = { "$schema": "http://json-schema.org/draft-07/schema#", "title": "insert-sensor-schema", "description": "Schema for inserting new sensor readings", "type": "object", "properties": { "temperature": { "$id": "/properties/temperature", "type": "num...
insert_sensor_schema = {'$schema': 'http://json-schema.org/draft-07/schema#', 'title': 'insert-sensor-schema', 'description': 'Schema for inserting new sensor readings', 'type': 'object', 'properties': {'temperature': {'$id': '/properties/temperature', 'type': 'number', 'title': 'A temperature reading (in celsius)', 'e...
# Copyright (C) 2022 Google Inc. # # 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, ...
"""starlark marcors to generate test suites.""" _template = 'package {VAR_PACKAGE};\nimport org.junit.runners.Suite;\nimport org.junit.runner.RunWith;\n\n@RunWith(Suite.class)\n@Suite.SuiteClasses({{{VAR_CLASSES}}})\npublic class {VAR_NAME} {{}}\n' def _impl(ctx): classes = ','.join(sorted(ctx.attr.test_classes)) ...