content
stringlengths
7
1.05M
""" adam_objects.py """ class AdamObject(object): def __init__(self): self._uuid = None self._runnable_state = None self._children = None def set_uuid(self, uuid): self._uuid = uuid def set_runnable_state(self, runnable_state): self._runnable_state = runnable_...
# Sudoku Solver :https://leetcode.com/problems/sudoku-solver/ # Write a program to solve a Sudoku puzzle by filling the empty cells. # A sudoku solution must satisfy all of the following rules: # Each of the digits 1-9 must occur exactly once in each row. # Each of the digits 1-9 must occur exactly once in e...
class FunctionMetadata: def __init__(self): self._constantReturnValue = () def setConstantReturnValue(self, value): self._constantReturnValue = (value,) def hasConstantReturnValue(self): return self._constantReturnValue def getConstantReturnValue(self): return self._co...
# https://www.codewars.com/kata/578553c3a1b8d5c40300037c/train/python # Given an array of ones and zeroes, convert the equivalent binary value # to an integer. # Eg: [0, 0, 0, 1] is treated as 0001 which is the binary representation of 1. # Examples: # Testing: [0, 0, 0, 1] ==> 1 # Testing: [0, 0, 1, 0] ==> 2 # Tes...
class Solution: def rob(self, nums: List[int]) -> int: def rob(l: int, r: int) -> int: dp1 = 0 dp2 = 0 for i in range(l, r + 1): temp = dp1 dp1 = max(dp1, dp2 + nums[i]) dp2 = temp return dp1 if not nums: return 0 if len(nums) < 2: return nums...
array = ['a', 'b', 'c'] def decorator(func): def newValueOf(pos): if pos >= len(array): print("Oops! Array index is out of range") return func(pos) return newValueOf @decorator def valueOf(index): print(array[index]) valueOf(10)
numero = 5 fracao = 6.1 online = True texto = "Armando"
maior = 0 pos = 0 for i in range(1, 11): val = int(input()) if val > maior: maior = val pos = i print('{}\n{}'.format(maior, pos))
x = 1 products=list() employees=list() customers=list() Sales=list() while x > 0 : print('Type 0 to end') print('Type 1 to create new product') print('Type 2 to show registered products') print('Type 3 to create new employee ') print('Type 4 to show registered employees') print('Type 5 to create...
# -*- coding: utf-8 -*- """ Created on Sun Jul 14 09:42:46 2019 @author: ASUS """ class Solution: def uniqueMorseRepresentations(self, words: list) -> int: self.M = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","...
COUNT = 100 class Stack: def __init__(self, value): self.value = value; self.next = None def test(): top = None for i in range(0, COUNT): curr = Stack(f'Hello #{i}') curr.next = top top = curr print(stackSize(top)) def stackSize(stack): size = 0 if s...
class Solution(object): def checkRecord(self, s): """ :type s: str :rtype: bool """ return s.count('A') <=1 and 'LLL' not in s """ You are given a string representing an attendance record for a student. The record only contains the following three c...
''' Author: Maciej Kaczkowski 26.03-13.04.2021 ''' # configuration file with constans, etc. # using "reversi convention" - black has first move, # hence BLACK is Max player, while WHITE is Min player WHITE = -1 BLACK = 1 EMPTY = 0 # player's codenames RANDOM = 'random' ALGO = 'minmax' # min-max parameters MAX_DEPT...
def replace_string_in_file(filepath, searched, replaced): with open(filepath) as f: file_source = f.read() # replace all occurences replace_string = file_source.replace(searched, replaced) with open(filepath, "w") as f: f.write(replace_string)
class Fail(Exception): pass class InvalidArgument(Fail): pass
# -*- coding: utf-8 -*- def main(): n = int(input()) a = list(map(int, input().split())) inf = 1 << 30 ans = inf for bit in range(1 << n - 1): candidate = 0 inner = 0 for j in range(n): inner |= a[j] if (bit >> j) & 1: candidate ^=...
# Addition and subtraction print(5 + 5) print(5 - 5) # Multiplication and division print(3 * 5) print(10 / 2) # Exponentiation print(4 ** 2) # Modulo print(18 % 7)
""" File: basic_permutations.py Name: Sharon ----------------------------- This program finds all the 3-digits binary permutations by calling a recursive function binary_permutations. Students will find a helper function useful in advanced recursion problems. """ def main(): binary_permutations(5) def binary_permu...
#!/usr/bin/env python # -*- coding: utf-8 -*- '''A simple module to store the user's style preferences.''' INDENT_PREFERENCE = {'indent': ' '} def get_indent_preference(): '''str: How the user prefers their indentation. Default: " ".''' return INDENT_PREFERENCE['indent'] def register_indent_prefere...
''' StaticRoute Genie Ops Object Outputs for IOSXE. ''' class StaticRouteOutput(object): # 'show ipv4 static route' output showIpv4StaticRoute = { 'vrf': { 'VRF1': { 'address_family': { 'ipv4': { 'routes': { ...
''' Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input st...
#=============================================================================== """ Optional features config. """ #=============================================================================== # Enter mail below to receive real-time email alerts # e.g., 'email@gmail.com' MAIL = '' # Enter the ip camera url (e....
datos= [0,0,0,0,0,0,0,0,0,0,0,0,0 ,1,1,1,1,1,1,1,1,1,1 ,2,2,2,2,2,2,2 ,3,3,3,3,3,3 ,4,4] def media(datos): return sum(datos)/len(datos) def mediana(datos): if(len(datos)%2 == 0): return (datos[int(len(datos)/2)] + datos[int((len(datos)+1)/2)]) / 2 else: retu...
FILTERS = [ "Você irá aprender", "Você irá receber", "Você também irá receber", "O seguinte feitiço será lançado em você", "Você vai poder escolher uma dessas recompensas", "Completando essa missão você ganhará", "Item fornecido", "texto temporário 02 - registro", "texto temporário 0...
while True: b=input().split() X,M=b X=int(X) M=int(M) if(X==0 and M==0): break else: E=X*M print(E)
first = ['Bucky', 'Tom', 'Taylor'] last = ['Roberts', 'Hanks', 'Swift'] names = zip(first, last) for a, b in names: print(a, b)
'''To find Symmetric Difference between two Sets.''' #Example INPUT: ''' 4 2 4 5 9 4 2 4 11 12 ''' #OUTPUT: (Symmetric difference in ascending order) ''' 5 9 11 12 ''' #Code n=int(input()) a=[int(i) for i in input().split()] m=int(input()) b=[int(i) for i in input().split()] a1=set(a) b1=set(b) t=...
class EditorFactory(object): __registeredEditors = [] def __init__(self): super(EditorFactory, self).__init__() @classmethod def registerEditorClass(cls, widgetClass): cls.__registeredEditors.append(widgetClass) @classmethod def constructEditor(cls, valueController, parent=...
def rev(j): rev = 0 while (j > 0): remainder = j % 10 rev = (rev * 10) + remainder j = j // 10 return rev def emirp(j): if j <= 1: return False else: for i in range(2, rev(j)): if j % i == 0 or rev(j) % i == 0: print(j, "Is not e...
#Leia um número qualquer #Mostre o seu fatorial resp = 1 c = 1 n = int(input('Digite um número :')) while (c < n) : c = c + 1 resp = resp * c print('O fatorial de {} é {}'.format(n,resp))
""" LeetCode Problem: 766. Toeplitz Matrix Link: https://leetcode.com/problems/toeplitz-matrix/ Language: Python Written by: Mostofa Adib Shakib """ # Optimal Solution # Time Complexity: O(M*N) # Space Complexity: O(1) class Solution: def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: rows = le...
x = 0 y = 0 def setup(): size(400, 400) def draw(): global x, y background(255) ellipse(x, y, 30, 30) x += (mouseX - x) / 10 y += (mouseY - y) / 10
class SignupsException(Exception): """Base class for PvP Signups exceptions.""" class CancelBooking(SignupsException): """User requested or timeout based booking cancellation.""" class BadConfig(SignupsException): """Value in config.json invalid.""" class ChannelNotFound(SignupsException): """Chan...
soma = 0 for n in range(1, 7): num = int(input(f'Informe o {n}° valor: ')) if num % 2 == 0: soma += num print(f'A soma dos numeros pares digitado é de {soma}.')
def parse_from_file(filename, parser): with open(filename,"r") as f: string=f.read() args=parser.parse_args(string.split()) return args
#Problem Set 02 print('Problem Set 02') # Problem 01 (20 points) print('\nProblem 1') cases = [70, 75, 126, 144, 170] cases_latest = None #TODO Replace # Problem 02 (20 points) print('\nProblem 2') tests = None #TODO Replace tests_last_three = None #TODO Replace tests_reverse = None #TODO Replace # Problem 03 ...
"""Top-level package for CY Widgets.""" try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: __path__ = __import__('pkgutil').extend_path(__path__, __name__) __author__ = """CY Gatro""" __email__ = 'cragodn@gmail.com' __version__ = '0.4.35'
class Mesh: def __init__(self): self.vertexs = [] def setName(self, name): self.name = name def addVertex(self, x, y, z): self.vertexs.append([x, y, z]) def read(self): print(self.name) print(self.vertexs) def getVertexs(self): return self.vertexs ...
#!/usr/bin/env python3 class RunfileFormatError(Exception): pass class RunfileNotFoundError(Exception): def __init__(self, path): self.path = path class TargetNotFoundError(Exception): def __init__(self, target=None): self.target = target class TargetExecutionError(Exception): de...
count= 0 fname= input("Enter the file name:") if fname== "na na boo boo": print("NA NA BOO BOO TO YOU- You have been punk'd") exit() else: try: fhand= open(fname) except: print("File cannot be opened", fname) exit() for line in fhand: if line.startswith("Subj...
'''Faça um programa que leia o sexo de uma pessoa, mas só aceite M ou F. Caso esteja errado, peça a digitação novamente até ter um valor correto.''' sexo = '' n = 1 while n != 0: sexo = str(input('''Escolha seu sexo: [ M ] - Masculino; [ F ] - Feminino. ''')).strip().upper()[0] if sexo == 'M': ...
input_data = input() symbols = {} def count_symbols(data): for symbol in data: if symbol not in symbols: symbols[symbol] = 0 symbols[symbol] += 1 return dict(sorted(symbols.items(), key=lambda s: s[0])) def print_data(symbols): for symbol, count in symbols.items(): pri...
def userinfo(claims, user): claims["name"] = user.username claims["preferred_username"] = user.username return claims
#%% 6-misol lst=list(input().split()) lst=[int(i) for i in lst] print(lst) k=0 son=list() for i in range(len(lst)-1): if lst[i]>lst[i+1]: if son!=[]: son.append(lst[i]) print(*son) son=list() k+=1 #%% 7-misol son=int(input("son=")) list1=list() while son!=0: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 17/5/16 下午3:09 # @Author : irmo file = 'pts.txt' output = 'lfw_landmark.txt' def check_line(line): if 'lfw' in line: return True def main(): f = open(file, 'r') out = open(output, 'w') while True: line = f.readline() ...
class Utils(object): ''' keep values between -180 and 180 degrees input and output parameters are in degrees ''' def normalize_angle(self, degrees: float) -> float: degrees = degrees % 360 if degrees > 180: return degrees - 360 return degrees
# The following is an implementation of the hex helper # from Electrum - lightweight Bitcoin client, which is # subject to the following license. # # Copyright (C) 2011 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation fil...
num = input("Please enter a num: ") while not num.isdigit(): num = input("Please enter a num: ") print("Your num: %s" % num)
class ModulationException(Exception): pass class EncodingException(ModulationException): pass class DecodingException(ModulationException): pass
class RedisMock(): def __init__(self): self.incoming_queue = [] self.in_progress_queue = [] def brpoplpush(self, *args): if self.incoming_queue: item = self.incoming_queue.pop(0) self.in_progress_queue.append(item) return item else: ...
def solve(matrix, target): possible_results = [] for r, row in enumerate(matrix): start = 0 end = len(row) - 1 while start <= end: mid = (start + end) // 2 if row[mid] == target: possible_results.append((r + 1) * 1009 + mid + 1) ...
P1_CHAR = "1" P2_CHAR = "2" class ChessPiece(object): """ This class is used entirely for inheretence for other chess piece classes. """ def __init__(self, row, col, player): assert 0 <= row < 8 assert 0 <= col < 8 assert player in (P1_CHAR, P2_CHAR), "player: {} error".format(...
class Solution: def pivotIndex(self, nums: List[int]) -> int: for i in range(0, len(nums)): if sum(nums[:i]) == sum(nums[i+1:]): return i return -1
# para variavel de vi até vf passo x # inicio # fim # para variavel de 1 até 5 passo 1 # inicio # Escrever "Oswaldo" # fim for variavel in range(1,6,1): print("Oswaldo")
class Solution: def longestOnes(self, A: List[int], K: int) -> int: maxLen = zero = start = 0 for i, a in enumerate(A): if a == 0: zero += 1 while zero > K: if A[start] == 0: zero -= 1 start += 1 ...
# coding: utf-8 SUBJECT_AREAS = [ 'Health Sciences', 'Agricultural Sciences', 'Human Sciences', 'Biological Sciences', 'Exact and Earth Sciences', 'Engineering', 'Applied Social Sciences', 'Linguistics, Letters and Arts' ] ISO_639_1 = { u"BE": u"Belarusian", u"BG": u"Bulgarian"...
"""simtk pydra tasks and workflows.""" # __all__ = [ # 'load_image_task' # ] # import numpy as np # from pydra import mark # import itk # from simtk import load_image # load_image_annotated = mark.annotate({'filename': str, 'nphases': int, # 'norientations': int, 'spacing': np.ndarray, 'return': itk.VectorImage })(...
# Fill all this out with your information patreon_client_id = None patreon_client_secret = None patreon_creator_refresh_token = None patreon_creator_access_token = None patreon_creator_id = None patreon_redirect_uri = None
#!/usr/bin/env python3 #https://codeforces.com/problemset/problem/180/C #这个题难度好像标的有点虚高 s = input() #1e5 n = len(s) ll = [0]*(n+1) #lower@left ur = [0]*(n+1) #upper@right for i in range(n): ll[i+1] = ll[i]+1 if s[i].islower() else ll[i] for i in range(n-1,-1,-1): ur[i] = ur[i+1]+1 if s[i].isupper...
# Initialize Global Variables VERSION = '1.4' TITLE = 'RO:X Next Generation - Auto Fishing version' PID = '' SCREEN_WIDTH = 0 SCREEN_HEIGHT = 0 IS_ACTIVE = False HOLD = True FRAME = None PREV_TIME = 0 CURRENT_TIME = 0 LIMIT = 0 LOOP = 0 IS_FISHING = True LAST_CLICK_TIME = 0 COUNT = 0 BOUNDING_BOX = {'top': 0, 'left...
class Node: next_node = None data = 0 def __init__(self, value): self.data = value def run(input_data): if input_data is None or input_data.next_node is None: return False input_data.data = input_data.next_node.data input_data.next_node = input_data.next_node.next_node retu...
# File to automate the conversion of the glosary to txt file text_file = open("glossory.txt", "r") glossory = text_file.readlines() word = [] deffinition = [] for i in range(len(glossory)): if (i % 2) == 0: word.append(glossory[i]) else: deffinition.append(glossory[i]) word[:] = [line.rstrip(...
class CronExecutor(object): def __init__(self): # cron cache key is {<Date String YYY-mm-dd>: {<timestamp>: [<string command 1>...]} self._cache = {}
# connect-4 # Define the board's Width and Height as constant WIDTH = 7 HEIGHT = 6 def init_board(): b = [] for x in range(0, WIDTH): b.append([]) for y in range(0, HEIGHT): b[x].append(0) return b def player1_move(board, x, y): board[x][y] = 1 def player2_move(board, ...
class _BaseStateError(BaseException): '''Base class for state-related exceptions. Accepts only one param which must be a list of strings.''' def __init__(self, message=None): message = message or [] if not isinstance(message, list): raise TypeError('{} takes a list of errors not ...
'''16 - Faça um programa para uma loja de tintas. O programa deverá pedir o tamanho em metros quadrados da área a ser pintada. Considere que a cobertura da tinta é de 1 litro para cada 3 metros quadrados e que a tinta é vendida em latas de 18 litros, que custam R$ 80,00. Informe ao usuário a quantidades de latas de tin...
P1_TWO_SUMS = """ Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] Example 3: Input: nums = [3,3], target = 6 Output: [0,1] """ P10_REGEXP_MATCHING = """ The matching should cover the...
# # PySNMP MIB module EATON-EPDU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EATON-EPDU-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:44:24 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...
# -*- coding: utf-8 -*- # URI Judge - Problema 1013 a, b, c = map(int, input().split()) if a > (b and c): print(str(a) + " eh o maior") elif b > c: print(str(b) + " eh o maior") else: print(str(c) + " eh o maior")
#reg add HKEY_CURRENT_USER\Console /v VirtualTerminalLevel /t REG_DWORD /d 0x00000001 /f colors = {\ 'OKBLUE' : '\033[94m', 'OKGREEN' : '\033[92m', 'WARNING' : '\033[93m', 'RED' : '\033[1;31;40m', } def colorText(text): for color in colors: text = text.replace("[[" + color + "]...
#function to check whether a number is in a given range. def test_range(n): if n in range(3,9): print( " %s is in the range"%str(n)) else : print("The number is outside the given range.") test_range(5)
# 短信验证码过期时间 SMS_CODE_EXPIRES = 300 # 发送信息短信的间隔 SMS_FLAG_EXPIRES = 60
ans = 0 for _ in range(5): a, b, c = sorted([int(x) for x in input().split()]) if a + b > c: ans += 1 print(ans)
def move_cars(current, final): if len(current) <= 1: return 0 if len(current) == 2 and current[0] == final[0]: return 0 moves = 0 for i, car in enumerate(current): if car == final[i]: if car == '_': # need to move car to this spot first ...
def get_letter_frequency(word): chars_dict = {} for letter in word: if letter in chars_dict: chars_dict[letter] += 1 else: chars_dict[letter] = 1 return chars_dict def number_of_deletions(a, b): count = 0 chars_of_a = get_letter_frequency(a) chars_of_b = ...
""" mcpython - a minecraft clone written in python licenced under the MIT-licence (https://github.com/mcpython4-coding/core) Contributors: uuk, xkcdjerry (inactive) Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence Original game "minecraft" by Mojang Studios (www.m...
def repeat(chars: str, count: int) -> str: """Return a string of repeated characters. :param chars: The characters to repeat. :param count: The number of times to repeat. :return: The string of repeated characters. """ return chars * count def truncate(source, max_len: int, el: str = "...", a...
# -*- coding: utf-8 -*- # Created at 03/10/2020 __author__ = 'raniys' class HomeData: home_url = "https://www.python.org/" search_text = "pycon"
def get_db_uri(dbinfo): username = dbinfo.get('user') or "root" password = dbinfo.get('pwd') or "123456" host = dbinfo.get('host') or "localhost" port = dbinfo.get('port') or "3306" database = dbinfo.get('dbname') or "pythonixf" driver = dbinfo.get('driver') or "pymysql" dialect = dbinfo.get...
expected_output = { "vrf": { "L3VPN-1538": { "index": {1: {"address_type": "Interface", "ip_address": "192.168.10.254"}} } } }
fib = {1: 1, 2: 1, 3: 2, 4: 3} print(fib.get(4, 0) + fib.get(7, 5)) ## get(4,0) is 3 because as you can see, 4:3, in the key 4, you can 3. ## Since there is not key 7, this will just equivalent to 5. ## 3 + 5 = 8 ## output is 8
contPares = 0 print('Numeros pares: ',end='') for i in range(1,51): if i % 2 == 0: print(i, end=' ')
# encoding: utf-8 # module SingleNameSpace.Some.Deep calls itself Deep # from SingleNameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null # by generatorXXX # no doc # no imports # no functions # classes class WeHaveClass(object): """ WeHaveClass() """ MyClass = None
__author__ = 'Meemaw' def isPalindrome(x, i): zacetek = 0 konec = len(x)-1 while zacetek <= konec: if x[zacetek] != x[konec]: return 0 zacetek+=1 konec-=1 return 1 vsota = 0 print("Please insert upper bound:") x = int(input()) for i in range(1,x+1): if isPalind...
class NestedIterator: def __init__(self, nestedList): self.l = [] self.i = 0 def search(l): for e in l: if e.isInteger(): self.l.append(e.getInteger()) else: search(e.getList()) search(nestedList) ...
def _copy_libs_impl(ctx): # Get a list of the input files in_files = ctx.files.libs # Declare the output files out_files = [ctx.actions.declare_file(f.basename) for f in in_files] ctx.actions.run_shell( # Input files visible to the action. inputs = in_files, # Output files...
#https://www.hackerrank.com/challenges/quicksort1 def partition(a, first, last): pivot = a[first] wall = last+1 for j in range(last, first,-1): if a[j] > pivot: wall -= 1 if j!=wall: a[j],a[wall] = a[wall], a[j] #saves time. in case lik [3,2,4,1] do its partition and s...
# -*- coding: utf-8 -*- """ Advent of Code 2021 @author marc """ with open("input-day06", 'r') as f: # with open("input-day06-test", 'r') as f: lines = f.readlines() fish = lines[0][:-1].split(',') fish = [(int(i),1) for i in fish] def run(fish, nrEpochs): for i in range(nrEpochs): spawncoun...
prompt = input('Enter the file name: ') try: prompt = open(prompt) except: print('File cannot be opened:', prompt) exit() total = 0 count = 0 # reading through the file for line in prompt: if line.startswith("X-DSPAM-Confidence:"): # removes lines after and before a sentence line = line....
""" A simple bencoding implementation in pure Python. Consult help(encode) and help(decode) for more info. >>> encode(42) == b'i42e' True >>> decode(b'i42e') 42 """ class Bencached(): __slots__ = ['bencoded'] def __init__(self, s): self.bencoded = s def encode_bencached(x, r): r.append(x.benco...
SOLUTIONS = { "LC": [ [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], ], "WASTE": [ [0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0],...
number = [1,3,6,2,7,5,8,9,0] result = filter(lambda x:x>5,number) print("Number List",number) print("Number Smaller than 5 in the list are:",list(result))
# # PySNMP MIB module NETGEAR-REF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETGEAR-REF-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:19:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
""" Low-level methods for handling a MiCADO master with Occopus """ class OccopusLauncher: """For launching a MiCADO Master with Occopus """
my_host = 'localhost' my_port = 10000 is_emulation = False emulator_host = '0.0.0.0' emulator_port = 4390 apis_web_host = '0.0.0.0' apis_web_budo_emulator_port = 43830 apis_web_api_server_port = 9999 #apis_log_group_address = 'FF02:0:0:0:0:0:0:1' apis_log_group_address = '224.2.2.4' apis_log_port = 8888 units = [...
def primes(): i, f = 2, 1 while True: if (f + 1) % i == 0: yield i f, i = f * i, i + 1
mypass = input() if ("1234" or "qwerty" in mypass) or (len(mypass) < 8): print("Bad password") elif ("1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9" or "0") not in mypass: print("Bad password") else: print("Good password")
n, m = map(int, input().split()) matches = [] for i in range(m): matches.append(list(map(int, input().split()))) matches.sort(key=lambda container: container[1], reverse=True) count = 0 i = 0 j = 0 while i <= n and j < m: if matches[j][0] < n - i: i += matches[j][0] count += matches[j][0] * mat...
def test(): assert len(doc1.ents) == 2, "Attendu deux entités dans le premier exemple" assert ( doc1.ents[0].label_ == "SITE_WEB" and doc1.ents[0].text == "Reddit" ), "Vérifie l'entité une dans le premier exemple" assert ( doc1.ents[1].label_ == "SITE_WEB" and doc1.ents[1].text == "P...
# 'guinea pig' is appended to the animals list animals.append('guinea pig') # Updated animals list print('Updated animals list: ', animals)