content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2017 Tijme Gommers # # 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...
class Crawleractions(object): """The actions that crawler callbacks can return. Attributes: DO_CONTINUE_CRAWLING (int): Continue by crawling the request. DO_SKIP_TO_NEXT (int): Skip the current request and continue with the next one in line. DO_STOP_CRAWLING (int): Stop crawling and qui...
word = input() dicc = {} for char in word: if char not in dicc.keys(): dicc[char] = 0 dicc[char] += 1 rainbow = 1 for x, y in dicc.items(): rainbow *= (y + 1) % 11092019 rainbow = rainbow % 11092019 print(rainbow)
word = input() dicc = {} for char in word: if char not in dicc.keys(): dicc[char] = 0 dicc[char] += 1 rainbow = 1 for (x, y) in dicc.items(): rainbow *= (y + 1) % 11092019 rainbow = rainbow % 11092019 print(rainbow)
#!/usr/bin/env python3 __author__ = 'Andrej Palicka <andrej.palicka@merck.com>'
__author__ = 'Andrej Palicka <andrej.palicka@merck.com>'
students_roll = (1,2,3,6,77,90) print(students_roll.index(77))
students_roll = (1, 2, 3, 6, 77, 90) print(students_roll.index(77))
def longestPalindrome(s: str) -> str: result = '' list1 = list(s) left = 0 right = 0 for left in range(len(list1)): char = list1[left] for right in range(len(list1)): if right > left and char == list1[right]: string = ''.join(list1[left:right+1]) ...
def longest_palindrome(s: str) -> str: result = '' list1 = list(s) left = 0 right = 0 for left in range(len(list1)): char = list1[left] for right in range(len(list1)): if right > left and char == list1[right]: string = ''.join(list1[left:right + 1]) ...
n = int(input("Whats your number?: ")) sumOrProduct = input("Sum or product?: ") output = 0 if sumOrProduct.lower() == "sum": for x in range(1, n + 1): output += x elif sumOrProduct.lower() == "product": output = 1 for x in range(1, n + 1): output *= x print(output)
n = int(input('Whats your number?: ')) sum_or_product = input('Sum or product?: ') output = 0 if sumOrProduct.lower() == 'sum': for x in range(1, n + 1): output += x elif sumOrProduct.lower() == 'product': output = 1 for x in range(1, n + 1): output *= x print(output)
#!/usr/bin/env python __author__ = 'kinpa200296' class mydefaultdict(object): def __init__(self): self._dict = dict() def __getitem__(self, item): if item not in self._dict: self._dict[item] = mydefaultdict() return self._dict[item] def __setitem__(self, key, value):...
__author__ = 'kinpa200296' class Mydefaultdict(object): def __init__(self): self._dict = dict() def __getitem__(self, item): if item not in self._dict: self._dict[item] = mydefaultdict() return self._dict[item] def __setitem__(self, key, value): self._dict[key...
# For each sample we input the integer identifiers # of a single user and a single item user_id_input = Input(shape=[1], name='user') item_id_input = Input(shape=[1], name='item') embedding_size = 16 dense_size = 128 dropout_embedding = 0.5 dropout_hidden = 0.2 user_embedding = Embedding(output_dim=embedding_size, in...
user_id_input = input(shape=[1], name='user') item_id_input = input(shape=[1], name='item') embedding_size = 16 dense_size = 128 dropout_embedding = 0.5 dropout_hidden = 0.2 user_embedding = embedding(output_dim=embedding_size, input_dim=max_user_id + 1, input_length=1, name='user_embedding')(user_id_input) item_embedd...
guys = list() data = list() adults = junior = 0 for counter in range(0, 3): data.append(str(input('Name: '))) data.append(int(input('Age: '))) guys.append(data[:]) data.clear() print(guys) for person in guys: if person[1] >= 21: print(f'{person[0]} has reached the legal age of majority.') ...
guys = list() data = list() adults = junior = 0 for counter in range(0, 3): data.append(str(input('Name: '))) data.append(int(input('Age: '))) guys.append(data[:]) data.clear() print(guys) for person in guys: if person[1] >= 21: print(f'{person[0]} has reached the legal age of majority.') ...
# Normalization uncertainties xsec_std = { 'TTJets_bkg': 0.06097560975609759, 'WZJets': 0.04770462700154329, 'STJets': 0.0666983590353544, 'TTJets_signal': 0.0609756097560975 } norms = {"lumi": 0.02, "mistag":0.05, "tau_trigger":0.05, "tau_id":0.06, "ttmass":0.03, ...
xsec_std = {'TTJets_bkg': 0.06097560975609759, 'WZJets': 0.04770462700154329, 'STJets': 0.0666983590353544, 'TTJets_signal': 0.0609756097560975} norms = {'lumi': 0.02, 'mistag': 0.05, 'tau_trigger': 0.05, 'tau_id': 0.06, 'ttmass': 0.03, 'ttq2': 0.02, 'ttparton': 0.03, 'xsec': xsec_std['TTJets_signal']} args = {} args['...
def extractSleepykoreanWordpressCom(item): ''' Parser for 'sleepykorean.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None if "lucia" in item['tags']: return buildReleaseMessageWithType(item, "Lu...
def extract_sleepykorean_wordpress_com(item): """ Parser for 'sleepykorean.wordpress.com' """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'lucia' in item['tags']: return build_...
lista = [1, 2, 3] lista.insert(1, 'teste') lista.append(10) print(lista) print(lista[1:-1]) print(2 in lista) lista.reverse() print(lista) print('teste' not in lista)
lista = [1, 2, 3] lista.insert(1, 'teste') lista.append(10) print(lista) print(lista[1:-1]) print(2 in lista) lista.reverse() print(lista) print('teste' not in lista)
while True: try: maximo = input() except EOFError: print(ult_max) break ult_max = maximo
while True: try: maximo = input() except EOFError: print(ult_max) break ult_max = maximo
matriz = [[], [], []] # matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] for lin in range(0, 3): # Representa as 3 linhas da matriz for col in range(0, 3): # Representa as 3 colunas da matriz matriz[lin].append(int(input(f'Digite um valor para [{lin}, {col}]: '))) # Adiciona os valor a matriz # matriz[...
matriz = [[], [], []] for lin in range(0, 3): for col in range(0, 3): matriz[lin].append(int(input(f'Digite um valor para [{lin}, {col}]: '))) print('-=' * 30) for lin in matriz: for col in lin: print(f'[{col:^5}]', end=' ') print()
def get_params_path_list(toppar_dir_path): params_path_list = [ f"{toppar_dir_path}/top_all36_prot.rtf", f"{toppar_dir_path}/par_all36m_prot.prm", f"{toppar_dir_path}/top_all36_na.rtf", f"{toppar_dir_path}/par_all36_na.prm", f"{toppar_dir_path}/top_all36_carb.rtf", f"{toppar_dir_path}/par...
def get_params_path_list(toppar_dir_path): params_path_list = [f'{toppar_dir_path}/top_all36_prot.rtf', f'{toppar_dir_path}/par_all36m_prot.prm', f'{toppar_dir_path}/top_all36_na.rtf', f'{toppar_dir_path}/par_all36_na.prm', f'{toppar_dir_path}/top_all36_carb.rtf', f'{toppar_dir_path}/par_all36_carb.prm', f'{toppar_...
DEBUG = False RRH_NUMBER = 3 CONNECTION_NUMBER = 5 POISSON_RATE = 1/4000.0 PACKET_SIZE_MEAN = 100 PACKET_SIZE_DEV = 20 PACKET_SIZE_MAX = 1000000 BASE_PORT = 3000 LG_SERVICE_PORT = 5001 BROADCAST_ADDRESS = '10.0.0.2'
debug = False rrh_number = 3 connection_number = 5 poisson_rate = 1 / 4000.0 packet_size_mean = 100 packet_size_dev = 20 packet_size_max = 1000000 base_port = 3000 lg_service_port = 5001 broadcast_address = '10.0.0.2'
# # @lc app=leetcode id=704 lang=python # # [704] Binary Search # # https://leetcode.com/problems/binary-search/description/ # # algorithms # Easy (45.32%) # Likes: 290 # Dislikes: 32 # Total Accepted: 62.1K # Total Submissions: 127.6K # Testcase Example: '[-1,0,3,5,9,12]\n9' # # Given a sorted (in ascending ord...
class Solution(object): def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if not nums: return -1 start = 0 end = len(nums) - 1 while start <= end: middle = (start + end) / 2 ...
class Message: def __init__(self, pass_on=False): self.pass_on = pass_on class MessengerNodeMixin: """ Implements a node that can send messages to its parent """ @property def parent(self): raise NotImplementedError def handle_message(self, message): """ This method must...
class Message: def __init__(self, pass_on=False): self.pass_on = pass_on class Messengernodemixin: """ Implements a node that can send messages to its parent """ @property def parent(self): raise NotImplementedError def handle_message(self, message): """ This method must ...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( n , m ) : return n if ( n == m ) else 1 #TOFILL if __name__ == '__main__': param = [ (57,57,), (...
def f_gold(n, m): return n if n == m else 1 if __name__ == '__main__': param = [(57, 57), (22, 22), (17, 17), (74, 74), (93, 22), (56, 54), (5, 33), (5, 68), (9, 75), (98, 21)] n_success = 0 for (i, parameters_set) in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): ...
class Solution: # @return an integer def trailingZeroes(self, n): return sum(map(lambda x: n / (5**x) , range(1, 31)))
class Solution: def trailing_zeroes(self, n): return sum(map(lambda x: n / 5 ** x, range(1, 31)))
#!/usr/bin/env python3 class Solution: def uniquePathsIII(self, grid): self.left = 0 nr, nc = len(grid), len(grid[0]) for i in range(nr): for j in range(nc): if grid[i][j] == 0: self.left += 1 elif grid[i][j] == 1: ...
class Solution: def unique_paths_iii(self, grid): self.left = 0 (nr, nc) = (len(grid), len(grid[0])) for i in range(nr): for j in range(nc): if grid[i][j] == 0: self.left += 1 elif grid[i][j] == 1: self.left...
# Advent of Code Day 8 def parse_file(file): with open (file, 'r') as f: data=[] for line in f.read().splitlines(): op, num = line.split() num = int(num) data.append([op, num]) return data def execute_prog_part1(file): data = parse_file(file) acc =...
def parse_file(file): with open(file, 'r') as f: data = [] for line in f.read().splitlines(): (op, num) = line.split() num = int(num) data.append([op, num]) return data def execute_prog_part1(file): data = parse_file(file) acc = 0 op_id = 0 ex...
class Player: def __init__(self, player_name): self.player_name = player_name self.character = None self.level = 1 self.hp = 100 self.mp = 1 self.win_record = {'win': 0, 'lose': 0} self.score = 0 def get_name(self): return self.player_name d...
class Player: def __init__(self, player_name): self.player_name = player_name self.character = None self.level = 1 self.hp = 100 self.mp = 1 self.win_record = {'win': 0, 'lose': 0} self.score = 0 def get_name(self): return self.player_name d...
def reporting(conn, result, timeout=None): timeout = timeout or conn.global_timeout # -1 a.k.a. wait for ever log_map = { 'debug': conn.logger.debug, 'error': conn.logger.error, 'warning': conn.logger.warning } while True: try: received = result.receive(tim...
def reporting(conn, result, timeout=None): timeout = timeout or conn.global_timeout log_map = {'debug': conn.logger.debug, 'error': conn.logger.error, 'warning': conn.logger.warning} while True: try: received = result.receive(timeout) (level_received, message) = list(received...
# # This file contains the Python code from Program 7.6 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm07_06.txt # class OrderedListAs...
class Orderedlistasarray(OrderedList): def withdraw(self, obj): if self._count == 0: raise ContainerEmpty i = 0 while i < self._count and self._array[i] is not obj: i += 1 if i == self._count: raise KeyError while i < self._count - 1: ...
''' If you are going to add a camera to this list please test and fill in all available settings. ''' LOGITECH = 'logitechHD1080p' PHILIPS = 'philips 3' camera_settings = { 'logitechHD1080p': { 'res': ((1920, 1080, 3), (640, 480, 3), (1280, 720, 3), (480, 360, 3)), 'fps': ((30.0),) }, 'phi...
""" If you are going to add a camera to this list please test and fill in all available settings. """ logitech = 'logitechHD1080p' philips = 'philips 3' camera_settings = {'logitechHD1080p': {'res': ((1920, 1080, 3), (640, 480, 3), (1280, 720, 3), (480, 360, 3)), 'fps': (30.0,)}, 'philips 3': {'res': ((640, 480, 3), (1...
#!/usr/bin/env python def home_samples(adapter, year, month): match = {"year": {"$eq": year}} if month: match["month"] = {"$eq": month} pipe = [ {"$match": {"received_date": {"$exists": "True"}}}, { "$project": { "month": {"$month": "$received_date"}, ...
def home_samples(adapter, year, month): match = {'year': {'$eq': year}} if month: match['month'] = {'$eq': month} pipe = [{'$match': {'received_date': {'$exists': 'True'}}}, {'$project': {'month': {'$month': '$received_date'}, 'year': {'$year': '$received_date'}, 'category': 1, 'priority': 1}}, {'$m...
point_cloud_range = [-50, 0, -5, 50, 50, 3] voxel_size = [0.25, 0.25, 8] model = dict( type='MMDA', img_backbone=dict( type='UNetResNet34', out_channels=64, pretrained=True), img_seg_head=dict( type='ImageSegHead', in_channels=64, num_classes=11 ), pts...
point_cloud_range = [-50, 0, -5, 50, 50, 3] voxel_size = [0.25, 0.25, 8] model = dict(type='MMDA', img_backbone=dict(type='UNetResNet34', out_channels=64, pretrained=True), img_seg_head=dict(type='ImageSegHead', in_channels=64, num_classes=11), pts_voxel_layer=dict(max_num_points=64, point_cloud_range=point_cloud_range...
"""" Dummy mocking module for pandas. When pandas is not avaialbe we will import this module as graphlab.deps.pandas, and set HAS_pandas to false. All methods that access pandas should check the HAS_pandas flag, therefore, attributes/class/methods in this module should never be actually used. """ ''' Copyright (C) 201...
"""" Dummy mocking module for pandas. When pandas is not avaialbe we will import this module as graphlab.deps.pandas, and set HAS_pandas to false. All methods that access pandas should check the HAS_pandas flag, therefore, attributes/class/methods in this module should never be actually used. """ '\nCopyright (C) 2016 ...
DOMAINS_TO_MONITOR = {"photoscape.ch"} # Sample malware domain def rule(event): return any(domain in event.get("domain") for domain in DOMAINS_TO_MONITOR) def title(event): return "Suspicious lookup to domain " + event.get("domain", "<UNKNOWN_DOMAIN>")
domains_to_monitor = {'photoscape.ch'} def rule(event): return any((domain in event.get('domain') for domain in DOMAINS_TO_MONITOR)) def title(event): return 'Suspicious lookup to domain ' + event.get('domain', '<UNKNOWN_DOMAIN>')
# Lugares em restaurante: Escreva um programa que pergunte ao usuario quantas pessoas estao em seu grupo para jantar. Se a resposta for maior que oito, exiba uma mensagem dizendo que eles deverao esperar uma mesa. Caso contrario, informe que sua mesa esta pronta. question = int(input("Dear costumer.\nHow many people a...
question = int(input('Dear costumer.\nHow many people are with you for dinner? ')) if question > 8: print('Please, wait for a table!') else: print('Your table is ready.')
# # PySNMP MIB module CRI-SERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CRI-SERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:12:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, single_value_constraint, value_range_constraint, constraints_intersection) ...
''' LICENSING ------------------------------------------------- hypergolix: A python Golix client. Copyright (C) 2016 Muterra, Inc. Contributors ------------ Nick Badger badg@muterra.io | badg@nickbadger.com | nickbadger.com This library is free software; you can redistribute it and/o...
""" LICENSING ------------------------------------------------- hypergolix: A python Golix client. Copyright (C) 2016 Muterra, Inc. Contributors ------------ Nick Badger badg@muterra.io | badg@nickbadger.com | nickbadger.com This library is free software; you can redistribute it and/o...
def empty_it(a, b, c, d, nested): for i in range(a, c+1): for j in range(b, d+1): nested[i][j] = 0 return nested
def empty_it(a, b, c, d, nested): for i in range(a, c + 1): for j in range(b, d + 1): nested[i][j] = 0 return nested
# -*- coding: utf-8 -*- G = 0.01720209895 * 0.01720209895 def fromSI_L(l): return l / 149597870700 def fromSI_T(t): return t / 86400 def fromSI_M(m): return m / 1.98892e30
g = 0.01720209895 * 0.01720209895 def from_si_l(l): return l / 149597870700 def from_si_t(t): return t / 86400 def from_si_m(m): return m / 1.98892e+30
class Team: #Creates the team and initializes all the players def __init__(self): self._pg = null self._sg = null self._sf = null self._pf = nul self._c = null self._g = null self._util = null
class Team: def __init__(self): self._pg = null self._sg = null self._sf = null self._pf = nul self._c = null self._g = null self._util = null
class Solution: def XXX(self, x: int) -> int: if x==0: return 0 l,r = 1,x while l<r-1: mid = (l+r)//2 if mid**2>x: r = mid elif mid**2<x: l = mid elif mid**2==x: return mid ret...
class Solution: def xxx(self, x: int) -> int: if x == 0: return 0 (l, r) = (1, x) while l < r - 1: mid = (l + r) // 2 if mid ** 2 > x: r = mid elif mid ** 2 < x: l = mid elif mid ** 2 == x: ...
# Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAND ---------- # M...
spark.readStream.table('workout_bpm').createOrReplaceTempView('TEMP_workout_bpm') user_bins_df = spark.sql('\n SELECT workout_id, session_id, a.user_id, age, gender, city, state, min_bpm, avg_bpm, max_bpm, num_recordings\n FROM user_bins a\n INNER JOIN\n (SELECT user_id, workout_id, session_id, \n ...
# Python 3 program to find lexicographically # next string def nextWord(s): # If string is empty. if (s == " "): return "a" # Find first character from right # which is not z. i = len(s) - 1 while (s[i] == 'z' and i >= 0): i -= 1 # If all characters are 'z', append # an 'a' at the end. if (i == -1): ...
def next_word(s): if s == ' ': return 'a' i = len(s) - 1 while s[i] == 'z' and i >= 0: i -= 1 if i == -1: s = s + 'a' else: s = s.replace(s[i], chr(ord(s[i]) + 1), 1) return s if __name__ == '__main__': str = 'samez' print(next_word(str))
list1 = [5, 7, 3] #print(5 in list1) print(55 in list1) if 5 in list1: print("Yes its in list") print(88 not in list1) if 66 not in list1: print("Not in listt")
list1 = [5, 7, 3] print(55 in list1) if 5 in list1: print('Yes its in list') print(88 not in list1) if 66 not in list1: print('Not in listt')
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified). __all__ = ['first_function'] # Cell def first_function(nom): return(f'{nom} ets burro')
__all__ = ['first_function'] def first_function(nom): return f'{nom} ets burro'
web3 = Web3(Web3.HTTPProvider('https://kovan.infura.io/v3/<infura_project_id>')) abi = '[{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string...
web3 = web3(Web3.HTTPProvider('https://kovan.infura.io/v3/<infura_project_id>')) abi = '[{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string...
""" Helper functions """ def match_client(project_data, client_name): """ Given a project's json data, sees if the client name matches """ if client_name is None: client_name = "" if "clientName" in project_data and project_data["clientName"] == client_name: return True return ...
""" Helper functions """ def match_client(project_data, client_name): """ Given a project's json data, sees if the client name matches """ if client_name is None: client_name = '' if 'clientName' in project_data and project_data['clientName'] == client_name: return True return F...
# Semantic versioning # MAJOR.MINOR.PATCH __version__ = '1.1.1'
__version__ = '1.1.1'
# These actually do something important... def do_this(): print('do_this') def do_that(): print('do_that') def do_three(): print('do_three') # These next four functions do the same thing def first(x): if x == 'one': do_this() else: if x == 'two': do_that() ...
def do_this(): print('do_this') def do_that(): print('do_that') def do_three(): print('do_three') def first(x): if x == 'one': do_this() elif x == 'two': do_that() elif x == 'three': do_thee() else: raise key_error(x) def second(x): if x == 'one': ...
# Populating Next Right Pointers in Each Node II # Definition for a Node. class Node: def __init__(self, val = 0, left = None, right = None, next = None): self.val = val self.left = left self.right = right self.next = next def __repr__(self): left = "<EMPTY>" if self.lef...
class Node: def __init__(self, val=0, left=None, right=None, next=None): self.val = val self.left = left self.right = right self.next = next def __repr__(self): left = '<EMPTY>' if self.left is None else f'{self.left.val}' right = '<EMPTY>' if self.right is None...
"""Exercise 6: Using Objects""" class Person: def __init__(self, name, age): self.name = name self.age = age def introduce_self(self): print(f"I am {self.name} and I am {self.age} years old") def compare_to(self, other_person): if self.age > other_person.age: ...
"""Exercise 6: Using Objects""" class Person: def __init__(self, name, age): self.name = name self.age = age def introduce_self(self): print(f'I am {self.name} and I am {self.age} years old') def compare_to(self, other_person): if self.age > other_person.age: ...
n = int(input()) listx = [] for i in range(n): x,y = input().split() listx.append(int(x)%int(y)) for i in range(n): print(listx[i])
n = int(input()) listx = [] for i in range(n): (x, y) = input().split() listx.append(int(x) % int(y)) for i in range(n): print(listx[i])
pkgname = "xwd" pkgver = "1.0.8" pkgrel = 0 build_style = "gnu_configure" hostmakedepends = ["pkgconf"] makedepends = ["libx11-devel", "libxkbfile-devel"] pkgdesc = "Dump an image of an X window" maintainer = "q66 <q66@chimera-linux.org>" license = "MIT" url = "https://xorg.freedesktop.org" source = f"$(XORG_SITE)/app/...
pkgname = 'xwd' pkgver = '1.0.8' pkgrel = 0 build_style = 'gnu_configure' hostmakedepends = ['pkgconf'] makedepends = ['libx11-devel', 'libxkbfile-devel'] pkgdesc = 'Dump an image of an X window' maintainer = 'q66 <q66@chimera-linux.org>' license = 'MIT' url = 'https://xorg.freedesktop.org' source = f'$(XORG_SITE)/app/...
# Solved 05/27/2020 # Hackerrank # https://www.hackerrank.com/challenges/sherlock-and-valid-string/ def is_valid(s): # create a frequency count # if there are 3 plus frequencies return false # if there are two frequencies, but the difference in frequencies # is more than 1 return false # if there a...
def is_valid(s): if len(s) == 0: return 'YES' frequencies = {} for char in s: if frequencies.__contains__(char): frequencies[char] += 1 pass else: frequencies[char] = 1 pass meta = {} for key in frequencies: if meta.__co...
""" Module: 'urequests' on micropython-esp32-1.14 """ # MCU: {'ver': '1.14', 'port': 'esp32', 'arch': 'xtensawin', 'sysname': 'esp32', 'release': '1.14.0', 'name': 'micropython', 'mpy': 10757, 'version': '1.14.0', 'machine': 'ESP32 module (spiram) with ESP32', 'build': '', 'nodename': 'esp32', 'platform': 'esp32', 'fam...
""" Module: 'urequests' on micropython-esp32-1.14 """ class Response: """""" def close(): pass content = None def json(): pass text = None def delete(): pass def get(): pass def head(): pass def patch(): pass def post(): pass def put(): pass def requ...
def solution(prices): answer = [] for i in range(len(prices)): pri = 0 for j in range(i+1, len(prices)): pri += 1 if prices[i] > prices[j]: break answer.append(pri) return answer
def solution(prices): answer = [] for i in range(len(prices)): pri = 0 for j in range(i + 1, len(prices)): pri += 1 if prices[i] > prices[j]: break answer.append(pri) return answer
""" :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu> :Date: 2019-10-02 :Copyright: 2016-2019, Karr Lab :License: MIT """ class TestMultialgorithmSimulation(unittest.TestCase): def test_partition_species(self): self.multialgorithm_simulation.partition_species() priv_species = self.multialgorith...
""" :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu> :Date: 2019-10-02 :Copyright: 2016-2019, Karr Lab :License: MIT """ class Testmultialgorithmsimulation(unittest.TestCase): def test_partition_species(self): self.multialgorithm_simulation.partition_species() priv_species = self.multialgorithm...
"""Controls Jiachang Switch devices. """ class JcSwitch: def __init__(self, JcDirector, item_id): """Creates a Jiachang Switch object. Parameters: `JcDirector` - A `jcapi.director.JcDirector` object that corresponds to the Jiachang Director that the switch is connected to. ...
"""Controls Jiachang Switch devices. """ class Jcswitch: def __init__(self, JcDirector, item_id): """Creates a Jiachang Switch object. Parameters: `JcDirector` - A `jcapi.director.JcDirector` object that corresponds to the Jiachang Director that the switch is connected to. ...
""" Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: 1634 = 14 + 64 + 34 + 44 8208 = 84 + 24 + 04 + 84 9474 = 94 + 44 + 74 + 44 As 1 = 14 is not a sum it is not included. The sum of these numbers is 1634 + 8208 + 9474 = 19316. Find the sum of all the numbers ...
""" Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: 1634 = 14 + 64 + 34 + 44 8208 = 84 + 24 + 04 + 84 9474 = 94 + 44 + 74 + 44 As 1 = 14 is not a sum it is not included. The sum of these numbers is 1634 + 8208 + 9474 = 19316. Find the sum of all the numbers ...
# KVM-based Discoverable Cloudlet (KD-Cloudlet) # Copyright (c) 2015 Carnegie Mellon University. # All Rights Reserved. # # THIS SOFTWARE IS PROVIDED "AS IS," WITH NO WARRANTIES WHATSOEVER. CARNEGIE MELLON UNIVERSITY EXPRESSLY DISCLAIMS TO THE FULLEST EXTENT PERMITTEDBY LAW ALL EXPRESS, IMPLIED, AND STATUTORY WARRANTIE...
__author__ = 'Sebastian' class Iskadevice: @staticmethod def initialize(root_folder): raise not_implemented_error() @staticmethod def bootstrap(): raise not_implemented_error() @staticmethod def list_devices(): raise not_implemented_error() def get_name(self): ...
class TagsTestCase(TestCase): def setUp(self): Tags.objects.create(Description="Urgent Pointer", Tag="URGP")
class Tagstestcase(TestCase): def set_up(self): Tags.objects.create(Description='Urgent Pointer', Tag='URGP')
d = mark_safe(c) b = execute(a, c, d) d = get_object_or_404(d) send_mail_jinja(d)
d = mark_safe(c) b = execute(a, c, d) d = get_object_or_404(d) send_mail_jinja(d)
#!/usr/local/bin/python3 def main(): # Test suite tests = [None, '', 'AABBCC', 'AAABCCDDDD'] results = [None, '', 'AABBCC', 'A3BCCD4'] for i in range(len(tests)): temp_result = compress_string(tests[i]) if temp_result == results[i]: print('PASS: {} returned {}'.format(tes...
def main(): tests = [None, '', 'AABBCC', 'AAABCCDDDD'] results = [None, '', 'AABBCC', 'A3BCCD4'] for i in range(len(tests)): temp_result = compress_string(tests[i]) if temp_result == results[i]: print('PASS: {} returned {}'.format(tests[i], temp_result)) else: ...
def load_dotdoe(doe_path=None): if doe_path is None: f = open('.doe', 'r') else: f = open(doe_path, 'r') text = f.read() lines = text.split('\n') dictionary = {} for line in lines: if line == '': pass else: variable = line.split(' > ')[...
def load_dotdoe(doe_path=None): if doe_path is None: f = open('.doe', 'r') else: f = open(doe_path, 'r') text = f.read() lines = text.split('\n') dictionary = {} for line in lines: if line == '': pass else: variable = line.split(' > ')[0] ...
gols = list() jogador = dict() tot = 0 jogador['nome'] = str(input('Nome do jogador: ')) partidas = int(input('Quantas partidas jogou: ')) for c in range(0, partidas): gol = int(input(f' ->> Quntidade de gols na partida {c}: ')) tot += gol gols.append(gol) jogador['gols'] = gols jogador['total'] = tot # M...
gols = list() jogador = dict() tot = 0 jogador['nome'] = str(input('Nome do jogador: ')) partidas = int(input('Quantas partidas jogou: ')) for c in range(0, partidas): gol = int(input(f' ->> Quntidade de gols na partida {c}: ')) tot += gol gols.append(gol) jogador['gols'] = gols jogador['total'] = tot print...
ROOT = "https://coursemology.org" LOGIN = "/users/sign_in" COURSE = "/courses/{}" ASSESSMENTS = "/assessments" SUBMISSIONS = "/submissions" MATERIALS = "/materials" FOLDERS = "/folders" def login(): return ROOT + LOGIN def course(id): return ROOT + COURSE.format(id) def assessments(id): return course...
root = 'https://coursemology.org' login = '/users/sign_in' course = '/courses/{}' assessments = '/assessments' submissions = '/submissions' materials = '/materials' folders = '/folders' def login(): return ROOT + LOGIN def course(id): return ROOT + COURSE.format(id) def assessments(id): return course(id)...
""" 777. Swap Adjacent in LR String In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or replacing one occurrence of "RX" with "XR". Given the starting string start and the ending string end, return True if and only if there exi...
""" 777. Swap Adjacent in LR String In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or replacing one occurrence of "RX" with "XR". Given the starting string start and the ending string end, return True if and only if there exi...
# -*- coding: utf-8 -*- def killTree(n, k): if n < 1: return k return killTree(n-1, (k+1)*2) aa=int(input()) for s in range(0, aa): nm,cc = list(map(int,input().split(" "))) print("%d" % killTree(nm,cc))
def kill_tree(n, k): if n < 1: return k return kill_tree(n - 1, (k + 1) * 2) aa = int(input()) for s in range(0, aa): (nm, cc) = list(map(int, input().split(' '))) print('%d' % kill_tree(nm, cc))
# enhanced version class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ dct = {} max_so_far = curr_max = start = 0 for index, i in enumerate(s): if i in dct and dct[i] >= start: max_so_far = max(max...
class Solution(object): def length_of_longest_substring(self, s): """ :type s: str :rtype: int """ dct = {} max_so_far = curr_max = start = 0 for (index, i) in enumerate(s): if i in dct and dct[i] >= start: max_so_far = max(max_so_...
def doPost(request,session): tagPaths = system.util.jsonDecode(request['postData'])['tagPaths'] tagValues = [] qualifiedValues = system.tag.readAll(tagPaths) tagValues = [{'value': qv.value, 'quality': qv.quality.toString(), 'timestamp': qv.timestamp} for qv in qualifiedValues] tagData = {} for i in range(len(t...
def do_post(request, session): tag_paths = system.util.jsonDecode(request['postData'])['tagPaths'] tag_values = [] qualified_values = system.tag.readAll(tagPaths) tag_values = [{'value': qv.value, 'quality': qv.quality.toString(), 'timestamp': qv.timestamp} for qv in qualifiedValues] tag_data = {} ...
# Stores data about professor class Professor: # Initializes professor data def __init__(self, id, name): self.Id = id self.Name = name self.CourseClasses = [] # Bind professor to course def addCourseClass(self, courseClass): self.CourseClasses.append(courseClass) ...
class Professor: def __init__(self, id, name): self.Id = id self.Name = name self.CourseClasses = [] def add_course_class(self, courseClass): self.CourseClasses.append(courseClass) def __eq__(self, rhs): return self.Id == rhs.Id
# exc - 1.4.2 (rolling mission) print("""picture 1: x-------x""") print("""picture 2: x-------x | | | | |""") print("""picture 3: x-------x | | | 0 | | |""") print("""picture 4: x-------x | | | ...
print('picture 1:\n x-------x') print('picture 2:\n x-------x\n |\n |\n |\n |\n |') print('picture 3:\n x-------x\n | |\n | 0\n |\n |\n |') print('picture 4:\n x-------x\n | |\n | 0\n | |\n |\n |') print('picture 5...
def get_short_answer(unswer): return unswer.replace( ',', '.').replace( '(', '.').replace('"', '.').split('.')[0].strip().lower() def get_explanation(right_answer): index = 0 for char in right_answer: if char == '.': index += 1 break if char == ',': ...
def get_short_answer(unswer): return unswer.replace(',', '.').replace('(', '.').replace('"', '.').split('.')[0].strip().lower() def get_explanation(right_answer): index = 0 for char in right_answer: if char == '.': index += 1 break if char == ',': break ...
_map_axis_values = { -11: -3, -9: -3, -7: -2, -5: -2, -3: -1, -1: -1, 1: 1, 3: 1, 5: 2, 7: 2, 9: 3, 11: 3, } class Learner: def __init__(self, id, lower_time, upper_time, active_reflexive, sensory_intuitive, visual_verbal, sequential_global, learning_goals): ...
_map_axis_values = {-11: -3, -9: -3, -7: -2, -5: -2, -3: -1, -1: -1, 1: 1, 3: 1, 5: 2, 7: 2, 9: 3, 11: 3} class Learner: def __init__(self, id, lower_time, upper_time, active_reflexive, sensory_intuitive, visual_verbal, sequential_global, learning_goals): self.score = {} self.id = id self....
f = open("all_ref.fa", "r") linear_ref = open("linear_all_ref.fa", "w") linear_GFP = '' linear_gacS = '' linear_pME6010 = '' linear_pUC18 = '' linear_control = '' content = [x.strip('\n') for x in f.readlines()] for i, line in enumerate(content): if line.startswith(">gi|211909964"): # print line lin...
f = open('all_ref.fa', 'r') linear_ref = open('linear_all_ref.fa', 'w') linear_gfp = '' linear_gac_s = '' linear_p_me6010 = '' linear_p_uc18 = '' linear_control = '' content = [x.strip('\n') for x in f.readlines()] for (i, line) in enumerate(content): if line.startswith('>gi|211909964'): linear_ref.write(li...
""" First Approach: Two Pointer Approach Time Complexity O(n*n), Space Complexity O(n) """ class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: if len(nums) <3: return [] ans = [] nums = sorted(nums) print(sorted(nums)) self.twoSum(nums, 0, ans...
""" First Approach: Two Pointer Approach Time Complexity O(n*n), Space Complexity O(n) """ class Solution: def three_sum(self, nums: List[int]) -> List[List[int]]: if len(nums) < 3: return [] ans = [] nums = sorted(nums) print(sorted(nums)) self.twoSum(nums, 0, ...
class Difference: def __init__(self, a): self.__elements = a def computeDifference(self): max = self.__elements[0] min = self.__elements[0] for num in self.__elements: if num > max: max = num if num < min: min = num ...
class Difference: def __init__(self, a): self.__elements = a def compute_difference(self): max = self.__elements[0] min = self.__elements[0] for num in self.__elements: if num > max: max = num if num < min: min = num ...
{ "targets": [{ "target_name": "heartbleed", "include_dirs": [ "src", "<(node_root_dir)/deps/openssl/openssl/include", ], "sources": [ "src/heartbleed.cc", ], }], }
{'targets': [{'target_name': 'heartbleed', 'include_dirs': ['src', '<(node_root_dir)/deps/openssl/openssl/include'], 'sources': ['src/heartbleed.cc']}]}
class computerAgent(object): """doc string""" def __init__(self,game): self.game=game pass
class Computeragent(object): """doc string""" def __init__(self, game): self.game = game pass
### Attribute IDS CONTROLLER = 500 RULES = 1000 IS_PREMADE_GAME = 1001 PARTIES_PRIVATE = 2000 PARTIES_PREMADE = 2001 PARTIES_PREMADE_1V1 = 2002 PARTIES_PREMADE_2V2 = 2003 PARTIES_PREMADE_3V3 = 2004 PARTIES_PREMADE_4V4 = 2005 PARTIES_PREMADE_FFA = 2006 PARTIES_PREMADE_5V5 = 2007 PARTIES_PREMADE_6V6 = 2008 PARTIES_PRIVAT...
controller = 500 rules = 1000 is_premade_game = 1001 parties_private = 2000 parties_premade = 2001 parties_premade_1_v1 = 2002 parties_premade_2_v2 = 2003 parties_premade_3_v3 = 2004 parties_premade_4_v4 = 2005 parties_premade_ffa = 2006 parties_premade_5_v5 = 2007 parties_premade_6_v6 = 2008 parties_private_one = 2010...
adapters = [] for line in open('input.txt', 'r').readlines(): adapters.append(int(line.strip())) adapters = sorted(adapters) device_joltage = adapters[-1] + 3 adapters.append(device_joltage) joltage, one_diff, three_diff = 0, 0, 0 for adapter in adapters: if adapter - joltage == 1: one_diff += 1 elif adapter - ...
adapters = [] for line in open('input.txt', 'r').readlines(): adapters.append(int(line.strip())) adapters = sorted(adapters) device_joltage = adapters[-1] + 3 adapters.append(device_joltage) (joltage, one_diff, three_diff) = (0, 0, 0) for adapter in adapters: if adapter - joltage == 1: one_diff += 1 ...
class Peak: def __init__(self, startidx): self.born = self.left = self.right = startidx self.died = None def get_persistence(self, seq): return seq[self.born] if self.died is None else seq[self.born] - seq[self.died] def get_persistent_homology(seq): peaks = [] # Maps indices t...
class Peak: def __init__(self, startidx): self.born = self.left = self.right = startidx self.died = None def get_persistence(self, seq): return seq[self.born] if self.died is None else seq[self.born] - seq[self.died] def get_persistent_homology(seq): peaks = [] idxtopeak = [No...
"""********************************************************************* * * * Description: Implementing a python client for proxy list * * Date: 12/05/2021 * * Author: Marc...
"""********************************************************************* * * * Description: Implementing a python client for proxy list * * Date: 12/05/2021 * * Author: Marc...
a = input() lst = input() ans = [] for i in lst: if i != 'J' and i != 'A' and i != 'V': ans.append(i) if not ans: print("nojava") else: print(*ans,sep='')
a = input() lst = input() ans = [] for i in lst: if i != 'J' and i != 'A' and (i != 'V'): ans.append(i) if not ans: print('nojava') else: print(*ans, sep='')
# -*- coding: utf-8 -*- pokemon_constants = { 1: "BULBASAUR", 2: "IVYSAUR", 3: "VENUSAUR", 4: "CHARMANDER", 5: "CHARMELEON", 6: "CHARIZARD", 7: "SQUIRTLE", 8: "WARTORTLE", 9: "BLASTOISE", 10: "CATERPIE", 11: "METAPOD", 12: "BUTTERFREE", 13: "WEEDLE", 14: "KAKUNA", 15: "BEEDRILL", 16: "PIDGEY", 17: "PIDGEOTTO", 18: "PI...
pokemon_constants = {1: 'BULBASAUR', 2: 'IVYSAUR', 3: 'VENUSAUR', 4: 'CHARMANDER', 5: 'CHARMELEON', 6: 'CHARIZARD', 7: 'SQUIRTLE', 8: 'WARTORTLE', 9: 'BLASTOISE', 10: 'CATERPIE', 11: 'METAPOD', 12: 'BUTTERFREE', 13: 'WEEDLE', 14: 'KAKUNA', 15: 'BEEDRILL', 16: 'PIDGEY', 17: 'PIDGEOTTO', 18: 'PIDGEOT', 19: 'RATTATA', 20:...
# # PySNMP MIB module CISCO-LWAPP-DOT11-LDAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-DOT11-LDAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:48:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
# k = 0 # string = "**A31" # while k < len(string): # valid_letters = ["A"," ","X","Y","*","1","2","3","4","5","6","7","8","9","W","F"] # if string[k] not in valid_letters: # raise ValueError("Bad letter in configuration file: {}".format(string[k])) # k += 1 # lines = ['**X**', '*...
ls = ['2', '3', '2', '4', '4', '5'] counts = [[x, ls.count(x)] for x in set(ls)] print(counts) print(counts[0][1]) x = 0 while x < len(counts): if counts[x][1] != 2: print('this number does not have matching pair {}'.format(counts[x][0])) break x += 1
# encoding: UTF-8 DATA_RECORDER = u'Data Recorder' TICK_RECORD = u'Tick Record' BAR_RECORD = u'Bar Record' CONTRACT_SYMBOL = u'Contract Symbol' GATEWAY = u'Gateway' DOMINANT_CONTRACT = u'Dominant Contract' DOMINANT_SYMBOL = u'Dominant Symbol' TICK_LOGGING_MESSAGE = u'Record Tick Data {symbol}, Time:{time}, last:{l...
data_recorder = u'Data Recorder' tick_record = u'Tick Record' bar_record = u'Bar Record' contract_symbol = u'Contract Symbol' gateway = u'Gateway' dominant_contract = u'Dominant Contract' dominant_symbol = u'Dominant Symbol' tick_logging_message = u'Record Tick Data {symbol}, Time:{time}, last:{last}, bid:{bid}, ask:{a...
__version__ = "4.2.1" __doc__ = ''' # Table of Contents - Introduction - [EnviroMS](#EnviroMS) - [Version](#current-version) - [Data Input](#data-input-formats) - [Data Output](#data-output-formats) - [Data Structure](#data-structure-types) - [Features](#molecular-formulae-search-and-assignment)...
__version__ = '4.2.1' __doc__ = '\n# Table of Contents \n- Introduction\n - [EnviroMS](#EnviroMS) \n - [Version](#current-version) \n - [Data Input](#data-input-formats) \n - [Data Output](#data-output-formats) \n - [Data Structure](#data-structure-types) \n - [Features](#molecular-formulae-search-and-assig...
# encoding: utf-8 # module _hashlib # from (pre-generated) # by generator 1.147 # no doc # no imports # functions def new(*args, **kwargs): # real signature unknown """ Return a new hash object using the named algorithm. An optional string argument may be provided and will be automatically hashed. ...
def new(*args, **kwargs): """ Return a new hash object using the named algorithm. An optional string argument may be provided and will be automatically hashed. The MD5 and SHA1 algorithms are always supported. """ pass def openssl_md5(*args, **kwargs): """ Returns a md5 hash object...
# Leemos las dos cadenas primera = input("Ingrese su primer cadena\n") segunda = input("Ingrese su segunda cadena cadena\n") # Intentamos obtener las cadenas try: # Obtenemos el ultimo elemento de la primera ultimo_primera = primera[-1] # Obtenemos el primer elemento de la segunda primero_segunda = se...
primera = input('Ingrese su primer cadena\n') segunda = input('Ingrese su segunda cadena cadena\n') try: ultimo_primera = primera[-1] primero_segunda = segunda[0] if ultimo_primera == primero_segunda: print('El ultimo elemento de la cadena', primera, 'es igual al primer elemento de la cadena', segun...
class LabelsHelper(object): @staticmethod def create_label_from_uint(label_uint): raise Exception("Not implemented") @staticmethod def create_label_from_relations(relation_labels, label_creation_mode): raise Exception("Not implemented") @staticmethod def create_label_from_op...
class Labelshelper(object): @staticmethod def create_label_from_uint(label_uint): raise exception('Not implemented') @staticmethod def create_label_from_relations(relation_labels, label_creation_mode): raise exception('Not implemented') @staticmethod def create_label_from_opin...
class Event(): def __init__(self, correspondingEvents: dict, objects: list, characters: list, name:str, description:str): self.correspondingEvents = correspondingEvents self.objects = objects self.characters = characters self.name = name self.description= description def...
class Event: def __init__(self, correspondingEvents: dict, objects: list, characters: list, name: str, description: str): self.correspondingEvents = correspondingEvents self.objects = objects self.characters = characters self.name = name self.description = description d...
soluciones = [] billetes, participantes = [int(x) for x in input().split()] while billetes and participantes: lista_billetes = [int(x) for x in input().split()] reparto = [[] for _ in range(participantes)] for posicion, billete in enumerate(lista_billetes): reparto[posicion % participantes].append(b...
soluciones = [] (billetes, participantes) = [int(x) for x in input().split()] while billetes and participantes: lista_billetes = [int(x) for x in input().split()] reparto = [[] for _ in range(participantes)] for (posicion, billete) in enumerate(lista_billetes): reparto[posicion % participantes].appe...
# -------------- ##File path for the file file_path def read_file(path): file=open(path,'r') sentence=file.readline() file.close() return sentence sample_message=read_file(file_path) print(sample_message) #Code starts here # -------------- #Code starts here message_1=str(re...
file_path def read_file(path): file = open(path, 'r') sentence = file.readline() file.close() return sentence sample_message = read_file(file_path) print(sample_message) message_1 = str(read_file(file_path_1)) message_2 = str(read_file(file_path_2)) print(message_1) print(message_2) def fuse_msg(messa...
class Solution: def _find_upper(self, arr, cnt, key): start = 0 end = cnt - 1 while start < end: mid = (start + end) // 2 if key < arr[mid]: end = mid elif key == arr[mid]: start = mid + 1 else: s...
class Solution: def _find_upper(self, arr, cnt, key): start = 0 end = cnt - 1 while start < end: mid = (start + end) // 2 if key < arr[mid]: end = mid elif key == arr[mid]: start = mid + 1 else: ...
class Match(object): def __init__(self, span, match): pass
class Match(object): def __init__(self, span, match): pass
#la diferencia entre estas dos variables "__dict__": # la de la clase y la del objeto. # class ClaseEjemplo: varia = 1 def __init__(self, val): ClaseEjemplo.varia = val self.__varia = val print(ClaseEjemplo.__dict__) objetoEjemplo = ClaseEjemplo(2) print(ClaseEjemplo.__dict__) print(objetoEjem...
class Claseejemplo: varia = 1 def __init__(self, val): ClaseEjemplo.varia = val self.__varia = val print(ClaseEjemplo.__dict__) objeto_ejemplo = clase_ejemplo(2) print(ClaseEjemplo.__dict__) print(objetoEjemplo.__dict__)
# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control version = '0.1.dev133+g3c58c47.d20220526' version_tuple = (0, 1, 'dev133', 'g3c58c47.d20220526')
version = '0.1.dev133+g3c58c47.d20220526' version_tuple = (0, 1, 'dev133', 'g3c58c47.d20220526')
# generates a list of 5 letter words from /usr/share/dict/words def main(): filtered = set() with open("/usr/share/dict/words", 'r') as file: for line in file: word = line.strip().replace("'", '').lower() if len(word) == 5: filtered.add(word) print(f"{len(fi...
def main(): filtered = set() with open('/usr/share/dict/words', 'r') as file: for line in file: word = line.strip().replace("'", '').lower() if len(word) == 5: filtered.add(word) print(f'{len(filtered)} 5 letter words found') filtered = list(filtered) ...
# -*- coding: utf-8 -*- ENVELOPE_XMLNS = 'http://schemas.xmlsoap.org/soap/envelope/' def strip_xmlns(root): def iter_node(n): nsmap = n.nsmap for child in n: nsmap.update(iter_node(child)) return nsmap xmlns = list('{' + item + '}' for item in iter_node(root).values()) ...
envelope_xmlns = 'http://schemas.xmlsoap.org/soap/envelope/' def strip_xmlns(root): def iter_node(n): nsmap = n.nsmap for child in n: nsmap.update(iter_node(child)) return nsmap xmlns = list(('{' + item + '}' for item in iter_node(root).values())) def strip_node(n): ...
def flatten(master): """ :param dict master: a multilevel dictionary :return: a flattened dictionary :rtype: dict Flattens a multilevel dictionary into a single-level one so that:: {'foo': {'bar': { 'a': 1, 'b': True, ...
def flatten(master): """ :param dict master: a multilevel dictionary :return: a flattened dictionary :rtype: dict Flattens a multilevel dictionary into a single-level one so that:: {'foo': {'bar': { 'a': 1, 'b': True, ...
#!/usr/bin/env python3 # represents the noteblocks of a certain instrument and pitch # may need to be split (further), because it may contain more than one of the same note playing at once # or for other reasons class UnsplitLine: def __init__(self, key, instrument): self.key = key self.instru...
class Unsplitline: def __init__(self, key, instrument): self.key = key self.instrument = instrument self.ticks = {} def __repr__(self): return f'[UnprocessedLine i,k:{self.instrument},{self.key} ticks:{self.ticks}]' def add_note(self, tick, count=1): if not tick in...
""" 30 Effective Approach - https://codeforces.com/problemset/problem/227/B """ n = int(input()) l = list(map(int,input().split())) m = int(input()) v=list(map(int,input().split())) a,b=0,0 d = [0]*(n+1) for i in range(n) : d[l[i]] = i for q in v: a += d[q]+1 b += n-d[q] print(a,b)
""" 30 Effective Approach - https://codeforces.com/problemset/problem/227/B """ n = int(input()) l = list(map(int, input().split())) m = int(input()) v = list(map(int, input().split())) (a, b) = (0, 0) d = [0] * (n + 1) for i in range(n): d[l[i]] = i for q in v: a += d[q] + 1 b += n - d[q] print(a, b)