content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def isIPv4Address(inputString): # Method 1 if len(inputString.split(".")) != 4: return False for x in inputString.split("."): if not x or not x.isnumeric() or (x.isnumeric() and int(x) > 255): return False return True # # Method 2 # # Same as method 1, but with Pyt...
def is_i_pv4_address(inputString): if len(inputString.split('.')) != 4: return False for x in inputString.split('.'): if not x or not x.isnumeric() or (x.isnumeric() and int(x) > 255): return False return True input_string = '172.16.254.1' print(is_i_pv4_address(inputString)) inp...
# Insertion Sort # Time Complexity: O(n^2) # Space Complexity: O(1) # Assume first element is sorted at beginning # and then using it to compare with next element # if this element is less than next element # then swap them def insertion_Sort(lst): for i in range(1, len(lst)): # first read from 1 to n-1...
def insertion__sort(lst): for i in range(1, len(lst)): print(lst) cur = lst[i] j = i - 1 while j >= 0 and cur < lst[j]: lst[j + 1] = lst[j] j -= 1 lst[j + 1] = cur return lst
#Assume s is a string of lower case characters. #Write a program that prints the longest substring of s #in which the letters occur in alphabetical order. #For example, if s = 'azcbobobegghakl', then your program should print #Longest substring in alphabetical order is: beggh #In the case of ties, print the first sub...
def f(x, y): if ord(x) <= ord(y): return True else: return False s = 'rmfsntggmsuqemcvy' a = 0 s1 = str() w = bool() while a < len(s) - 1: w = f(s[a], s[a + 1]) if w == True: s1 = s1 + s[a] if a == len(s) - 2: s1 = s1 + s[a + 1] a += 1 elif w == Fa...
def calc_fitness_value(x,y,z): fitnessvalues = [] x = generation_fitness_func(x) y = generation_fitness_func(y) z = generation_fitness_func(z) for p in range(len(x)): fitnessvalues += [(x[p]*x[p])+(y[p]*y[p])+(z[p]*z[p])] return fitnessvalues #fitness_value = x*x + y*...
def calc_fitness_value(x, y, z): fitnessvalues = [] x = generation_fitness_func(x) y = generation_fitness_func(y) z = generation_fitness_func(z) for p in range(len(x)): fitnessvalues += [x[p] * x[p] + y[p] * y[p] + z[p] * z[p]] return fitnessvalues def generation_fitness_func(generation...
content = b'BM\xbc\x03\x00\x00\x00\x00\x00\x006\x00\x00\x00(\x00\x00\x00\x1e\x00\x00\x00\x0f\x00\x00\x00\x01\x00\x10\x00\x00\x00\x00\x00\x86\x03\x00\x00\x12\x0b\x00\x00\x12\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x7f\xff\x7f\xff\x7f\xdf{\x7fo\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x...
content = b'BM\xbc\x03\x00\x00\x00\x00\x00\x006\x00\x00\x00(\x00\x00\x00\x1e\x00\x00\x00\x0f\x00\x00\x00\x01\x00\x10\x00\x00\x00\x00\x00\x86\x03\x00\x00\x12\x0b\x00\x00\x12\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x7f\xff\x7f\xff\x7f\xdf{\x7fo\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x7f\xff\x...
class Baseagent(object): def __init__(self, args): self.args = args self.agent = list() # inference def choose_action_to_env(self, observation, train=True): observation_copy = observation.copy() obs = observation_copy["obs"] agent_id = observation_copy["controlled_p...
class Baseagent(object): def __init__(self, args): self.args = args self.agent = list() def choose_action_to_env(self, observation, train=True): observation_copy = observation.copy() obs = observation_copy['obs'] agent_id = observation_copy['controlled_player_index'] ...
# Knutha Morrisa Pratt (KMP) for string matching # Complexity: O(n) # Reference used: http://code.activestate.com/recipes/117214/ def kmp(full_string, pattern): ''' It takes two arguments, the main string and the patterb which is to be searched and returns the position(s) or the starting indexes of the ...
def kmp(full_string, pattern): """ It takes two arguments, the main string and the patterb which is to be searched and returns the position(s) or the starting indexes of the pattern in the main string (if exists) agrs 'full-string' is the text from where pappern has to be searched 'pattern'...
# Description # Keep improving your bot by developing new skills for it. # We suggest a simple guessing game that will predict the age of a user. # It's based on a simple math trick. First, take a look at this formula: # `age = (remainder3 * 70 + remainder5 * 21 + remainder7 * 15) % 105` # The `numbersremainder3`, `...
print('Hello! My name is Aid.') print('I was created in 2020.') print('Please, remind me your name.') name = input() print(f'What a great name you have, {name}!') print('Let me guess your age.') print('Enter remainders of dividing your age by 3, 5 and 7.') remainder3 = int(input()) remainder5 = int(input()) remainder7 ...
REQUEST_CACHE_LIMIT = 200*1024*1024 QUERY_CACHE_LIMIT = 200*1024*1024 class index: def __init__(self, name, request_cache, query_cache): self.name = name self.request_cache = request_cache self.query_cache = query_cache
request_cache_limit = 200 * 1024 * 1024 query_cache_limit = 200 * 1024 * 1024 class Index: def __init__(self, name, request_cache, query_cache): self.name = name self.request_cache = request_cache self.query_cache = query_cache
PCLASS = ''' class Parser(object): class ScanError(Exception): pass class ParseError(Exception): pass def parsefail(self, expected, found, val=None): raise Parser.ParseError("Parse Error, line {}: Expected token {}, but found token {}:{}".format(self.line, expected, found, val)) ...
pclass = '\nclass Parser(object):\n\n class ScanError(Exception):\n pass\n class ParseError(Exception):\n pass\n def parsefail(self, expected, found, val=None):\n raise Parser.ParseError("Parse Error, line {}: Expected token {}, but found token {}:{}".format(self.line, expected, found, val...
x = int(input()) y = int(input()) numeros = [x,y] numeros_ = sorted(numeros) soma = 0 for a in range(numeros_[0]+1,numeros_[1]): if a %2 != 0: soma += a print(soma)
x = int(input()) y = int(input()) numeros = [x, y] numeros_ = sorted(numeros) soma = 0 for a in range(numeros_[0] + 1, numeros_[1]): if a % 2 != 0: soma += a print(soma)
class couponObject(object): def __init__( self, player_unique_id, code = None, start_at = None, ends_at = None, entitled_collection_ids = {}, entitled_product_ids = {}, once_per_customer = None, prerequisite_quantity_range = None, ...
class Couponobject(object): def __init__(self, player_unique_id, code=None, start_at=None, ends_at=None, entitled_collection_ids={}, entitled_product_ids={}, once_per_customer=None, prerequisite_quantity_range=None, prerequisite_shipping_price_range=None, prerequisite_subtotal_range=None, prerequisite_collection_i...
{ 'targets': [ { 'target_name': 'vivaldi', 'type': 'none', 'dependencies': [ 'chromium/chrome/chrome.gyp:chrome', ], 'conditions': [ ['OS=="win"', { # Allow running and debugging vivaldi from the top directory of the MSVS solution view 'product_na...
{'targets': [{'target_name': 'vivaldi', 'type': 'none', 'dependencies': ['chromium/chrome/chrome.gyp:chrome'], 'conditions': [['OS=="win"', {'product_name': 'vivaldi.exe', 'dependencies': ['chromium/third_party/crashpad/crashpad/handler/handler.gyp:crashpad_handler']}]]}]}
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def pseudoPalindromicPaths (self, root: TreeNode) -> int: ''' T: O(n) and S: O(n) ''...
class Solution: def pseudo_palindromic_paths(self, root: TreeNode) -> int: """ T: O(n) and S: O(n) """ def is_palindrome(path): d = {} for digit in path: d[digit] = d.get(digit, 0) + 1 even_count = 0 for digit in d: ...
# # PySNMP MIB module RADLAN-RADIUSSRV (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-RADIUSSRV # Produced by pysmi-0.3.4 at Wed May 1 14:48:38 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ...
def rom(n): if n == 1000: return 'M' if n == 900: return 'CM' if n == 500: return 'D' if n == 400: return 'CD' if n == 100: return 'C' if n == 90: return 'XC' if n == 50: return 'L' if n == 40: return 'XL' if n == 10: return 'X' if n == 9: return 'IX' if n == ...
def rom(n): if n == 1000: return 'M' if n == 900: return 'CM' if n == 500: return 'D' if n == 400: return 'CD' if n == 100: return 'C' if n == 90: return 'XC' if n == 50: return 'L' if n == 40: return 'XL' if n == 10: ...
def resolve(): ''' code here ''' N = int(input()) mat = [[int(item) for item in input().split()] for _ in range(N)] dp = [[0 for _ in range(N+1)] for _ in range(N+1)] for i in reversed(range(N-2)): for j in range(i+2, N): dp[i][j] = min(dp[i][j-1] * mat[i][0]*mat[j][0]*...
def resolve(): """ code here """ n = int(input()) mat = [[int(item) for item in input().split()] for _ in range(N)] dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)] for i in reversed(range(N - 2)): for j in range(i + 2, N): dp[i][j] = min(dp[i][j - 1] * mat[i][0] * ...
class Classe_1: def funcao_da_classe_1(self, string): dicionario = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} valor = 0 for i in range(len(string)): if i > 0 and dicionario[string[i]] > dicionario[string[i -1]]: valor += dicionario[string[i]...
class Classe_1: def funcao_da_classe_1(self, string): dicionario = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} valor = 0 for i in range(len(string)): if i > 0 and dicionario[string[i]] > dicionario[string[i - 1]]: valor += dicionario[string[...
def partition(array, low, high): i = low - 1 pivot = array[high] for j in range(low, high): if array[j] < pivot: i += 1 array[i], array[j] = array[j], array[i] array[i + 1], array[high] = array[high], array[i + 1] return i + 1 def quick_sort(array...
def partition(array, low, high): i = low - 1 pivot = array[high] for j in range(low, high): if array[j] < pivot: i += 1 (array[i], array[j]) = (array[j], array[i]) (array[i + 1], array[high]) = (array[high], array[i + 1]) return i + 1 def quick_sort(array, low, high)...
# -*- coding: utf-8 -*- # @Date : 2014-06-27 14:37:20 # @Author : xindervella@gamil.com SRTP_URL = 'http://10.1.30.98:8080/srtp2/USerPages/SRTP/Report3.aspx' TIME_OUT = 8
srtp_url = 'http://10.1.30.98:8080/srtp2/USerPages/SRTP/Report3.aspx' time_out = 8
i=1 for i in range(0,5): if i==2: print('bye') break print("sadique")
i = 1 for i in range(0, 5): if i == 2: print('bye') break print('sadique')
def _normalize_scratch_rotation(degree): while degree <= -180: degree += 360 while degree > 180: degree -= 360 return degree def _convert_scratch_to_pygame_rotation(degree): deg = _normalize_scratch_rotation(degree) if deg == 0: return 90 elif deg == 90: ...
def _normalize_scratch_rotation(degree): while degree <= -180: degree += 360 while degree > 180: degree -= 360 return degree def _convert_scratch_to_pygame_rotation(degree): deg = _normalize_scratch_rotation(degree) if deg == 0: return 90 elif deg == 90: return 0...
def frequencySort(self, s: str) -> str: m = {} for i in s: if i not in m: m[i] = 1 else: m[i] += 1 r = "" for i in sorted(m, key=m.get, reverse=True): r += i * m[i] return r
def frequency_sort(self, s: str) -> str: m = {} for i in s: if i not in m: m[i] = 1 else: m[i] += 1 r = '' for i in sorted(m, key=m.get, reverse=True): r += i * m[i] return r
# String Format # As we learned in the Python Variables chapter, we cannot combine strings and numbers like this: ''' age = 23 txt = "My name is Nayan, I am " + age + "Years old" print(txt) #Error ''' # But we can combine strings and numbers by using the format() method! # The format() method takes the passed arg...
""" age = 23 txt = "My name is Nayan, I am " + age + "Years old" print(txt) #Error """ age = 23 txt = "My name is Nayan, and I'm {} Years old" print(txt.format(age)) quantity = 5 itemno = 1001 price = 101.05 myorder = 'I want {} pieces of item {} for {} Rupees' print(myorder.format(quantity, itemno, price)) quantity...
#Write a Python class to reverse a string word by word. class py_solution: def reverse_words(self, s): return reversed(s) print(py_solution().reverse_words('rewangi'))
class Py_Solution: def reverse_words(self, s): return reversed(s) print(py_solution().reverse_words('rewangi'))
# Chapter 7 exercises from the book Python Crash Course: A Hands-On, Project-Based Introduction to Programming. # 7-1. Rental Car car = input('Which car do you want to rent?') print('Let me see if I can find you a '+ car + '.') # 7-2. Restaurant Seating number = input('How many people come to dinner?') number...
car = input('Which car do you want to rent?') print('Let me see if I can find you a ' + car + '.') number = input('How many people come to dinner?') number = int(number) if number > 8: print('Sorry, but there is none table available for your group right now, can you wait for a little?') else: print('Your table ...
# follow pep-386 # Examples: # * 0.3 - released version # * 0.3a1 - alpha version # * 0.3.dev - version in developmentv __version__ = '0.7.dev' __releasedate__ = ''
__version__ = '0.7.dev' __releasedate__ = ''
class RegistrationInfo(object): def __init__(self, hook_name, expect_exists, register_kwargs=None): assert isinstance(expect_exists, bool) self.hook_name = hook_name self.expect_exists = expect_exists self.register_kwargs = register_kwargs or {}
class Registrationinfo(object): def __init__(self, hook_name, expect_exists, register_kwargs=None): assert isinstance(expect_exists, bool) self.hook_name = hook_name self.expect_exists = expect_exists self.register_kwargs = register_kwargs or {}
def includeme(config): config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('home', '/') config.add_route('api', '/api') config.add_route('download', '/download') config.add_route('docs', '/docs') config.add_route('create', '/create') config.add_route('demo', '/dem...
def includeme(config): config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('home', '/') config.add_route('api', '/api') config.add_route('download', '/download') config.add_route('docs', '/docs') config.add_route('create', '/create') config.add_route('demo', '/dem...
metadata = Hash() data = Hash(default_value=0) sc_contract = Variable() unit_contract = Variable() terrain_contract = Variable() random.seed() @construct def seed(): metadata['operator'] = ctx.caller #prize calclulation Parameters metadata['winner_percent'] = decimal('0.09') metadata['h...
metadata = hash() data = hash(default_value=0) sc_contract = variable() unit_contract = variable() terrain_contract = variable() random.seed() @construct def seed(): metadata['operator'] = ctx.caller metadata['winner_percent'] = decimal('0.09') metadata['house_percent'] = decimal('0.01') sc_contract.se...
def tic_tac_toe(): board = [1, 2, 3, 4, 5, 6, 7, 8, 9] end = False win_commbinations = ((0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)) def draw(): print(board[0], board[1], board[2]) print(board[3], board[4], board[5]) print(board...
def tic_tac_toe(): board = [1, 2, 3, 4, 5, 6, 7, 8, 9] end = False win_commbinations = ((0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)) def draw(): print(board[0], board[1], board[2]) print(board[3], board[4], board[5]) print(board[6], boa...
# This is the library where we store the value of the different constants # In order to use this library do: # import units_library as UL # U = UL.units() # kpc = U.kpc_cm class units: def __init__(self): self.rho_crit = 2.77536627e11 #h^2 Msun/Mpc^3 self.c_kms = 3e5 #km/s ...
class Units: def __init__(self): self.rho_crit = 277536627000.0 self.c_kms = 300000.0 self.Mpc_cm = 3.0856e+24 self.kpc_cm = 3.0856e+21 self.Msun_g = 1.989e+33 self.Ymass = 0.24 self.mH_g = 1.6726e-24 self.yr_s = 31557600.0 self.km_cm = 100000...
def get_transporter(configuration): transporter_module = configuration.get_module_transporter() transporter_configuration = configuration.get_configuration() return transporter_module.get_transporter(transporter_configuration)
def get_transporter(configuration): transporter_module = configuration.get_module_transporter() transporter_configuration = configuration.get_configuration() return transporter_module.get_transporter(transporter_configuration)
def LCSlength(X, Y, lx, ly): # Parameters are the two strings and their lengths if lx == 0 or ly == 0: return 0 if X[lx - 1] == Y[ly - 1]: return LCSlength(X, Y, lx - 1, ly - 1) + 1 return max(LCSlength(X, Y, lx - 1, ly), LCSlength(X, Y, lx, ly - 1)) print("Enter the first string : \n") X...
def lc_slength(X, Y, lx, ly): if lx == 0 or ly == 0: return 0 if X[lx - 1] == Y[ly - 1]: return lc_slength(X, Y, lx - 1, ly - 1) + 1 return max(lc_slength(X, Y, lx - 1, ly), lc_slength(X, Y, lx, ly - 1)) print('Enter the first string : \n') x = input() print('Enter the second string: \n') y ...
def areRotations(someString, someSubstring): tempString = 2 * someString return tempString.find(someSubstring, 0, len(tempString)) print(areRotations("AACD", "ACDA")) print(areRotations("AACD", "AADC"))
def are_rotations(someString, someSubstring): temp_string = 2 * someString return tempString.find(someSubstring, 0, len(tempString)) print(are_rotations('AACD', 'ACDA')) print(are_rotations('AACD', 'AADC'))
m= ["qzbw", "qez", ],[ "xgedfibnyuhqsrazlwtpocj", "fxgpoqijdzybletckwaunsr", "pwnqsizrfcbyljexgouatd", "ljtperqsodghnufiycxwabz", ],[ "uk", "kupacjlriv", "dku", "qunk", ],[ "yjnprofmcuhdlawt", "frmhulyncvweatodzjp", "fhadtrcyjzwlnpumo", "hrcutablndyjpfmwo", ],[ "rdclv", "lrvdc", "crldv", "dvrcl", "vrlcd", ],[ "dqrwajpb...
m = (['qzbw', 'qez'], ['xgedfibnyuhqsrazlwtpocj', 'fxgpoqijdzybletckwaunsr', 'pwnqsizrfcbyljexgouatd', 'ljtperqsodghnufiycxwabz'], ['uk', 'kupacjlriv', 'dku', 'qunk'], ['yjnprofmcuhdlawt', 'frmhulyncvweatodzjp', 'fhadtrcyjzwlnpumo', 'hrcutablndyjpfmwo'], ['rdclv', 'lrvdc', 'crldv', 'dvrcl', 'vrlcd'], ['dqrwajpb', 'asrf...
a, b = 1, 2 result = 0 while True: a, b = b, a + b if a >= 4_000_000: break if a % 2 == 0: result += a print(result)
(a, b) = (1, 2) result = 0 while True: (a, b) = (b, a + b) if a >= 4000000: break if a % 2 == 0: result += a print(result)
def draw_1d(line, row): print(("*"*row + "\n")*line) def draw_2d(line, row, simbol): print((simbol*row + "\n")*line) def special_draw_2d(line, row, border, fill): print(border*row) row -= 2 line -= 2 i = line while i > 0: print(border + fill*row + border) i -= 1 print(...
def draw_1d(line, row): print(('*' * row + '\n') * line) def draw_2d(line, row, simbol): print((simbol * row + '\n') * line) def special_draw_2d(line, row, border, fill): print(border * row) row -= 2 line -= 2 i = line while i > 0: print(border + fill * row + border) i -= 1...
#!/usr/bin/env python # encoding: utf-8 # @author: Zhipeng Ye # @contact: Zhipeng.ye19@xjtlu.edu.cn # @file: implementstrstr.py # @time: 2020-02-22 16:27 # @desc: class Solution: def strStr(self, haystack, needle): if len(needle) == 0: return 0 haystack_length = len(haystack) ...
class Solution: def str_str(self, haystack, needle): if len(needle) == 0: return 0 haystack_length = len(haystack) needle_length = len(needle) if needle_length > haystack_length: return -1 index = -1 for i in range(haystack_length): ...
# Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'shard', 'type': 'static_library', 'msvs_shard': 4, 'sources': [ 'hello1.cc', 'hello2....
{'targets': [{'target_name': 'shard', 'type': 'static_library', 'msvs_shard': 4, 'sources': ['hello1.cc', 'hello2.cc', 'hello3.cc', 'hello4.cc'], 'product_dir': '<(PRODUCT_DIR)'}, {'target_name': 'refs_to_shard', 'type': 'executable', 'dependencies': ['shard'], 'sources': ['hello.cc']}]}
#-*- coding: utf-8 -*- BASE = { # can be overriden by a configuration file 'SOA_MNAME': 'polaris.example.com.', 'SOA_RNAME': 'hostmaster.polaris.example.com.', 'SOA_SERIAL': 1, 'SOA_REFRESH': 3600, 'SOA_RETRY': 600, 'SOA_EXPIRE': 86400, 'SOA_MINIMUM': 1, 'SOA_TTL': 86400, 'SHAR...
base = {'SOA_MNAME': 'polaris.example.com.', 'SOA_RNAME': 'hostmaster.polaris.example.com.', 'SOA_SERIAL': 1, 'SOA_REFRESH': 3600, 'SOA_RETRY': 600, 'SOA_EXPIRE': 86400, 'SOA_MINIMUM': 1, 'SOA_TTL': 86400, 'SHARED_MEM_HOSTNAME': '127.0.0.1', 'SHARED_MEM_STATE_TIMESTAMP_KEY': 'polaris_health:state_timestamp', 'SHARED_ME...
# test_with_pytest.py def test_always_passes(): assert True def test_always_fails(): assert False
def test_always_passes(): assert True def test_always_fails(): assert False
def main(): chars = input() stack = [] for char in chars: if char == '<': # pop from stack if len(stack) != 0: stack.pop() else: stack.append(char) print(''.join(stack)) if __name__ == "__main__": main()
def main(): chars = input() stack = [] for char in chars: if char == '<': if len(stack) != 0: stack.pop() else: stack.append(char) print(''.join(stack)) if __name__ == '__main__': main()
# -*- coding: utf-8 -*- model = { 'en ': 0, 'de ': 1, ' de': 2, 'et ': 3, 'an ': 4, ' he': 5, 'er ': 6, ' va': 7, 'n d': 8, 'van': 9, 'een': 10, 'het': 11, ' ge': 12, 'oor': 13, ' ee': 14, 'der': 15, ' en': 16, 'ij ': 17, 'aar': 18, 'gen': 19, 'te ': 20, 'ver': 21, ' in': 22, ' me': 23, 'aan': ...
model = {'en ': 0, 'de ': 1, ' de': 2, 'et ': 3, 'an ': 4, ' he': 5, 'er ': 6, ' va': 7, 'n d': 8, 'van': 9, 'een': 10, 'het': 11, ' ge': 12, 'oor': 13, ' ee': 14, 'der': 15, ' en': 16, 'ij ': 17, 'aar': 18, 'gen': 19, 'te ': 20, 'ver': 21, ' in': 22, ' me': 23, 'aan': 24, 'den': 25, ' we': 26, 'at ': 27, 'in ': 28, ' ...
class BaseError(Exception): pass class CredentialRequired(BaseError): pass class UnexpectedError(BaseError): pass class Forbidden (BaseError): pass class Not_Found (BaseError): pass class Payment_Required (BaseError): pass class Internal_Server_Error (BaseError): pass class Service_Un...
class Baseerror(Exception): pass class Credentialrequired(BaseError): pass class Unexpectederror(BaseError): pass class Forbidden(BaseError): pass class Not_Found(BaseError): pass class Payment_Required(BaseError): pass class Internal_Server_Error(BaseError): pass class Service_Unavai...
def formula(): a=int(input("Enter a ")) b=int(input("Enter b ")) print((for1(a,b))*(for1(a,b))) print(for1(a,b)) def for1(a,b): return(a+b) formula()
def formula(): a = int(input('Enter a ')) b = int(input('Enter b ')) print(for1(a, b) * for1(a, b)) print(for1(a, b)) def for1(a, b): return a + b formula()
class Solution(object): def insert(self, intervals, working): r = [] s = working[0] e = working[1] for pair in intervals: print(r,s,e,pair) print() cs = pair[0] ce = pair[1] if ce < s: r.append(pair) ...
class Solution(object): def insert(self, intervals, working): r = [] s = working[0] e = working[1] for pair in intervals: print(r, s, e, pair) print() cs = pair[0] ce = pair[1] if ce < s: r.append(pair) ...
#!/bin/zsh def isphonenumber(text): if len(text) != 12: return False for i in range(0, 3): if not text[i].isdecimal(): return False if text[3] != '-': return False for i in range(4, 7): if not text[i].isdecimal(): return False if text[7] != '-...
def isphonenumber(text): if len(text) != 12: return False for i in range(0, 3): if not text[i].isdecimal(): return False if text[3] != '-': return False for i in range(4, 7): if not text[i].isdecimal(): return False if text[7] != '-': r...
class BiggestRectangleEasy: def findArea(self, N): m, n = 0, N/2 for i in xrange(n+1): m = max(m, i*(n-i)) return m
class Biggestrectangleeasy: def find_area(self, N): (m, n) = (0, N / 2) for i in xrange(n + 1): m = max(m, i * (n - i)) return m
class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: l = [] for i in range(1<<len(nums)): subset = [] for j in range(len(nums)): if i & (1<<j): subset.append(nums[j]) l.append(subset) return l
class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: l = [] for i in range(1 << len(nums)): subset = [] for j in range(len(nums)): if i & 1 << j: subset.append(nums[j]) l.append(subset) return l
# VEX Variables class VEXVariable: __slots__ = tuple() def __hash__(self): raise NotImplementedError() def __eq__(self, other): raise NotImplementedError() class VEXMemVar: __slots__ = ('addr', 'size', ) def __init__(self, addr, size): self.addr = addr self.s...
class Vexvariable: __slots__ = tuple() def __hash__(self): raise not_implemented_error() def __eq__(self, other): raise not_implemented_error() class Vexmemvar: __slots__ = ('addr', 'size') def __init__(self, addr, size): self.addr = addr self.size = size def...
''' A script that replaces commas with tabs in a file ''' in_filename = input("Please input the file name:") out_filename = "out_"+in_filename with open(in_filename,"r") as fin: with open(out_filename,"w+") as fout: for line in fin: fout.write(line.replace(',','\t')) print("Output File:",out_...
""" A script that replaces commas with tabs in a file """ in_filename = input('Please input the file name:') out_filename = 'out_' + in_filename with open(in_filename, 'r') as fin: with open(out_filename, 'w+') as fout: for line in fin: fout.write(line.replace(',', '\t')) print('Output File:', o...
class Command: def __init__(self): self.id self.commandName self.commandEmbbeding self.event
class Command: def __init__(self): self.id self.commandName self.commandEmbbeding self.event
def get_input() -> list: with open(f"{__file__.rstrip('code.py')}input.txt") as f: return [l[:-1] for l in f.readlines()] def parse_input(lines: list) -> list: instructions = [] for line in lines: split = line.split(" ") instructions.append([split[0], int(split[1])]) return ins...
def get_input() -> list: with open(f"{__file__.rstrip('code.py')}input.txt") as f: return [l[:-1] for l in f.readlines()] def parse_input(lines: list) -> list: instructions = [] for line in lines: split = line.split(' ') instructions.append([split[0], int(split[1])]) return inst...
with open("files_question4.txt")as main_file: with open("Delhi.txt","w")as file1: with open("Shimla.txt","w") as file2: with open("other.txt","w") as file3: for i in main_file: if "delhi" in i: file1.write(i) elif "Shimla" in i: file2.write(i) else: file3.write(i) main_file.cl...
with open('files_question4.txt') as main_file: with open('Delhi.txt', 'w') as file1: with open('Shimla.txt', 'w') as file2: with open('other.txt', 'w') as file3: for i in main_file: if 'delhi' in i: file1.write(i) el...
def create_new_employee_department(): employee_department = [] emp = ' ' while emp != ' ': emp_department_input = input('Enter employee last name \n') employee_department.append(emp_department_input) return employee_department
def create_new_employee_department(): employee_department = [] emp = ' ' while emp != ' ': emp_department_input = input('Enter employee last name \n') employee_department.append(emp_department_input) return employee_department
# TRANSCRIBE TO MRNA EDABIT SOLUTION: # creating a function to solve the problem. def dna_to_rna(dna): # returning the DNA strand with modifications to make it an RNA strand. return(dna.replace("A", "U") .replace("T", "A") .replace("G", "C") .replace("C", "G"))
def dna_to_rna(dna): return dna.replace('A', 'U').replace('T', 'A').replace('G', 'C').replace('C', 'G')
class Calculator: def add(self, x, y): return x + y def subtract(self, x, y): return x - y def multiply(self, x, y): return x * y def divide(self, x, y): try: return x / y except ZeroDivisionError: print('Invalid operation. Division by 0...
class Calculator: def add(self, x, y): return x + y def subtract(self, x, y): return x - y def multiply(self, x, y): return x * y def divide(self, x, y): try: return x / y except ZeroDivisionError: print('Invalid operation. Division by ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"func": "MLE_01_serving.ipynb", "Class": "MLE_01_serving.ipynb"} modules = ["de__extract.py", "de__transform.py", "de__load.py", "ds__load.py", "ds__prepr...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'func': 'MLE_01_serving.ipynb', 'Class': 'MLE_01_serving.ipynb'} modules = ['de__extract.py', 'de__transform.py', 'de__load.py', 'ds__load.py', 'ds__preprocess.py', 'ds__build_features.py', 'ds__modelling.py', 'ds__validate.py', 'ds__postprocess.py'...
def bisection(f, x0, x1, error=1e-15): if f(x0) * f(x1) > 0: print("No root found.") else: while True: mid = 0.5 * (x0 + x1) if abs(f(mid)) < error: return mid elif f(x0) * f(mid) > 0: x0 = mid else: ...
def bisection(f, x0, x1, error=1e-15): if f(x0) * f(x1) > 0: print('No root found.') else: while True: mid = 0.5 * (x0 + x1) if abs(f(mid)) < error: return mid elif f(x0) * f(mid) > 0: x0 = mid else: ...
# Longest Substring Without Repeating Characters class Solution: def lengthOfLongestSubstring(self, s: str) -> int: window = set() # pointer of sliding window, if find the char in window, then need to move pointer to right to remove all chars until remove this char left =...
class Solution: def length_of_longest_substring(self, s: str) -> int: window = set() left = 0 max_len = 0 cur_len = 0 for ch in s: while ch in window: window.remove(s[left]) left += 1 cur_len -= 1 window...
{ "targets": [ { # OpenSSL has a lot of config options, with some default options # enabling known insecure algorithms. What's a good combinations # of openssl config options? # ./config no-asm no-shared no-ssl2 no-ssl3 no-hw no-zlib no-threads #...
{'targets': [{'target_name': 'openssl', 'type': 'static_library', 'sources': ['1.0.1m/openssl-1.0.1m/crypto/aes/aes_cbc.c', '1.0.1m/openssl-1.0.1m/crypto/aes/aes_cfb.c', '1.0.1m/openssl-1.0.1m/crypto/aes/aes_core.c', '1.0.1m/openssl-1.0.1m/crypto/aes/aes_ctr.c', '1.0.1m/openssl-1.0.1m/crypto/aes/aes_ecb.c', '1.0.1m/ope...
# Copyright 2018 Inria Damien.Saucez@inria.fr # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUT...
k = 4 login = 'login' password = 'password' subnet = '10.0.0.0/8' location = 'nancy' walltime = '1:00' images = {'ovs': 'file:///home/dsaucez/distem-fs-jessie-ovs.tar.gz', 'hadoop-slave': 'file:///home/dsaucez/slave.tgz', 'hadoop-master': 'file:///home/dsaucez/master.tgz'} masters = list() slaves = list() k2 = int(k / ...
class FixedWidthRecord(object): fields = () LEFT = 'ljust' RIGHT = 'rjust' encoding = 'utf-8' lineterminator = '\r\n' def __init__(self): self.data = {} def __setitem__(self, key, value): self.data[key] = value def __getitem__(self, key): return self.data[key...
class Fixedwidthrecord(object): fields = () left = 'ljust' right = 'rjust' encoding = 'utf-8' lineterminator = '\r\n' def __init__(self): self.data = {} def __setitem__(self, key, value): self.data[key] = value def __getitem__(self, key): return self.data[key] ...
month = input() nights = int(input()) total_price_apartment = 0 total_price_studio = 0 discount_studio = 0 discount_apartment = 0 if month == 'May' or month == 'October': total_price_studio = nights * 50 total_price_apartment = nights * 65 if nights > 14: discount_studio = 0.30 ...
month = input() nights = int(input()) total_price_apartment = 0 total_price_studio = 0 discount_studio = 0 discount_apartment = 0 if month == 'May' or month == 'October': total_price_studio = nights * 50 total_price_apartment = nights * 65 if nights > 14: discount_studio = 0.3 elif nights > 7: ...
price_history_2015="$413,268 $371,473 $336,311 $239,010 $227,809 $398,996 $403,729 $353,405 $220,980 $203,186 $459,297 $461,085 $1,078,036 $551,382 $503,344 $364,826 $399,342 $430,636 $644,972 $554,170 $275,601 $849,539 $396,181 $410,221 $381,013 $272,015 $457,796 $472,744 $229,586 $217,508 $287,573 $284,288 $266,932 $...
price_history_2015 = '$413,268 $371,473 $336,311 $239,010 $227,809 $398,996 $403,729 $353,405 $220,980 $203,186 $459,297 $461,085 $1,078,036 $551,382 $503,344 $364,826 $399,342 $430,636 $644,972 $554,170 $275,601 $849,539 $396,181 $410,221 $381,013 $272,015 $457,796 $472,744 $229,586 $217,508 $287,573 $284,288 $266,932...
def main(): n = int(input()) a = list(map(int, input().split())) minValue = 10 ** 9 maxValue = - (10 ** 9) for i in range(n): if a[i] > maxValue: maxValue = a[i] if a[i] < minValue: minValue = a[i] print(maxValue - minValue) if __name__=="__mai...
def main(): n = int(input()) a = list(map(int, input().split())) min_value = 10 ** 9 max_value = -10 ** 9 for i in range(n): if a[i] > maxValue: max_value = a[i] if a[i] < minValue: min_value = a[i] print(maxValue - minValue) if __name__ == '__main__': ...
# WEIGHING THE STONES for _ in range(int(input())): N = int(input()) DictR = {} DictA = {} Rupam = [int(a) for a in input().split()] Ankit = [int(a) for a in input().split()] for i in range(N): DictR[Rupam[i]] = Rupam.count(Rupam[i]) DictA[Ankit[i]] = Ankit.count(Ankit[i]) #...
for _ in range(int(input())): n = int(input()) dict_r = {} dict_a = {} rupam = [int(a) for a in input().split()] ankit = [int(a) for a in input().split()] for i in range(N): DictR[Rupam[i]] = Rupam.count(Rupam[i]) DictA[Ankit[i]] = Ankit.count(Ankit[i]) maxr = r = 0 maxa ...
def formatacao_real(numero: float) -> str: return f"R${numero:,.2f}"
def formatacao_real(numero: float) -> str: return f'R${numero:,.2f}'
class NullMailerErrorPool(Exception): pass class NullMailerErrorPipe(Exception): pass class NullMailerErrorQueue(Exception): pass class RabbitMQError(Exception): pass
class Nullmailererrorpool(Exception): pass class Nullmailererrorpipe(Exception): pass class Nullmailererrorqueue(Exception): pass class Rabbitmqerror(Exception): pass
class State: def __init__(self, charge, time_of_day, day_of_year, rounds_remaining, cost): self.battery = Battery(charge) self.time_of_day = time_of_day self.day_of_year = day_of_year self.rounds_remaining = rounds_remaining self.cost = cost class Battery: def __init__(s...
class State: def __init__(self, charge, time_of_day, day_of_year, rounds_remaining, cost): self.battery = battery(charge) self.time_of_day = time_of_day self.day_of_year = day_of_year self.rounds_remaining = rounds_remaining self.cost = cost class Battery: def __init__...
def encontra_impares(lista): x = [] if len(lista) > 0: n = lista.pop(0) if n % 2 != 0: x.append(n) x = x + encontra_impares(lista) return x if __name__=='__main__': print (encontra_impares([1,2,3,4,5,5]))
def encontra_impares(lista): x = [] if len(lista) > 0: n = lista.pop(0) if n % 2 != 0: x.append(n) x = x + encontra_impares(lista) return x if __name__ == '__main__': print(encontra_impares([1, 2, 3, 4, 5, 5]))
seat_ids = [] def binary_partition(start, end, identifier, lower_id, upper_id): if start == end: return start half_range = int((end - start + 1) / 2) if identifier[0] == lower_id: new_start = start new_end = end - half_range elif identifier[0] == upper_id: new_start =...
seat_ids = [] def binary_partition(start, end, identifier, lower_id, upper_id): if start == end: return start half_range = int((end - start + 1) / 2) if identifier[0] == lower_id: new_start = start new_end = end - half_range elif identifier[0] == upper_id: new_start = st...
def skyhook_calculator(upper_vel,delta_vel): Cmax = 4000 Cmin = 300 epsilon = 0.0001 alpha = 0.5 sat_limit = 800 if upper_vel * delta_vel >= 0: C = (alpha * Cmax * upper_vel + (1 - alpha) * Cmax * upper_vel)/(delta_vel + epsilon) C = min(C,Cmax) u = C * del...
def skyhook_calculator(upper_vel, delta_vel): cmax = 4000 cmin = 300 epsilon = 0.0001 alpha = 0.5 sat_limit = 800 if upper_vel * delta_vel >= 0: c = (alpha * Cmax * upper_vel + (1 - alpha) * Cmax * upper_vel) / (delta_vel + epsilon) c = min(C, Cmax) u = C * delta_vel ...
def printmove(fr,to): print("Moved from " + str(fr)+" to "+str(to)) def TowerOfHanoi(n,fr,to,spare): if n==1: printmove(fr,to) else: TowerOfHanoi(n-1,fr,spare,to) TowerOfHanoi(1,fr,to,spare) TowerOfHanoi(n-1,spare,to,fr) TowerOfHanoi(int(input("Enter the number of rings in the source peg\n")),'A','B','C')
def printmove(fr, to): print('Moved from ' + str(fr) + ' to ' + str(to)) def tower_of_hanoi(n, fr, to, spare): if n == 1: printmove(fr, to) else: tower_of_hanoi(n - 1, fr, spare, to) tower_of_hanoi(1, fr, to, spare) tower_of_hanoi(n - 1, spare, to, fr) tower_of_hanoi(int(inp...
# Enter your code here. Read input from STDIN. Print output to STDOUT n = input() a = set(raw_input().strip().split(" ")) m = input() b = set(raw_input().strip().split(" ")) print(len(a.intersection(b)))
n = input() a = set(raw_input().strip().split(' ')) m = input() b = set(raw_input().strip().split(' ')) print(len(a.intersection(b)))
# how to copy a list months = ['jan', 'feb', 'march', 'apr', 'may'] months_copy = months[:] print(months_copy) print(months)
months = ['jan', 'feb', 'march', 'apr', 'may'] months_copy = months[:] print(months_copy) print(months)
data = ( 'nzup', # 0x00 'nzurx', # 0x01 'nzur', # 0x02 'nzyt', # 0x03 'nzyx', # 0x04 'nzy', # 0x05 'nzyp', # 0x06 'nzyrx', # 0x07 'nzyr', # 0x08 'sit', # 0x09 'six', # 0x0a 'si', # 0x0b 'sip', # 0x0c 'siex', # 0x0d 'sie', # 0x0e 'siep', # 0x0f 'sat', # 0x10 'sax', #...
data = ('nzup', 'nzurx', 'nzur', 'nzyt', 'nzyx', 'nzy', 'nzyp', 'nzyrx', 'nzyr', 'sit', 'six', 'si', 'sip', 'siex', 'sie', 'siep', 'sat', 'sax', 'sa', 'sap', 'suox', 'suo', 'suop', 'sot', 'sox', 'so', 'sop', 'sex', 'se', 'sep', 'sut', 'sux', 'su', 'sup', 'surx', 'sur', 'syt', 'syx', 'sy', 'syp', 'syrx', 'syr', 'ssit', ...
''' import requests import copy host = "http://172.30.1.8" uri = "/changeuser.ghp" org_headers = { "User-Agent": "Mozilla/4.0", "Host": host.split("://")[1], "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-us", "Accept-Encoding": "gzip, deflate",...
""" import requests import copy host = "http://172.30.1.8" uri = "/changeuser.ghp" org_headers = { "User-Agent": "Mozilla/4.0", "Host": host.split("://")[1], "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-us", "Accept-Encoding": "gzip, deflate",...
def create_matrix(rows): matrix = [[int(x) for x in input().split()] for _ in range(rows)] return matrix def valid_cell(row, col, size): return 0 <= row < size and 0 <= col < size def print_matrix(matrix): [print(' '.join([str(x) for x in row])) for row in matrix] # did this for the sake of using c...
def create_matrix(rows): matrix = [[int(x) for x in input().split()] for _ in range(rows)] return matrix def valid_cell(row, col, size): return 0 <= row < size and 0 <= col < size def print_matrix(matrix): [print(' '.join([str(x) for x in row])) for row in matrix] rows = int(input()) matrix = create_m...
#Leia uma temperatura em graus Celsius e apresente-a convertida em Kelvin. # A formula da conversao eh: K=C+273.15, # sendo K a temperatura em Kelvin e c a temperatura em celsius. C=float(input("Informe a temperatura em Celsius: ")) K=C+273.15 print(f"A temperatura em Kelvin eh {round(K,1)}")
c = float(input('Informe a temperatura em Celsius: ')) k = C + 273.15 print(f'A temperatura em Kelvin eh {round(K, 1)}')
def operate(operator, *args): result = 1 for x in args: if operator == "+": return sum(args) elif operator == "*": result *= x elif operator == "/": result /= x return result print(operate("+", 1, 2, 3)) print(operate("*", 3, 4)) print(operate("/"...
def operate(operator, *args): result = 1 for x in args: if operator == '+': return sum(args) elif operator == '*': result *= x elif operator == '/': result /= x return result print(operate('+', 1, 2, 3)) print(operate('*', 3, 4)) print(operate('/',...
class MonoBasicPackage (GitHubTarballPackage): def __init__(self): GitHubTarballPackage.__init__(self, 'mono', 'mono-basic', '4.8', 'e31cb702937a0adcc853250a0989c5f43565f9b8', configure='./configure --prefix="%{staged_profile}"') def install(self): self.s...
class Monobasicpackage(GitHubTarballPackage): def __init__(self): GitHubTarballPackage.__init__(self, 'mono', 'mono-basic', '4.8', 'e31cb702937a0adcc853250a0989c5f43565f9b8', configure='./configure --prefix="%{staged_profile}"') def install(self): self.sh('./configure --prefix="%{staged_prefix...
# We start our program by informing the user that this program is for a calculator. print("Welcome to the calculator program!") # Our program will run until the user chooses to exit, so we define a variable to # hold the text that a user must enter to exit the program. Since we intend that # this variable be constant ...
print('Welcome to the calculator program!') exit_user_input_option = 'EXIT' print('Enter ' + EXIT_USER_INPUT_OPTION + ' after a calculation to end program.') user_input_after_calculation = '' while EXIT_USER_INPUT_OPTION != user_input_after_calculation: first_number = int(input('Enter first number: ')) second_n...
# Copyright 2020 Keren Ye, University of Pittsburgh # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
class Groundingtuple(object): entity_proposal_id = None entity_proposal_box = None entity_proposal_score = None entity_proposal_feature = None class Detectiontuple(object): valid_detections = None nmsed_proposal_id = None nmsed_boxes = None nmsed_scores = None nmsed_classes = None ...
################################################## ## ## Auto generate the simple WAT unit tests for ## wrap, trunc, extend, convert, demote, promote ## and reinterpret operators. ## ################################################## tyi32 = "i32"; tyi64 = "i64"; tyf32 = "f32"; tyf64 = "f64"; tests =...
tyi32 = 'i32' tyi64 = 'i64' tyf32 = 'f32' tyf64 = 'f64' tests = ['i32_wrap_i64 ', 'i32_trunc_f32_s ', 'i32_trunc_f32_u ', 'i32_trunc_f64_s ', 'i32_trunc_f64_u ', 'i64_extend_i32_s ', 'i64_extend_i32_u ', 'i64_trunc_f32_s ', 'i64_trunc_f32_u ', 'i64_trunc_f64_s ', 'i64_trunc_f64_u ', 'f...
# M0_C5 - Mean, Median def mean(scores): # Write your code here return "not implemented" def median(scores): # Write your code here return "not implemented" if __name__ == '__main__': scores = input("Input list of test scores, space-separated: ") scores_list = [int(i) for i in scores.split()]...
def mean(scores): return 'not implemented' def median(scores): return 'not implemented' if __name__ == '__main__': scores = input('Input list of test scores, space-separated: ') scores_list = [int(i) for i in scores.split()] mean = mean(scores_list) median = median(scores_list) print(f'Mean...
entradas = int(input()) def cesar_cifra(frase, deslocamento): frase_codificada = "" for letra in frase: ascii_value = ord(letra)-deslocamento if ascii_value < 65: ascii_value = 91 - (65-ascii_value) frase_codificada += chr(ascii_value) return frase_codificada for i in...
entradas = int(input()) def cesar_cifra(frase, deslocamento): frase_codificada = '' for letra in frase: ascii_value = ord(letra) - deslocamento if ascii_value < 65: ascii_value = 91 - (65 - ascii_value) frase_codificada += chr(ascii_value) return frase_codificada for i i...
all_cells = input().split("#") water = int(input()) effort = 0 fire = 0 cells_value = [] total_fire = 0 for cell in all_cells: current_cell = cell.split(" = ") type_of_fire = current_cell[0] cell_value = int(current_cell[1]) if type_of_fire == "High": if not 81 <= cell_value <= 125:...
all_cells = input().split('#') water = int(input()) effort = 0 fire = 0 cells_value = [] total_fire = 0 for cell in all_cells: current_cell = cell.split(' = ') type_of_fire = current_cell[0] cell_value = int(current_cell[1]) if type_of_fire == 'High': if not 81 <= cell_value <= 125: ...
class NextcloudRequestException(Exception): def __init__(self, request=None, message=None): self.request = request message = message or f"Error {request.status_code}: {request.get_error_message()}" super().__init__(message) class NextcloudDoesNotExist(NextcloudRequest...
class Nextcloudrequestexception(Exception): def __init__(self, request=None, message=None): self.request = request message = message or f'Error {request.status_code}: {request.get_error_message()}' super().__init__(message) class Nextclouddoesnotexist(NextcloudRequestException): pass ...
def generate_game_stats(sheets): games = 0 wins = [0, 0, 0] #Re, Contra, Tie for sheet in sheets: for row_int in range(1, len(sheet)): row = sheet[row_int] # print(row) if len(row) == 5: games += 1 if int(row[4]) >= 1: ...
def generate_game_stats(sheets): games = 0 wins = [0, 0, 0] for sheet in sheets: for row_int in range(1, len(sheet)): row = sheet[row_int] if len(row) == 5: games += 1 if int(row[4]) >= 1: wins[0] += 1 elif i...
rf_commands = { 'light/off': '2600500000012b9312131337131312131213131213121338133713131238133713131238133713131312133714371337143713121312131214371312131214111411143713371436140005610001294813000d050000000000000000', 'aircon/off': '2600d6007f3d110e112c110f112c110e112c110f112c110e112c110f112c112c110e112c110f112c112c11...
rf_commands = {'light/off': '2600500000012b9312131337131312131213131213121338133713131238133713131238133713131312133714371337143713121312131214371312131214111411143713371436140005610001294813000d050000000000000000', 'aircon/off': '2600d6007f3d110e112c110f112c110e112c110f112c110e112c110f112c112c110e112c110f112c112c112c1...
#L01EX06 topo = int(input()) carta = int(input()) if (topo % 13) == (carta % 13) or carta % 13 == 11: print("True") elif (-12 <= (topo - carta)) and ((topo - carta) <= 12): print("True") else: print("False")
topo = int(input()) carta = int(input()) if topo % 13 == carta % 13 or carta % 13 == 11: print('True') elif -12 <= topo - carta and topo - carta <= 12: print('True') else: print('False')
testcases = int(input()) for _ in range(0, testcases): pc, pr = list(map(int, input().split())) nnm_of_9_pc = pc if pc % 9 == 0 else pc + 9 - (pc % 9) nnm_of_9_pr = pr if pr % 9 == 0 else pr + 9 - (pr % 9) digits_pc = nnm_of_9_pc // 9 digits_pr = nnm_of_9_pr // 9 who_wins = '1' if digits_pc...
testcases = int(input()) for _ in range(0, testcases): (pc, pr) = list(map(int, input().split())) nnm_of_9_pc = pc if pc % 9 == 0 else pc + 9 - pc % 9 nnm_of_9_pr = pr if pr % 9 == 0 else pr + 9 - pr % 9 digits_pc = nnm_of_9_pc // 9 digits_pr = nnm_of_9_pr // 9 who_wins = '1' if digits_pc >= dig...
elements = { 'login_page': { 'input_email': '//*[@id="ap_email"]', 'btn_continue': '//*[@id="continue"]', 'input_password': '//*[@id="ap_password"]', 'btn_login': '//*[@id="signInSubmit"]' }, 'header_confirm': '/html/body/div[1]/header/div/div[1]/div[3]/div/a[1]/div/span', ...
elements = {'login_page': {'input_email': '//*[@id="ap_email"]', 'btn_continue': '//*[@id="continue"]', 'input_password': '//*[@id="ap_password"]', 'btn_login': '//*[@id="signInSubmit"]'}, 'header_confirm': '/html/body/div[1]/header/div/div[1]/div[3]/div/a[1]/div/span', 'bnt_buy_one_click': '/html/body/div[1]/div[2]/di...
valor_real = float(input("\033[1;30mDigite o valor na carteira?\033[m \033[1;32mR$\033[m")) dolares = valor_real / 3.27 print("\033[1;37mO valor\033[m \033[1;32mR$: {0:.2f} reais\033[m \033[1;37mpode comprar\033[m \033[1;32mUSD$: {1:.2f} dolares\033[m \033[1;37m!\033[m".format(valor_real, dolares))
valor_real = float(input('\x1b[1;30mDigite o valor na carteira?\x1b[m \x1b[1;32mR$\x1b[m')) dolares = valor_real / 3.27 print('\x1b[1;37mO valor\x1b[m \x1b[1;32mR$: {0:.2f} reais\x1b[m \x1b[1;37mpode comprar\x1b[m \x1b[1;32mUSD$: {1:.2f} dolares\x1b[m \x1b[1;37m!\x1b[m'.format(valor_real, dolares))
class Node: def __init__(self,val=None,nxt=None,prev=None): self.val = val self.nxt = nxt self.prev = prev class LL: def __init__(self): self.head = Node() self.tail = Node() self.head.nxt = self.tail self.tail.prev = self.head def find(s...
class Node: def __init__(self, val=None, nxt=None, prev=None): self.val = val self.nxt = nxt self.prev = prev class Ll: def __init__(self): self.head = node() self.tail = node() self.head.nxt = self.tail self.tail.prev = self.head def find(self, va...
p1 = 0.49 p2 = 0.38 p3 = 0.1 p4 = 0.03 p = p1 * p1 + p1 * p2 + p1 * p3 + p1 * p4 + p2 * p2 + p2 * p4 + p3 * p3 + p3 * p4 + p4 * p4 print(p) print(10 * 0.2 * 0.8 ** 9)
p1 = 0.49 p2 = 0.38 p3 = 0.1 p4 = 0.03 p = p1 * p1 + p1 * p2 + p1 * p3 + p1 * p4 + p2 * p2 + p2 * p4 + p3 * p3 + p3 * p4 + p4 * p4 print(p) print(10 * 0.2 * 0.8 ** 9)
class Developer: DUNDY = 321730481903370240 ADM = 600443374587346989 TEMPLAR = 108281077319077888 GHOSTRIDER = 846009958062358548
class Developer: dundy = 321730481903370240 adm = 600443374587346989 templar = 108281077319077888 ghostrider = 846009958062358548
def computeParameterValue(sources): mapping = {} for idx, source in enumerate(sources): for kv in source: k, v = kv.split(":") mapping[k] = v results = [] for key in mapping: results.append(mapping[key]) return results
def compute_parameter_value(sources): mapping = {} for (idx, source) in enumerate(sources): for kv in source: (k, v) = kv.split(':') mapping[k] = v results = [] for key in mapping: results.append(mapping[key]) return results