content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
entrada = input() def fibonacci(n): fib = [0, 1, 1] if n > 0 and n <= 2: return fib[1] elif n == 0: return fib[0] else: for x in range(3, n+1): fib.append(0) fib[x] = fib[x-1] + fib[x-2] return fib[n] numeros = entrada.split(' ') numeros = l...
entrada = input() def fibonacci(n): fib = [0, 1, 1] if n > 0 and n <= 2: return fib[1] elif n == 0: return fib[0] else: for x in range(3, n + 1): fib.append(0) fib[x] = fib[x - 1] + fib[x - 2] return fib[n] numeros = entrada.split(' ') numeros = l...
class AXFundAddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
class Axfundaddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
class Usuario(object): def __init__(self, email='', senha=''): self.email = email self.senha = senha def __str__(self): return f'{self.email}' class Equipe(object): def __init__(self, nome='', sigla='', local=''): self.nome = nome self.sigla = sigla self....
class Usuario(object): def __init__(self, email='', senha=''): self.email = email self.senha = senha def __str__(self): return f'{self.email}' class Equipe(object): def __init__(self, nome='', sigla='', local=''): self.nome = nome self.sigla = sigla self.l...
''' | Write a program that should prompt the user to type some sentences. It should then print number of words, number of characters, number of digits and number of special characters in it. | |------------------------------------------------------------------------------------------------------------------------------...
""" | Write a program that should prompt the user to type some sentences. It should then print number of words, number of characters, number of digits and number of special characters in it. | |------------------------------------------------------------------------------------------------------------------------------...
def problem1_1(): print("Problem Set 1") pass # replace this pass (a do-nothing) statement with your code
def problem1_1(): print('Problem Set 1') pass
# # PySNMP MIB module CTRON-SSR-CONFIG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SSR-CONFIG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:15:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) ...
seats = [] with open("input.txt") as f: for line in f: line = line.replace("\n", "") seat = {} seat["raw"] = line seat["row"] = int(seat["raw"][:7].replace("F", "0").replace("B", "1"), 2) seat["column"] = int(seat["raw"][-3:].replace("L", "0").replace("R", "1"), 2) s...
seats = [] with open('input.txt') as f: for line in f: line = line.replace('\n', '') seat = {} seat['raw'] = line seat['row'] = int(seat['raw'][:7].replace('F', '0').replace('B', '1'), 2) seat['column'] = int(seat['raw'][-3:].replace('L', '0').replace('R', '1'), 2) se...
class MLModelInterface: def fit(self, features, labels): raise NotImplementedError def predict(self, data): raise NotImplementedError class KNeighborsClassifier(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class LinearRegres...
class Mlmodelinterface: def fit(self, features, labels): raise NotImplementedError def predict(self, data): raise NotImplementedError class Kneighborsclassifier(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class Linearregres...
{ "targets": [ { "target_name": "gpio", "sources": ["gpio.cc", "tizen-gpio.cc"] } ] }
{'targets': [{'target_name': 'gpio', 'sources': ['gpio.cc', 'tizen-gpio.cc']}]}
songs = { ('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('Miles Davis', 'Stella by Starlight'), ('Nickelback', 'Animals') } # Using a set comprehension, create a new set that contains all songs that were not performed by Nickelback. nonNickelback = {}
songs = {('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('Miles Davis', 'Stella by Starlight'), ('Nickelback', 'Animals')} non_nickelback = {}
file1 = open("./logs/pythonlog.txt", 'r+') avg1 = 0.0 lines1 = 0.0 for line in file1: lines1 = lines1 + 1.0 avg1 = (avg1 + float(line)) avg1 = avg1/lines1 print(avg1, "for Python with", lines1, "lines") file2 = open("./logs/clog.txt", 'r+') avg2 = 0.0 lines2 = 0.0 for line in file2: lines2 = lines2 + 1.0 ...
file1 = open('./logs/pythonlog.txt', 'r+') avg1 = 0.0 lines1 = 0.0 for line in file1: lines1 = lines1 + 1.0 avg1 = avg1 + float(line) avg1 = avg1 / lines1 print(avg1, 'for Python with', lines1, 'lines') file2 = open('./logs/clog.txt', 'r+') avg2 = 0.0 lines2 = 0.0 for line in file2: lines2 = lines2 + 1.0 ...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: if head is None: return None # 1 - check cycle p1 = head p2 = head.next ...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def detect_cycle(self, head: ListNode) -> ListNode: if head is None: return None p1 = head p2 = head.next has_cycle = False while p2 is not None and p2.next...
#!/usr/bin/python def add(a,b): return a+b def sub(a,b): return a-b def mul(a,b): return a*b def div(a,b): return a/b a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) print("Please select operation : \n" \ "1. Addition \n" \ "2. Subtraction \n" \ ...
def add(a, b): return a + b def sub(a, b): return a - b def mul(a, b): return a * b def div(a, b): return a / b a = int(input('Enter first number: ')) b = int(input('Enter second number: ')) print('Please select operation : \n1. Addition \n2. Subtraction \n3. Multiplication \n4. Division \n') select ...
# The classroom scheduling problem # Suppose you have a classroom and you want to hold as many classes as possible # __________________________ #| class | start | end | #|_______|_________|________| #| Art | 9:00 am | 10:30am| #|_______|_________|________| #| Eng | 9:30am | 10:30am| #|_______|_________|_____...
def schedule(classes): possible_classes = [] possible_classes.append(classes[0]) print(possible_classes) for i in range(2, len(classes)): if possible_classes[-1][1] <= classes[i][0]: possible_classes.append(classes[i]) return possible_classes
class restaurantvalidator(): def valideaza(self, restaurant): erori = [] if len(restaurant.nume) == 0: erori.append('numele nu trb sa fie null') if erori: raise ValueError(erori)
class Restaurantvalidator: def valideaza(self, restaurant): erori = [] if len(restaurant.nume) == 0: erori.append('numele nu trb sa fie null') if erori: raise value_error(erori)
OVERALL_CATEGORY_ID = '0x02E00000FFFFFFFF' HERO_CATEGORY_IDS = { 'reaper': '0x02E0000000000002', 'tracer': '0x02E0000000000003', 'mercy': '0x02E0000000000004', 'hanzo': '0x02E0000000000005', 'torbjorn': '0x02E0000000000006', 'reinhardt': '0x02E0000000000007', 'pharah': '0x02E0000000000008',...
overall_category_id = '0x02E00000FFFFFFFF' hero_category_ids = {'reaper': '0x02E0000000000002', 'tracer': '0x02E0000000000003', 'mercy': '0x02E0000000000004', 'hanzo': '0x02E0000000000005', 'torbjorn': '0x02E0000000000006', 'reinhardt': '0x02E0000000000007', 'pharah': '0x02E0000000000008', 'winston': '0x02E000000000000...
class Section: def get_display_text(self): pass def get_children(self): pass
class Section: def get_display_text(self): pass def get_children(self): pass
def solution(prices): if len(prices) == 0: return 0 # We are always paying the first price. total = prices[0] min_price = prices[0] for i in range(1, len(prices)): if prices[i] > min_price: total += prices[i] - min_price if prices[i] < min_price: min_p...
def solution(prices): if len(prices) == 0: return 0 total = prices[0] min_price = prices[0] for i in range(1, len(prices)): if prices[i] > min_price: total += prices[i] - min_price if prices[i] < min_price: min_price = prices[i] return total def num_d...
# /////////////////////////////////////////////////////////////////////////// # # # # /////////////////////////////////////////////////////////////////////////// class GLLight: def __init__(self, pos=(0.0,0.0,0.0), color=(1.0,1.0,1.0)): self.pos = pos self.color = color self.ambient = (1.0...
class Gllight: def __init__(self, pos=(0.0, 0.0, 0.0), color=(1.0, 1.0, 1.0)): self.pos = pos self.color = color self.ambient = (1.0, 1.0, 1.0) self.diffuse = (1.0, 1.0, 1.0) self.constant = 1.0 self.linear = 0.09 self.quadratic = 0.032
def splitbylength(wordlist): initlen = len(wordlist[0]) lastlen = len(wordlist[-1]) splitlist = [] for i in range(initlen, lastlen+1): curlist = [] for x in wordlist: if len(x) == i: curlist.append(x.capitalize()) splitlist.append(sorte...
def splitbylength(wordlist): initlen = len(wordlist[0]) lastlen = len(wordlist[-1]) splitlist = [] for i in range(initlen, lastlen + 1): curlist = [] for x in wordlist: if len(x) == i: curlist.append(x.capitalize()) splitlist.append(sorted(curlist)) ...
if __name__ == '__main__': checksum = 0 while True: try: numbers = input() except EOFError: break numbers = map(int, numbers.split('\t')) numbers = sorted(numbers) checksum += numbers[-1] - numbers[0] print(checksum)
if __name__ == '__main__': checksum = 0 while True: try: numbers = input() except EOFError: break numbers = map(int, numbers.split('\t')) numbers = sorted(numbers) checksum += numbers[-1] - numbers[0] print(checksum)
# # PySNMP MIB module ITOUCH-RADIUS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ITOUCH-RADIUS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:47:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ...
hyper_params = { 'weight_decay': float(1e-6), 'epochs': 30, 'batch_size': 256, 'validate_every': 3, 'early_stop': 3, 'max_seq_len': 10, }
hyper_params = {'weight_decay': float(1e-06), 'epochs': 30, 'batch_size': 256, 'validate_every': 3, 'early_stop': 3, 'max_seq_len': 10}
# 1073 n = int(input()) if 5 < n < 2000: for i in range(2, n + 1, 2): print("{}^{} = {}".format(i, 2, i ** 2))
n = int(input()) if 5 < n < 2000: for i in range(2, n + 1, 2): print('{}^{} = {}'.format(i, 2, i ** 2))
class BinaryIndexedTree(object): def __init__(self): self.BITTree = [0] # Returns sum of arr[0..index]. This function assumes # that the array is preprocessed and partial sums of # array elements are stored in BITree[]. def getsum(self, i): s = 0 # initialize result # inde...
class Binaryindexedtree(object): def __init__(self): self.BITTree = [0] def getsum(self, i): s = 0 i = i + 1 while i > 0: s += self.BITTree[i] i -= i & -i return s def get_sum(self, a, b): return self.getsum(b) - self.getsum(a - 1) i...
s = input() t = int(input()) xy = [0, 0] cnt = 0 for i in range(len(s)): if s[i] == 'U': xy[1] += 1 elif s[i] == 'D': xy[1] -= 1 elif s[i] == 'R': xy[0] += 1 elif s[i] == 'L': xy[0] -= 1 else: cnt += 1 ans = abs(xy[0]) + abs(xy[1]) if t == 1: ans += cnt else: if ans >= cnt: ans -= ...
s = input() t = int(input()) xy = [0, 0] cnt = 0 for i in range(len(s)): if s[i] == 'U': xy[1] += 1 elif s[i] == 'D': xy[1] -= 1 elif s[i] == 'R': xy[0] += 1 elif s[i] == 'L': xy[0] -= 1 else: cnt += 1 ans = abs(xy[0]) + abs(xy[1]) if t == 1: ans += cnt el...
class Solution: def intToRoman(self, num: int) -> str: convertor = [ ["","M", "MM", "MMM"], ["","C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"], ["","X", "XX", "XXX", "XL", "L", "LX","LXX","LXXX", "XC"], ["","I","II","III","IV","V","VI","VII","VIII","I...
class Solution: def int_to_roman(self, num: int) -> str: convertor = [['', 'M', 'MM', 'MMM'], ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'], ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'], ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']] return convertor[0]...
# 2. Multiples List # Write a program that receives two numbers (factor and count) and creates a list with length of the given count # and contains only elements that are multiples of the given factor. factor = int(input()) count = int(input()) list = [] for counter in range(1, count+1): list.append(factor * cou...
factor = int(input()) count = int(input()) list = [] for counter in range(1, count + 1): list.append(factor * counter) print(list)
# # PySNMP MIB module H3C-IPSEC-MONITOR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-IPSEC-MONITOR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:09:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ...
# # PySNMP MIB module CISCO-CAS-IF-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CAS-IF-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:35:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sortedArrayToBST(self, nums) -> TreeNode: def func(left, right) -> TreeNode: if left > right: return None ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sorted_array_to_bst(self, nums) -> TreeNode: def func(left, right) -> TreeNode: if left > right: return None mid = (left + right)...
class Solution: def isPalindrome(self, s: str) -> bool: lo, hi = 0, len(s) - 1 while lo < hi: if not s[lo].isalnum(): lo += 1 elif not s[hi].isalnum(): hi -= 1 else: if s[lo].lower() != s[hi].lower(): ...
class Solution: def is_palindrome(self, s: str) -> bool: (lo, hi) = (0, len(s) - 1) while lo < hi: if not s[lo].isalnum(): lo += 1 elif not s[hi].isalnum(): hi -= 1 else: if s[lo].lower() != s[hi].lower(): ...
# Change these values and rename this file to "settings_secret.py" # SECURITY WARNING: If you are using this in production, do NOT use the default SECRET KEY! # See: https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-SECRET_KEY SECRET_KEY = '!!super_secret!!' # https://docs.djangoproject.com/en/3.0/ref/se...
secret_key = '!!super_secret!!' allowed_hosts = ['*']
def maxPower(s: str) -> int: if not s or len(s) == 0: return 0 result = 1 temp_result = 1 curr = s[0] for c in s[1:]: if c == curr: temp_result += 1 else: result = max(result, temp_result) temp_result = 1 curr = c ...
def max_power(s: str) -> int: if not s or len(s) == 0: return 0 result = 1 temp_result = 1 curr = s[0] for c in s[1:]: if c == curr: temp_result += 1 else: result = max(result, temp_result) temp_result = 1 curr = c return ma...
class data: def __init__(self): self._ = {} def set(self, key, data_): self._[key] = data_ return data_ def get(self, key): if key in self._: return self._[key] else: return False
class Data: def __init__(self): self._ = {} def set(self, key, data_): self._[key] = data_ return data_ def get(self, key): if key in self._: return self._[key] else: return False
#This application is supposed to mimics #a seat reservation system for a bus company #or railroad like Amtrak or Greyhound. class Seat: def __init__(self): self.first_name = '' self.last_name = '' self.paid = False def reserve(self, fn, ln, pd): self.first_name = fn se...
class Seat: def __init__(self): self.first_name = '' self.last_name = '' self.paid = False def reserve(self, fn, ln, pd): self.first_name = fn self.last_name = ln self.paid = pd def make_empty(self): self.first_name = '' self.last_name = '' ...
# author: elia deppe # date 6/4/21 # # simple password confirmation program that confirms a password of size 12 to 48, with at least: one lower-case letter # one upper-case letter, one number, and one special character. # constants MIN_LENGTH, MAX_LENGTH = 8, 48 # min and max length of password # dictionaries LO...
(min_length, max_length) = (8, 48) (lower_case, upper_case) = ('abcdefghijklmnopqrstuvwxz', 'ABCDEFGHJKLMNOPQRSTUVWXYZ') (numbers, special_chars) = ('0123456789', '!@#$%^&()-_+=[{]}|:;<,>.?/') full_dictionary = LOWER_CASE + UPPER_CASE + NUMBERS + SPECIAL_CHARS def get_password(): password = input('>> password\n>> ...
# Copyright 2010 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 ...
crc_table = [] for n in range(256): c = n for k in range(8): if c & 1: c = 3988292384 ^ c >> 1 else: c >>= 1 CRC_TABLE.append(c) def png_crc32(string): crc = 4294967295 for char in string: crc = CRC_TABLE[crc & 255 ^ ord(char)] ^ crc >> 8 return c...
FORMAT_MSG_HIGH_ALERT = "High traffic generated an alert - hits = %s, triggered at %s" FORMAT_MSG_RECOVERED_ALERT = "Traffic recovered - hits = %s, triggered at %s" HIGHEST_HITS_HEADER = "Highest hits" ALERTS_HEADER = "Alerts"
format_msg_high_alert = 'High traffic generated an alert - hits = %s, triggered at %s' format_msg_recovered_alert = 'Traffic recovered - hits = %s, triggered at %s' highest_hits_header = 'Highest hits' alerts_header = 'Alerts'
model = dict( type='ImageClassifier', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3, ), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict( type='LinearClsHead', num_classes=1000, in_channels=2048, ...
model = dict(type='ImageClassifier', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=2048, loss=dict(type='CrossEntropyLoss', loss_weight=1.0), topk=(1, 5))) dataset_type = 'Ima...
float_num = 3.14159265 # float_num is a variable which has been assigned a float print(type(float_num)) # prints the type of float_num print(str(float_num) + " is a float") # prints "3.14159265 is a float" print("\"Hello, I'm Leonardo, nice to meet you!\"")
float_num = 3.14159265 print(type(float_num)) print(str(float_num) + ' is a float') print('"Hello, I\'m Leonardo, nice to meet you!"')
x = 3 y = 12.5 print('The rabbit is ', x, '.', sep='') print('The rabbit is', x, 'years old.') print(y, 'is average.') print(y, ' * ', x, '.', sep='') print(y, ' * ', x, ' is ', x*y, '.', sep='')
x = 3 y = 12.5 print('The rabbit is ', x, '.', sep='') print('The rabbit is', x, 'years old.') print(y, 'is average.') print(y, ' * ', x, '.', sep='') print(y, ' * ', x, ' is ', x * y, '.', sep='')
name = 'ConsulClient' __author__ = 'Rodrigo Alejandro Loza Lucero / lozuwaucb@gmail.com' __version__ = '0.1.0' __log__ = 'Consul api client for python'
name = 'ConsulClient' __author__ = 'Rodrigo Alejandro Loza Lucero / lozuwaucb@gmail.com' __version__ = '0.1.0' __log__ = 'Consul api client for python'
# Copyright 2012 Dietrich Epp <depp@zdome.net> # See LICENSE.txt for details. @test def skip_this(): skip() @test def pass_this(): pass @test def skip_rest(): skip_module() @test def fail_this(): fail("shouldn't get here")
@test def skip_this(): skip() @test def pass_this(): pass @test def skip_rest(): skip_module() @test def fail_this(): fail("shouldn't get here")
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > counter else counter
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > c...
class TransportType: NAPALM = "napalm" NCCLIENT = "ncclient" NETMIKO = "netmiko" class DeviceType: IOS = "ios" NXOS = "nxos" NXOS_SSH = "nxos_ssh" NEXUS = "nexus" CISCO_NXOS = "cisco_nxos"
class Transporttype: napalm = 'napalm' ncclient = 'ncclient' netmiko = 'netmiko' class Devicetype: ios = 'ios' nxos = 'nxos' nxos_ssh = 'nxos_ssh' nexus = 'nexus' cisco_nxos = 'cisco_nxos'
inf = 100000 def dijkstra(src, dest, graph: list[list], matrix: list[list]): number_of_nodes = len(matrix) visitors = [0 for i in range(len(matrix))] previous = [-1 for i in range(len(matrix))] distances = [inf for i in range(len(matrix))] distances[src] = 0 current_node = getPriority(distan...
inf = 100000 def dijkstra(src, dest, graph: list[list], matrix: list[list]): number_of_nodes = len(matrix) visitors = [0 for i in range(len(matrix))] previous = [-1 for i in range(len(matrix))] distances = [inf for i in range(len(matrix))] distances[src] = 0 current_node = get_priority(distance...
# process local states local = range(12) # L states L = {"x0" : [6], "x1" : [7], "x2" : [8], "f0" : [9], "f1" : [10], "f2" : [11], "v0" : [0, 3, 6, 9], "v1" : [1, 4, 7, 10], "v2" : [2, 5, 8, 11], "corr0" : [0, 6], "corr1" : [1, 7], "corr2" : [2, 8]} # receive variables rcv_vars = ["nr0", "nr1", "nr2"] #...
local = range(12) l = {'x0': [6], 'x1': [7], 'x2': [8], 'f0': [9], 'f1': [10], 'f2': [11], 'v0': [0, 3, 6, 9], 'v1': [1, 4, 7, 10], 'v2': [2, 5, 8, 11], 'corr0': [0, 6], 'corr1': [1, 7], 'corr2': [2, 8]} rcv_vars = ['nr0', 'nr1', 'nr2'] initial = local rules = [] rules.append({'idx': 0, 'from': 0, 'to': 0, 'guard': '(a...
class Solution: def removeDuplicates(self, nums: List[int]) -> int: l = len(nums) if l == 1: return 1 index = 1 num = nums[0] for i in range(1, l): if nums[i] == num: continue num = nums[i]...
class Solution: def remove_duplicates(self, nums: List[int]) -> int: l = len(nums) if l == 1: return 1 index = 1 num = nums[0] for i in range(1, l): if nums[i] == num: continue num = nums[i] nums[index] = nums[i...
''' Define constraints (depends on your problem) https://stackoverflow.com/questions/42303470/scipy-optimize-inequality-constraint-which-side-of-the-inequality-is-considered [0.1268 0.467 0.5834 0.2103 -0.1268 -0.5425 -0.5096 0.0581] . The bounds are +/-30% of this. ''' t_base = [0.1268, 0.467, 0.5834, 0.2103, -0.1268...
""" Define constraints (depends on your problem) https://stackoverflow.com/questions/42303470/scipy-optimize-inequality-constraint-which-side-of-the-inequality-is-considered [0.1268 0.467 0.5834 0.2103 -0.1268 -0.5425 -0.5096 0.0581] . The bounds are +/-30% of this. """ t_base = [0.1268, 0.467, 0.5834, 0.2103, -0.1268,...
__key_mapping = { 'return' : 'enter', 'up_arrow' : 'up', 'down_arrow' : 'down', 'left_arrow' : 'left', 'right_arrow' : 'right', 'page_up' : 'pageup', 'page_down' : 'pagedown', } def translate_key(e): if len(e.key) > 0: return __key_mapping[e.key] if e.key in __key_mapping e...
__key_mapping = {'return': 'enter', 'up_arrow': 'up', 'down_arrow': 'down', 'left_arrow': 'left', 'right_arrow': 'right', 'page_up': 'pageup', 'page_down': 'pagedown'} def translate_key(e): if len(e.key) > 0: return __key_mapping[e.key] if e.key in __key_mapping else e.key elif e.char == '\x08': ...
class Solution: def wordPattern(self, pattern: str, str: str) -> bool: lst = str.split() combo = zip(pattern, lst) return len(set(pattern)) == len(set(lst)) == len(set(combo)) and len(pattern) == len(lst)
class Solution: def word_pattern(self, pattern: str, str: str) -> bool: lst = str.split() combo = zip(pattern, lst) return len(set(pattern)) == len(set(lst)) == len(set(combo)) and len(pattern) == len(lst)
soma_idade=0 media_Idade=0 maior_idade_homem=0 nome_velho='' tot_mulher_20=0 for i in range(0,4): nome=str(input('Nome: ')).strip() idade=int(input('Idade: ')) sexo=str(input('Sexo: ')).strip() soma_idade+=idade if i==1 and sexo in 'Mm': maior_idade_homem=idade nome_velho=nome el...
soma_idade = 0 media__idade = 0 maior_idade_homem = 0 nome_velho = '' tot_mulher_20 = 0 for i in range(0, 4): nome = str(input('Nome: ')).strip() idade = int(input('Idade: ')) sexo = str(input('Sexo: ')).strip() soma_idade += idade if i == 1 and sexo in 'Mm': maior_idade_homem = idade ...
# Copyright (c) 2020 Samplasion <samplasion@gmail.com> # # This software is released under the MIT License. # https://opensource.org/licenses/MIT TARGET = 2020 def main(): print("=============") print("= AoC Day 1 =") print("=============") print() with open("input.txt") as f: file = f.r...
target = 2020 def main(): print('=============') print('= AoC Day 1 =') print('=============') print() with open('input.txt') as f: file = f.read() numbers = sorted(list(map(int, file.split('\n')))) phase1(numbers) phase2(numbers) def phase1(numbers): min = 0 ...
SCHEMA = { # staff-and-student-information "all_students_count": "{short_code}PETALLC", "african_american_count": "{short_code}PETBLAC", "african_american_percent": "{short_code}PETBLAP", "american_indian_count": "{short_code}PETINDC", "american_indian_percent": "{short_code}PETINDP", "asian...
schema = {'all_students_count': '{short_code}PETALLC', 'african_american_count': '{short_code}PETBLAC', 'african_american_percent': '{short_code}PETBLAP', 'american_indian_count': '{short_code}PETINDC', 'american_indian_percent': '{short_code}PETINDP', 'asian_count': '{short_code}PETASIC', 'asian_percent': '{short_code...
# This problem was asked by Facebook. # Given an array of numbers representing the stock prices of a company in chronological # order and an integer k, return the maximum profit you can make from k buys and sells. # You must buy the stock before you can sell it, and you must sell the stock before you can buy it again...
def get_max_profit(arr, k): a = arr + [-1] current_min = a[0] current_max = a[0] ends = [] for i in range(1, len(a)): if a[i] > current_max: current_max = a[i] if a[i] < current_max and current_max != current_min: ends.append((current_min, current_max)) ...
def file_html(fname): fptr=open(fname,"r") to_send = "" for lines in fptr: to_send += lines; return to_send #file_html("myfile.html");
def file_html(fname): fptr = open(fname, 'r') to_send = '' for lines in fptr: to_send += lines return to_send
md = [0,0] facing = "E" def rotate(cw, val): idx = 4 + cw * int((val/90) % 4) mv = ['E','S','W','N'] c = mv.index(facing) return mv[(idx + c) % 4] def move(dr, val): global ew global ns global facing if dr == 'N': md[1] += val elif dr == 'S': md[1] -= val ...
md = [0, 0] facing = 'E' def rotate(cw, val): idx = 4 + cw * int(val / 90 % 4) mv = ['E', 'S', 'W', 'N'] c = mv.index(facing) return mv[(idx + c) % 4] def move(dr, val): global ew global ns global facing if dr == 'N': md[1] += val elif dr == 'S': md[1] -= val el...
for _ in range(int(input())): n,x = map(int,input().split()) l = list(map(int,input().split())) flag=2 if len(set(l)) == 1 and l[0] == x: flag=0 elif x in l or sum([i-x for i in l])==0: flag=1 if flag==0: print(0) elif flag==1: print(1) else: print...
for _ in range(int(input())): (n, x) = map(int, input().split()) l = list(map(int, input().split())) flag = 2 if len(set(l)) == 1 and l[0] == x: flag = 0 elif x in l or sum([i - x for i in l]) == 0: flag = 1 if flag == 0: print(0) elif flag == 1: print(1) ...
#!/usr/bin/env python # configure these settings to change projector behavior server_mount_path = '//192.168.42.11/PiShare' # shared folder on other pi user_name = 'pi' # shared drive login user name user_password = 'raspberry' # shared drive login password client_mount_path = '/mnt/pishare' # where to find the shared...
server_mount_path = '//192.168.42.11/PiShare' user_name = 'pi' user_password = 'raspberry' client_mount_path = '/mnt/pishare' pics_folder = '/mnt/pishare/pics' waittime = 2 use_prime = True prime_slide = '/home/pi/photobooth/projector.png' prime_freq = 16 monitor_w = 800 monitor_h = 600 title = 'SlideShow'
data = ( 'E ', # 0x00 'Cheng ', # 0x01 'Xin ', # 0x02 'Ai ', # 0x03 'Lu ', # 0x04 'Zhui ', # 0x05 'Zhou ', # 0x06 'She ', # 0x07 'Pian ', # 0x08 'Kun ', # 0x09 'Tao ', # 0x0a 'Lai ', # 0x0b 'Zong ', # 0x0c 'Ke ', # 0x0d 'Qi ', # 0x0e 'Qi ', # 0x0f 'Yan ', # 0x10 'Fei '...
data = ('E ', 'Cheng ', 'Xin ', 'Ai ', 'Lu ', 'Zhui ', 'Zhou ', 'She ', 'Pian ', 'Kun ', 'Tao ', 'Lai ', 'Zong ', 'Ke ', 'Qi ', 'Qi ', 'Yan ', 'Fei ', 'Sao ', 'Yan ', 'Jie ', 'Yao ', 'Wu ', 'Pian ', 'Cong ', 'Pian ', 'Qian ', 'Fei ', 'Huang ', 'Jian ', 'Huo ', 'Yu ', 'Ti ', 'Quan ', 'Xia ', 'Zong ', 'Kui ', 'Rou ', 'Si...
def remove_duplicated_keep_order(value_in_tuple): new_tuple = [] for i in value_in_tuple: if not (i in new_tuple): new_tuple.append(i) return new_tuple # return tuple(set(value_in_tuple))
def remove_duplicated_keep_order(value_in_tuple): new_tuple = [] for i in value_in_tuple: if not i in new_tuple: new_tuple.append(i) return new_tuple
# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): return { _ASTROPY_PACKAGE_NAME_ + '.tests': ['coveragerc', 'data/*.hdr'] # noqa }
def get_package_data(): return {_ASTROPY_PACKAGE_NAME_ + '.tests': ['coveragerc', 'data/*.hdr']}
exp.set('total_responses', 0) exp.set('total_correct', 0) exp.set('total_response_time', 0) exp.set('average_response_time', 'NA') exp.set('avg_rt', 'NA') exp.set('accuracy', 'NA') exp.set('acc', 'NA')
exp.set('total_responses', 0) exp.set('total_correct', 0) exp.set('total_response_time', 0) exp.set('average_response_time', 'NA') exp.set('avg_rt', 'NA') exp.set('accuracy', 'NA') exp.set('acc', 'NA')
def exception_test(assert_check_fn): try: def exception_wrapper(*arg, **kwarg): assert_check_fn(*arg, **kwarg) except Exception as e: pytest.failed(e)
def exception_test(assert_check_fn): try: def exception_wrapper(*arg, **kwarg): assert_check_fn(*arg, **kwarg) except Exception as e: pytest.failed(e)
def green(text): return f"\033[92m{text}\033[0m" def yellow(text): return f"\033[93m{text}\033[0m"
def green(text): return f'\x1b[92m{text}\x1b[0m' def yellow(text): return f'\x1b[93m{text}\x1b[0m'
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...', 'C':'-.-.', 'D':'-..', 'E':'.', 'F':'..-.', 'G':'--.', 'H':'....', 'I':'..', 'J':'.---', 'K':'-.-', 'L':'.-..', 'M':'--', 'N':'-.', 'O':'---', 'P':'.--.', 'Q':'--.-', ...
morse_code_dict = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--'...
# -*- coding: utf-8 -*- class MyClass: # The __init__ method doesn't return anything, so it gets return # type None just like any other method that doesn't return anything. def __init__(self) -> None: ... # For instance methods, omit `self`. def my_class_method(self, num: int, str1: str) -> str: ...
class Myclass: def __init__(self) -> None: ... def my_class_method(self, num: int, str1: str) -> str: return num * str1 x = my_class()
expected_output = { "bridge_group": { "D": { "bridge_domain": { "D-w": { "ac": { "num_ac": 1, "num_ac_up": 1 }, "id": 0, "pbb": { ...
expected_output = {'bridge_group': {'D': {'bridge_domain': {'D-w': {'ac': {'num_ac': 1, 'num_ac_up': 1}, 'id': 0, 'pbb': {'num_pbb': 0, 'num_pbb_up': 0}, 'pw': {'num_pw': 1, 'num_pw_up': 1}, 'state': 'up', 'vni': {'num_vni': 0, 'num_vni_up': 0}}}}, 'GO-LEAFS': {'bridge_domain': {'GO': {'ac': {'num_ac': 3, 'num_ac_up': ...
INPUT_TO_DWI_CONVERSION_EDGES = [("dwi_file", "in_file")] INPUT_TO_FMAP_CONVERSION_EDGES = [("fmap_file", "in_file")] LOCATE_ASSOCIATED_TO_COVERSION_EDGES = [ ("json_file", "json_import"), ("bvec_file", "in_bvec"), ("bval_file", "in_bval"), ] DWI_CONVERSION_TO_OUTPUT_EDGES = [("out_file", "dwi_file")] FMAP...
input_to_dwi_conversion_edges = [('dwi_file', 'in_file')] input_to_fmap_conversion_edges = [('fmap_file', 'in_file')] locate_associated_to_coversion_edges = [('json_file', 'json_import'), ('bvec_file', 'in_bvec'), ('bval_file', 'in_bval')] dwi_conversion_to_output_edges = [('out_file', 'dwi_file')] fmap_conversion_to_o...
almacen_api_config = { 'debug': { 'name': 'almacen_api', 'database': 'stage_01', 'debug': True, 'app': { 'DEBUG': True, 'UPLOAD_FOLDER': '/tmp', }, 'run': { # 'ssl_context': ('ssl/cert.pem', 'ssl/key.pem'), 'port': 8000, }, 'app_tokens': { 'TOKEN': { ...
almacen_api_config = {'debug': {'name': 'almacen_api', 'database': 'stage_01', 'debug': True, 'app': {'DEBUG': True, 'UPLOAD_FOLDER': '/tmp'}, 'run': {'port': 8000}, 'app_tokens': {'TOKEN': {'app': 'development', 'roles': ['super', 'tagger']}, 'TOKEN': {'app': 'longcat_api', 'roles': ['tagger']}}}, 'development': {'nam...
a=1 def change_integer(a): a = a+1 return a print (change_integer(a)) print (a) b=[1,2,3] def change_list(b): b[0]=b[0]+1 return b print (change_list(b)) print (b)
a = 1 def change_integer(a): a = a + 1 return a print(change_integer(a)) print(a) b = [1, 2, 3] def change_list(b): b[0] = b[0] + 1 return b print(change_list(b)) print(b)
number_1 = int(input()) number_2 = int(input()) if number_1 >= number_2: print(number_1) print(number_2) else: print(number_2) print(number_1)
number_1 = int(input()) number_2 = int(input()) if number_1 >= number_2: print(number_1) print(number_2) else: print(number_2) print(number_1)
#!/usr/bin/env python3 # CHECKED A = [[4.5, -1, -1, 1], [-1, 4.5, 1, -1], [-1, 2, 4.5, -1], [2, -1, -1, 4.5]] b = [1, -1, -1, 0] x = [0.25, 0.25, 0.25, 0.25] x_new = [0, 0, 0, 0] for k in range(2): for i in range(4): x_new[i] = b[i] for j in range(4): if j != i: x_new[...
a = [[4.5, -1, -1, 1], [-1, 4.5, 1, -1], [-1, 2, 4.5, -1], [2, -1, -1, 4.5]] b = [1, -1, -1, 0] x = [0.25, 0.25, 0.25, 0.25] x_new = [0, 0, 0, 0] for k in range(2): for i in range(4): x_new[i] = b[i] for j in range(4): if j != i: x_new[i] -= A[i][j] * x[j] x_new[i...
class Solution: # @param num : a list of integer # @return : a list of integer def nextPermutation(self, num): # write your code here # Version 1 bp = -1 for i in range(len(num) - 1): if (num[i] < num[i + 1]): bp = i if (bp == -1): ...
class Solution: def next_permutation(self, num): bp = -1 for i in range(len(num) - 1): if num[i] < num[i + 1]: bp = i if bp == -1: num.reverse() return num rest = num[bp:] local_max = None for i in rest: ...
X = int(input()) a_list = [] for s in range(1, 32): for i in range(2, 10): a = s ** i if a > 1000: break a_list.append(a) a2 = sorted(list(set(a_list)), reverse=True) for n in a2: if n <= X: print(n) break
x = int(input()) a_list = [] for s in range(1, 32): for i in range(2, 10): a = s ** i if a > 1000: break a_list.append(a) a2 = sorted(list(set(a_list)), reverse=True) for n in a2: if n <= X: print(n) break
def presentacion_inicial(): print("*"*20) print("Que accion desea realizar : ") print("1) Insertar Persona : ") print("2) Insertar Empleado : ") print("3) Consultar las personas : ") print("4) Consultar por empleados : ") return int(input("Opcion necesitas : "))
def presentacion_inicial(): print('*' * 20) print('Que accion desea realizar : ') print('1) Insertar Persona : ') print('2) Insertar Empleado : ') print('3) Consultar las personas : ') print('4) Consultar por empleados : ') return int(input('Opcion necesitas : '))
load("@io_bazel_rules_docker//go:image.bzl", go_image_repositories="repositories") load("@io_bazel_rules_docker//container:container.bzl", container_repositories = "repositories") def initialize_rules_docker(): container_repositories() go_image_repositories() load("@distroless//package_manager:package_manager.bzl"...
load('@io_bazel_rules_docker//go:image.bzl', go_image_repositories='repositories') load('@io_bazel_rules_docker//container:container.bzl', container_repositories='repositories') def initialize_rules_docker(): container_repositories() go_image_repositories() load('@distroless//package_manager:package_manager.bz...
# urls.py # urls for dash app url_paths = { "index": '/', "home": '/home', "scatter": '/apps/scatter-test', "combo": '/apps/combo-test' }
url_paths = {'index': '/', 'home': '/home', 'scatter': '/apps/scatter-test', 'combo': '/apps/combo-test'}
scoreboard_display = [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25'], ['51', '50', '49', '48', '47', '46', '45', '44', '43', '42', '41', '40', '39', '38', '37', '36', '35', '34', '33', '32', '31', '30', '29', '28', '27',...
scoreboard_display = [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25'], ['51', '50', '49', '48', '47', '46', '45', '44', '43', '42', '41', '40', '39', '38', '37', '36', '35', '34', '33', '32', '31', '30', '29', '28', '27',...
# flake8: noqa # in legacy datasets we need to put our sample data within the data dir legacy_datasets = ["cmu_small_region.svs"] # Registry of datafiles that can be downloaded along with their SHA256 hashes # To generate the SHA256 hash, use the command # openssl sha256 filename registry = { "histolab/broken.svs...
legacy_datasets = ['cmu_small_region.svs'] registry = {'histolab/broken.svs': 'b1325916876afa17ad5e02d2e7298ee883e758ed25369470d85bc0990e928e11', 'histolab/kidney.png': '5c6dc1b9ae10a2865302d9c8eda360362ec47732cb3e9766c38ed90cb9f4c371', 'data/cmu_small_region.svs': 'ed92d5a9f2e86df67640d6f92ce3e231419ce127131697fbbce42...
print('=' * 15, '\033[1;35mAULA 18 - Listas[Part #2]\033[m', '=' * 15) # -------------------------------------------------------------------- dados = [] pessoas = [] galera = [['Miguel', 25], ['Berta', 59], ['Joaquim', 20]] # -------------------------------------------------------------------- dados.append('Joaquim') d...
print('=' * 15, '\x1b[1;35mAULA 18 - Listas[Part #2]\x1b[m', '=' * 15) dados = [] pessoas = [] galera = [['Miguel', 25], ['Berta', 59], ['Joaquim', 20]] dados.append('Joaquim') dados.append(20) dados.append('Fernando') dados.append(23) dados.append('Maria') dados.append(19) pessoas.append(dados[:]) print(galera[0][0]) ...
P, D = list(map(int, input().split(' '))) totA, totB = 0, 0 dis = [[0,0,0,0] for i in range(D)] for i in range(P): a, b, c = map(int, input().split(' ')) k = (b+c)//2 + 1 dis[a-1][0] += b dis[a-1][1] += c for i, (ta, tb, _, _) in enumerate(dis): k = (ta + tb)//2 + 1 if ta > tb: wA = ta-k wB ...
(p, d) = list(map(int, input().split(' '))) (tot_a, tot_b) = (0, 0) dis = [[0, 0, 0, 0] for i in range(D)] for i in range(P): (a, b, c) = map(int, input().split(' ')) k = (b + c) // 2 + 1 dis[a - 1][0] += b dis[a - 1][1] += c for (i, (ta, tb, _, _)) in enumerate(dis): k = (ta + tb) // 2 + 1 if t...
baklava_price = float(input()) muffin_price = float(input()) shtolen_kg = float(input()) candy_kg = float(input()) bisquits_kg = int(input()) shtolen_price = baklava_price + baklava_price * 0.6 candy_price = muffin_price + muffin_price * 0.8 busquits_price = 7.50 shtolen_sum = shtolen_kg * shtolen_price candy_sum = ca...
baklava_price = float(input()) muffin_price = float(input()) shtolen_kg = float(input()) candy_kg = float(input()) bisquits_kg = int(input()) shtolen_price = baklava_price + baklava_price * 0.6 candy_price = muffin_price + muffin_price * 0.8 busquits_price = 7.5 shtolen_sum = shtolen_kg * shtolen_price candy_sum = cand...
x=int(input('Enter the number to convert: ')) print('Select the convertion') print(''' [ 1 ] Binary [ 1 ] Octal [ 3 ] HexaDeicmal ''') y=int(input('1 - Binary 2 - Octal 3 - Hexadecimal')) if y==1: bin(x)[2:] print('{}'.format(x)) elif y==2: oct(x) print('{}'.format(x)) elif y==3: hex(x) print(...
x = int(input('Enter the number to convert: ')) print('Select the convertion') print(' \n[ 1 ] Binary\n[ 1 ] Octal\n[ 3 ] HexaDeicmal\n') y = int(input('1 - Binary 2 - Octal 3 - Hexadecimal')) if y == 1: bin(x)[2:] print('{}'.format(x)) elif y == 2: oct(x) print('{}'.format(x)) elif y == 3: hex(x) ...
#!/usr/bin/python3 def safe_print_list_integers(my_list=[], x=0): i = 0 for index in range(x): try: print("{:d}".format(my_list[index]), end="") i += 1 except (ValueError, TypeError): pass print() return i
def safe_print_list_integers(my_list=[], x=0): i = 0 for index in range(x): try: print('{:d}'.format(my_list[index]), end='') i += 1 except (ValueError, TypeError): pass print() return i
N = int(input()) A, B = ( zip(*(map(int, input().split()) for _ in range(N))) if N else ((), ()) ) ans = len({(min(a, b), max(a, b)) for a, b in zip(A, B)}) print(ans)
n = int(input()) (a, b) = zip(*(map(int, input().split()) for _ in range(N))) if N else ((), ()) ans = len({(min(a, b), max(a, b)) for (a, b) in zip(A, B)}) print(ans)
URLS = [ "url1" ] STATUSPAGE_API_KEY = "" STATUSPAGE_PAGE_ID = "" STATUSPAGE_METRICS = { "url": "metric_id" } STATUSPAGE_COMPONENTS = { "url": "component_id" } PING_WEBHOOKS = [] STATUS_WEBHOOKS = [] ESCALATION_IDS = [] POLL_TIME = 60 OUTAGE_CHANGE_AFTER = 10 DRY_MODE = False DEGRADED_PERFORMANCE_TARGET_PIN...
urls = ['url1'] statuspage_api_key = '' statuspage_page_id = '' statuspage_metrics = {'url': 'metric_id'} statuspage_components = {'url': 'component_id'} ping_webhooks = [] status_webhooks = [] escalation_ids = [] poll_time = 60 outage_change_after = 10 dry_mode = False degraded_performance_target_ping = 500 timeout_pi...
{ 'application':{ 'type':'Application', 'name':'MulticolumnExample', 'backgrounds': [ { 'type':'Background', 'name':'bgMulticolumnExample', 'title':'Multicolumn Example PythonCard Application', 'size':( 620, 500 ), 'menubar': { 'type':'MenuBar', 'menus': ...
{'application': {'type': 'Application', 'name': 'MulticolumnExample', 'backgrounds': [{'type': 'Background', 'name': 'bgMulticolumnExample', 'title': 'Multicolumn Example PythonCard Application', 'size': (620, 500), 'menubar': {'type': 'MenuBar', 'menus': [{'type': 'Menu', 'name': 'menuFile', 'label': '&File', 'items':...
# Find algorithm that sorts the stack of size n in O(log(n)) time. It is allowed to use operations # provided only by the stack interface: push(), pop(), top(), isEmpty() and additional stacks. class Stack: def __init__(self): self.stack = [] def push(self, value): self.stack.append(value) ...
class Stack: def __init__(self): self.stack = [] def push(self, value): self.stack.append(value) def pop(self): return self.stack.pop() def top(self): return self.stack[-1] def is_empty(self): if self.stack == []: return True else: ...
N = int(input()) MAX, VAR, FIX = range(3) # latest=9 r=3 b=4 # max_variable_fixed_values = [ # 3 4 5 # 2 3 3 # 2 1 5 # 2 4 2 # 2 2 4 # 2 5 1 # ] def try_to_beat(latest_score, r, b, max_var_fixed): our_score = 0 while b > 0: if not r: return -1 best_c_max_b, best_max_b = ...
n = int(input()) (max, var, fix) = range(3) def try_to_beat(latest_score, r, b, max_var_fixed): our_score = 0 while b > 0: if not r: return -1 (best_c_max_b, best_max_b) = (0, 0) for (max_b, variable, fixed) in max_var_fixed: this_c_max = min(max_b, b, (latest_sc...
# # PySNMP MIB module CTRON-CHASSIS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-CHASSIS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:44:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
class BaseDataset: def __init__(self, data=list()): self.data = data def __getitem__(self, idx): return self.data[idx] def __len__(self): return len(self.data)
class Basedataset: def __init__(self, data=list()): self.data = data def __getitem__(self, idx): return self.data[idx] def __len__(self): return len(self.data)
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the messag...
def test(): assert 'DecisionTreeClassifier' in __solution__, "Make sure you are specifying a 'DecisionTreeClassifier'." assert model.get_params()['random_state'] == 1, "Make sure you are settting the model's 'random_state' to 1." assert 'model.fit' in __solution__, "Make sure you are using the '.fit()' func...
def foo(): ''' >>> from mod import CamelCase as CONST ''' pass
def foo(): """ >>> from mod import CamelCase as CONST """ pass
#! python3 ############################################################################### # Copyright (c) 2021, PulseRain Technology LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (LGPL) as # published by the Free Softw...
class Prbs: def reset(self, prbs_length, start_value): if prbs_length == 7: self.poly = 193 >> 1 elif prbs_length == 9: self.poly = 545 >> 1 elif prbs_length == 11: self.poly = 2561 >> 1 elif prbs_length == 15: self.poly = 49153 >> 1 ...
class AVLNode: def __init__(self, key): self.key = key self.parent = None self.left = None self.right = None self.balance = 0 def has_left(self): return self.left is not None def has_right(self): return self.right is not None def has_no_children(self): return not...
class Avlnode: def __init__(self, key): self.key = key self.parent = None self.left = None self.right = None self.balance = 0 def has_left(self): return self.left is not None def has_right(self): return self.right is not None def has_no_childre...
# Project Euler Problem 11 # Created on: 2012-06-14 # Created by: William McDonald # Return the minimum number that can be present in # a solution set of four numbers def getMin(cap, min): k = 99 * 99 * 99 for i in range(min, 99): if i * k > cap: return i def importGrid(): ...
def get_min(cap, min): k = 99 * 99 * 99 for i in range(min, 99): if i * k > cap: return i def import_grid(): f = open('problem11.txt') grid = [] for line in f: str = line lon = str.split(' ') i = 0 for n in lon: lon[i] = int(n) ...
def get_final_line( filepath: str ) -> str: with open(filepath) as fs_r: for line in fs_r: pass return line def get_final_line__readlines( filepath: str ) -> str: with open(filepath) as fs_r: return fs_r.readlines()[-1] def main(): filepath = 'file.txt' fi...
def get_final_line(filepath: str) -> str: with open(filepath) as fs_r: for line in fs_r: pass return line def get_final_line__readlines(filepath: str) -> str: with open(filepath) as fs_r: return fs_r.readlines()[-1] def main(): filepath = 'file.txt' final_line_conte...
price = float(input("Digite o preco do produto: ")) discount = (5/100) * price total = price - discount print("O valor com desconto eh: {:.2f}".format(total))
price = float(input('Digite o preco do produto: ')) discount = 5 / 100 * price total = price - discount print('O valor com desconto eh: {:.2f}'.format(total))