content
stringlengths
7
1.05M
# almostIncreasingSequence or "too big or too small" # is there one exception to the list being sorted? (with no repeats) # including being already sorted # (User's) Problem # We Have: # list of int # We Need: # Is there one exception to the list being sorted? yes/no # We Must: # return boolean: true false...
# Header used at the top of log files and such # usage: header = "(>'')><('')><(''<)" header = r""" _____ .__ ____ ____ _____/ ____\_____ | | ___.__. _/ ___\/ _ \ / \ __\\____ \| |< | | \ \__( <_> ) | \ | | |_> > |_\___ | \___ >____/|___| /__| | __/|____/ ____|...
# # PySNMP MIB module XEDIA-DHCP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XEDIA-DHCP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:36:09 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...
class CustomError(Exception): def __init__(self, *args): if args: self.topic = args[0] else: self.topic = None def __str__(self): if self.topic: return 'Custom Error:, {0}'.format(self.topic) class MessageHandler(object): def __init__(self, event...
class Solution: # @return a string def longestCommonPrefix(self, strs): n = len(strs) if n == 0: return '' if n == 1: return strs[0] prefix = '' m = min([len(s) for s in strs]) for i in range(m): first = strs[0] com...
"""Shared constants.""" # Wiktionary dump URL # {0}: current locale # {1}: dump date BASE_URL = "https://dumps.wikimedia.org/{0}wiktionary" DUMP_URL = f"{BASE_URL}/{{1}}/{{0}}wiktionary-{{1}}-pages-meta-current.xml.bz2" # GitHub stuff # {0}: current locale REPOS = "BoboTiG/ebook-reader-dict" GH_REPOS = f"https://gith...
def parseSolutions(solutions, orderList): parsedSolutions = [] for solution in solutions: solutionItems = solution.items() schedule = [] finishTimes = [] for item in solutionItems: if "enter" in item[0]: parsedItem = item[0].split("-") order = orderList.orderFromID(int(parsedItem[0])) schedule....
# Copyright 2014-2019 Ivan Yelizariev <https://it-projects.info/team/yelizariev> # Copyright 2015 Bassirou Ndaw <https://github.com/bassn> # Copyright 2015 Alexis de Lattre <https://github.com/alexis-via> # Copyright 2016-2017 Stanislav Krotov <https://it-projects.info/team/ufaks> # Copyright 2017 Ilmir Karamov <https:...
# -*- coding: utf-8 -*- __author__ = 'Kris,QQ:1209304692。QQ群:知尔MOOC,760196377' default_app_config = "operation.apps.OperationConfig"
""" Implement shared pieces of Erlang node negotiation and distribution protocol """ DIST_VSN = 5 DIST_VSN_PAIR = (DIST_VSN, DIST_VSN) " Supported distribution protocol version (MAX,MIN). " def dist_version_check(max_min: tuple) -> bool: """ Check pair of versions against version which is supported by us ...
description = 'BOA Translations stages' pvprefix = 'SQ:BOA:mcu2:' devices = dict( translation_300mm_a = device('nicos_ess.devices.epics.motor.EpicsMotor', description = 'Translation 1', motorpv = pvprefix + 'TVA', errormsgpv = pvprefix + 'TVA-MsgTxt', ), translation_300mm_b = devic...
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # 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 appli...
query = """ select * from languages; """ query = """ select * from games where test=0 """ def get_query(): query = f"SELEct max(weight) from world where ocean='Atlantic'" return query def get_query(): limit = 6 query = f"SELEct speed from world where animal='dolphin' limit {limit}" ...
def frac(num1,num2): if num1 == 0 or num2 ==0: return 0 else: sum1 = num1 / num2 sum1 = str(sum1) sum1 = sum1.split(".") final = "0."+ sum1[1][0] final = float(final) return final print(frac(4,1))
my_dict = {} my_dict[(1,2,4)] = 8 my_dict[(4,2,1)] = 10 my_dict[(1,2)] = 12 sum = 0 for k in my_dict: sum += my_dict[k] print (sum) print(my_dict)
def increase(colour, increments): """Take a colour and increase each channel by the increments given in the list""" colour_values = [int(colour[1:3], 16), int(colour[3:5], 16), int(colour[5:], 16)] output = [min(255, colour_values[0] + increments[0]), min(255, colour_values[1] + increments[1]), min(255, col...
user = input("Say something! ") print(user.upper()) print(user.lower()) print(user.swapcase())
# 1. The code below prints the numbers from 1 to 50. Rewrite the code using a while loop to # accomplish the same thing. # for i in range(1,51): # print(i) i = 1 while i <= 50: print(i) i += 1
#!/usr/bin/env python def vowel_percent(in_str): vowels = 'aeiou' consonants = 'bcdfghjklmnpqrstvwxyz' vowel_count = 0 consonant_count = 0 total = 0 for a_char in in_str: if a_char in vowels or a_char in consonants: total += 1 # only increment total for letters, not space/pu...
#Code written by Ryan Helgoth class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: sol = [] for i in range(len(nums)): currentNum = nums[i] if currentNum <= target: amountLeft = target - currentNum try: ...
""" list列表使用lambda自定义排序, list.sort(lambda) lambda中拿出alist中的每一项temp,按照temp["name"]进行排序 """ a_list = [ {"name": "张三", "age":19}, {"name": "李四", "age":18}, {"name": "王五", "age":20} ] a_list.sort(key=lambda temp: temp["age"],reverse=True) print(a_list) # list中包含多个list,嵌...
# -*- coding: utf-8 -*- """ Created on Sat Dec 14 09:13:30 2019 @author: NOTEBOOK """ def main(): g = 'green' o = 'orange' p = 'purple' print('') print('Welcome to your Color mixing application '+ 'Please be aware that you can only input '+ 'primary colours(red,blue,yellow)') ...
class UsersPage: TITLE = "All users" INVITE_BUTTON = "Invite a new user" MANAGE_ROLES_BUTTON = "Manage roles" INVITE_SUCCESSFUL_BANNER = "User has been invited successfully" class Table: NAME = "Name" EMAIL = "Email" TEAM = "Team" ROLE = "Role" STATUS = "Stat...
SETTINGS = { "FPS": 60, "WIDTH": 1280, "HEIGHT": 720, "SOUNDS_VOLUME": 1.0, "MUSICS_VOLUME": 0.1 }
""" Custom error classes """ class GenerationError(Exception): pass class TooManyInvalidError(RuntimeError): pass
# # PySNMP MIB module BAS-SONET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAS-SONET-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:17:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
class Question: def __init__(self, prompt, answer): self.prompt = prompt self.answer = answer question_prompt = ["what is my name? \n" , "When was I born? \n", "Name my by color \n"] questions = [Question(question_prompt[0], "Michael"), Question(question_prompt[1], 2002), ...
""" Recursivly compute the Fibonacci sequence """ def rec_fib(n): if n == 1: return 1 elif n == 0: return 0 else: return rec_fib(n-1)+rec_fib(n-2) def main(): n : int = int(input("n := ")) for i in range(0, n): print(rec_fib(i)) if __name__ == "__main__": m...
Scale.default = Scale.egyptian Root.default = 0 Clock.bpm = 120 print(SynthDefs) print(BufferManager()) print(Player.get_attributes()) p1 >> play( P["@+ET"], ).every(3, "stutter", dur=1/2) p1 >> play( P["V+EA"], ).every(3, "stutter", dur=1/2) p2 >> play( P["<X >< n >"],#.layer("mirror"), sample = ...
# coding: utf-8 def check(a,b,s,ans): for j in range(b): if [s[k] for k in range(12) if k%b==j].count('X')==a: ans.append('%dx%d'%(a,b)) return ans return ans t = int(input()) for i in range(t): ans = [] s = input() ans = check(1,12,s,ans) ans = check(2,6,s,ans) ...
# def a_calculateRectangleArea(): # print (5 * 7) # def b_calculateRectangleArea(x, y): # print (x * y) # print(b_calculateRectangleArea(4, 8)) # def c_calculateRectangleArea(): # return 5 * 7 def d_calculateRectangleArea(x, y): print("함수 안에 있습니다") return (x * y) print(d_calculateRectangleArea(5,7)...
""" Crie um programa que gerencie o aproveitamento de um jogador de futebol. O programa vai ler o nome do jogador e quantas partidas ele jogou. Depois vai ler a quantidade de gols feitp em cada partida. No final, tudo isso será guardado em um dicionário, incluindo o total de gols feito durante o campeonato. """ dic = {...
def linha(): print('-=' * 10) times = ('Palmeiras','Atlético-MG','Fortaleza','Bragantino','Athletico-PR','Flamengo','Ceará','Atlético-GO','Bahia','Corinthians','Fluminense','Santos','Juventude','Internacional','Cuiabá','Sport','São Paulo','América-MG','Grêmio','Chapecoense') linha() print(f'Lista de times do Bras...
# !/usr/bin/env python3 # -*- coding: utf-8 -*- """ Name this module. This is blank """
## @ StitchIfwi.py # This is an IFWI stitch config script for Slim Bootloader # # Copyright (c) 2020, Intel Corporation. All rights reserved. <BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## extra_usage_txt = \ """This is an IFWI stitch config script for Slim Bootloader For the FIT tool and stitchin...
####################################SLICING###################################### # x[start:stop:step] # result starts at <start> including it # result ends at <stop> excluding it # optional third argument determines which arguments are carved out (default is 1) # slice assgnments -> ###############################...
# Python program to find largest # number in a list # list of numbers list1 = [10, 20, 4, 45, 99] # printing the maximum element print("Largest element is:", max(list1))
""" Colours used in Capel & Mortlock (2019). """ darkblue = '#114A56' midblue = '#1A7282' lightblue = '#6DA5AF' lightpurple = '#875F74' purple = '#592441' grey = '#BEC1C2' lightgrey = '#F9F9F9' darkgrey= '#464747' white = '#FFFFFF'
t = int(input()) visit = None sequence = None def dfs(x, y, r, c, dist): global visit, sequence visit[x][y] = True # print(x, y, dist) # print(visit) sequence[x][y] = dist if dist == r * c - 1: return True for nx in range(r): for ny in range(c): if visit[nx][ny...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # foobar.py 1.2 # Write a program that prints the numbers from 1 to 100. But for multiples of three print “Foo” instead of the number and for the multiples of five print “Bar”. For numbers which are multiples of both three and five print “FooBar”. def main(): for...
class Event: def __init__(self, event_name, sender, params=None): """ Defines an event. name: event name sender: who has sent the event params: dictionary of event parameters """ self.event_name = event_name self.sender = sender self.params =...
#!/usr/bin/env python3 # -*- coding utf-8 -*- __Author__ ='eamon' 'Object Oriented Programming' std1={'name':'Eamon','Score':99} std2={'name':'chen','Score':100} def print_score(std): print('%s: %s' % (std['name'], std['Score'])) print_score(std1) print_score(std2) class Student(object): def __init__(se...
class HostManagerBase(object): def get_sni_host(self, ip): return "", ""
n = int(input("Enter the month number:")) a = [1,3,5,7,8,10,12] b = [4,6,9,11] c = 2 if n in a: print("The total number of days in month",n,"is 31") elif n in b: print("The total number of days in month",n,"is 30") elif n == c: print("This month may have 28 or 29 days based on leap year") else: ...
# Hyperparameters BUFFER_SIZE = int(1e6) BATCH_SIZE = 64 GAMMA = 0.99 TAU = 0.01 LRA = 1e-4 LRC = 1e-3 HIDDEN_1 = 400 HIDDEN_2 = 300 MAX_EPISODES = 50000 MAX_STEPS = 200 GLOBAL_LINEAR_EPS_DECAY = 1e-5 # Decay over 100 thousand transitions OPTION_LINEAR_EPS_DECAY = 2e-5 # Decay over 50 thousand transitions PRINT_EVE...
""" Tipos de dados str - string - "Texto" ,'Texto' int - inteiro - 10, 20 -45 float - numero com ponto - 0.2 -3.14 8000.1 bool - booleano - True/False """ # Utilizando a função type é possivel ver o tipo(classe) de um valor print(type('Luiz')) print(type(10)) print(type(3.14)) print(type(True))
class Rqst: """ Request object helper """ @classmethod def get_post_get_param(cls, request, name, default_value): """ Retrieve either POST or GET variable from the request object :param request: the request object :param name: the name :param default_value...
# Fruta Favorita:Faça uma lista de suas frutas favoritas e, então, escreva uma série de instruções if. # independetes que verifiquem se determinadas frutas estão em sua lista: frutas = ['laranja', 'melão', 'melancia', 'maracujá', 'mamão', 'banana'] while True: fruta = input('Digite o nome de uma fruta ou s pa...
# opyright 2010 OpenStack Foundation # All Rights Reserved. # # 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 # # Unl...
"""To be deleted once https://github.com/ansible/ansible/pull/15062 has been merged""" def issubset(a, b): return set(a) <= set(b) def issuperset(a, b): return set(a) >= set(b) class FilterModule(object): def filters(self): return { 'issubset': issubset, 'issuperset': is...
"""The module's version information.""" __author__ = "Tomás Farías Santana" __copyright__ = "Copyright 2021 Tomás Farías Santana" __title__ = "dbt-dag-factory" __version__ = "0.1.0"
# @author: cchen # pretty long and should be simplified later class Solution: # @param {string} s # @return {string} def longestPalindrome(self, s): size = len(s) ls = [] ll = 0 rr = 0 l = 0 r = 0 maxlen = r - l + 1 for i in range(1, size): ...
class ParseError(Exception): pass class NotEnoughInputError(ParseError): pass class ImproperInputError(ParseError): pass class PlaceholderError(Exception): pass
# Exercício Python 081: Crie um programa que vai ler vários números e colocar em uma lista. Depois disso, mostre: # A) Quantos números foram digitados. # B) A lista de valores, ordenada de forma decrescente. # C) Se o valor 5 foi digitado e está ou não na lista. valores = [] while True: valores.append(int(input('Di...
# -------------- # Code starts here # Create the lists class_1 = ['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] class_2 = ['Hilary Mason','Carla Gentry','Corinna Cortes'] # Concatenate both the strings new_class = class_1 + class_2 print(new_class) # Append the list new_class.append('P...
################################################################# #Config base_data_dir='/home/shawn/data/nist/ECODSEdataset/' hs_image_dir = base_data_dir + 'RSdata/hs/' chm_image_dir= base_data_dir + 'RSdata/chm/' rgb_image_dir= base_data_dir + 'RSdata/camera/' training_polygons_dir = base_data_dir + 'Task1/ITC/' p...
""" Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string. Example 1: Input: s1 = "ab" s2 = "eidbaooo" Output: True Explanation: s2 contains one permutation of s1 ("ba"). Example ...
a=4 b=2 # addition operator print(a+b)
found_coins = 20 magic_coins = 10 stolen_coins = 3 print(found_coins + magic_coins * 365 - stolen_coins * 52) stolen_coins = 2 print(found_coins + magic_coins * 365 - stolen_coins * 52) magic_coins = 13 print(found_coins + magic_coins * 365 - stolen_coins * 52)
class BaseCssSelect(object): """base class cssselect fields""" element_method = None extra_data = False attr = False text = False text_content = False def __init__(self, add_domain=False, save_start_url=False, save_url=False, many=False, *args, **kwargs): self.add_domain = add_dom...
class RecordsBase: pass class VersionBase: pass class VersionsBase: pass
# Exercício 080: '''Crie um programa onde o usuário possa digitar cinco valores numéricos e cadastre-os em uma lista, já na posição correta de inserção (sem usar o sort()). No final, mostre a lista ordenada na tela.''' valores = [] for num in range(0, 5): valor = int(input(f'Digite um valor: ')) if num == 0 o...
# O(n) time | O(1) space def findLoop(head): first = head.next second = head.next.next while first != second: first = first.next second = second.next.next first = head while first != second: first = first.next second = second.next return first
class Solution: # @param {integer} dividend # @param {integer} divisor # @return {integer} def divide(self, dividend, divisor): if divisor == 0: return None sig = 1-2*(1 if dividend * divisor<0 else 0) dividend,divisor = abs(dividend), abs(divisor) if divisor ...
ratings = 0 all_mean = 0 user_mean = 0 item_mean = 0 user_similarity = 0 item_similarity = 0 user_similarity_norm = 0 item_similarity_norm = 0 n_users = 943 n_items = 1682
# TODO: add/import version support here class InvalidState(Exception): """Used when repomd data reaches an unexpected state""" pass class UnsupportedFileListException(Exception): """Used when the file list version is unsupported""" def __init__(self, version): super().__init__(f'This file lis...
_base_ = [ '../_base_/models/resnest50.py', '../_base_/datasets/diseased_bs32_pil_resize.py', '../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py' ] model = dict( head=dict( num_classes=2, topk=(1,)) )
""" Module """ def my_multiplier(value1, value2): return value1 * value2 * 1000
def hanoi(n, from_tower, to_tower, other_tower): if n == 1: # recursion bottom print(f'{from_tower} -> {to_tower}') else: # recursion step hanoi(n - 1, from_tower, other_tower, to_tower) print(f'{from_tower} -> {to_tower}') hanoi(n - 1, other_tower, to_tower, from_tower) h...
# -*- coding: utf-8 -*- # @Time : 2020/12/11 10:13 上午 # @File : const.py VERSION_IMAGE_MAP = { 'storaged': { 'nightly': 'vesoft/nebula-storaged:nightly', '1.2': 'vesoft/nebula-storaged:v1.2.0', '1.1': 'vesoft/nebula-storaged:v1.1.0' }, 'metad': { 'nightly': 'vesoft/nebu...
# Copyright 2017 The Bazel Authors. All rights reserved. # # 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 la...
campeonato = ('Flamengo', 'Atlético-MG', 'São Paulo', 'Internacional', 'Grêmio', 'Palmeiras', 'Sport', 'Cruzeiro', 'Botafogo', 'Corinthians', 'Vasco', 'Fluminense', 'América-MG', 'Chapecoense', 'Santos', 'Vitória-BA', 'Bahia', 'Paraná', 'Atlético-PR', 'Ceará') print("CAMPEONAT...
# Sample Code For Assignment #3 # Printing Formatted Data in Python # Copyright (C) 2021 Clinton Garwood # MIT Open Source Initiative Approved License # hw_assignment_3.py # CIS-135 Python # Resources: # https://www.w3schools.com/python/ref_string_format.asp # https://www.w3schools.com/python/python_string_...
class VanillaRNN(nn.Module): def __init__(self, layers, output_size, hidden_size, vocab_size, embed_size, device): super(VanillaRNN, self).__init__() self.n_layers= layers self.hidden_size = hidden_size self.device = device # Define the embedding self.embeddings = nn.Embedding(v...
__all__ = ("country_codes",) country_codes = { # talk about ugly lol "oc": 1, "eu": 2, "ad": 3, "ae": 4, "af": 5, "ag": 6, "ai": 7, "al": 8, "am": 9, "an": 10, "ao": 11, "aq": 12, "ar": 13, "as": 14, "at": 15, "au": 16, "aw": 17, "az": 18, "b...
# This Python file uses the following encoding: utf-8 numbers = [] # 使用列表存放临时数据 while True: x = input('请输入一个成绩:') try: # 异常处理结构 numbers.append(float(x)) except: print('不是合法成绩') while True: flag = input('继续输入吗?(yes/no)').lower() if flag not in ('yes', 'no'): # 限定用户输...
# Code strings the E6-B code # OCR from European patent EP1825626B1.pdf (may have a few errors) # The codes for the following PRNs have been compared with recorded signals and should be error-free: # 1 2 3 4 5 7 8 9 11 12 13 14 15 18 19 21 24 25 26 27 30 31 33 36 e6b_strings = { 1: "5mSKpe/wkHoXA3f7IM7e4ejSU9rCSWgxA...
#!/usr/bin/env python #coding: utf-8 class Solution: # @param gas, a list of integers # @param cost, a list of integers # @return an integer def canCompleteCircuit(self, gas, cost): total, tank, start = 0, 0, 0 lg = len(gas) for i in range(lg): tank = tank + gas[i] ...
# Jadoo, the Space Alien has befriended Koba upon landing on Earth. Since then, he wishes Koba to be more like him. In order to do so he decides to slowly transcribe Koba's DNA into RNA. But he has to write a very short code in order to do the transcription so as not to make Koba aware of the change. # The four nucleo...
class NameTooShortError(ValueError): pass raise NameTooShortError("foo")
# O((2n)!/((n!((n + 1)!)))) time | O((2n)!/((n!((n + 1)!)))) space - # where n is the input number def generateDivTags(numberOfTags): matchedDivTags = [] generateDivTagsFromPrefix(numberOfTags, numberOfTags, "", matchedDivTags) return matchedDivTags def generateDivTagsFromPrefix(openingTagsNeede...
# md5 : d385b6882bfe47bedf2a2b9547c91a16 # sha1 : 907eec7568423245054be9c59638f0e2bc04afad # sha256 : a4e40c348031047b966c18f2761ee0460a226905721d2f29327528cb2b213cb1 ord_names = { 1: b'AcquireSRWLockExclusive', 2: b'AcquireSRWLockShared', 3: b'ActivateActCtx', 4: b'ActivateActCtxWorker', 5: b'AddA...
"""Exercício Python 086: Crie um programa que declare uma matriz de dimensão 3x3, preencha com valores lidos pelo teclado. No final, mostre a matriz na tela, com a formatação correta.""" # RESOLUÇÃO GUANABARA matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] # a parte dos 'for' é para o programa 'achar o caminho' na hora ...
# -*- coding: utf-8 -*- class Solution: def countOdds(self, low: int, high: int) -> int: return (high + 1) // 2 - low // 2 if __name__ == '__main__': solution = Solution() assert 3 == solution.countOdds(3, 7) assert 1 == solution.countOdds(8, 10)
def solution(x, y): result = 0 if y == 1: result = (1 + x) * x / 2 elif y == 2: result = (1 + x) * x / 2 + x else: end = x + y - 2 result = (1 + end) * end / 2 + x return str(result)
# # PySNMP MIB module MAU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MAU-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:49:53 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)...
valores = list() valor = 0 for c in range(0, 5): valor = int(input('Digite um valor: ')) if c == 0 or valor >= valores[len(valores)-1]: valores.append(valor) print('Adicionado ao final da lista') else: pos = 0 while pos < len(valores): if valor <= valores[pos]: ...
capac = int(input()) qtn500 = capac // 500 capac = capac - (qtn500 * 500) qtn100 = capac // 100 capac = capac - (qtn100 * 100) qtn25 = capac // 25 capac = capac - (qtn25 * 25) print(qtn500) print(qtn100) print(qtn25) print(capac)
""" @author : Hyunwoong @when : 2019-10-29 @homepage : https://github.com/gusdnd852 """ def epoch_time(start_time, end_time): elapsed_time = end_time - start_time elapsed_mins = int(elapsed_time / 60) elapsed_secs = int(elapsed_time - (elapsed_mins * 60)) return elapsed_mins, elapsed_secs
def split_all_strings(input_array,splitter,keep_empty=False): out=[] while(len(input_array)): current=input_array.pop(0).split(splitter) while(len(current)): i=current.pop(0) if(len(i) or keep_empty): out.append(i) return(out) if __name__ == '__main__': test = 'hello world or something like that'.spl...
with open("encoded.bmp", "rb") as f: f.seek(0x7d0) buf = f.read(0x32 * 8) flag = '' bin_flag = '' for i, c in enumerate(buf): bin_flag += str(c & 1) if i % 8 == 7: flag += chr(int(bin_flag[::-1], 2) + 5) bin_flag = '' print(repr(flag))
numero = int(input('Digite um numero: ')) count = 1 while count <= numero: print(count) count = count + 1
def Trace(tag=''): pass def TracePrint(strMsg): pass _traceEnabled = False _traceIndent = 0
# https://programmers.co.kr/learn/courses/30/lessons/42748 def solution(array, commands): answer = [] for idx in range(len(commands)): i, j, k = commands[idx] values = array[i-1:j] values.sort() v = values[k-1] answer.append(v) return answer
# Copyright 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. def _CommonChecks(input_api, output_api): results = [] results += input_api.RunTests(input_api.canned_checks.GetPylint( input_api, output_api, ex...
class Solution: def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if not nums: return -1 peak_idx = -1 peak_num = float('-inf') for idx in range(0, len(nums)): if nums[idx] > ...
a = source() b = source2() c = source3() d = source4() e = a f = b + c g = 2*c + d c = 1 print(sink(sink(e), c, sink(f), sink(g, 4*a)))
def gcd(a: int, b: int) -> int : if a == 0: return b return gcd(b % a, a) def lcm(a: int, b: int) -> int: return (a / gcd(a,b))* b
""" The :mod:`fatf.accountability` module holds a range of accountability methods. This module holds a variety of techniques that can be used to assess *privacy*, *security* and *robustness* of artificial intelligence pipelines and the machine learning process: *data*, *models* and *predictions*. """ # Author: Kacper ...
def find_lcm(a:int, b:int)->int: if a <= b: # 1 45000 for i in range(1, a + 1): if a % i == 0 and b % i == 0: gcd = i lcm = int(a * b / gcd) return lcm if a > b: # 6, 2 for i in range(1, b + 1): if a % i == 0 and b % i == 0: ...