content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# # PySNMP MIB module EXTREME-OSPF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-BASE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:53:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
# -*- coding: utf-8 -*- """ Created on Mon May 29 17:31:17 2017 @author: Prosimio """
""" Created on Mon May 29 17:31:17 2017 @author: Prosimio """
class IndigoDevice: def __init__(self, id, name): self.id = id self.name = name self.states = {} self.states_meta = {} self.pluginProps = {} self.image = None self.brightness = 0 def updateStateOnServer(self, key, value, uiValue=None, decimalPlaces=0): ...
class Indigodevice: def __init__(self, id, name): self.id = id self.name = name self.states = {} self.states_meta = {} self.pluginProps = {} self.image = None self.brightness = 0 def update_state_on_server(self, key, value, uiValue=None, decimalPlaces=0)...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reorderList(self, head): """ :type head: ListNode :rtype: void Do not return anything, modify head in-place instead. ...
class Solution(object): def reorder_list(self, head): """ :type head: ListNode :rtype: void Do not return anything, modify head in-place instead. """ f = s = dummy = list_node(0) dummy.next = head while f and f.next: f = f.next.next s ...
# callbacks.py # Authors: Jacob Schreiber <jmschreiber91@gmail.com> class Callback(object): """An object that adds functionality during training. A callback is a function or group of functions that can be executed during the training process for any of pomegranate's models that have iterative training procedures....
class Callback(object): """An object that adds functionality during training. A callback is a function or group of functions that can be executed during the training process for any of pomegranate's models that have iterative training procedures. A callback can be called at three stages-- the beginning of trai...
# Nama : Eraraya Morenzo Muten # NIM : 16520002 # Tanggal : 26 Maret 2021 # Program EmpatInteger # Input: 4 integer: A, B, C, D # Output: Sifat integer dari A, B, C, D (positif/negatif/nol) # Jika semua integer positif, tampilkan: # nilai maksimum, minimum, dan mean olympic # KAMUS # variabel...
def cek_integer(x): if x > 0: print('POSITIF') elif x < 0: print('NEGATIF') elif x == 0: print('NOL') def max(a, b, c, d): return max(a, b, c, d) def min(a, b, c, d): return min(a, b, c, d) def is_all_positif(a, b, c, d): return a > 0 and b > 0 and (c > 0) and (d > 0) ...
username = 'ENTER YOUR E-MAIL ID HERE' password = 'ENTER YOUR PASSWORD HERE' entry_nodeIp = 'http://py4e-data.dr-chuck.net/json?' gmaps_api_key = 42 user_agents_list = ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36", "Mozilla/5.0 (Windows NT ...
username = 'ENTER YOUR E-MAIL ID HERE' password = 'ENTER YOUR PASSWORD HERE' entry_node_ip = 'http://py4e-data.dr-chuck.net/json?' gmaps_api_key = 42 user_agents_list = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; ...
# uninhm # https://atcoder.jp/contests/abc183/tasks/abc183_a # implementation print(max(0, int(input())))
print(max(0, int(input())))
d1 = {42: 100} d2 = {'abc': 'fob'} d3 = {1e1000: d1} s = set([frozenset([2,3,4])]) class C(object): abc = 42 def f(self): pass cinst = C() class C2(object): abc = 42 def __init__(self): self.oar = 100 self.self = self def __repr__(self): return 'myrepr' ...
d1 = {42: 100} d2 = {'abc': 'fob'} d3 = {1e309: d1} s = set([frozenset([2, 3, 4])]) class C(object): abc = 42 def f(self): pass cinst = c() class C2(object): abc = 42 def __init__(self): self.oar = 100 self.self = self def __repr__(self): return 'myrepr' def...
url = "https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json" def turn_right(): turn_left() turn_left() turn_left() def hurdle(): move() turn_left() move() turn_right() move() turn_rig...
url = 'https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json' def turn_right(): turn_left() turn_left() turn_left() def hurdle(): move() turn_left() move() turn_right() move() turn_rig...
class Test: def __init__(self, text): self.text = text def text(self): return self.text
class Test: def __init__(self, text): self.text = text def text(self): return self.text
# Instruments SST_INSTRUMENT = 'SST' POEMAS_INSTRUMENT = 'POEMAS' # File types TRK_TYPE = 'TRK' RBD_TYPE = 'RBD' # Instrument Types AVAILABLE_SST_TYPES = { RBD_TYPE: ["bi", "rs", "rf"] } AVAILABLE_POEMAS_TYPES = { TRK_TYPE: ["TRK"] } INSTRUMENT_TO_TYPE_MAP = { SST_INSTRUMENT: AVAILABLE_SST_TYPES, POEM...
sst_instrument = 'SST' poemas_instrument = 'POEMAS' trk_type = 'TRK' rbd_type = 'RBD' available_sst_types = {RBD_TYPE: ['bi', 'rs', 'rf']} available_poemas_types = {TRK_TYPE: ['TRK']} instrument_to_type_map = {SST_INSTRUMENT: AVAILABLE_SST_TYPES, POEMAS_INSTRUMENT: AVAILABLE_POEMAS_TYPES} objects_not_from_same_instrume...
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 23:51:39 2020 @author: abcdk """ word = "Guten Morgen" extract = word[2:5:1] print(extract.upper()) word2 = "Racetrack" extract2 = word2[1:4:1] print(extract2.capitalize())
""" Created on Sun Apr 19 23:51:39 2020 @author: abcdk """ word = 'Guten Morgen' extract = word[2:5:1] print(extract.upper()) word2 = 'Racetrack' extract2 = word2[1:4:1] print(extract2.capitalize())
def get_sunday(): return 'Sunday' def get_monday(): return 'Monday' def get_tuesday(): return 'Tuesday' def get_default(): return 'Unknown' day = 4 switcher = { 0 : get_sunday, 1 : get_monday, 2 : get_tuesday } day_name = switcher.get(day,get_default)() print(day_name)
def get_sunday(): return 'Sunday' def get_monday(): return 'Monday' def get_tuesday(): return 'Tuesday' def get_default(): return 'Unknown' day = 4 switcher = {0: get_sunday, 1: get_monday, 2: get_tuesday} day_name = switcher.get(day, get_default)() print(day_name)
CONFIG_FILENAMES = [ '.vintrc.yaml', '.vintrc.yml', '.vintrc', ]
config_filenames = ['.vintrc.yaml', '.vintrc.yml', '.vintrc']
# -------------- This file adds actual expected results to submission file -----------------# f=open('submission.csv','r') g=open('testHistory.csv','r') # ts.csv generated before h=open('res.csv','w+') lines=f.readlines() i=0 for line in g.readlines(): k=line.split(',') toWrite=k[5] h.write...
f = open('submission.csv', 'r') g = open('testHistory.csv', 'r') h = open('res.csv', 'w+') lines = f.readlines() i = 0 for line in g.readlines(): k = line.split(',') to_write = k[5] h.write(lines[i][0:-1] + ',' + toWrite + '\n') i += 1 h.close() f.close() g.close()
""" Version. Doing it this way provides for access in setup.py and via __version__ """ __version__ = "0.1.4"
""" Version. Doing it this way provides for access in setup.py and via __version__ """ __version__ = '0.1.4'
IRIS_BYPASS=False AWS_REGION = "us-west-1" IRIS_SNS_TOPIC = "iris-topic" IRIS_SQS_APP_QUEUE = "iris-test-queue" IRIS_POLL_INTERVAL = 20
iris_bypass = False aws_region = 'us-west-1' iris_sns_topic = 'iris-topic' iris_sqs_app_queue = 'iris-test-queue' iris_poll_interval = 20
# This dictionary is to define metrics that we should extract data from and then # their exposed name as predicted metric metrics = { 'actual_metric_name1': 'actual_metric_name1_predict', 'actual_metric_name2': 'actual_metric_name2_predict' } # prom_url = 'http://localhost/' expose_port = 8000 # interval in ...
metrics = {'actual_metric_name1': 'actual_metric_name1_predict', 'actual_metric_name2': 'actual_metric_name2_predict'} prom_url = 'http://localhost/' expose_port = 8000 interval = 30 chunk_size = 24
""" Data types used on Android and whatsapp """ class TextPlain: def __str__(self): return "text/plain" class AnyImage: def __str__(self): return "image/*" class AndroidVndContact: def __str__(self): return "vnd.android.cursor.dir/contact"
""" Data types used on Android and whatsapp """ class Textplain: def __str__(self): return 'text/plain' class Anyimage: def __str__(self): return 'image/*' class Androidvndcontact: def __str__(self): return 'vnd.android.cursor.dir/contact'
def print_hello(): print("hello!") def print_goodbye(): print("goodbye!")
def print_hello(): print('hello!') def print_goodbye(): print('goodbye!')
n = int(input()) primary = [] secondary = [] matrix = [] for _ in range(n): matrix.append([int(x) for x in input().split()]) for r in range(n): primary.append(matrix[r][r]) secondary.append(matrix[r][n - 1 -r]) sum_p = (sum([x for x in primary])) sum_s = (sum([x for x in secondary])) print(abs(sum_p-sum...
n = int(input()) primary = [] secondary = [] matrix = [] for _ in range(n): matrix.append([int(x) for x in input().split()]) for r in range(n): primary.append(matrix[r][r]) secondary.append(matrix[r][n - 1 - r]) sum_p = sum([x for x in primary]) sum_s = sum([x for x in secondary]) print(abs(sum_p - sum_s))
# replace with the label of class for which you are interested in building the lexicon; # this should be the same as the label in your input files positive_class_label = "on-topic" # replace the label for the examples that do not belong to the topic of interest # this should be the same as the label in your input file...
positive_class_label = 'on-topic' negative_class_label = 'off-topic' lexicon_size = 400
"""JPL Planetary and Lunar Ephemeris DE422 for the jplephem package. This is the most recent long-period ephemeris published by the Jet Propulsion Laboratory. While requiring more than half a gigabyte of space, it achieves quite high accuracy. :Name: DE422 (September 2009) :Years: -3000 through 3000 :Planets: Yes :S...
"""JPL Planetary and Lunar Ephemeris DE422 for the jplephem package. This is the most recent long-period ephemeris published by the Jet Propulsion Laboratory. While requiring more than half a gigabyte of space, it achieves quite high accuracy. :Name: DE422 (September 2009) :Years: -3000 through 3000 :Planets: Yes :S...
def loadfile(name): values = [] f = open(name, "r") for x in f: values.append(x) return values def day2(): depth = 0 position = 0 depth2 = 0 for i in range(0, len(values)): value = values[i].split() if value[0] == "forward": position += int(value[1]) ...
def loadfile(name): values = [] f = open(name, 'r') for x in f: values.append(x) return values def day2(): depth = 0 position = 0 depth2 = 0 for i in range(0, len(values)): value = values[i].split() if value[0] == 'forward': position += int(value[1]) ...
"""Kata: Move Zeroes - Move all zeroes in list to end. #1 Best Practices Solution by riyakayal def move_zeros(arr): l = [i for i in arr if isinstance(i, bool) or i!=0] return l+[0]*(len(arr)-len(l)) """ def move_zeroes(array): all_zeroes = list(filter((lambda x: x == 0 and type(x) is not bool), array)) ...
"""Kata: Move Zeroes - Move all zeroes in list to end. #1 Best Practices Solution by riyakayal def move_zeros(arr): l = [i for i in arr if isinstance(i, bool) or i!=0] return l+[0]*(len(arr)-len(l)) """ def move_zeroes(array): all_zeroes = list(filter(lambda x: x == 0 and type(x) is not bool, array)) ...
class PrefixStorage(object): """Storage for store information about prefixes. >>> s = PrefixStorage() First we save information for some prefixes: >>> s["123"] = "123 domain" >>> s["12"] = "12 domain" Then we can retrieve prefix information by full key (longest prefix always win): >...
class Prefixstorage(object): """Storage for store information about prefixes. >>> s = PrefixStorage() First we save information for some prefixes: >>> s["123"] = "123 domain" >>> s["12"] = "12 domain" Then we can retrieve prefix information by full key (longest prefix always win): >...
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY short_version = '1.10.4' version = '1.10.4' full_version = '1.10.4' git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60' release = True if not release: version = full_version
short_version = '1.10.4' version = '1.10.4' full_version = '1.10.4' git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60' release = True if not release: version = full_version
class Solution: def twoSum(self, numbers, target): """ :type numbers: List[int] :type target: int :rtype: List[int] """ l = 0 r = len(numbers) - 1 while l < r: sum = numbers[l] + numbers[r] if sum < target: l +=...
class Solution: def two_sum(self, numbers, target): """ :type numbers: List[int] :type target: int :rtype: List[int] """ l = 0 r = len(numbers) - 1 while l < r: sum = numbers[l] + numbers[r] if sum < target: l +...
# Define a Subtraction Function def sub(num1, num2): return num1 - num2
def sub(num1, num2): return num1 - num2
baseurl='\t\t\t<input name="marriageLine" type="radio" id="marriageLine%s" value="%s" /><label for="marriageLine%s"><img src="images/marriageLine/%s.jpg" height=195 width=150></label>' for i in range(1, 18): url = baseurl % (i,i,i,i) print(url+"\n")
baseurl = '\t\t\t<input name="marriageLine" type="radio" id="marriageLine%s" value="%s" /><label for="marriageLine%s"><img src="images/marriageLine/%s.jpg" height=195 width=150></label>' for i in range(1, 18): url = baseurl % (i, i, i, i) print(url + '\n')
class Duck: def swim(self): print("Duck is swimming!") def layEggs(self): print("Duck is laying eggs!") class Fish: def swim(self): print("Fish is swimming!") def layEggs(self): print("Fish is laying eggs!") class Diver: def swim(self): ...
class Duck: def swim(self): print('Duck is swimming!') def lay_eggs(self): print('Duck is laying eggs!') class Fish: def swim(self): print('Fish is swimming!') def lay_eggs(self): print('Fish is laying eggs!') class Diver: def swim(self): print('A human...
def findTagInChildren(children, key, value=None): """ Find in children a tag element with specified attribute key. If value is set to None, the value is returned. If value is specified, name et attrs of child are returned. In case no element or value is found, None is returned - children: list of ...
def find_tag_in_children(children, key, value=None): """ Find in children a tag element with specified attribute key. If value is set to None, the value is returned. If value is specified, name et attrs of child are returned. In case no element or value is found, None is returned - children: list ...
class main: a = '' def func(self): s = '' b = '\n\n\ntareq\n\n\n' for i in b: if i != '\n': s += i print(s) ii = main() ii.func()
class Main: a = '' def func(self): s = '' b = '\n\n\ntareq\n\n\n' for i in b: if i != '\n': s += i print(s) ii = main() ii.func()
def lambda_handler(event, context): message = event['Records'][0]['Sns']['Message'] print("handle message: " + message) webhook_url = 'https://hookb.in/RZYdoJVodkcREEj72WqV' http = urllib3.PoolManager() r = http.request( 'POST', webhook_url, body=message.encode('utf-8'), ...
def lambda_handler(event, context): message = event['Records'][0]['Sns']['Message'] print('handle message: ' + message) webhook_url = 'https://hookb.in/RZYdoJVodkcREEj72WqV' http = urllib3.PoolManager() r = http.request('POST', webhook_url, body=message.encode('utf-8'), headers={'Content-Type': 'app...
#!/usr/bin/env python """ CREATED AT: 2021/11/5 Des: https://leetcode.com/problems/arranging-coins/ GITHUB: https://github.com/Jiezhi/myleetcode Difficulty: Easy Tag: See: """ class Solution: def arrangeCoins(self, n: int) -> int: """ Runtime: 924 ms, faster than 35.91% Memory Usage:...
""" CREATED AT: 2021/11/5 Des: https://leetcode.com/problems/arranging-coins/ GITHUB: https://github.com/Jiezhi/myleetcode Difficulty: Easy Tag: See: """ class Solution: def arrange_coins(self, n: int) -> int: """ Runtime: 924 ms, faster than 35.91% Memory Usage: 14.3 MB, less than 3...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 11 16:00:00 2020 @author: natnem """ def CountingSort(A): k = max(A) + 1 C = [0]*(k) #Auxillary array to keep track of the key appearances B = [0]*(len(A)) #To hold the output for i in A: C[i] = C[i] + 1 #0 i if key(Ind...
""" Created on Tue Feb 11 16:00:00 2020 @author: natnem """ def counting_sort(A): k = max(A) + 1 c = [0] * k b = [0] * len(A) for i in A: C[i] = C[i] + 1 for x in range(1, k): C[x] = C[x] + C[x - 1] for j in range(len(A) - 1, -1, -1): B[C[A[j]] - 1] = A[j] C[A[j...
class Descritor: def __init__(self, obj, set=None, get=None, delete=None): self.obj = obj self.set = set self.get = get self.delete = delete def __set__(self, obj, val): print('Estou setando algo') self.obj = val def __get__(self, obj, tipo=None): pr...
class Descritor: def __init__(self, obj, set=None, get=None, delete=None): self.obj = obj self.set = set self.get = get self.delete = delete def __set__(self, obj, val): print('Estou setando algo') self.obj = val def __get__(self, obj, tipo=None): p...
# -*- coding: utf-8 -*- A = int(input()) B = int(input()) PROD = (A*B) print("PROD =", PROD)
a = int(input()) b = int(input()) prod = A * B print('PROD =', PROD)
class Persona: cedula = 0 nombre = '' telefono = 0 voto = 0 def __init__(self, cd, nm, tl, vt): self.cedula = cd self.nombre = nm self.telefono = tl self.voto = vt def getCedula(self): return self.cedula def getNombre(self): return self.nomb...
class Persona: cedula = 0 nombre = '' telefono = 0 voto = 0 def __init__(self, cd, nm, tl, vt): self.cedula = cd self.nombre = nm self.telefono = tl self.voto = vt def get_cedula(self): return self.cedula def get_nombre(self): return self.no...
def stingy(total_lambs): stingyList = [1, 1] x, total = 2, 2 while x <= total_lambs: value = stingyList[x-1] + stingyList[x-2] stingyList.append(value) total += int(stingyList[x]) if total > total_lambs: break x+= 1 return len(stingyList) def generou...
def stingy(total_lambs): stingy_list = [1, 1] (x, total) = (2, 2) while x <= total_lambs: value = stingyList[x - 1] + stingyList[x - 2] stingyList.append(value) total += int(stingyList[x]) if total > total_lambs: break x += 1 return len(stingyList) de...
""" Desenvolva um programa que leia seis numeros inteiros e mostre a soma apenas daques que forem pares. Se o valor digitado for impar, desconsidere-o. """ soma = 0 for n in range (0, 6): numero = int(input('Digite um numero: ')) if numero %2 == 0: soma = soma + numero print(soma) print('FIM')
""" Desenvolva um programa que leia seis numeros inteiros e mostre a soma apenas daques que forem pares. Se o valor digitado for impar, desconsidere-o. """ soma = 0 for n in range(0, 6): numero = int(input('Digite um numero: ')) if numero % 2 == 0: soma = soma + numero print(soma) print('FIM')
class Account: def __init__(self): self.__blocked: bool = False self.__bound: int = 1000000 self.__balance: int = 0 self.__max_credit: int = -1000 def deposit(self, _sum: int) -> bool: if self.__blocked : return False if _sum < 0 or _sum > self.__bou...
class Account: def __init__(self): self.__blocked: bool = False self.__bound: int = 1000000 self.__balance: int = 0 self.__max_credit: int = -1000 def deposit(self, _sum: int) -> bool: if self.__blocked: return False if _sum < 0 or _sum > self.__boun...
def process_sql_file(file_name): file, string = open(file_name, "r"), '' # for line in file, remove comments, space out '(' and ')', add line to output string: for line in file: line = line.rstrip() line = line.split('//')[0] line = line.split('--')[0] line = line.replace('(...
def process_sql_file(file_name): (file, string) = (open(file_name, 'r'), '') for line in file: line = line.rstrip() line = line.split('//')[0] line = line.split('--')[0] line = line.replace('(', ' ( ') line = line.replace(')', ' ) ') string += ' ' + line file....
# Membership, identity, and logical operations x=[1,2,3] y=[1,2,3] print(x==y) #test equivalance print(x is y) #test object identity x=y # assignment print(x is y)
x = [1, 2, 3] y = [1, 2, 3] print(x == y) print(x is y) x = y print(x is y)
''' Created on Nov 20, 2014 This is a dummy to solve dependencies from error.py @author: Tim Gerhard ''' # The webfrontend does not dump errors. If this function is called anywhere, this simply doesn't matter. def dumpError(error): return
""" Created on Nov 20, 2014 This is a dummy to solve dependencies from error.py @author: Tim Gerhard """ def dump_error(error): return
la_liga_goals = 43 champions_league_goals = 10 copa_del_rey_goals = 5 total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals
la_liga_goals = 43 champions_league_goals = 10 copa_del_rey_goals = 5 total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals
# Write a program that reads a temperature value and the letter C for Celsius or F for # Fahrenheit. Print whether water is liquid, solid, or gaseous at the given temperature # at sea level. type = str(input("Enter the temperature type, C for celsius or F for fahrenheit: ")) temperature = float(input("Enter the temper...
type = str(input('Enter the temperature type, C for celsius or F for fahrenheit: ')) temperature = float(input('Enter the temperature: ')) if type == 'C': if temperature >= 0 and temperature < 100: print('Water is liquid.') elif temperature >= 100: print('Water is gaseous.') else: pr...
def mike(): print("hola") mike() mike() mike() mike() mike()
def mike(): print('hola') mike() mike() mike() mike() mike()
# Python3 program to count triplets with # sum smaller than a given value # Function to count triplets with sum smaller # than a given value def countTriplets(arr, n, sum): # Sort input array arr.sort() # Initialize result ans = 0 # Every iteration of loop counts triplet with # first element...
def count_triplets(arr, n, sum): arr.sort() ans = 0 for i in range(0, n - 2): j = i + 1 k = n - 1 while j < k: if arr[i] + arr[j] + arr[k] >= sum: k = k - 1 else: ans += k - j j = j + 1 return ans if __name__...
class UnknownResponseType(Exception): pass class UnknownDatetime(Exception): pass
class Unknownresponsetype(Exception): pass class Unknowndatetime(Exception): pass
t=int(input()) for i in range(t): s=int(input()) m=s%12 if m==1: print(s+11,'WS') elif m==2: print(s+9,'MS') elif m==3: print(s+7,'AS') elif m==4: print(s+5,'AS') elif m==5: print(s+3,'MS') elif m==6: print(s+1,'WS') elif m==7: ...
t = int(input()) for i in range(t): s = int(input()) m = s % 12 if m == 1: print(s + 11, 'WS') elif m == 2: print(s + 9, 'MS') elif m == 3: print(s + 7, 'AS') elif m == 4: print(s + 5, 'AS') elif m == 5: print(s + 3, 'MS') elif m == 6: prin...
__author__ = 'Mikhail' def add_line(line_one, line_two): """ >>> line_one = [1, 2, 3] >>> line_two = [1, 2, 3] >>> add_line(line_one, line_two) >>> line_one [2, 4, 6] >>> line_two [1, 2, 3] >>> add_line(line_two, line_one) >>> line_one [2, 4, 6] >>> line_two [3, 6, ...
__author__ = 'Mikhail' def add_line(line_one, line_two): """ >>> line_one = [1, 2, 3] >>> line_two = [1, 2, 3] >>> add_line(line_one, line_two) >>> line_one [2, 4, 6] >>> line_two [1, 2, 3] >>> add_line(line_two, line_one) >>> line_one [2, 4, 6] >>> line_two [3, 6, 9...
def mergeSortedArrays(L, R): sorted_array = [] i = j = 0 while i < len(L) and j < len(R): if L[i] < R[j]: sorted_array.append(L[i]) i += 1 else: sorted_array.append(R[j]) j += 1 # When we run out of elements in either L or M, #...
def merge_sorted_arrays(L, R): sorted_array = [] i = j = 0 while i < len(L) and j < len(R): if L[i] < R[j]: sorted_array.append(L[i]) i += 1 else: sorted_array.append(R[j]) j += 1 while i < len(L): sorted_array.append(L[i]) ...
"abcd".startswith("ab") #returns True "abcd".endswith("zn") #returns False "bb" in "abab" #returns False "ab" in "abab" #returns True loc = "abab".find("bb") #returns -1 loc = "abab".find("ab") #returns 0 loc = "abab".find("ab",loc+1) #returns 2
'abcd'.startswith('ab') 'abcd'.endswith('zn') 'bb' in 'abab' 'ab' in 'abab' loc = 'abab'.find('bb') loc = 'abab'.find('ab') loc = 'abab'.find('ab', loc + 1)
# -*- encoding: utf-8 -*- """ Copyright (c) Minu Kim - minu.kim@kaist.ac.kr Templates from AppSeed.us This file is hidden for privacy issues. """
""" Copyright (c) Minu Kim - minu.kim@kaist.ac.kr Templates from AppSeed.us This file is hidden for privacy issues. """
SOLVERS = ( { 'type': 'local', 'name': 'leo3', 'pretty-name': 'Leo III', 'version': '1.4', 'command': 'leo3 %s -t %d', }, { 'type': 'local', 'name': 'cvc4', 'command': 'cvc4 --output-lang tptp --produce-models --tlimit=%md %s', }, ...
solvers = ({'type': 'local', 'name': 'leo3', 'pretty-name': 'Leo III', 'version': '1.4', 'command': 'leo3 %s -t %d'}, {'type': 'local', 'name': 'cvc4', 'command': 'cvc4 --output-lang tptp --produce-models --tlimit=%md %s'}, {'type': 'local', 'name': 'picosat', 'command': './solvers/picosat-tptp.sh -L %d %s'}, {'type': ...
"""Choices for Rider APP""" status_choices = ( ('in_shop', 'In Shop'), ('enroute_destination', 'Enroute destination'), ('delivered', 'Delivered') ) IN_SHOP = 'in_shop'
"""Choices for Rider APP""" status_choices = (('in_shop', 'In Shop'), ('enroute_destination', 'Enroute destination'), ('delivered', 'Delivered')) in_shop = 'in_shop'
""" For ease of use, please lay out your grid in Euclidean-plane format and NOT in numpy-type format. For example, if an object needs to be placed in the 3rd row and 7th column of the gridworld numpy matrix, enter its location in your layout dict as [7,3]. The codebase will take care of the matrix-indexing for you....
""" For ease of use, please lay out your grid in Euclidean-plane format and NOT in numpy-type format. For example, if an object needs to be placed in the 3rd row and 7th column of the gridworld numpy matrix, enter its location in your layout dict as [7,3]. The codebase will take care of the matrix-indexing for you....
SEED_URLS = [ "https://www.microsoft.com/en-ca/p/immortals-fenyx-rising/c07kjzrh0l7s?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/grand-theft-auto-v-premium-edition/C496CLVXMJP8?wa=wsignin1.0&lc=4105&activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/far-cry-5/br7x7mvbbqkm?...
seed_urls = ['https://www.microsoft.com/en-ca/p/immortals-fenyx-rising/c07kjzrh0l7s?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/grand-theft-auto-v-premium-edition/C496CLVXMJP8?wa=wsignin1.0&lc=4105&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/far-cry-5/br7x7mvbbqkm?activetab=piv...
# salva no copiateste.txt o mesmo conteudo do teste.txt with open('teste.txt', 'r') as arquivolido: with open('copiateste.txt', 'w') as arquivocriado: for linha in arquivolido: arquivocriado.write(linha)
with open('teste.txt', 'r') as arquivolido: with open('copiateste.txt', 'w') as arquivocriado: for linha in arquivolido: arquivocriado.write(linha)
class Event: def __init__(self, event_type, time, direction, intersection): self.event_type = event_type self.time = time self.direction = direction self.intersection = intersection
class Event: def __init__(self, event_type, time, direction, intersection): self.event_type = event_type self.time = time self.direction = direction self.intersection = intersection
""" Please write a program to compress and decompress the string "hello world!hello world!hello world!hello world!". import zlib s = 'hello world!hello world!hello world!hello world!' # In Python 3 zlib.compress() accepts only DataType <bytes> y = bytes(s, 'utf-8') x = zlib.compress(y) print(x) print(zlib.decompress(...
""" Please write a program to compress and decompress the string "hello world!hello world!hello world!hello world!". import zlib s = 'hello world!hello world!hello world!hello world!' # In Python 3 zlib.compress() accepts only DataType <bytes> y = bytes(s, 'utf-8') x = zlib.compress(y) print(x) print(zlib.decompress(...
#write import statement for reverse string function ''' 10 points Write a main function to .... Loop as long as user types y. Prompt user for a string (assume user will always give you good data). Pass the string to the reverse string function and display the reversed string '''
""" 10 points Write a main function to .... Loop as long as user types y. Prompt user for a string (assume user will always give you good data). Pass the string to the reverse string function and display the reversed string """
day = str(input()) if (day == "Monday") or (day == "Tuesday") or (day == "Friday"): print("12") elif (day == "Wednesday") or (day == "Thursday"): print("14") else: print("16")
day = str(input()) if day == 'Monday' or day == 'Tuesday' or day == 'Friday': print('12') elif day == 'Wednesday' or day == 'Thursday': print('14') else: print('16')
def two_fer(name=""): if not name.strip(): return "One for you, one for me." else: return "One for {}, one for me.".format(name)
def two_fer(name=''): if not name.strip(): return 'One for you, one for me.' else: return 'One for {}, one for me.'.format(name)
""" The probe's x,y position starts at 0,0. Then, it will follow some trajectory by moving in steps. On each step, these changes occur in the following order: The probe's x position increases by its x velocity. The probe's y position increases by its y velocity. Due to drag, the probe's x...
""" The probe's x,y position starts at 0,0. Then, it will follow some trajectory by moving in steps. On each step, these changes occur in the following order: The probe's x position increases by its x velocity. The probe's y position increases by its y velocity. Due to drag, the probe's x...
""" Write a Python program to check if two given strings are isomorphic to each other or not. """ def isIsomorphic(str1, str2): dict_str1 = {} dict_str2 = {} for i, value in enumerate(str1): dict_str1[value] = dict_str1.get(value, []) + [i] for j, value in enumerate(str2): dict_str2[va...
""" Write a Python program to check if two given strings are isomorphic to each other or not. """ def is_isomorphic(str1, str2): dict_str1 = {} dict_str2 = {} for (i, value) in enumerate(str1): dict_str1[value] = dict_str1.get(value, []) + [i] for (j, value) in enumerate(str2): dict_str...
class Args: def __init__(self, config, checkpoint): self.cfg = config self.checkpoint = checkpoint self.sp = True self.detector = "yolo" self.inputpath = "./" self.inputlist = "" self.inputimg = "" self.outputpath = "examples/res/" self.save_im...
class Args: def __init__(self, config, checkpoint): self.cfg = config self.checkpoint = checkpoint self.sp = True self.detector = 'yolo' self.inputpath = './' self.inputlist = '' self.inputimg = '' self.outputpath = 'examples/res/' self.save_i...
PANDA_MODELS = dict( gt_joints='dream-panda-gt_joints--495831', predict_joints='dream-panda-predict_joints--173472', ) KUKA_MODELS = dict( gt_joints='dream-kuka-gt_joints--192228', predict_joints='dream-kuka-predict_joints--990681', ) BAXTER_MODELS = dict( gt_joints='dream-baxter-gt_joints--510055...
panda_models = dict(gt_joints='dream-panda-gt_joints--495831', predict_joints='dream-panda-predict_joints--173472') kuka_models = dict(gt_joints='dream-kuka-gt_joints--192228', predict_joints='dream-kuka-predict_joints--990681') baxter_models = dict(gt_joints='dream-baxter-gt_joints--510055', predict_joints='dream-baxt...
n = int(input()) narr = list(map(int,input().split())) ev,od = 0,0 for i in range(n): if narr[i]%2==0: ev+=narr[i] else: od+=narr[i] print(od-ev)
n = int(input()) narr = list(map(int, input().split())) (ev, od) = (0, 0) for i in range(n): if narr[i] % 2 == 0: ev += narr[i] else: od += narr[i] print(od - ev)
def linear_search(array, n): """ - Definition - In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Line...
def linear_search(array, n): """ - Definition - In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Line...
def _resource_from_cache_prefix(resource, cache): """ Combine the resource name with the cache prefix (if any) """ if getattr(cache, 'key_prefix', None): name = '{} {}'.format(resource, cache.key_prefix) else: name = resource # enforce lowercase to make the output nicer to read ...
def _resource_from_cache_prefix(resource, cache): """ Combine the resource name with the cache prefix (if any) """ if getattr(cache, 'key_prefix', None): name = '{} {}'.format(resource, cache.key_prefix) else: name = resource return name.lower() def quantize_key_values(key): ...
#!usr/bin/env python3 # -*- coding:utf-8 -*- ''' Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. For example, Given [5, 7, 7, 8, 8, 10] and ...
""" Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. For example, Given [5, 7, 7, 8, 8, 10] and target value 8, return [3, 4]. """ class Sol...
# Here we assume that cs_array has the dimensions (n_bins, n_chans, n_seg) # Where n_chans is the number of channels of interest ## cs_array has been filtered before this step cs_avg = np.mean(cs_array, axis=-1) ## Take the IFFT of the cross spectrum to get the CCF ccf_avg = fftpack.ifft(cs_avg, axis=0).real ccf_arra...
cs_avg = np.mean(cs_array, axis=-1) ccf_avg = fftpack.ifft(cs_avg, axis=0).real ccf_array = fftpack.ifft(cs_array, axis=0).real ccv_avg *= 2.0 / np.float(n_bins) / ref_rms ccf_array *= 2.0 / np.float(n_bins) / ref_rms ccf_resid = (ccf_array.T - ccf_avg.T).T sample_var = np.sum(ccf_resid ** 2, axis=2) / (meta_dict['n_se...
# Copyright (c) 2017 Dustin Toff # Licensed under Apache License v2.0 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository") def new_github_repository(name = None, user = None, project = None, commit = None, tag ...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository', 'new_git_repository') def new_github_repository(name=None, user=None, project=None, commit=None, tag=None, sha256=None, build_file=None, build_file_content=None): """ E...
""" sqmpy ~~~~~ A job management web application that makes it easier for scientists to submit and monitor jobs to remote to remote resources. `sqm' stands for Simple Queue Manager. """ __author__ = 'Mehdi Sadeghi' __version__ = '0.4'
""" sqmpy ~~~~~ A job management web application that makes it easier for scientists to submit and monitor jobs to remote to remote resources. `sqm' stands for Simple Queue Manager. """ __author__ = 'Mehdi Sadeghi' __version__ = '0.4'
int_list = list(map(int, input().split())) movement = int(input()) for i in range(movement): int_list.append(int_list[0]) int_list.remove(int_list[0]) print(int_list)
int_list = list(map(int, input().split())) movement = int(input()) for i in range(movement): int_list.append(int_list[0]) int_list.remove(int_list[0]) print(int_list)
total = 0 count = 0 average = 0 smallest = None largest = None print('before largest:', largest) while True: inp = input('>') if inp == "done": break try: if float(inp): total += float(inp) count += 1 new_value = float(inp) if largest is None o...
total = 0 count = 0 average = 0 smallest = None largest = None print('before largest:', largest) while True: inp = input('>') if inp == 'done': break try: if float(inp): total += float(inp) count += 1 new_value = float(inp) if largest is None o...
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-AlarmMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AlarmMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:19:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 #...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ...
def insertion_sort(a): for i in range (1,len(a)): c=a[i] k=i-1 while (k>=0) and (c<=a[k]) : a[k+1] = a[k] k=k-1 a[k+1] = c n=int(input("Enter No. Of Elements in List :-s ")) a=[i for i in range (n)] print ("Enter the Elements one after the other :...
def insertion_sort(a): for i in range(1, len(a)): c = a[i] k = i - 1 while k >= 0 and c <= a[k]: a[k + 1] = a[k] k = k - 1 a[k + 1] = c n = int(input('Enter No. Of Elements in List :-s ')) a = [i for i in range(n)] print('Enter the Elements one after the other...
""" assign a database version to the getpaid installation for future upgrades. """ def evolve( portal ): # the upgrade framework will take care of upgrading for us pass
""" assign a database version to the getpaid installation for future upgrades. """ def evolve(portal): pass
class GraphAlgos: """ Wrapper class which handle the graph algorithms more efficiently, by abstracting repeating code. """ database = None # Static variable shared across objects. def __init__(self, database, start, relationship, end = None, orientation = 'NATURAL', rel_weight = None): ...
class Graphalgos: """ Wrapper class which handle the graph algorithms more efficiently, by abstracting repeating code. """ database = None def __init__(self, database, start, relationship, end=None, orientation='NATURAL', rel_weight=None): if GraphAlgos.database is None: Gr...
total = int(input()) b_num = 0 b_x = 0 b_y = 0 for i in range(total): num, x, y = map(int, input().split()) mn = num - b_num mx = abs(x - b_x) my = abs(y - b_y) if mn < mx + my: print("No") exit() else: if b_num % 2 == (mx + my) % 2: mn = num b_...
total = int(input()) b_num = 0 b_x = 0 b_y = 0 for i in range(total): (num, x, y) = map(int, input().split()) mn = num - b_num mx = abs(x - b_x) my = abs(y - b_y) if mn < mx + my: print('No') exit() elif b_num % 2 == (mx + my) % 2: mn = num b_x = x b_y = y...
# uninhm # https://atcoder.jp/contests/abc164/tasks/abc164_c # dictionary a = {} ans = 0 n = int(input()) for _ in range(n): i = input() ans += a.get(i, 1) a[i] = 0 print(ans)
a = {} ans = 0 n = int(input()) for _ in range(n): i = input() ans += a.get(i, 1) a[i] = 0 print(ans)
class UnionFind: def __init__(self, size): self.parent = list(range(size)) self.component = [[i] for i in range(size)] def root(self, i): if self.parent[i] != i: self.parent[i] = self.root(self.parent[i]) return self.parent[i] def unite(self, i, j): i, j = self.root(i), self.root(j...
class Unionfind: def __init__(self, size): self.parent = list(range(size)) self.component = [[i] for i in range(size)] def root(self, i): if self.parent[i] != i: self.parent[i] = self.root(self.parent[i]) return self.parent[i] def unite(self, i, j): (i,...
class Print: """ A simple text-printing component """ def doPrint(self, v): print(v) @staticmethod def cfgr(builder): ## outputs builder.addInput('on').string_to_method(lambda obj: obj.doPrint)
class Print: """ A simple text-printing component """ def do_print(self, v): print(v) @staticmethod def cfgr(builder): builder.addInput('on').string_to_method(lambda obj: obj.doPrint)
#!/usr/bin/env python # -*- coding: utf-8 -*- class TClassStatic(object): obj_num = 0 def __init__(self, data): self.data = data TClassStatic.obj_num += 1 def printself(self): print("self.data: ", self.data) @staticmethod def smethod(): print("the number of obj is : "...
class Tclassstatic(object): obj_num = 0 def __init__(self, data): self.data = data TClassStatic.obj_num += 1 def printself(self): print('self.data: ', self.data) @staticmethod def smethod(): print('the number of obj is : ', TClassStatic.obj_num) @classmethod ...
# This code is connected with '18 - Modules.py' def kgs_to_lbs(weight): return 2.20462 * weight def lbs_t_kgs(weight): return 0.453592 * weight
def kgs_to_lbs(weight): return 2.20462 * weight def lbs_t_kgs(weight): return 0.453592 * weight
"""December 1st""" def sevenish_number(num): """Sevenish Number""" power_of_two = 0 sevenish = 0 while num > 0: val = pow(7, power_of_two) if num % 2 == 1 else 0 sevenish += val power_of_two += 1 num //= 2 return sevenish
"""December 1st""" def sevenish_number(num): """Sevenish Number""" power_of_two = 0 sevenish = 0 while num > 0: val = pow(7, power_of_two) if num % 2 == 1 else 0 sevenish += val power_of_two += 1 num //= 2 return sevenish
""" ------------------------------------------------------------------------------ @file variable.py @author Milos Milicevic (milosh.mkv@gmail.com) @brief ... @version 0.1 @date 2020-08-26 @copyright Copyright (c) 2020 Distributed under the MIT software licens...
""" ------------------------------------------------------------------------------ @file variable.py @author Milos Milicevic (milosh.mkv@gmail.com) @brief ... @version 0.1 @date 2020-08-26 @copyright Copyright (c) 2020 Distributed under the MIT software licens...
n=int(input()) arr=[] game=True for i in range(n): arr.append((input())) for j in range(n): if "OO" in arr[j]: print("YES") ind=arr[j].index("OO") if ind==0 and arr[j][ind+1]=="O": arr[j]="++|"+arr[j][3]+arr[j][4] if ind==3 and arr[j][ind+1]=="O": arr[j]=arr[j][0]+arr[j][1]+"|"+"++" game=False break...
n = int(input()) arr = [] game = True for i in range(n): arr.append(input()) for j in range(n): if 'OO' in arr[j]: print('YES') ind = arr[j].index('OO') if ind == 0 and arr[j][ind + 1] == 'O': arr[j] = '++|' + arr[j][3] + arr[j][4] if ind == 3 and arr[j][ind + 1] == '...
# -*- coding: utf-8 -*- """ Created on Sat May 29 03:30:25 2021 @author: Septhiono """ year=int(input("Which year would you like to check?")) if year%4==0: if year%100==0: if year%400==0: print(f"{year} is a leap year") else: print(f"{year} is not a leap year")...
""" Created on Sat May 29 03:30:25 2021 @author: Septhiono """ year = int(input('Which year would you like to check?')) if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: print(f'{year} is a leap year') else: print(f'{year} is not a leap year') else: print...
""" LeetCode Problem: 1095. Find in Mountain Array Link: https://leetcode.com/problems/find-in-mountain-array/ Language: Python Written by: Mostofa Adib Shakib """ class Solution: def findInMountainArray(self, target: int, mountain_arr: 'MountainArray') -> int: #binary search to find the peak mountain ...
""" LeetCode Problem: 1095. Find in Mountain Array Link: https://leetcode.com/problems/find-in-mountain-array/ Language: Python Written by: Mostofa Adib Shakib """ class Solution: def find_in_mountain_array(self, target: int, mountain_arr: 'MountainArray') -> int: high = mountain_arr.length() - 1 ...
"""Modules for user interfaces. Modules: ui -- Provide a base class for user interface facades. ui_cmd -- Provide a facade for a command line user interface. ui_tk -- Provide a facade for a Tkinter based GUI. ui_mb -- Provide a facade for a GUI featuring just message boxes. """
"""Modules for user interfaces. Modules: ui -- Provide a base class for user interface facades. ui_cmd -- Provide a facade for a command line user interface. ui_tk -- Provide a facade for a Tkinter based GUI. ui_mb -- Provide a facade for a GUI featuring just message boxes. """
class A: def spam(self): print('A.spam') class B(A): def spam(self): print('B.spam') super().spam() # Call parent spam() class C: def __init__(self): self.x = 0 class D(C): def __init__(self): super().__init__() self.y = 1 d = D() print(d.y) class Bas...
class A: def spam(self): print('A.spam') class B(A): def spam(self): print('B.spam') super().spam() class C: def __init__(self): self.x = 0 class D(C): def __init__(self): super().__init__() self.y = 1 d = d() print(d.y) class Base: def __init...
foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item'] print(foo[0], ' FIRST ITEM') print(foo[len(foo) - 1], ' LAST ITEM')
foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item'] print(foo[0], ' FIRST ITEM') print(foo[len(foo) - 1], ' LAST ITEM')
# Copyright 2017 Citrix Systems # # 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 agr...
def set_host_enabled(session, enabled): args = {'enabled': enabled} return session.call_plugin('xenhost.py', 'set_host_enabled', args) def get_host_uptime(session): return session.call_plugin('xenhost.py', 'host_uptime', {}) def get_host_data(session): return session.call_plugin('xenhost.py', 'host_da...
""" get information of receptive field """ def get_receptive_field(neuron_index, layer_info, pad=(0, 0)): """ neuron_index: tuple of length 2 or int represented x axis and y layer_info: tuple of length 4 has information of receptive_field """ n, j, rf, start = layer_info if isinstance(neur...
""" get information of receptive field """ def get_receptive_field(neuron_index, layer_info, pad=(0, 0)): """ neuron_index: tuple of length 2 or int represented x axis and y layer_info: tuple of length 4 has information of receptive_field """ (n, j, rf, start) = layer_info if isinstance(neu...
"""This module regroups all exceptions tied to pyqtcli cli.""" class QresourceError(Exception): """Exception raised with problems concerning qresource node in qrc files.""" def __init__(self, arg): super(QresourceError, self).__init__() self.msg = arg def __str__(self): return sel...
"""This module regroups all exceptions tied to pyqtcli cli.""" class Qresourceerror(Exception): """Exception raised with problems concerning qresource node in qrc files.""" def __init__(self, arg): super(QresourceError, self).__init__() self.msg = arg def __str__(self): return sel...