content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# # PySNMP MIB module DLB-ATHDRV-STATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLB-ATHDRV-STATS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:32:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ...
DEFAULTS = { 'hide_if_offline': False, "label": "{icon}", 'layout_icons': { "bsp": "[\\\\]", "columns": "[||]", "rows": "[==]", "vertical_stack": "[V]=", "horizontal_stack": "[H]=", "ultrawide_vertical_stack": "||=", "monocle": "[M]", "maximise...
defaults = {'hide_if_offline': False, 'label': '{icon}', 'layout_icons': {'bsp': '[\\\\]', 'columns': '[||]', 'rows': '[==]', 'vertical_stack': '[V]=', 'horizontal_stack': '[H]=', 'ultrawide_vertical_stack': '||=', 'monocle': '[M]', 'maximised': '[X]', 'floating': '><>', 'paused': '[P]'}, 'callbacks': {'on_left': 'next...
def addNumbers(a, b): return a + b spam = addNumbers(2, 40) print(spam)
def add_numbers(a, b): return a + b spam = add_numbers(2, 40) print(spam)
# https://www.acmicpc.net/problem/1059 if __name__ == '__main__': input = __import__('sys').stdin.readline L = int(input()) data = [0] + list(sorted(map(int, input().split()))) n = int(input()) left_count = 0 right_count = 0 prev_number = data[0] result = 0 for index in range(L): ...
if __name__ == '__main__': input = __import__('sys').stdin.readline l = int(input()) data = [0] + list(sorted(map(int, input().split()))) n = int(input()) left_count = 0 right_count = 0 prev_number = data[0] result = 0 for index in range(L): left_number = data[index] ...
class Solution: def isPrefixOfWord(self, sentence: str, searchWord: str) -> int: lenght = len(searchWord) for i, word in enumerate(sentence.split(" ")): if searchWord == word[:lenght]: return i+1 return -1 class Solution: def isPrefixOfWord(self, senten...
class Solution: def is_prefix_of_word(self, sentence: str, searchWord: str) -> int: lenght = len(searchWord) for (i, word) in enumerate(sentence.split(' ')): if searchWord == word[:lenght]: return i + 1 return -1 class Solution: def is_prefix_of_word(self, ...
# fastest fibonacci method def fib(n): return 0 fib(1000000)
def fib(n): return 0 fib(1000000)
forb = [] while True: try: line = list(map(int, input().split("-"))) except: break forb.append(line) forb.sort() #a) higher = 0 for (l, u) in forb: if l > (higher+1): print("solution a: ", higher+1) break higher = max(higher, u) #b) allowed = 0 higher = 0 for (...
forb = [] while True: try: line = list(map(int, input().split('-'))) except: break forb.append(line) forb.sort() higher = 0 for (l, u) in forb: if l > higher + 1: print('solution a: ', higher + 1) break higher = max(higher, u) allowed = 0 higher = 0 for (l, u) in forb...
# Build a dictionary containing ("User": "number_of_tweets") pairs n_recent_tweets = {} for user in twitter_data['tweets'].keys(): if 'data' in twitter_data['tweets'][user].keys(): n_recent_tweets[user] = len(twitter_data['tweets'][user]['data']) else: # Lady Gaga seems to be inactive fo...
n_recent_tweets = {} for user in twitter_data['tweets'].keys(): if 'data' in twitter_data['tweets'][user].keys(): n_recent_tweets[user] = len(twitter_data['tweets'][user]['data']) else: n_recent_tweets[user] = 0 df['n_recent_tweets'] = pd.Series(n_recent_tweets) df
# Given a list of integers and a number K, return which contiguous elements of # the list sum to K. # For example, if the list is [1, 2, 3, 4, 5] and K is 9, then it should # return [2, 3, 4]. def contiguous_sum_k(nums, k): candidates = [] summary = 0 i = 0 while i < len(nums): ...
def contiguous_sum_k(nums, k): candidates = [] summary = 0 i = 0 while i < len(nums): if summary == k: return candidates elif summary < k: candidates.append(nums[i]) summary += nums[i] i += 1 else: summary -= candidates....
n = ' ' game = [[n[0], n[1], n[2]], [n[3], n[4], n[5]], [n[6], n[7], n[8]]] ## prints the game def print_game(): print('---------') print('|', game[0][0], game[0][1], game[0][2], '|') print('|', game[1][0], game[1][1], game[1][2], '|') print('|', game[2][0], game[2][1], game[2][2], '|')...
n = ' ' game = [[n[0], n[1], n[2]], [n[3], n[4], n[5]], [n[6], n[7], n[8]]] def print_game(): print('---------') print('|', game[0][0], game[0][1], game[0][2], '|') print('|', game[1][0], game[1][1], game[1][2], '|') print('|', game[2][0], game[2][1], game[2][2], '|') print('---------') de...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def reverseBetween(self, head: ListNode, m: int, n: int) -> ListNode: if m == n: return head pre = None cursor = head cou...
class Solution: def reverse_between(self, head: ListNode, m: int, n: int) -> ListNode: if m == n: return head pre = None cursor = head count = 0 flag_start_with_head = m - 1 == 0 flag_end_with_tail = False start = head pre_start = None ...
coordinates_E0E1E1 = ((123, 107), (123, 109), (123, 110), (123, 113), (123, 114), (123, 115), (124, 106), (124, 109), (124, 113), (125, 106), (125, 109), (126, 99), (126, 100), (126, 106), (126, 108), (127, 89), (127, 98), (127, 100), (127, 106), (127, 108), (128, 68), (128, 69), (128, 89), (128, 90), (128, 97), (128...
coordinates_e0_e1_e1 = ((123, 107), (123, 109), (123, 110), (123, 113), (123, 114), (123, 115), (124, 106), (124, 109), (124, 113), (125, 106), (125, 109), (126, 99), (126, 100), (126, 106), (126, 108), (127, 89), (127, 98), (127, 100), (127, 106), (127, 108), (128, 68), (128, 69), (128, 89), (128, 90), (128, 97), (128...
def test_request_factory_creates_request_with_provided_properties(chain, web3, denoms, txn_recorder, ...
def test_request_factory_creates_request_with_provided_properties(chain, web3, denoms, txn_recorder, request_factory, RequestData): request_lib = chain.get_contract('RequestLib') window_start = web3.eth.blockNumber + 20 expected_request_data = request_data(claimWindowSize=255, donation=12345, payment=54321,...
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] pretrained = '/mmdetection/checkpoints/swin_tiny_patch4_window7_224.pth' # dataset settings dataset_type = 'CocoDataset' classes = ("chicken",) ...
_base_ = ['../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'] pretrained = '/mmdetection/checkpoints/swin_tiny_patch4_window7_224.pth' dataset_type = 'CocoDataset' classes = ('chicken',) data = dict(samples_per_gpu=1, work...
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def secp256k1(): http_archive( name="secp256k1" , build_file="//bazel/deps/secp256k1:build.BUILD" , sha256="85d571...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def secp256k1(): http_archive(name='secp256k1', build_file='//bazel/deps/secp256k1:build.BUILD', sha256='85d571a698011159666fa596907028511fc98b6ac73505cf34a4656dba7bd8e5', strip_prefix='secp256k1-3dc8c072b6d84845820c1483a2ee21094fb87cc3', urls=['...
'''Usual module. ''' class Bazz: pass
"""Usual module. """ class Bazz: pass
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # @param head, a ListNode # @return nothing def reorderList(self, head): if not head or not head.next: return head fast = head s...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def reorder_list(self, head): if not head or not head.next: return head fast = head slow = head while fast and fast.next: fast = fast.next.next ...
question_code_to_name = {"b1": "broken", "b2": "clumsy", "b3": "competent", "b4": "confused", "b5": "curious", "b6": "efficient", "b7": "energetic", "b8": "focused", "b9": "intelligent", "b10": "investigative", "b11": "lazy", "b12": "lost", "b13": "reliable", "b14": "re...
question_code_to_name = {'b1': 'broken', 'b2': 'clumsy', 'b3': 'competent', 'b4': 'confused', 'b5': 'curious', 'b6': 'efficient', 'b7': 'energetic', 'b8': 'focused', 'b9': 'intelligent', 'b10': 'investigative', 'b11': 'lazy', 'b12': 'lost', 'b13': 'reliable', 'b14': 'responsible', 'b15': 'inquisitive'} old_question_nam...
n = int(input()) num = 1 for i in range(0, n+1, 2): print(num) num = num * 2 * 2 # 11 task #n = int(input()) # for i in range(n + 1): # if i % 2 == 0: #for i in range(0, n + 1, 2): #print(2 ** i)
n = int(input()) num = 1 for i in range(0, n + 1, 2): print(num) num = num * 2 * 2
# [Shaolin Temple] Finding the Secret Library CHENGXIN = 9310047 WISE_CHIEF_PRIEST = 9310053 SUTRA_5_6F = 701220300 sm.removeEscapeButton() sm.setSpeakerID(CHENGXIN) sm.setBoxChat() sm.sendNext("Now that the demons have quieted down, tell me who you are. What are you doing here?") sm.flipBoxChat() sm.flipBoxChatPlay...
chengxin = 9310047 wise_chief_priest = 9310053 sutra_5_6_f = 701220300 sm.removeEscapeButton() sm.setSpeakerID(CHENGXIN) sm.setBoxChat() sm.sendNext('Now that the demons have quieted down, tell me who you are. What are you doing here?') sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.sendNext('(You fill him in on t...
# Databricks notebook source spark.conf.set("spark.sql.legacy.allowCreatingManagedTableUsingNonemptyLocation","true") # COMMAND ---------- def drop_project_table(table_name): q = f'''DROP TABLE IF EXISTS {table_name}''' print(q) spark.sql(q) # COMMAND ---------- def alter_project_table(table_name): q = f'''...
spark.conf.set('spark.sql.legacy.allowCreatingManagedTableUsingNonemptyLocation', 'true') def drop_project_table(table_name): q = f'DROP TABLE IF EXISTS {table_name}' print(q) spark.sql(q) def alter_project_table(table_name): q = f'ALTER TABLE {table_name} OWNER TO dars_nic_391419_j3w9t_collab' pr...
apiAttachAvailable = u'API tilgjengelig' apiAttachNotAvailable = u'Ikke tilgjengelig' apiAttachPendingAuthorization = u'Venter p\xe5 \xe5 bli godkjent' apiAttachRefused = u'Avsl\xe5tt' apiAttachSuccess = u'Vellykket' apiAttachUnknown = u'Ukjent' budDeletedFriend = u'Slettet fra kontaktlisten' budFriend = u'Venn' budNev...
api_attach_available = u'API tilgjengelig' api_attach_not_available = u'Ikke tilgjengelig' api_attach_pending_authorization = u'Venter på å bli godkjent' api_attach_refused = u'Avslått' api_attach_success = u'Vellykket' api_attach_unknown = u'Ukjent' bud_deleted_friend = u'Slettet fra kontaktlisten' bud_friend = u'Venn...
def string_ignorance(s): tracker = set() result = "" for c in s: try: tracker.remove(c.lower()) except KeyError: tracker.add(c.lower()) result += c return result if __name__ == '__main__': t = int(input()) for i in range(t): s = inpu...
def string_ignorance(s): tracker = set() result = '' for c in s: try: tracker.remove(c.lower()) except KeyError: tracker.add(c.lower()) result += c return result if __name__ == '__main__': t = int(input()) for i in range(t): s = input()...
i=0 while i in range(0,100): print ("Dilution Calculator") while i >=0: try: conc_input = float(input("Enter final concentration (mM): ")) mole_input = float(input("Enter molecular mass (g/mol): ")) mass_input = float(input("Enter mass (mg): ")) ...
i = 0 while i in range(0, 100): print('Dilution Calculator') while i >= 0: try: conc_input = float(input('Enter final concentration (mM): ')) mole_input = float(input('Enter molecular mass (g/mol): ')) mass_input = float(input('Enter mass (mg): ')) except Valu...
def check_index(row: int, col: int): if row in range(len(matrix)) and col in range(len(matrix)): return True print("Invalid coordinates") return False rows = int(input()) matrix = [] valid_index = False for row in range(rows): matrix.append([int(n) for n in input().split()]) while True: ...
def check_index(row: int, col: int): if row in range(len(matrix)) and col in range(len(matrix)): return True print('Invalid coordinates') return False rows = int(input()) matrix = [] valid_index = False for row in range(rows): matrix.append([int(n) for n in input().split()]) while True: comm...
class CDMSException(Exception): def __init__(self, message, status_code=None): super(CDMSException, self).__init__(message) self.message = message self.status_code = status_code class CDMSNotFoundException(CDMSException): pass class CDMSUnauthorizedException(CDMSException): pass
class Cdmsexception(Exception): def __init__(self, message, status_code=None): super(CDMSException, self).__init__(message) self.message = message self.status_code = status_code class Cdmsnotfoundexception(CDMSException): pass class Cdmsunauthorizedexception(CDMSException): pass
#!/usr/bin/env python3 def read_record(): input() # don't need n return map(int, input().split()) for _ in range(int(input())): # Python's sort performs well with partially sorted data print(*sorted(read_record()))
def read_record(): input() return map(int, input().split()) for _ in range(int(input())): print(*sorted(read_record()))
# Christian Piper # 9/5/19 # This program will prompt the user for miles driven and gallons used 4 times. It will then output the total miles driven, # total gallons used, and the average miles per gallon of the trip def main(): # Create prompts for inputs and convert to floating point numbers miles1 = float(i...
def main(): miles1 = float(input('Enter miles travelled: ')) gallons1 = float(input('Enter gallons of gas used: ')) print() miles2 = float(input('Enter miles travelled: ')) gallons2 = float(input('Enter gallons of gas used: ')) print() miles3 = float(input('Enter miles travelled: ')) gal...
# 1111. Maximum Nesting Depth of Two Valid Parentheses Strings class Solution: def maxDepthAfterSplit(self, seq: str) -> List[int]: c = 0 ans = [0] * len(seq) for i, br in enumerate(seq): if br == '(': c += 1 ans[i] = c % 2 else: ...
class Solution: def max_depth_after_split(self, seq: str) -> List[int]: c = 0 ans = [0] * len(seq) for (i, br) in enumerate(seq): if br == '(': c += 1 ans[i] = c % 2 else: ans[i] = c % 2 c -= 1 r...
PLATFORM = "windows" # Options: windows, linux, mac PROFILE = 'system' # Options: choose, system, zoom, meet, teams, jitsi, slack DEBUG = False # Switch to True to see debug statements in REPL SELECTION_TIMEOUT = 1.5 # Value in seconds to choose a chat profile BUTTON_LATCH_TIME = 0.25 # How long a button stays 'la...
platform = 'windows' profile = 'system' debug = False selection_timeout = 1.5 button_latch_time = 0.25
#################################################### #server: CAUTION must exist orion_server="http://18.194.211.208:80/api/v1" #project name project_name="waziup" #your organization: CHANGE HERE #choose one of the following: "DEF", "UPPA", "EGM", "IT21", "CREATENET", "CTIC", "UI", "ISPACE", "UGB", "WOELAB", "FARMERL...
orion_server = 'http://18.194.211.208:80/api/v1' project_name = 'waziup' organization_name = 'ORG' service_tree = '-TESTS' sensor_name = 'Sensor' service_path = '-' + organization_name + service_tree orion_token = 'this_is_my_authorization_token' source_list = []
#!/usr/bin/env python3 # An if statement only runs if the # condition evaluates to true. # if statent never runs if false. # A while statement repeatedly tests # a condition for trueness until # it returns false. Then code continues. i = 0 # to-be iterations counter while i < 5: print(i) i += 1 # i equals val...
i = 0 while i < 5: print(i) i += 1 print('done')
a= 138 b=232 c=495 d=982 if b >100: a= b-392 else: c=d-392 if d>394: c=b-283 else: a=a+200 if a<800: c=c-50 else: d=d+30
a = 138 b = 232 c = 495 d = 982 if b > 100: a = b - 392 else: c = d - 392 if d > 394: c = b - 283 else: a = a + 200 if a < 800: c = c - 50 else: d = d + 30
# Copyright 2015 Michael DeHaan <michael.dehaan/gmail> # # 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...
class Memoize: def __init__(self, fn): self.fn = fn self.result = {} def __call__(self, *args): try: return self.result[args] except KeyError: self.result[args] = self.fn(*args) return self.result[args]
class Collections: @staticmethod def drop_none(dictionary): return {k: v for k, v in dictionary.items() if v is not None} @staticmethod def drop_falsy(dictionary): return {k: v for k, v in dictionary.items() if v}
class Collections: @staticmethod def drop_none(dictionary): return {k: v for (k, v) in dictionary.items() if v is not None} @staticmethod def drop_falsy(dictionary): return {k: v for (k, v) in dictionary.items() if v}
# check the validity of the value at particular position def isvalid(board, num, pos): for i in range(len(board[0])): if board[pos[0]][i] == num and pos[1] != i: return False for i in range(len(board[0])): if board[i][pos[1]] == num and pos[0] != i: return False x = ...
def isvalid(board, num, pos): for i in range(len(board[0])): if board[pos[0]][i] == num and pos[1] != i: return False for i in range(len(board[0])): if board[i][pos[1]] == num and pos[0] != i: return False x = pos[1] // 3 y = pos[0] // 3 for i in range(y * 3, ...
class Solution: def removeElement(self, nums, val): j=0 for i in range(0,len(nums)): if(nums[i]!=val): nums[j] = nums[i] j=j+1 return j
class Solution: def remove_element(self, nums, val): j = 0 for i in range(0, len(nums)): if nums[i] != val: nums[j] = nums[i] j = j + 1 return j
# # PySNMP MIB module RAPID-IPSEC-TUNNEL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RAPID-IPSEC-TUNNEL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:43:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) ...
TITLE = "Cliff jumper" # screen dims WIDTH = 1000 HEIGHT = 600 # frames per second FPS = 60 # colors WHITE = (255, 255, 255) BLACK = (0,0,0) REDDISH = (240,55,66) SKY_BLUE = (143, 185, 252) FONT_NAME = 'Comic Sans' SPRITESHEET = "spritesheet_jumper.png" SPRITESHEET2 = "spritesheet.png" # data files HS_FILE = "highscore...
title = 'Cliff jumper' width = 1000 height = 600 fps = 60 white = (255, 255, 255) black = (0, 0, 0) reddish = (240, 55, 66) sky_blue = (143, 185, 252) font_name = 'Comic Sans' spritesheet = 'spritesheet_jumper.png' spritesheet2 = 'spritesheet.png' hs_file = 'highscore.txt' player_acc = 0.5 player_friction = -0.12 playe...
# http://www.practicepython.org/exercise/2014/01/29/01-character-input.html # 01 characterInput.py name = input('What is your name? ') age = input('What is your age? ') print('You will turn 100 years old in ' + str(100- int(age) + 2018) + '.\n') loop = int(input('Feed me another number: ')) print('Printing previous...
name = input('What is your name? ') age = input('What is your age? ') print('You will turn 100 years old in ' + str(100 - int(age) + 2018) + '.\n') loop = int(input('Feed me another number: ')) print('Printing previous string ' + str(loop) + ' times.\n') for i in range(loop): print('You will turn 100 years old in t...
Application.runInBackground = True UnityMolMain.disableSurfaceThread = True UnityMolMain.allowIDLE = False absolutePath = "C:/Users/ME/fair_covid_molvisexp/ex1_spike/" inVR = UnityMolMain.inVR() bleu1 = ColorUtility.TryParseHtmlString("#6baed6")[1] bleu2 = ColorUtility.TryParseHtmlString("#3182bd")[1] bleu3 = Colo...
Application.runInBackground = True UnityMolMain.disableSurfaceThread = True UnityMolMain.allowIDLE = False absolute_path = 'C:/Users/ME/fair_covid_molvisexp/ex1_spike/' in_vr = UnityMolMain.inVR() bleu1 = ColorUtility.TryParseHtmlString('#6baed6')[1] bleu2 = ColorUtility.TryParseHtmlString('#3182bd')[1] bleu3 = ColorUt...
animals = ['monkey', 'cat', 'squirrel'] for animal in animals: print(f'Would you adopt a {animal} as a pet?') print('\nThese animals uses their tales for balance')
animals = ['monkey', 'cat', 'squirrel'] for animal in animals: print(f'Would you adopt a {animal} as a pet?') print('\nThese animals uses their tales for balance')
class MovementComponent: def update(self, entity, game_time): delta = game_time / 1000.0 * entity.speed entity.x_loc = entity.x_loc + entity.x_direction * delta entity.y_loc = entity.y_loc + entity.y_direction * delta
class Movementcomponent: def update(self, entity, game_time): delta = game_time / 1000.0 * entity.speed entity.x_loc = entity.x_loc + entity.x_direction * delta entity.y_loc = entity.y_loc + entity.y_direction * delta
# Suma 2 + 1 # Resta 5 - 1 # Multiplicacion 2*2 # Divicion 3/2 # Modulo 7 % 4 # Power 2 ** 2 # juntas (1*2) + (4-1)
2 + 1 5 - 1 2 * 2 3 / 2 7 % 4 2 ** 2 1 * 2 + (4 - 1)
def __above_printer__(above: list, below: list) -> str: '''Prints the numbers above.''' # Above. A = str() for i in range(len(above)): if i < len(above) - 1: if len(above[i]) >= len(below[i]): # A space for the operator, a space for the space between the op. and the number, # the number, then four sp...
def __above_printer__(above: list, below: list) -> str: """Prints the numbers above.""" a = str() for i in range(len(above)): if i < len(above) - 1: if len(above[i]) >= len(below[i]): a += ' ' + above[i] + ' ' else: a += ' ' + ' ' * (len(b...
MIN_NUM = float('-inf') MAX_NUM = float('inf') class PID(object): def __init__(self, kp, ki, kd, min=MIN_NUM, max=MAX_NUM): self.kp = kp self.ki = ki self.kd = kd self.min = min self.max = max self.integral = self.last_error = 0. def reset(self): self...
min_num = float('-inf') max_num = float('inf') class Pid(object): def __init__(self, kp, ki, kd, min=MIN_NUM, max=MAX_NUM): self.kp = kp self.ki = ki self.kd = kd self.min = min self.max = max self.integral = self.last_error = 0.0 def reset(self): self....
#!/user/bin/python class IPDfile: def __init__(self): self.l = [] class ImportIPD: def __init__(self): self.l = [] self.f = '' def setFileName(self, fname): self.f = fname def getFileName(self): return self.f def setFileData(self): # requires file wit...
class Ipdfile: def __init__(self): self.l = [] class Importipd: def __init__(self): self.l = [] self.f = '' def set_file_name(self, fname): self.f = fname def get_file_name(self): return self.f def set_file_data(self): with open(self.f, 'r') as f...
a, b = int(input()), int(input()) s = 0 ans = [0]*(10**6+1) for i in range(1, 10**6+1): s += i ans[i] = ans[i] + ans[i-1] + i*s print((ans[b] - ans[a-1]) % (10**9 + 7))
(a, b) = (int(input()), int(input())) s = 0 ans = [0] * (10 ** 6 + 1) for i in range(1, 10 ** 6 + 1): s += i ans[i] = ans[i] + ans[i - 1] + i * s print((ans[b] - ans[a - 1]) % (10 ** 9 + 7))
data = ( 'geul', # 0x00 'geulg', # 0x01 'geulm', # 0x02 'geulb', # 0x03 'geuls', # 0x04 'geult', # 0x05 'geulp', # 0x06 'geulh', # 0x07 'geum', # 0x08 'geub', # 0x09 'geubs', # 0x0a 'geus', # 0x0b 'geuss', # 0x0c 'geung', # 0x0d 'geuj', # 0x0e 'geuc', # 0x...
data = ('geul', 'geulg', 'geulm', 'geulb', 'geuls', 'geult', 'geulp', 'geulh', 'geum', 'geub', 'geubs', 'geus', 'geuss', 'geung', 'geuj', 'geuc', 'geuk', 'geut', 'geup', 'geuh', 'gyi', 'gyig', 'gyigg', 'gyigs', 'gyin', 'gyinj', 'gyinh', 'gyid', 'gyil', 'gyilg', 'gyilm', 'gyilb', 'gyils', 'gyilt', 'gyilp', 'gyilh', 'gyi...
list_ = list(range(5)) index = None print(list_[index])
list_ = list(range(5)) index = None print(list_[index])
class CompositeView: def __init__(self): self.views = []; def add(self, view): self.views.append(view) def receiveMessages(self, messages): for v in self.views: v.receiveMessages(messages) def receiveMessageToMe(self, messages): for v in self.views: ...
class Compositeview: def __init__(self): self.views = [] def add(self, view): self.views.append(view) def receive_messages(self, messages): for v in self.views: v.receiveMessages(messages) def receive_message_to_me(self, messages): for v in self.views: ...
# Sophistacted inheritance example class Parent: def setCoordinate(self,x,y): self.x=x self.y=y class Child(Parent): def draw(self): print('Locate point x =',self.x,'on x-axis') print('Locate point y =',self.y,'on y-axis') c=Child() c.setCoordinate(10,20) c.draw()
class Parent: def set_coordinate(self, x, y): self.x = x self.y = y class Child(Parent): def draw(self): print('Locate point x =', self.x, 'on x-axis') print('Locate point y =', self.y, 'on y-axis') c = child() c.setCoordinate(10, 20) c.draw()
EMAIL = 'your fb email' PASSWORD = 'your fb password' PHONE = 1234 # 'fb' = Facebook, 'ph' = Phone, 'go' = Google account LOGIN = 'ph'
email = 'your fb email' password = 'your fb password' phone = 1234 login = 'ph'
print('*-----Logical Operator (and)-----*') high_income = True good_credit = False if high_income and good_credit: print("Eligible for loan") else: print("Not eligible for loan") print('\n*-----Logical Operator (or)-----*') high_income = True good_credit = False if high_income or good_credit: print("Elig...
print('*-----Logical Operator (and)-----*') high_income = True good_credit = False if high_income and good_credit: print('Eligible for loan') else: print('Not eligible for loan') print('\n*-----Logical Operator (or)-----*') high_income = True good_credit = False if high_income or good_credit: print('Eligibl...
class User: ''' Class that generates new instances of users ''' users = [] #Create empty list that will store the users def __init__(self, first_name, last_name, user_name, email, password): ''' __init__ method that defines properties for our objects ''' self.first_name = first_name sel...
class User: """ Class that generates new instances of users """ users = [] def __init__(self, first_name, last_name, user_name, email, password): """ __init__ method that defines properties for our objects """ self.first_name = first_name self.last_name = last_name ...
items_part_one = [4, 5, 1, 0] items_part_two = [8, 5, 1, 0] # hint from reddit: to move n items up 1 floor, it requires 2 * (n - 1) - 1 moves def count_moves(items): moves = 0 total_items = sum(items) while items[-1] < total_items: floor = 0 # check for empty floors. while loop in case mult...
items_part_one = [4, 5, 1, 0] items_part_two = [8, 5, 1, 0] def count_moves(items): moves = 0 total_items = sum(items) while items[-1] < total_items: floor = 0 while items[floor] == 0: floor += 1 moves += 2 * (items[floor] - 1) - 1 items[floor + 1] += items[floor...
def gen_number(end, step): i = 0 numbers = [] while i < end: numbers.append(i) i += step return numbers def gen_number_with_range(end, step): return range(0, end, step) print("gen_number(10, 2)", gen_number(10,2)) print("gen_number_with_range(10, 2)", [*gen_number_with_range(10, ...
def gen_number(end, step): i = 0 numbers = [] while i < end: numbers.append(i) i += step return numbers def gen_number_with_range(end, step): return range(0, end, step) print('gen_number(10, 2)', gen_number(10, 2)) print('gen_number_with_range(10, 2)', [*gen_number_with_range(10, 2)...
# Class node :: Stores the data and the link to the next element class Node: # Constructor :: def __init__(self, data=None,next=None): self.data = data self.next = next # Class LinkedList :: Uses Node Class class LinkedList: # Constructor...
class Node: def __init__(self, data=None, next=None): self.data = data self.next = next class Linkedlist: def __init__(self): self.head = None def get_length(self): if self.head is None: return 0 iterator = self.head count = 1 while ite...
class Orders: def __init__(self,startingValue,action,lot,stopLoss,takeProfit,orderID): self.startingValue=startingValue self.action=action self.orderID=orderID self.stopLossPip=stopLoss self.takeProfitPip=takeProfit self.lot=lot if action=="buy": self.stopLoss=startingValue-stopLoss/100000 self.ta...
class Orders: def __init__(self, startingValue, action, lot, stopLoss, takeProfit, orderID): self.startingValue = startingValue self.action = action self.orderID = orderID self.stopLossPip = stopLoss self.takeProfitPip = takeProfit self.lot = lot if action ==...
''' URL: https://leetcode.com/problems/third-maximum-number/ Difficulty: Easy Description: Third Maximum Number Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1: Input: [3, 2, 1] Outpu...
""" URL: https://leetcode.com/problems/third-maximum-number/ Difficulty: Easy Description: Third Maximum Number Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1: Input: [3, 2, 1] Outpu...
IBD_GENES = ["ENSG00000073756", "ENSG00000095303", "ENSG00000280151", "ENSG00000108219", "ENSG00000198369", "ENSG00000105401", "ENSG00000134882", "ENSG00000104998", "ENSG00000181915", "ENSG00000119919", "ENSG00000105397", "ENSG00000178623", "ENSG00000107968", "ENSG00000133195", "ENSG0000017152...
ibd_genes = ['ENSG00000073756', 'ENSG00000095303', 'ENSG00000280151', 'ENSG00000108219', 'ENSG00000198369', 'ENSG00000105401', 'ENSG00000134882', 'ENSG00000104998', 'ENSG00000181915', 'ENSG00000119919', 'ENSG00000105397', 'ENSG00000178623', 'ENSG00000107968', 'ENSG00000133195', 'ENSG00000171522', 'ENSG00000116288', 'EN...
#Method to create TXT file def generateTXTFile(firstName, lastName, netID, department): #Check to make sure folder is cleared out try: with open((firstName + "_" + lastName + ".txt"), "w+") as f: f.write("First Name: " + firstName + "\n") f.write("Last Name: " + lastName + "\n"...
def generate_txt_file(firstName, lastName, netID, department): try: with open(firstName + '_' + lastName + '.txt', 'w+') as f: f.write('First Name: ' + firstName + '\n') f.write('Last Name: ' + lastName + '\n') f.write('NetID: ' + netID + '\n') f.write('Depart...
nil = 0 num = 0 max = 1 cap = 'A' low = 'a' print( 'Equality :\t' , nil , '==' , num , nil == num ) print( 'Equality :\t' , cap , '==' , low , cap == low ) print( 'Inequality :\t' , nil , '!=' , max , nil != max ) print( 'Greater :\t' , nil , '>' , max , nil > max ) print( 'Lesser :\t' , nil , '<' , max , nil < max ...
nil = 0 num = 0 max = 1 cap = 'A' low = 'a' print('Equality :\t', nil, '==', num, nil == num) print('Equality :\t', cap, '==', low, cap == low) print('Inequality :\t', nil, '!=', max, nil != max) print('Greater :\t', nil, '>', max, nil > max) print('Lesser :\t', nil, '<', max, nil < max) print('More Or Equal :\t', nil,...
# __init__.py # Version of the fluke_28x_dmm_util package __version__ = "0.3.8"
__version__ = '0.3.8'
# mygreet.py def hello(name, *age): print("Hello there %s" % name) print("Age is %d." % age) return 'Greetings {} and welcome.'.format(name)
def hello(name, *age): print('Hello there %s' % name) print('Age is %d.' % age) return 'Greetings {} and welcome.'.format(name)
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'programCHAR COMMA FLOAT ID INT SEMICOLONprogram : sequence_declarationsequence_declaration : declaration sequence_declaration \n | declaratio...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'programCHAR COMMA FLOAT ID INT SEMICOLONprogram : sequence_declarationsequence_declaration : declaration sequence_declaration \n | declarationdeclaration : type variavel define_end_of_instructiontype : INT\n | FLOAT\n ...
# AShift Cipher def AShiftEncrypt(text,s): print("[*] Original Message: "+text) result = "" for i in range(len(text)): char = text[i] if(char.isupper()): result += chr((ord(char) + s-65) % 26 + 65) else: result += chr((ord(char) + s - 97) % 26 + 97) retur...
def a_shift_encrypt(text, s): print('[*] Original Message: ' + text) result = '' for i in range(len(text)): char = text[i] if char.isupper(): result += chr((ord(char) + s - 65) % 26 + 65) else: result += chr((ord(char) + s - 97) % 26 + 97) return result pr...
# Orla Higgins, 2018-02-27 # Collatz Conjecture # (Script that starts with an integer and repeatedly applies the Collatz function using a while loop and if statement) # ask the user for the integer instead of specifying a value of 17 # (returns error when number is not an integer) n = int(input("Please enter an ...
n = int(input('Please enter an integer: ')) while n > 1: if n % 2 == 0: n = n / 2 else: n = 3 * n + 1 print(n)
# aaf info - everything is from the private oam network (also called ecomp private network) GLOBAL_AAF_SERVER = "http://10.0.12.1:8101" GLOBAL_AAF_USERNAME = "username" GLOBAL_AAF_PASSWORD = "password" # aai info - everything is from the private oam network (also called ecomp private network) GLOBAL_AAI_SERVER_PROTOCOL...
global_aaf_server = 'http://10.0.12.1:8101' global_aaf_username = 'username' global_aaf_password = 'password' global_aai_server_protocol = 'https' global_aai_server_port = '8443' global_aai_username = 'username' global_aai_password = 'password' global_appc_server_protocol = 'http' global_appc_server_port = '8282' globa...
# add inventory level ListOfParts = dist_inv["tyco_electronics_corp_part_nbr"].unique().tolist() PartnbrYearMonthInventory = dist_inv.drop(["disty_ww_acct","region_name", "fisdate", "invy_at_avg_sell_price"],axis=1) firstpartnbr = PartnbrYearMonthInventory[PartnbrYearMonthInventory["tyco_electronics_corp_part_nbr"]...
list_of_parts = dist_inv['tyco_electronics_corp_part_nbr'].unique().tolist() partnbr_year_month_inventory = dist_inv.drop(['disty_ww_acct', 'region_name', 'fisdate', 'invy_at_avg_sell_price'], axis=1) firstpartnbr = PartnbrYearMonthInventory[PartnbrYearMonthInventory['tyco_electronics_corp_part_nbr'] == '027608-000'] f...
# Time: O(N * M) Where N and M are length and width of Matrix # Space: O(1) class Solution: def setZeroes(self, matrix): first_col_has_zero = False first_row_has_zero = False # Check if first col has a zero for i in range(0, len(matrix)): if matrix[i][0] == 0: ...
class Solution: def set_zeroes(self, matrix): first_col_has_zero = False first_row_has_zero = False for i in range(0, len(matrix)): if matrix[i][0] == 0: first_col_has_zero = True break for j in range(0, len(matrix[0])): if mat...
COLOR_WARNING = "red" COLOR_DANGER = "red" COLOR_SUCCESS = "green" COLOR_CAUTION = "yellow" COLOR_STABLE = "blue"
color_warning = 'red' color_danger = 'red' color_success = 'green' color_caution = 'yellow' color_stable = 'blue'
class NotImplementedImportError(ImportError, NotImplementedError): pass def _(name): msg = "{} is not yet implemented in Skulpt".format(name) raise NotImplementedImportError(msg, name=name)
class Notimplementedimporterror(ImportError, NotImplementedError): pass def _(name): msg = '{} is not yet implemented in Skulpt'.format(name) raise not_implemented_import_error(msg, name=name)
class BaseCavokeError(Exception): # Base exception pass class BaseCavokeWarning(Warning): # Base warning pass class GameTypeDoesNotExistError(BaseCavokeError): # Raised when no game type was found for the request pass class UrlInvalidError(BaseCavokeError): # Raised when provided url i...
class Basecavokeerror(Exception): pass class Basecavokewarning(Warning): pass class Gametypedoesnotexisterror(BaseCavokeError): pass class Urlinvaliderror(BaseCavokeError): pass class Toomanygametypeswarning(BaseCavokeWarning): pass class Toomanygamesessionswarning(BaseCavokeWarning): pass
keys = { "product_url": "http://airlabs.xyz/", "name": "Caspar Chlebowski", "email": "chleb@gmail.com", "message": "this is a test" }
keys = {'product_url': 'http://airlabs.xyz/', 'name': 'Caspar Chlebowski', 'email': 'chleb@gmail.com', 'message': 'this is a test'}
def compact(list): return [value for value in list if value != False and value != None and len(str(value)) != 0 and not not value] def compact(list): return [value for value in list if value] print(compact([0,1,2,"",[], False, {}, None, "All done"]))
def compact(list): return [value for value in list if value != False and value != None and (len(str(value)) != 0) and (not not value)] def compact(list): return [value for value in list if value] print(compact([0, 1, 2, '', [], False, {}, None, 'All done']))
# from itertools import permutations t = int(input()) for _ in range(t): l = input() s = list(input()) # spr = list(permutations(s)) # sstr = [] # for i in spr: # sstr.append("".join(i)) lens = len(s) sums = sum(map(lambda x: ord(x),s)) count = 0 for i in range(0,len(l)-lens+...
t = int(input()) for _ in range(t): l = input() s = list(input()) lens = len(s) sums = sum(map(lambda x: ord(x), s)) count = 0 for i in range(0, len(l) - lens + 1): if sum(map(lambda x: ord(x), l[i:i + lens])) == sums and all(map(lambda x: x in s, l[i:i + lens])): count += 1 ...
#!/usr/bin/env python3 # simple fibonacci series # the sum of two elements defines the next set # class = definition to create object (instance of class, blueprint) class Fibonacci(): # self = 1st arg, reference to object (in this case, 'f') # def __init__ = constructor # a, b = variables (in this case, '0...
class Fibonacci: def __init__(self, a, b): self.a = a self.b = b def series(self): while True: yield self.b (self.a, self.b) = (self.b, self.a + self.b) f = fibonacci(0, 1) for r in f.series(): if r > 100: break print(r, end=' ')
class UndefinedError(Exception): pass class Env(): def __init__(self, parent=None): self.parent=parent self.bindings = {} def getValue(self, name): try: return self.bindings[name] except KeyError: if self.parent != None: return self.parent.getValue(name) else: raise UndefinedError(name) def...
class Undefinederror(Exception): pass class Env: def __init__(self, parent=None): self.parent = parent self.bindings = {} def get_value(self, name): try: return self.bindings[name] except KeyError: if self.parent != None: return self...
def foo(): return "bipp" def bar(): return foo() def baz(): return bar() def why(): return "elle" if True: baz() else: why()
def foo(): return 'bipp' def bar(): return foo() def baz(): return bar() def why(): return 'elle' if True: baz() else: why()
class User(): def __init__(self, id, username, password): self.id = id self.username = username self.password = password def is_active(self): return True def is_authenticated(self): return True def is_anonymous(self): return False def get_id(self): ...
class User: def __init__(self, id, username, password): self.id = id self.username = username self.password = password def is_active(self): return True def is_authenticated(self): return True def is_anonymous(self): return False def get_id(self): ...
def quicksort(x): if len(x) == 1 or len(x) == 0: return x else: pivot = x[0] i = 0 for j in range(len(x)-1): if x[j+1] < pivot: x[j+1],x[i+1] = x[i+1], x[j+1] i += 1 x[0],x[i] = x[i],x[0] first_part = quicksort(x[:i]) ...
def quicksort(x): if len(x) == 1 or len(x) == 0: return x else: pivot = x[0] i = 0 for j in range(len(x) - 1): if x[j + 1] < pivot: (x[j + 1], x[i + 1]) = (x[i + 1], x[j + 1]) i += 1 (x[0], x[i]) = (x[i], x[0]) first_par...
i=0 num =0 def lists(test): global i global num if type(test[i])==list: for obj in test[i]: num =num + obj else: num=num + test[i] if i < len(test)-1: i += 1 return lists(test) else: return num test=[1,2,[3,4],[5,6]] print(lists...
i = 0 num = 0 def lists(test): global i global num if type(test[i]) == list: for obj in test[i]: num = num + obj else: num = num + test[i] if i < len(test) - 1: i += 1 return lists(test) else: return num test = [1, 2, [3, 4], [5, 6]] print(lis...
subprocess.Popen('/bin/ls *', shell=True) #nosec (on the line) subprocess.Popen('/bin/ls *', #nosec (at the start of function call) shell=True) subprocess.Popen('/bin/ls *', shell=True) #nosec (on the specific kwarg line) subprocess.Popen('#nosec', shell=True) subprocess.Popen('/bin/l...
subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('#nosec', shell=True) subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('#nosec', sh...
#!/usr/bin/python3.5 def clustering(): # input_file_name = 'clustering_test_k_is_2_result_is_100.txt' input_file_name = 'clustering_input.txt' k = 4 edges = [] vertex_to_cluster = {} cluster_to_vertices = {} with open(input_file_name) as f: for line in f: edge = [int(x) for x in line.rstrip()...
def clustering(): input_file_name = 'clustering_input.txt' k = 4 edges = [] vertex_to_cluster = {} cluster_to_vertices = {} with open(input_file_name) as f: for line in f: edge = [int(x) for x in line.rstrip().split(' ')] if len(edge) == 3: edges.a...
DEBUG = True SQLALCHEMY_DATABASE_URI = 'mysql+cymysql://root:0000@localhost:3306/fisher' SQLALCHEMY_TRACK_MODIFICATIONS = True SECRET_KEY = 'SECRET_KEY'
debug = True sqlalchemy_database_uri = 'mysql+cymysql://root:0000@localhost:3306/fisher' sqlalchemy_track_modifications = True secret_key = 'SECRET_KEY'
# -*- coding: utf-8 -*- # # Copyright (c) 2012-2018, CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify...
tables = {'HL70001': ('Administrative sex', ('A', 'F', 'M', 'N', 'O', 'U')), 'HL70002': ('Marital status', ('A', 'B', 'C', 'D', 'E', 'G', 'I', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'W')), 'HL70003': ('Event type', ('A01', 'A02', 'A03', 'A04', 'A05', 'A06', 'A07', 'A08', 'A09', 'A10', 'A11', 'A12', 'A13', 'A14', 'A15'...
def write_output(output_file, lines): with open(output_file, 'w') as f: for line in lines: f.write("%s\n" % line)
def write_output(output_file, lines): with open(output_file, 'w') as f: for line in lines: f.write('%s\n' % line)
''' BaseLearner template for people to subclass if they want ''' class BaseLearner: ''' Base class for all visual classifiers used by the active learner. ''' def __init__(self, **params): # To store whatever hyperparameters, video info, etc. that's necessary self.params = params d...
""" BaseLearner template for people to subclass if they want """ class Baselearner: """ Base class for all visual classifiers used by the active learner. """ def __init__(self, **params): self.params = params def batch_train(self, examples, ground_truth): """ Train the mod...
print("Please enter two numbers to set the range") print() starting_number = int(input("Please enter the starting number of range")) ending_number = int(input("Please enter the ending number of range")) def square_dict(n1, n2): dictionary = {} # create an empty dictionary to store square values of numbers. ...
print('Please enter two numbers to set the range') print() starting_number = int(input('Please enter the starting number of range')) ending_number = int(input('Please enter the ending number of range')) def square_dict(n1, n2): dictionary = {} for number in range(n1, n2 + 1): dictionary[number] = numbe...
URL_BASE = "https://apps2.poligran.edu.co/empr/Miscreditos.aspx" COMMENTS = { "APORTE": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a ...
url_base = 'https://apps2.poligran.edu.co/empr/Miscreditos.aspx' comments = {'APORTE': "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type s...
# # PySNMP MIB module RADLAN-DHCPv6-RELAY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-DHCPv6-RELAY # Produced by pysmi-0.3.4 at Wed May 1 14:46:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, constraints_union, single_value_constraint, value_size_constraint) ...
# Modified diffusion 1D # Compute n = 5 # number of elements config = { "logFormat": "csv", "Solvers": { "linearSolver": { "solverType": "gmres", # the solver type, refer to PETSc documentation about implemented solvers and preconditioners (https://www.mcs.anl.gov/petsc/petsc-current/docs...
n = 5 config = {'logFormat': 'csv', 'Solvers': {'linearSolver': {'solverType': 'gmres', 'preconditionerType': 'none', 'relativeTolerance': 1e-15, 'absoluteTolerance': 1e-10, 'maxIterations': 10000.0, 'dumpFilename': '', 'dumpFormat': 'matlab'}}, 'MyNewTimesteppingSolver': {'myOption': 42, 'option1': 'blabla', 'endTime'...
def missing(arr1, arr2): count = {} for num in arr2: if num in count: count[num] += 1 else: count[num] = 1 for num in arr1: if num not in count: return num else: count[num] -= 1 if __name__ == "__main__": print(missing([1...
def missing(arr1, arr2): count = {} for num in arr2: if num in count: count[num] += 1 else: count[num] = 1 for num in arr1: if num not in count: return num else: count[num] -= 1 if __name__ == '__main__': print(missing([1, 2...
# Part 1: # Part 2: class Name: def __init__(self, path): self._data = [] with open(path, "r") as f: # print(f.readlines()) self.data = [x.strip() for x in f.readlines()] def part1(self): ans = 0 hor = 0 ver = 0 # print(self.data) ...
class Name: def __init__(self, path): self._data = [] with open(path, 'r') as f: self.data = [x.strip() for x in f.readlines()] def part1(self): ans = 0 hor = 0 ver = 0 for d in self.data: a = d.split(' ') b = int(a[1]) ...
def main(): a,b = map(int,input().split()) if a+b >= 15 and b >= 8: print(1) elif a+b >= 10 and b >= 3: print(2) elif a+b >= 3: print(3) else: print(4) if __name__ == "__main__": main()
def main(): (a, b) = map(int, input().split()) if a + b >= 15 and b >= 8: print(1) elif a + b >= 10 and b >= 3: print(2) elif a + b >= 3: print(3) else: print(4) if __name__ == '__main__': main()
# => HEAP SORT ALGORITHM FILE def heapify(arr, n, i, change): largest = i l = 2 * i + 1 r = 2 * i + 2 if l < n and arr[largest].size_Y < arr[l].size_Y: largest = l if r < n and arr[largest].size_Y < arr[r].size_Y: largest = r if largest != i: arr[i], arr...
def heapify(arr, n, i, change): largest = i l = 2 * i + 1 r = 2 * i + 2 if l < n and arr[largest].size_Y < arr[l].size_Y: largest = l if r < n and arr[largest].size_Y < arr[r].size_Y: largest = r if largest != i: (arr[i], arr[largest]) = (arr[largest], arr[i]) cha...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sumRootToLeaf(self, root: TreeNode) -> int: if not root: return 0 result_arr = [] def dfs(node, s): ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sum_root_to_leaf(self, root: TreeNode) -> int: if not root: return 0 result_arr = [] def dfs(node, s): if not node: ...
class Registros: ListaRegistros=[] ListaRegistro=[] def insert(self, registro): try: self.ListaRegistro= [] for x in registro.split(','): print("Dato a almacenar:" + x) self.ListaRegistro.append(x) print(...
class Registros: lista_registros = [] lista_registro = [] def insert(self, registro): try: self.ListaRegistro = [] for x in registro.split(','): print('Dato a almacenar:' + x) self.ListaRegistro.append(x) print('dato almacenado...
# Write a program that prints a house that looks exactly like the following: print(" /\\ ") print(" / \\ ") print(" +----+ ") print(" | .-.| ") print(" | | || ") print(" +-+-++ ")
print(' /\\ ') print(' / \\ ') print(' +----+ ') print(' | .-.| ') print(' | | || ') print(' +-+-++ ')