content
stringlengths
7
1.05M
def merge_dicts(dict1, dict2): res = {**dict1, **dict2} return res def pairwise(iterable): itr = iter(iterable) a = next(itr, None) for b in itr: yield a, b a = b
class Token: def __init__(self): self.content = [] def add_content(self, content): self.content.append(content) def close(self): if len(self.content) == 0: raise Exception("Content for token '" + self.token_name() + "' is missing")
########################################################################## # Author: Samuca # # brief: returns if a str has "silva" # # this is a list exercise available on youtube: # https://www.youtube.com/playlist?list=PLHz_AreHm4dm6wYOIW20Nyg12TAjmMGT- ############################################################...
""" This API can be used to interact with and modify Motorola S-Record files. .. moduleauthor:: Yves-Noel Weweler <y.weweler@gmail.com> """ __author__ = 'Yves-Noel Weweler <y.weweler@gmail.com>' __status__ = 'Development' __version__ = '0.0.1' __all__ = ('SRECError', 'SRecordParsingError', 'NotSRecFileError') class...
class Menu: def __init__(self): self.divMenu = '=' * 40 self.infoBot = 'CriptoBot / Versao: 1.1.2' self.desenvolvedor = 'Guilherme Malaquias' def inicial_menu(self) -> str: return f'{self.divMenu}\n0 - Consultar Moeda\n1 - Consultar Moeda Por Intervalo\n\n2 - Para sair\n{self.d...
async def call1(callback): await callback()
""" Session: 7 Topic: Homework - simple calculator """ # function adds two numbers def add(x, y): return x + y # function subtracts two numbers def subtract(x, y): return x - y # function multiplies two numbers def multiply(x, y): return x * y # function divides two numbers def divide(x, y): return ...
#Unique Nickname while True: online = input("Online now: ") nickname = input("Nickname: ") online_list = online.split(" ") if nickname not in online_list: print("Welcome, {}!".format(nickname)) else: print("Sorry, that nickname is taken.")
class Code: SUCCESS = 0 NO_PARAM = 1 ERROR =-1 msg = { SUCCESS: "success", NO_PARAM: "param error", ERROR:"error" }
# DROP TABLES songplay_table_drop = "DROP TABLE IF EXISTS f_songplays;" user_table_drop = "DROP TABLE IF EXISTS d_users;" song_table_drop = "DROP TABLE IF EXISTS d_songs;" artist_table_drop = "DROP TABLE IF EXISTS d_artists;" time_table_drop = "DROP TABLE IF EXISTS d_times;" # CREATE TABLES user_table_create = ("CRE...
class Help(object): """Help View""" def __init__(self, ui): self.ui = ui self.tab = ui.contents.help # connect signals self.ui.menu.btnHelp.clicked.connect(self.tab_handler) def tab_handler(self): self.ui.contents.showTab(self.ui.contents.HELP)
DOCUMENT_MAPPING = [ { 'name': 'title', 'pattern': '<{}> dc:title|rdfs:label ?title .', 'type': 'string' }, { 'name': 'journalTitle', 'pattern': """?journal vivo:publicationVenueFor <{}> ; rdfs:label ?journalTitle .""", 'type':...
""" Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Notice that the solution set must not contain duplicate quadruplets. Example 1: Input: nums = [1,0,-1,...
def insert_sort(unsorted): sorted = [] while unsorted: x = unsorted.pop() len_sorted = len(sorted) for i in range(len_sorted): if sorted[i] >= x: sorted.insert(i, x) break if len_sorted == len(sorted): sorted.append(x) ...
""" This module holds all the UP API routes used in the SDK. https://jawbone.com/up/developer/endpoints """ DOMAIN = 'https://jawbone.com' """ OAuth Endpoints """ AUTH_PATH = '{}/auth/oauth2'.format(DOMAIN) AUTH = '{}/auth'.format(AUTH_PATH) TOKEN = '{}/token'.format(AUTH_PATH) """ Resource Endpoints """ VERSION = 'v...
words = {} first_line = input().split() iterations = int(first_line[0]) for i in range(int(first_line[1])): line = input().split() words[int(line[0])] = line[1] for n in range(1, iterations+1): o = "" for i, word in words.items(): if n % i == 0: o += word print(o if o else n)
class BackendError(Exception): pass class ThreadStoppedError(Exception): pass
class Solution: def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool: s1 = "".join(word1) s2 = "".join(word2) return s1 == s2
#N_gram.py #owakatiの分かち書きをする。uni=1,bi=2 tri=3 '''どうやったら分かち書きになるか 今日は眠いをbigramに手動ですると 今日、日は、は眠、眠い 今で始まって日で終わる感じで定義する。''' def n_gram(txt, n): #n=n_garmのn result = [] for i in range(0, len(txt) - n + 1):#例:今日という単語からn個(2)-で+1すると日から始まる result.append(txt[i:i + n]) #iで始まってi+n(nは指定分割個数的なやつ) retu...
def matrix_sum(matrix): total_sum = 0 for row in matrix: total_sum += sum(row) return total_sum rows_count, columns_count = [int(x) for x in input().split(', ')] matrix = [] for _ in range(rows_count): row = [int(x) for x in input().split(', ')] matrix.append(row) print(matrix_sum(matrix...
# -*- encoding: utf-8 -*- """ Copyright (c) 2019 - present AppSeed.us License: https://github.com/app-generator/license-eula """ class COMMON: NULL = None # not set NA = -1 # not set OK = 0 # all ok ERR = 1 # not ok NOT_FOUND = 2 # file or directory no...
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2020/soni_f110_ws/src/f110-skeletons-spring2020/system/vesc/vesc_driver/include".split(';') if "/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2...
#!/usr/bin/python3 def multiple_returns(sentence): "returns a tuple with the length of a string and its first character" "if the sentence is empty, the first character should be equal to None" if sentence == "": return (0, None) return (len(sentence), sentence[0])
#!/usr/bin/python # -*- coding: utf-8 -*- # vi: ts=4 sw=4 ################################################################################ # Short-term settings (specific to a particular user/experiment) can # be placed in this file. You may instead wish to make a copy of this file in # the user's data directory, ...
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """ Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first f...
# -*- coding: utf-8 -*- n = 0 a = 0 g = 0 d = 0 while n!=4: n = int(input()) if n==1: a += 1 if n==2: g += 1 if n==3: d += 1 print('''MUITO OBRIGADO Alcool: {} Gasolina: {} Diesel: {}'''.format(a, g, d))
# # @lc app=leetcode id=1209 lang=python3 # # [1209] Remove All Adjacent Duplicates in String II # # https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii/description/ # # algorithms # Medium (57.56%) # Likes: 1125 # Dislikes: 26 # Total Accepted: 68.2K # Total Submissions: 118.4K # Testcase E...
class TableNotFoundException(Exception): def __init__(self, database, table): self.database = database self.table = table Exception.__init__(self, "table not find %s.%s" % (database, table))
""" https://www.codechef.com/SEPT20B/problems/TREE2/ https://www.codechef.com/users/aditi124jha """ def main(): t=int(input()) for i in range(t): n=int(input()) h=list(map(int, input().split()[:n])) s=set(h) s.discard(0) print(len(s)) return 0 main()
# CALCULATE CANADIAN SALES TAX # If the province is Alberta or Nunavut charge 5% # If the province is Ontario charge 13% # If only one of the conditions will ever occur you can use a single if statement with elif province = input("What province do you live in? ") tax = 0 if province == 'Alberta': tax = 0.05 elif...
# Time: O(m + n), m is the length of source # , n is the length of target # Space: O(m) # greedy solution class Solution(object): def shortestWay(self, source, target): """ :type source: str :type target: str :rtype: int """ lookup = [[None for _ in r...
#!/usr/bin/env python #coding=utf-8 __author__ = 'vzer' class Base_Config(object): #app config SECRET_KEY="" POST_PRE_PAGE=6 REGISTERCODE="" DEBUG = True #mysql config MYSQL_DB = "" MYSQL_USER = "" MYSQL_PASS = "" MYSQL_HOST = "" MYSQL_PORT =0 SQLALCHEMY_DATABASE_URI =...
#!/usr/bin/env python # Copyright 2011 Google Inc. All Rights Reserved. """Protobufs used by GRR."""
# V1 # V2 # Time: O(n^2) # Space: O(1) class Solution(object): def triangleNumber(self, nums): """ :type nums: List[int] :rtype: int """ result = 0 nums.sort() for i in range(len(nums)-2): if nums[i] == 0: continue ...
# Ableitung von der Standardklasse "list" class Default_list (list): def __init__(self, s=[], default=0): #1"s" und "default" sind obtionale Attribute self.default=default list.__init__(self,s) #2 Aufruf der Methode "__init__()" der Basisklasse "list" ...
def is_prime(n): """Returns True is n is prime, False if not""" for i in range(2,n-1): if n%i == 0: return False return True def all_primes(n): primes = [] for number in range(1,n): if is_prime(number): primes.append(number) return primes
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-upheno_ontology' ES_DOC_TYPE = 'phenotype' API_PREFIX = 'upheno_ontology' API_VERSION = ''
servo_a_pw = [[-90.0, 2463] [-86.4, 2423] [-72.0, 2263] [-56.6, 2093] [-43.2, 2013] [-28.8, 1793] [-14.4, 1646] [0.0, 1436] [14.4, 1276] [28.8, 1096] [43.2, 916] [56....
#!/usr/bin/python3 #https://practice.geeksforgeeks.org/problems/a-simple-fraction/0 def sol(n, d): res = [] r = {} i = int(n/d) rem = n%d res.append(i) if rem: res.append(".") r[rem] = 0 p = 1 while rem: div = rem*10 q = div//d rem = div%d ...
class Solution: def validMountainArray(self, arr: List[int]) -> bool: if len(arr) < 3: return False if arr[1] < arr[0]: return False n = len(arr) i = 1 while i < n and arr[i] > arr[i-1]: i += 1 if i >= n: return False ...
''' Create the Control class: Deal with hazards Forwarding Branch handling ''' class Control(object): def __init__(self, ForwardStatus): self.DataHazardFlag=False self.ControlHazardFlag=False self.forwardFlag=ForwardStatus ''' Forward keys: 0: Inactive 1: Execution forward ...
# Código utilizado no livro Aprenda Python Básico - Rápido e Fácil de entender, de Felipe Galvão # Mais informações sobre o livro: http://felipegalvao.com.br/livros # Capítulo 11: Funções # Definição de função sem parâmetros e sem valor de retorno def print_ola_tres_vezes(): print("Ola Python") print("Ola Python"...
l = ["he", "hi", "hello", "hi"] r = [k for k in l if 'gene' in k or 'dis' in k] print(r) with open('project2_test.txt', 'r') as f: prefix = 'gene' for line in f: r = filter(lambda x: x.startswith(prefix), list(line.split())) print(list(r))
# Author: Asif Ali Mehmuda # Email: asif.mehmuda9@gmail.com # This file exposes some of the common mathematical functions def add_nums(num1, num2): return num1 + num2 # Subtract two numbers def sub_nums(num1, num2): return num1 - num2 # Subtract two numbers such that the smaller number is always subtracted...
# 动态规划法 # 进一步优化空间复杂度 # 使用一维数组来存储 class Solution: def uniquePaths(self, m: int, n: int) -> int: dp = [1] * m for _ in range(1, n): for col in range(1, m): dp[col] = dp[col - 1] + dp[col] return dp[-1]
count = 1 while True: a = input() if a == '0': break if count > 1: print() numbers = input() print("Instancia", count) if a in numbers: print("verdadeira") else: print("falsa") count += 1
string = "Janet Asimov" pattern = re.compile(r"(?<!Isaac )Asimov") # Will match any Asimov except Isaac, and only keep "Asimov" result = re.search(pattern, string) if result is not None: print("Substring '{0}' was found in the range {1}".format(result.group(), result.span()))
# # PySNMP MIB module RM2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RM2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:49:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)...
""" Michael Persico Sept.29, 2021 Ones and Zeros https://www.codewars.com/kata/578553c3a1b8d5c40300037c """ def binary_array_to_number(arr): return int("0b" + "".join([str(digit) for digit in arr]), 2) if __name__ == "__main__": print(binary_array_to_number([0,0,0,1])) # 1 print(binary_array_to_number([0,...
nk=list(map(int,input().split())) n=nk[0] k=nk[1] l=list(map(int,input().split())) f=0 for i in range(len(l)-1): if(l[i]+l[i+1]==k): print('yes') f=1 break if(f==0): print('no')
class Point(): def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return f"({self.x}, {self.y})" class Edge(): def __init__(self, v1, v2): self.v1 = v1 self.v2 = v2 def __repr__(self): return f"{self.v1}-{self.v2}" def ...
'''연도가 주어졌을 때, 윤년이면 1, 아니면 0을 출력하는 프로그램을 작성하시오. 윤년은 연도가 4의 배수이면서, 100의 배수가 아닐 때 또는 400의 배수일 때이다. 예를 들어, 2012년은 4의 배수이면서 100의 배수가 아니라서 윤년이다. 1900년은 100의 배수이고 400의 배수는 아니기 때문에 윤년이 아니다. 하지만, 2000년은 400의 배수이기 때문에 윤년이다. 첫째 줄에 연도가 주어진다. 연도는 1보다 크거나 같고, 4000보다 작거나 같은 자연수이다. 첫째 줄에 윤년이면 1, 아니면 0을 출력한다.''' a = input() a = int(a)...
# -*- coding: utf-8 -*- class Route(object): def __init__(self, base_url=None): self.base_url = base_url self.handlers = [] def __call__(self, url, **kwds): name = kwds.pop('name', None) if self.base_url: url = '/' + self.base_url.strip('/') + '/' + url.lstrip('/')...
class Solution: def groupThePeople(self, groupSizes): match = {} for idx, groupSize in enumerate(groupSizes): if groupSize in match: match[groupSize].append(idx) else: match[groupSize] = [idx] ans = [] for groupSize, m in match...
def to_postfix(infix): priority = {'*': 1, '/': 1, '^': 1, '+': 0, '-': 0, '(': 0 } res = '' stack = [] for x in infix: if x.isdigit(): res += x elif x == '(': stack.a...
if __name__ == '__main__': # pragma: no cover data = """ /com,*********** Create Remote Point "Internal Remote Point 39" *********** ! -------- Remote Point Used by "Fixed - Line Body To EndCap 14054021-1 d" -------- *set,_npilot,803315 _npilot474=_npilot et,332,170 type,332 real,332 mat,332 keyo,332,2,1 ...
# A list is symmetric if the first row is the same as the first column, # the second row is the same as the second column and so on. Write a # procedure, symmetric, which takes a list as input, and returns the # boolean True if the list is symmetric and False if it is not. def symmetric(base_list): list_length = l...
def is_self_evaluating(exp): """number, string, booleans """ return \ isinstance(exp, int) or isinstance(exp, float) \ or (isinstance(exp, str) and len(exp) >= 2 and exp[0] == '"' and exp[-1] == '"') \ or exp == 'true' or exp == 'false' def text_of_quotation(exp): pass
f = open("C:/Users/Username/Documents/2020_aoc/03.txt", "r") l = f.read().split("\n") grid = [] for line in l: grid.append(line*200) def slope_change(right_inc, down_inc): hor = ver = found = 0 while ver + down_inc < len(grid): hor += right_inc ver += down_inc if gr...
def ensure_column_exists(df, col_name, col_alt = False): """Checks if a particular name is among the column names of a dataframe. Alternative names can be given, which when found will be changed to the desired name. The DataFrame will be changed in place. If no matching name is found an AttributeError is...
class BaseIOException(Exception): pass class InvalidFitFile(BaseIOException): pass
#Lucia Saura 25/03/2018 # euler 5 # source https://www.youtube.com/watch?v=EMTcsNMFS_g def euler5 (ni): #first create a function for i in range (11,21): #loop trough the numbers from 11 to 21 (if it is divisible by 11 to 20 is also from 1 to 10) if ni % i ==0: #if the number is divisible by the number in ...
def divisors(integer): integer = abs(integer) divisor = [] for candidate in range(integer//2): if integer % (candidate+1) == 0: divisor.append(candidate+1) return divisor alist = divisors(10) print(alist)
class GenericTurbine(object): def __init__(self, loc, RD, W): self.loc = loc # Location in Space self.RD = RD # Rotor Diameter self.W = W # Width of influence
""" * @file linear_search.py * @author Vladimir Mijic * @date 26/03/2021 """ def linearSearch(array, x): n = len(array) for i in range(0, n): if array[i] == x: return True return False if __name__ == '__main__': arr = [75, 41, 92, 60, 2, 0, 39, 23, 10, 68] print("Bef...
''' main.py Created by Jo Hyuk Jun on 2020 Copyright © 2020 Jo Hyuk Jun. All rights reserved. ''' def solution(skill, skill_trees): answer = 0 skill_stack = list(skill) for v in skill_trees: tmp = [] is_ok = True cur_skill = list(v) for i in range(len(cur_...
# # PySNMP MIB module IBM-OSA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBM-OSA-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:51:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
def diff_strings_rec(source, target, dp={}): dp_key = (source, target) if dp_key in dp: return dp[dp_key] if not source and not target: result = [] dp[dp_key] = (0, result) return dp[dp_key] if not source: result = ["+" + ch for ch in target] dp[dp_key] = ...
""" Title: 0026 - Remove Duplicates from Sorted Array Tags: Array Time: O(n) Space: O(1) Source: https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Difficulty: Easy """ class Solution: def removeDuplicates(self, nums: List[int]) -> int: if not nums: return 0 last = 0 ...
# Using list to print hello world my_list = ["H", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d"] s = "" for i in my_list: s = s + i print(s)
# EASY # Two pointer # --> if < tar # <-- if > tar # Time O(N) Space O(1) class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: left,right = 0, len(numbers)-1 while left < right: if numbers[left] + numbers[right] == target: return [...
#Polimorfismo # #Es la capacidad que tienen los objetos en # #diferentes clases para usar un comportamiento # #o atributo del mismo nombre pero con diferente valor # # # Por ejemplo #class Auto: # rueda = 4 # def desplazamiento(self): # print("el auto se esta desplazando sobre 4 ruegas") # #class Moto: # ...
rows_total = 0 rows_masked = 0 ret = 0 profileret = 0
# coding=utf-8 # Author: Jianghan LI # Question: 617.Merge_Two_Binary_Trees # Complexity: O(N) # Date: 2017-06-12 10:52 - 10:54, 0 wrong try # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class ...
class Dicotomia(): def __init__(self, tabla) -> None: self.fin = len(tabla) - 1 self.tabla = tabla self.tablaordenada =[] def bubbleSort(self): for i in range(0, self.fin): for j in range(0, self.fin - i): if self.tabla[j] > self.tabla[j + 1]: ...
def run(data_list): # Vamos verificar quantas linhas nós temos print("Número de linhas:") print(len(data_list)) # Imprimindo a primeira linha de data_list para verificar se funcionou. print("Linha 0: ") print(data_list[0]) # É o cabeçalho dos dados, para que possamos identificar as colunas....
s = "12010000000000111100000000" for _ in range(int(input())): ans = 0 k = input() for i in k: if i != " ": ans += int(s[ord(i) - 65]) print(ans)
# -*- coding: utf-8 -*- """ Test the api preprocess module for biolink. .. moduleauthor:: Jiwen Xin <kevinxin@scripps.edu> """
def init_dashboard(bot): @bot.dashboard.route async def get_stats(data): channels_list = [] for guild in bot.guilds: for channel in guild.channels: channels_list.append(channel) return { "status": "200", "message": "all is ok", ...
ex = input('Digite uma expressão matematica:\n') lista = [] for simb in ex: if simb == '(': lista.append('(') elif simb == ')': if len(lista) > 0: lista.pop() else: lista.append(')') break if len(lista) == 0: print('Sua expressão está correta.') el...
# test basics of Voilà running a notebook async def test_hello_world(http_server_client, print_notebook_url): response = await http_server_client.fetch(print_notebook_url) assert response.code == 200 html_text = response.body.decode('utf-8') assert 'Hi Voilà' in html_text assert 'print(' not in ht...
# coding=utf-8 """ 数字组合 描述:给定一个候选数字的集合 candidates 和一个目标值 target. 找到 candidates 中所有的和为 target 的组合. 在同一个组合中, candidates 中的某个数字不限次数地出现. 思路: dfs backtricking的应用 """ class Solution: """ @param candidates: A list of integers @param target: An integer @return: A list of lists of integers """ def ...
n = int(input().strip()) scores = [int(scores_temp) for scores_temp in input().strip().split(' ')] m = int(input().strip()) alice = [int(alice_temp) for alice_temp in input().strip().split(' ')] ranking = [scores[0]] for itm in scores: if itm != ranking[-1]: ranking.append(itm) inx = len(ranking) - 1 fo...
class DockerService(): """Class that abstracts docker service info """ def __init__(self, data: str) -> None: info = data.split('\t') self.container_id = info[0].split('@')[-1] self.name = info[1].split('@')[-1] self.status = info[2].split('@')[-1] self.ports = info...
# # @lc app=leetcode id=319 lang=python3 # # [319] Bulb Switcher # # https://leetcode.com/problems/bulb-switcher/description/ # # algorithms # Medium (45.82%) # Likes: 722 # Dislikes: 1353 # Total Accepted: 98.8K # Total Submissions: 214.5K # Testcase Example: '3' # # There are n bulbs that are initially off. Yo...
def RemovesNthDupicate(array, n): hashTable = {} i = 0 while i < len(array): if array[i] in hashTable: hashTable[array[i]] += 1 if hashTable[array[i]] == n: hashTable[array[i]] = 1 array.pop(i) else: ...
""" Constants associated with the NEOCERA. """ # Index in the arrays of the heater output HEATER_INDEX = 0 # Index in the arrays of the analog output ANALOG_INDEX = 1 # Minimum allowed output control type for the output index (see self.control) CONTROL_TYPE_MIN = [0, 3] # Maximum allowed output control type for the...
def create_request_url(url: str, params: dict = None): """ Adds query params to the given url :param url: the url to extend :param params: query params as a keyed dictionary :return: the url including the given query params """ if params: first_param = True for k, v in sort...
class Solution(object): def alertNames(self, keyName, keyTime): """ :type keyName: List[str] :type keyTime: List[str] :rtype: List[str] """ mapp = {} for i in range(len(keyName)): name = keyName[i] if(name not in mapp): ...
"""crafting_system.py This class represents a simple crafting system. All recipe-related data is stored externally in a JSON file. """ class CraftingSystem: def __init__(self, event_queue, **kwargs): self.event_queue = event_queue self.event_queue.register_system(self) self.__dict__.updat...
# Limbs LEG_UPPER_RIGHT = (24,26) LEG_LOWER_RIGHT = (26,28) UPPER_BODY_RIGHT = (12,24) ARM_UPPER_RIGHT = (12,14) ARM_LOWER_RIGHT = (14,16) FOOT_RIGHT = (28,32) LIMBS_ALL = [LEG_UPPER_RIGHT,UPPER_BODY_RIGHT,ARM_UPPER_RIGHT,ARM_LOWER_RIGHT,FOOT_RIGHT] # Joints ANKLE_RIGHT = (26,28,32) ELBOW_RIGHT = (12,14,16) SHOULDER...
# # PySNMP MIB module CISCO-SYS-INFO-LOG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SYS-INFO-LOG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:57:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
# # PySNMP MIB module HUAWEI-SERVER-IBMC-MIB (http://pysnmp.sf.net) # ASN.1 source file:///home/jhzhang/test/snmp/HUAWEI-SERVER-iBMC-MIB.txt # Produced by pysmi-0.0.7 at Mon Apr 3 12:24:09 2017 # On host localhost.localdomain platform Linux version 3.10.0-123.el7.x86_64 by user root # Using Python version 2.7.5 (defau...
n,m = list(map(int,input().split())) cost = list(map(int,input().split())) ans=0 for i in range(m): f,s = list(map(int,input().split())) ans += min(cost[f-1],cost[s-1]) print(ans)
''' | Write a program to show if the entered character is uppercase or lowercase. | |---------------------------------------------------------------------------------------------| | Usage of isalpha(), islower() and isupper() | ''' n = input("Enter charac...
""" Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0,...
# Program 8 : multiply two matrices # take a 3x3 matrix A = [[12, 7, 3], [4, 5, 6], [7, 8, 9]] # take a 3x4 matrix B = [[5, 8, 1, 2], [6, 7, 3, 0], [4, 5, 9, 1]] result = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] # iterating by row of A for i in range(len(A)): # iterating by coloum by B for j in rang...
API_SECRET = 'fluffernutterpie' # google reCAPTCHA sign-up # https://www.google.com/recaptcha/admin RECAPTCHA_KEY = '6LedVBUUAAAAANb2vWVUSByvl66ob3k9r-zSruCu' RECAPTCHA_PRIVATE_KEY = '6LedVBUUAAAAALWe4MQ2VJQhI9rKi6GJTukS6Hrl'
list1 = [12,3,5,-5,-6,-1] for i in list1: if i >= 0: print (i) list2 = [12,4,-95,3] for num in list2: if num >= 0: print (" [ ",num," ] ")
class Point: def __init__(self, x, y): self.x = float(x) self.y = float(y) def collinear(self, p, q): if p.x - self.x == 0 and q.x - self.x == 0: return True if p.x - self.x == 0 or q.x - self.x == 0: return False m1 = (p.y-self.y)/(p.x-self.x) m2 = (q.y-self.y)/(q.x-self.x) return m1 == m2 ...