content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# https://codeforces.com/problemset/problem/96/A teams = input() + "-" count = 0 isOnes = True if teams[0] == "1" else False isDangerous = False for player in teams: if count == 7: isDangerous = True break if player == "1": if not(isOnes): count = 0 ...
teams = input() + '-' count = 0 is_ones = True if teams[0] == '1' else False is_dangerous = False for player in teams: if count == 7: is_dangerous = True break if player == '1': if not isOnes: count = 0 is_ones = True count += 1 elif player == '0': ...
def try_or_default(default_value, func): def wrap(*args, **kwargs): try: return func(*args, **kwargs) except: return default_value return wrap def try_or_false(func): return try_or_default(False, func) def try_or_true(func): return try_or_default(True, func)
def try_or_default(default_value, func): def wrap(*args, **kwargs): try: return func(*args, **kwargs) except: return default_value return wrap def try_or_false(func): return try_or_default(False, func) def try_or_true(func): return try_or_default(True, func)
{ 'variables': { 'target_arch': 'ia32', 'VERSION_FULL': '<!(python tools/version.py)', 'VERSION_MAJOR': '<!(python tools/version.py major)', 'VERSION_MINOR': '<!(python tools/version.py minor)', 'VERSION_PATCH': '<!(python tools/version.py patch)', 'VERSION_RELEASE': '<!(python tools/version.p...
{'variables': {'target_arch': 'ia32', 'VERSION_FULL': '<!(python tools/version.py)', 'VERSION_MAJOR': '<!(python tools/version.py major)', 'VERSION_MINOR': '<!(python tools/version.py minor)', 'VERSION_PATCH': '<!(python tools/version.py patch)', 'VERSION_RELEASE': '<!(python tools/version.py release)'}, 'targets': [{'...
class StorageResult: def __init__(self, result=None): if result is None: self.total = 0 self._hits = [] self.chunk = 0 else: self.total = result['hits']['total']['value'] self._hits = result['hits']['hits'] self.chunk = len(self...
class Storageresult: def __init__(self, result=None): if result is None: self.total = 0 self._hits = [] self.chunk = 0 else: self.total = result['hits']['total']['value'] self._hits = result['hits']['hits'] self.chunk = len(sel...
class Sortness: def getSortness(self, a): s = 0.0 for i, e in enumerate(a): s += len(filter(lambda j: j > e, a[:i])) s += len(filter(lambda j: j < e, a[i+1:])) return s / len(a)
class Sortness: def get_sortness(self, a): s = 0.0 for (i, e) in enumerate(a): s += len(filter(lambda j: j > e, a[:i])) s += len(filter(lambda j: j < e, a[i + 1:])) return s / len(a)
# This code has to be added to the corresponding __init__.py DRIVERS["lis3dh"] = ["LIS3DH"]
DRIVERS['lis3dh'] = ['LIS3DH']
def hello(name): return 'Hello, {}.'.format(name) def test_hello(): assert 'Hello, Fred.' == hello('Fred') if __name__ == '__main__': print(hello('Taro'))
def hello(name): return 'Hello, {}.'.format(name) def test_hello(): assert 'Hello, Fred.' == hello('Fred') if __name__ == '__main__': print(hello('Taro'))
# -*- coding: utf-8 -*- INSTALLED_APPS += ("ags2sld",) DATA_UPLOAD_MAX_MEMORY_SIZE = 1073741824 FILE_UPLOAD_MAX_MEMORY_SIZE = 1073741824 # maximum file upload 1GB
installed_apps += ('ags2sld',) data_upload_max_memory_size = 1073741824 file_upload_max_memory_size = 1073741824
h,m=map(int,input().split());m+=60*h-45 if m<0: m+=24*60 print(m//60,m%60)
(h, m) = map(int, input().split()) m += 60 * h - 45 if m < 0: m += 24 * 60 print(m // 60, m % 60)
## func def make_withdrawal(balance): def inner(withdraw): balance -= withdraw if balance <0: print("Error: withdraw amount is more than initial balance") else: return balance return inner ## Explain print("updating the balance inner function doesn't work. In the inner function block, variable balance's...
def make_withdrawal(balance): def inner(withdraw): balance -= withdraw if balance < 0: print('Error: withdraw amount is more than initial balance') else: return balance return inner print("updating the balance inner function doesn't work. In the inner function bl...
class LinkedListMode: def __init__(self, value): self.vale = value self.next = None def reverse(head_of_list): current = head_of_list previous = None next = None # until we have 'fallen off' the end of the list while current: # copy a pointer to the next element ...
class Linkedlistmode: def __init__(self, value): self.vale = value self.next = None def reverse(head_of_list): current = head_of_list previous = None next = None while current: next = current.next current.next = previous previous = current current = ...
# # @lc app=leetcode id=657 lang=python3 # # [657] Robot Return to Origin # # https://leetcode.com/problems/robot-return-to-origin/description/ # # algorithms # Easy (74.23%) # Total Accepted: 288.7K # Total Submissions: 388.7K # Testcase Example: '"UD"' # # There is a robot starting at position (0, 0), the origin,...
class Solution: def judge_circle(self, moves: str) -> bool: num_l = 0 num_r = 0 num_u = 0 num_d = 0 for s in moves: if s == 'L': num_l += 1 elif s == 'U': num_u += 1 elif s == 'R': num_r += 1...
def insertion_sort(arr): length = len(arr) for i in range(1, length): #Move elements of arr[0..i-1], that are # greater than key, to one position ahead # of their current position key = arr[i] j=i-1 while( j>=0 and arr[j]>key): arr[j+1] = arr[j] ...
def insertion_sort(arr): length = len(arr) for i in range(1, length): key = arr[i] j = i - 1 while j >= 0 and arr[j] > key: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = key return arr
task_dataset = "entry-small-1" # number of individuals for each population population_size = 40 # number of generations (rounds) generations = 1000 exitAfter = 250 # for controlling the time scheduling, in minutes block_size = 10 # in minutes (less than or equal 1 hour) # define the parents selection method for cro...
task_dataset = 'entry-small-1' population_size = 40 generations = 1000 exit_after = 250 block_size = 10 select_parents_method = 'roulette' mutation_rate = 5 use_pace = False use_pace_width = True pace_method = 1 use_employee_wage = True use_equipment_cost = True auto_adjust = True
class Solution: def gen(self, nums, target): for i, A in enumerate(nums, 0): for k, B in enumerate(nums[i + 1:], i + 1): if target - A == B: yield list((i, k)) def twoSum(self, nums: List[int], target: int) -> List[int]: for a ...
class Solution: def gen(self, nums, target): for (i, a) in enumerate(nums, 0): for (k, b) in enumerate(nums[i + 1:], i + 1): if target - A == B: yield list((i, k)) def two_sum(self, nums: List[int], target: int) -> List[int]: for a in self.gen(nu...
class Solution: def fib(self, n: int) -> int: if (n == 0): return 0 if (n == 1): return 1 last = 1 lastlast = 0 for i in range(n-1): tmp = last last += lastlast lastlast = tmp return last
class Solution: def fib(self, n: int) -> int: if n == 0: return 0 if n == 1: return 1 last = 1 lastlast = 0 for i in range(n - 1): tmp = last last += lastlast lastlast = tmp return last
# heuristic monster types lists ONLY_RANGED_SLOW_MONSTERS = ['floating eye', 'blue jelly', 'brown mold', 'gas spore', 'acid blob'] EXPLODING_MONSTERS = ['yellow light', 'gas spore', 'flaming sphere', 'freezing sphere', 'shocking sphere'] INSECTS = ['giant ant', 'killer bee', 'soldier ant', 'fire ant', 'giant beetle', '...
only_ranged_slow_monsters = ['floating eye', 'blue jelly', 'brown mold', 'gas spore', 'acid blob'] exploding_monsters = ['yellow light', 'gas spore', 'flaming sphere', 'freezing sphere', 'shocking sphere'] insects = ['giant ant', 'killer bee', 'soldier ant', 'fire ant', 'giant beetle', 'queen bee'] weak_monsters = ['li...
class A: def __init__(self,a): self.a = a a=A(1) b=A(2) c=A(3) abc = [a,b,c] for i in abc[1:]: if i.a>2: i.a=0 abc.remove(i) for i in abc: print(i.a)
class A: def __init__(self, a): self.a = a a = a(1) b = a(2) c = a(3) abc = [a, b, c] for i in abc[1:]: if i.a > 2: i.a = 0 abc.remove(i) for i in abc: print(i.a)
# -*- coding: utf-8 -*- class TracimError(Exception): pass class RunTimeError(TracimError): pass class ContentRevisionUpdateError(RuntimeError): pass class ContentRevisionDeleteError(ContentRevisionUpdateError): pass class ConfigurationError(TracimError): pass class AlreadyExistError(Tra...
class Tracimerror(Exception): pass class Runtimeerror(TracimError): pass class Contentrevisionupdateerror(RuntimeError): pass class Contentrevisiondeleteerror(ContentRevisionUpdateError): pass class Configurationerror(TracimError): pass class Alreadyexisterror(TracimError): pass class Comm...
# Video - https://youtu.be/PmW8NfctNpk def sum_of_digits(n): n = abs(n) digits = [] char_digits = list(str(n)) for char_digit in char_digits: digits.append(int(char_digit)) return sum(digits) tests = [ (1325132435356, 43), (123, 6), (6, 6), (-10, 1) ] for n, expected in...
def sum_of_digits(n): n = abs(n) digits = [] char_digits = list(str(n)) for char_digit in char_digits: digits.append(int(char_digit)) return sum(digits) tests = [(1325132435356, 43), (123, 6), (6, 6), (-10, 1)] for (n, expected) in tests: result = sum_of_digits(n) print(result == exp...
class Get: def __init__(self,db): self.db = db def _get(self,key): try: return JsonObject(self.db, key, self.db[key]) except Exception as e: raise ValueError(f"No Key named {key} found.") def __call__(self,key): return self._get(key) class JsonObject(type({})): def __init__(self, db, key=N...
class Get: def __init__(self, db): self.db = db def _get(self, key): try: return json_object(self.db, key, self.db[key]) except Exception as e: raise value_error(f'No Key named {key} found.') def __call__(self, key): return self._get(key) class Jso...
#Ensure there is an exceptional edge from the following case def f2(): b, d = Base, Derived try: class MyNewClass(b, d): pass except: e2 def f3(): sequence_of_four = a_global try: a, b, c = sequence_of_four except: e3 #Always treat locals as no...
def f2(): (b, d) = (Base, Derived) try: class Mynewclass(b, d): pass except: e2 def f3(): sequence_of_four = a_global try: (a, b, c) = sequence_of_four except: e3 def f4(): if cond: local = 1 try: local except: e4...
for _ in range(int(input())): l,r,m=map(int,input().split()) ma=r-l for i in range(l,r+1): temp=m%i if temp<=ma and i<=m: print(i,l+temp,l) break elif i-temp<=ma: print(i,l,l+i-temp) break
for _ in range(int(input())): (l, r, m) = map(int, input().split()) ma = r - l for i in range(l, r + 1): temp = m % i if temp <= ma and i <= m: print(i, l + temp, l) break elif i - temp <= ma: print(i, l, l + i - temp) break
MOVING = "moving" SLEEPING = "sleeping" jobs: dict[str, str] = { "mine_foo": "Mining Foo", "mine_bar": "Mining Bar", "build_foobar": "Trying to build a Foobar", "sell_foobar": "Selling Foobar", "buy_robot": "Buying a robot", MOVING: "Moving", SLEEPING: "Sleeping", }
moving = 'moving' sleeping = 'sleeping' jobs: dict[str, str] = {'mine_foo': 'Mining Foo', 'mine_bar': 'Mining Bar', 'build_foobar': 'Trying to build a Foobar', 'sell_foobar': 'Selling Foobar', 'buy_robot': 'Buying a robot', MOVING: 'Moving', SLEEPING: 'Sleeping'}
#!/usr/bin/python3 hostname = input("What value should we set for hostname?") #hostname = "MTG" hostname = hostname.upper() if hostname == "MTG": print("The hostname was found to be mtg")
hostname = input('What value should we set for hostname?') hostname = hostname.upper() if hostname == 'MTG': print('The hostname was found to be mtg')
class EVBaseException(Exception): def __init__(self, msg): super(EVBaseException, self).__init__(msg) self._msg = msg # Exception.__init__(self, msg) def __str__(self): return self._msg class EVConnectionError(EVBaseException): def __init__(self, msg, exc_obj): supe...
class Evbaseexception(Exception): def __init__(self, msg): super(EVBaseException, self).__init__(msg) self._msg = msg def __str__(self): return self._msg class Evconnectionerror(EVBaseException): def __init__(self, msg, exc_obj): super(EVConnectionError, self).__init__(ms...
''' Author: Yurii Bielotsytsia Version: Easy-01 Name: Ideal BMI by Brok formula ''' sex = input('Enter you sex(m if you are a man, w if you are a woman): ') height = float(input('Enter you height in cm ')) if(sex == 'm'): result=(((height*4/2.54)-128)*0.453) print('You ideal BMI is {0:.2f}'.format(resu...
""" Author: Yurii Bielotsytsia Version: Easy-01 Name: Ideal BMI by Brok formula """ sex = input('Enter you sex(m if you are a man, w if you are a woman): ') height = float(input('Enter you height in cm ')) if sex == 'm': result = (height * 4 / 2.54 - 128) * 0.453 print('You ideal BMI is {0:.2f}'.format(result))...
# # PySNMP MIB module SW-PROJECTX-SRPRIMGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SW-PROJECTX-SRPRIMGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:46:16 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
material_iron = 'iron' material_titanium = 'titanium' material_naonite = 'naonite' material_trinium = 'trinium' material_xanion = 'xanion' material_ogonite = 'ogonite' material_avorion = 'avorion' block_armor = 'armor' block_engine = 'engine' block_cargo = 'cargo' block_quarters = 'quarters' block_thruster = 'thruster...
material_iron = 'iron' material_titanium = 'titanium' material_naonite = 'naonite' material_trinium = 'trinium' material_xanion = 'xanion' material_ogonite = 'ogonite' material_avorion = 'avorion' block_armor = 'armor' block_engine = 'engine' block_cargo = 'cargo' block_quarters = 'quarters' block_thruster = 'thruster'...
def heapify(arr, n, i): largest = i l = 2*n +1 r = 2*n +2 if l<n and arr[largest] < arr[l]: largest = l if r<n and arr[largest] < arr[r]: largest = r if largest != i: arr[largest], arr[i] = arr[i], arr[largest] heapify(arr, n, largest) def hea...
def heapify(arr, n, i): largest = i l = 2 * n + 1 r = 2 * n + 2 if l < n and arr[largest] < arr[l]: largest = l if r < n and arr[largest] < arr[r]: largest = r if largest != i: (arr[largest], arr[i]) = (arr[i], arr[largest]) heapify(arr, n, largest) def heapsort(...
class Solution: def largestRectangleArea(self, heights: List[int]) -> int: n, heights, st, ans = len(heights), [0] + heights + [0], [], 0 for i in range(n + 2): while st and heights[st[-1]] > heights[i]: ans = max(ans, heights[st.pop(-1)] * (i - st[-1] - 1)) s...
class Solution: def largest_rectangle_area(self, heights: List[int]) -> int: (n, heights, st, ans) = (len(heights), [0] + heights + [0], [], 0) for i in range(n + 2): while st and heights[st[-1]] > heights[i]: ans = max(ans, heights[st.pop(-1)] * (i - st[-1] - 1)) ...
f = open("unicode/data/utf-8_1.txt") l = f.readline() print(l) print(len(l))
f = open('unicode/data/utf-8_1.txt') l = f.readline() print(l) print(len(l))
''' *********************************************************************************************************************** * Configuration file for Solar estimation tool * * Created by P.Nezval ...
""" *********************************************************************************************************************** * Configuration file for Solar estimation tool * * Created by P.Nezval ...
kartyak = ['2383 8823 9423 1164'] for kartya in kartyak: kartyaCheck = [] for karakter in kartya: if karakter != ' ': kartyaCheck.append(karakter) print(kartyaCheck) for index, karakter in enumerate(kartyaCheck): if index%2 == 0: double = 2*int(karakter) if double >= 10: ...
kartyak = ['2383 8823 9423 1164'] for kartya in kartyak: kartya_check = [] for karakter in kartya: if karakter != ' ': kartyaCheck.append(karakter) print(kartyaCheck) for (index, karakter) in enumerate(kartyaCheck): if index % 2 == 0: double = 2 * int(karakter) ...
{ 'Datadog': [ 'host:dev-test', 'environment:test' ], 'Users': [ 'role:database' ] }
{'Datadog': ['host:dev-test', 'environment:test'], 'Users': ['role:database']}
# random.seed(1234) # np.random.seed(1234) # torch.manual_seed(1234) # torch.cuda.manual_seed_all(1234) # torch.backends.cudnn.deterministic = True class Transition(object): def __init__( self, FromCluster, ArriveCluster, Vehicle, State, StateQTable, Action, ...
class Transition(object): def __init__(self, FromCluster, ArriveCluster, Vehicle, State, StateQTable, Action, TotallyReward, PositiveReward, NegativeReward, NeighborNegativeReward, State_, State_QTable): self.FromCluster = FromCluster self.ArriveCluster = ArriveCluster self.Vehicle = Vehicl...
''' Part 1: Define a class named Circle which can be constructed by a radius. Compare two circles objects and return True if circles are equal. Return False if circles are not equal Take radius of these circles through Input Expected Input/Output 1: Enter Radius of Circle 1: 2 Enter Radius of circle 2: 4 Output: Fal...
""" Part 1: Define a class named Circle which can be constructed by a radius. Compare two circles objects and return True if circles are equal. Return False if circles are not equal Take radius of these circles through Input Expected Input/Output 1: Enter Radius of Circle 1: 2 Enter Radius of circle 2: 4 Output: Fal...
while True: text = input(">>>") if (text == "python"): break print(text) print("Python is Addictive")
while True: text = input('>>>') if text == 'python': break print(text) print('Python is Addictive')
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"binarize_mask": "00_mask_transform.ipynb", "data_loader": "00_mask_transform.ipynb", "data_saver": "00_mask_transform.ipynb", "outpath_from_inpath": "00_mask_transform.ipynb", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'binarize_mask': '00_mask_transform.ipynb', 'data_loader': '00_mask_transform.ipynb', 'data_saver': '00_mask_transform.ipynb', 'outpath_from_inpath': '00_mask_transform.ipynb', 'check_outpath': '00_mask_transform.ipynb', 'create_outpath': '00_mask_t...
#!/usr/bin/env python3 cfg_overridden_precisions = { # Convolution: output value inaccuracy exceeds threshold for FP16 'vgg16-IR:opid42': ['FP32'], 'vgg16-IR:opid31': ['FP32'], 'yolo-v4-tf:opid227': ['FP32'], # FusedConvolution: output value inaccuracy exceeds threshold for FP16 '3d_unet-grap...
cfg_overridden_precisions = {'vgg16-IR:opid42': ['FP32'], 'vgg16-IR:opid31': ['FP32'], 'yolo-v4-tf:opid227': ['FP32'], '3d_unet-graph-transform-cuda:opid31': ['FP32']}
def count_char(text, char): count = 0 for c in text: if c == char: count += 1 return count filename = input("Enter a filename: ") with open(filename) as f: text = f.read() for char in "abcdefghijklmnopqrstuvwxyz": perc = 100 * count_char(text, char) / len(text) print("{0} - {1}%".format(char, round(perc, 2...
def count_char(text, char): count = 0 for c in text: if c == char: count += 1 return count filename = input('Enter a filename: ') with open(filename) as f: text = f.read() for char in 'abcdefghijklmnopqrstuvwxyz': perc = 100 * count_char(text, char) / len(text) print('{0} - {...
def pytest_addoption(parser): parser.addoption("--runexamples", action="store_true", help="run examples") parser.addoption("--runbenchmarks", action="store_true", help="run benchmarks") parser.addoption("--all", action="store_true", help="run be...
def pytest_addoption(parser): parser.addoption('--runexamples', action='store_true', help='run examples') parser.addoption('--runbenchmarks', action='store_true', help='run benchmarks') parser.addoption('--all', action='store_true', help='run benchmarks')
list1 = [6, 8, 19, 20, 23, 41, 49, 53, 56, 87] def find_max(items): if (len(items) == 1): return items[0] item1 = items[0] print(f"Item1 = {item1}") item2 = find_max(items[1:]) print(f"Item2 = {item2}") if item1 > item2: return item1 else: return item2 print(fin...
list1 = [6, 8, 19, 20, 23, 41, 49, 53, 56, 87] def find_max(items): if len(items) == 1: return items[0] item1 = items[0] print(f'Item1 = {item1}') item2 = find_max(items[1:]) print(f'Item2 = {item2}') if item1 > item2: return item1 else: return item2 print(find_max(l...
class InlineIfThen (Exception): pass
class Inlineifthen(Exception): pass
lines = [] file = "output.txt" with open(file, "r") as default_branch: lines = default_branch.readlines() repos = set(lines) sort_file = file[:-4] + "_sorted" + file[-4:] with open(sort_file, "w") as default_branch: default_branch.writelines(sorted(repos))
lines = [] file = 'output.txt' with open(file, 'r') as default_branch: lines = default_branch.readlines() repos = set(lines) sort_file = file[:-4] + '_sorted' + file[-4:] with open(sort_file, 'w') as default_branch: default_branch.writelines(sorted(repos))
#!/usr/bin/env python3 # Dictionaries are data structures(blueprint for big data, definition template) # used to map key:value pairs. # As if lists were dictionaries with integer keys at range. # Dictionaries can be indexed in the same way as lists, using [] containing keys. # {key:value} can be: {"String":int} {"Stri...
data = {'age': 25, 'car': 'red', 'char1': 'c'} print(data['age']) print(data['car']) print(data['char1']) data['new'] = 'value' print(data) print('new' in data) print(data.get('age')) print(data.get('char2', "Key 'char2' is not in list, que this message")) print(data.get('age') + data.get('age'))
class ConfusionMatrix(object): TP = TN = FP = FN = 0 def __str__(self): return "p\\t\tP\tN\nP\t{}\t{}\nN\t{}\t{}".format(self.TP, self.FP, self.FN, self.TN) def recall(self): return self.TP / float(self.TP + self.FN) def precision(self): return self.TP / floa...
class Confusionmatrix(object): tp = tn = fp = fn = 0 def __str__(self): return 'p\\t\tP\tN\nP\t{}\t{}\nN\t{}\t{}'.format(self.TP, self.FP, self.FN, self.TN) def recall(self): return self.TP / float(self.TP + self.FN) def precision(self): return self.TP / float(self.TP + self.F...
# Example of what a for loop does: nums = [1, 2, 3] i_nums = iter(nums) while True: try: item = next(i_nums) print(item) except StopIteration: break
nums = [1, 2, 3] i_nums = iter(nums) while True: try: item = next(i_nums) print(item) except StopIteration: break
# # PySNMP MIB module CXFrameRelayInterfaceModule-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXFrameRelayInterfaceModule-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:17:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pytho...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) ...
game_board = {'7': ' ', '8': ' ', '9': ' ', '4': ' ', '5': ' ', '6': ' ', '1': ' ', '2': ' ', '3': ' '} disp_board = {'1': '1', '2': '2', '3': '3', '4': '4', '5': '5', '6': '6', '7': '7', '8': '8', '9': '9'} fill_board = [] # for i in the_board: # fill_boar...
game_board = {'7': ' ', '8': ' ', '9': ' ', '4': ' ', '5': ' ', '6': ' ', '1': ' ', '2': ' ', '3': ' '} disp_board = {'1': '1', '2': '2', '3': '3', '4': '4', '5': '5', '6': '6', '7': '7', '8': '8', '9': '9'} fill_board = [] def print_board(board): print(board['1'], ' |', board['2'], '|', board['3']) print('-- ...
# -*- coding: utf-8 -*- DDD = int(input()) dic = { 61: "Brasilia", 71: "Salvador", 11: "Sao Paulo", 21: "Rio de Janeiro", 32: "Juiz de Fora", 19: "Campinas", 27: "Vitoria", 31: "Belo Horizonte" } if (DDD in dic.keys()): print(dic[DDD]) else: print("DDD nao cadastrado")
ddd = int(input()) dic = {61: 'Brasilia', 71: 'Salvador', 11: 'Sao Paulo', 21: 'Rio de Janeiro', 32: 'Juiz de Fora', 19: 'Campinas', 27: 'Vitoria', 31: 'Belo Horizonte'} if DDD in dic.keys(): print(dic[DDD]) else: print('DDD nao cadastrado')
class DBSCAN(object): def __init__(self, eps=0, min_points=2): self.eps = eps self.min_points = min_points self.noise = [] self.clusters = [] self.dp = [] self.near_neighbours = [] self.wp = set() self.proto_cores = set() self.points = [] ...
class Dbscan(object): def __init__(self, eps=0, min_points=2): self.eps = eps self.min_points = min_points self.noise = [] self.clusters = [] self.dp = [] self.near_neighbours = [] self.wp = set() self.proto_cores = set() self.points = [] ...
config_structure = { "default_user" : { "profile": { "description" : None, #string < 1000 "roster" : [], # List of champion dict "roster_ss": [], "alliance_ids": [], #list of dicts { alliance: 1234, tag: ABCDE} "alliance_tag": None, "...
config_structure = {'default_user': {'profile': {'description': None, 'roster': [], 'roster_ss': [], 'alliance_ids': [], 'alliance_tag': None, 'started': None, 'ingame': None, 'aq5_paths': [], 'aq6_paths': [], 'aq7_paths': [], 'aw': [], 'offense': None, 'defense': None, 'utility': None, 'collage': None}, 'settings': {'...
class Solution: def countLetters(self, S: str) -> int: if len(S) == 1: return 1 prev_char = S[0] res = 1 flag = 1 for cur_char in S[1:]: if cur_char == prev_char: flag += 1 res += flag else: p...
class Solution: def count_letters(self, S: str) -> int: if len(S) == 1: return 1 prev_char = S[0] res = 1 flag = 1 for cur_char in S[1:]: if cur_char == prev_char: flag += 1 res += flag else: ...
i=10 for i in range(5): print(i) i = i+3 print(i) '''output 0 3 1 4 2 5 3 6 4 7 '''
i = 10 for i in range(5): print(i) i = i + 3 print(i) 'output\n0\n3\n1\n4\n2\n5\n3\n6\n4\n7\n'
{ 'includes': [ 'common.gypi' ], 'targets': [ { 'target_name': 'webserver', 'type': 'executable', 'sources': [ 'webserver.cc', ], 'dependencies': [ './deps/libuv/uv.gyp:libuv', './deps/http-parser/http_parser.gyp:http_parser' ], }, { 'tar...
{'includes': ['common.gypi'], 'targets': [{'target_name': 'webserver', 'type': 'executable', 'sources': ['webserver.cc'], 'dependencies': ['./deps/libuv/uv.gyp:libuv', './deps/http-parser/http_parser.gyp:http_parser']}, {'target_name': 'webclient', 'type': 'executable', 'sources': ['webclient.cc'], 'dependencies': ['./...
reveal_type(len("blub")) def get_id(name: str): return len(name) reveal_type(get_id("blub")) # limitations_inference.py:1: error: Revealed type is 'builtins.int' # limitations_inference.py:7: error: Revealed type is 'Any'
reveal_type(len('blub')) def get_id(name: str): return len(name) reveal_type(get_id('blub'))
MOCK_GOOD_COMMIT_1 = "\n".join([ "557fec0b69228ae803c81e38f80c3b1fb993d9cb|||<<<(((ooo+++ooo)))>>>|||Bob Dole|||<<<(((ooo+++ooo)))>>>|||bob@dole.com|||<<<(((ooo+++ooo)))>>>|||2015-05-20|||<<<(((ooo+++ooo)))>>>|||TIK-1111 - Some important change|||<<<(((ooo+++ooo)))>>>|||This change affects something really importan...
mock_good_commit_1 = '\n'.join(['557fec0b69228ae803c81e38f80c3b1fb993d9cb|||<<<(((ooo+++ooo)))>>>|||Bob Dole|||<<<(((ooo+++ooo)))>>>|||bob@dole.com|||<<<(((ooo+++ooo)))>>>|||2015-05-20|||<<<(((ooo+++ooo)))>>>|||TIK-1111 - Some important change|||<<<(((ooo+++ooo)))>>>|||This change affects something really important and...
# -*- coding: utf-8 -*- __version__ = '0.0.0' __author__ = 'Mike Bland' __license__ = "CC0-1.0"
__version__ = '0.0.0' __author__ = 'Mike Bland' __license__ = 'CC0-1.0'
class MockLogger: @staticmethod def info(content): print(f"\nMockLogger: info - {content}") @staticmethod def debug(content): print(f"\nMockLogger: debug - {content}") def warn(self, content): self.warning(content) @staticmethod def warning(content): print(...
class Mocklogger: @staticmethod def info(content): print(f'\nMockLogger: info - {content}') @staticmethod def debug(content): print(f'\nMockLogger: debug - {content}') def warn(self, content): self.warning(content) @staticmethod def warning(content): print...
# simple python spark examples, as if they were typed into pyspark, not a full application # load sales sales=sc.textFile("sales_*.txt").map(lambda x:x.split('\t')) #load stores and products stores=sc.textFile("stores.txt").map(lambda x:x.split('\t')) products=sc.textFile("products.txt").map(lambda x:x.split('\t')) ...
sales = sc.textFile('sales_*.txt').map(lambda x: x.split('\t')) stores = sc.textFile('stores.txt').map(lambda x: x.split('\t')) products = sc.textFile('products.txt').map(lambda x: x.split('\t')) sales_by_day = sales.map(lambda x: (x[0], int(x[3]))).reduceByKey(lambda x, y: x + y) sales_by_day.map(lambda l: '{0}\t{1}'....
class Student(): count=0 pycount=0 def __init__(self,USN,Name,Subject): self.USN=USN self.Name=Name self.Subject=Subject if self.Subject.lower()=="python": Student.pycount+=1 Student.count+=1 listofstud=[] n=int(input("Enter the number of students ")) for ...
class Student: count = 0 pycount = 0 def __init__(self, USN, Name, Subject): self.USN = USN self.Name = Name self.Subject = Subject if self.Subject.lower() == 'python': Student.pycount += 1 Student.count += 1 listofstud = [] n = int(input('Enter the numbe...
# Reading input file f = open("inputs/day02.txt", "r") lines = f.readlines() def part1(): valid_passwords = 0 for line in lines: password = line.replace("\n", "").split(": ") min_occurrence = int(password[0].split(" ")[0].split("-")[0]) max_occurrence = int(password[0].split(" ")[0].spl...
f = open('inputs/day02.txt', 'r') lines = f.readlines() def part1(): valid_passwords = 0 for line in lines: password = line.replace('\n', '').split(': ') min_occurrence = int(password[0].split(' ')[0].split('-')[0]) max_occurrence = int(password[0].split(' ')[0].split('-')[1]) l...
__all__ = [ "category", "event_log", "org", "user", ]
__all__ = ['category', 'event_log', 'org', 'user']
def main(): infile = open("test_master.txt","r") infileContent = infile.read(); infile.close() testsRaw = infileContent.split("==========\n") for testRaw in testsRaw: testParts = testRaw.split("----------\n") name = testParts[0].strip() inSrc = testParts[1] outSrc ...
def main(): infile = open('test_master.txt', 'r') infile_content = infile.read() infile.close() tests_raw = infileContent.split('==========\n') for test_raw in testsRaw: test_parts = testRaw.split('----------\n') name = testParts[0].strip() in_src = testParts[1] out_s...
n=int(input()) if n%2==0: print("I LOVE CBNU") exit(0) print("*"*n) for i in range(n//2+1): print(end=" "*(n//2-i)) if i==0: print("*") else: print("*"+" "*(i*2-1)+"*")
n = int(input()) if n % 2 == 0: print('I LOVE CBNU') exit(0) print('*' * n) for i in range(n // 2 + 1): print(end=' ' * (n // 2 - i)) if i == 0: print('*') else: print('*' + ' ' * (i * 2 - 1) + '*')
#!/usr/bin/env python3.7 rules = {} with open('input.txt') as fd: for line in fd: words = line[:-1].split() this_bag = words[0]+ " " + words[1] rules[this_bag] = [] b = line[:-1].split('contain') bags = b[1].split(',') for bag in bags: words = bag.split()...
rules = {} with open('input.txt') as fd: for line in fd: words = line[:-1].split() this_bag = words[0] + ' ' + words[1] rules[this_bag] = [] b = line[:-1].split('contain') bags = b[1].split(',') for bag in bags: words = bag.split() count = 0 ...
# Copyright (C) 2005, Giovanni Bajo # Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the...
hiddenimports = ['xml.dom.html.HTMLAnchorElement', 'xml.dom.html.HTMLAppletElement', 'xml.dom.html.HTMLAreaElement', 'xml.dom.html.HTMLBaseElement', 'xml.dom.html.HTMLBaseFontElement', 'xml.dom.html.HTMLBodyElement', 'xml.dom.html.HTMLBRElement', 'xml.dom.html.HTMLButtonElement', 'xml.dom.html.HTMLDirectoryElement', 'x...
class Solution: def mySqrt(self, x: int) -> int: if x == 0 or x == 1: return x cur_min = x left = 0 right = x // 2 res = 0 while left <= right: mid = (left + right) // 2 cur_val = x - mid * mid if cur_val >= 0 and cur_va...
class Solution: def my_sqrt(self, x: int) -> int: if x == 0 or x == 1: return x cur_min = x left = 0 right = x // 2 res = 0 while left <= right: mid = (left + right) // 2 cur_val = x - mid * mid if cur_val >= 0 and cur_...
n=int(input()) l=list(map(int,input().split())) count1=0 count2=0 for i in range(0,len(l)-1): if l[i]<l[i+1]: count1=count1+1 if(count1>count2): count2=count1 else: count1=0 print(count2+1)
n = int(input()) l = list(map(int, input().split())) count1 = 0 count2 = 0 for i in range(0, len(l) - 1): if l[i] < l[i + 1]: count1 = count1 + 1 if count1 > count2: count2 = count1 else: count1 = 0 print(count2 + 1)
def ilen(n, mapa): pole = [[1 for i in range(n)] for j in range(n)] for obsz in mapa: x = obsz[:2] [::-1] y = obsz[2:4] y = [y[1] - 1, y[0] - 1] poziom = obsz[4] wiersz = range(x[1], y[1] + 1) wiersze = range(x[0], y[0] + 1) for k in wiersze: ...
def ilen(n, mapa): pole = [[1 for i in range(n)] for j in range(n)] for obsz in mapa: x = obsz[:2][::-1] y = obsz[2:4] y = [y[1] - 1, y[0] - 1] poziom = obsz[4] wiersz = range(x[1], y[1] + 1) wiersze = range(x[0], y[0] + 1) for k in wiersze: fo...
def gcd(A, B): while A != 0: B, A = A, B % A return B A, B = map(int, input().split()) if A >= B: GCD = gcd(B, A) else: GCD = gcd(A, B) result = A * B // GCD print(result)
def gcd(A, B): while A != 0: (b, a) = (A, B % A) return B (a, b) = map(int, input().split()) if A >= B: gcd = gcd(B, A) else: gcd = gcd(A, B) result = A * B // GCD print(result)
description = 'Basic setup for SPHERES containing sis detector, doppler, ' \ 'sps selector and shutter' group = 'basic' includes = ['sis', 'doppler', 'cct6', 'sps', 'shutter', 'memograph', 'selector', ] startupcode = 'S...
description = 'Basic setup for SPHERES containing sis detector, doppler, sps selector and shutter' group = 'basic' includes = ['sis', 'doppler', 'cct6', 'sps', 'shutter', 'memograph', 'selector'] startupcode = 'SetDetectors(sis)\nSetEnvironment(cct6_c_temperature, cct6_setpoint)'
def test_validate(client): mimetype = "application/json" headers = { "Accept": mimetype } response = client.get(path="/validate", query_string={"numbers": "100000000" "020000000" ...
def test_validate(client): mimetype = 'application/json' headers = {'Accept': mimetype} response = client.get(path='/validate', query_string={'numbers': '100000000020000000003000000000400000000050000000006000000000700000000080000000009'}, headers=headers) assert response.status_code == 200 assert re...
def safe_open(*args, **kwargs): file_handle = None try: file_handle = open(*args, **kwargs) except IOError as exc: yield None, exc # return for an exception else: try: yield file_handle, None # return for success # func(file_handle, None) final...
def safe_open(*args, **kwargs): file_handle = None try: file_handle = open(*args, **kwargs) except IOError as exc: yield (None, exc) else: try: yield (file_handle, None) finally: print('clean things up') if file_handle: ...
def process_raw_input(s): s = 'inputs/'+s with open(s) as t: return [line.strip().rstrip() for line in t.readlines()]
def process_raw_input(s): s = 'inputs/' + s with open(s) as t: return [line.strip().rstrip() for line in t.readlines()]
REACTION_SUZUKI = "[*;$(c2aaaaa2),$(c2aaaa2):1]-!@[*;$(c2aaaaa2),$(c2aaaa2):2]>>[*:1][*].[*:2][*]" SCAFFOLD_SUZUKI = 'Cc1ccc(cc1)c2cc(nn2c3ccc(cc3)S(=O)(=O)N)[*]' DECORATION_SUZUKI = '[*]c1ncncc1' TWO_DECORATIONS_SUZUKI = '[*]c1ncncc1|[*]c1ncncc1' TWO_DECORATIONS_ONE_SUZUKI = '[*]c1ncncc1|[*]C' SCAFFOLD_NO_SUZUKI = '[...
reaction_suzuki = '[*;$(c2aaaaa2),$(c2aaaa2):1]-!@[*;$(c2aaaaa2),$(c2aaaa2):2]>>[*:1][*].[*:2][*]' scaffold_suzuki = 'Cc1ccc(cc1)c2cc(nn2c3ccc(cc3)S(=O)(=O)N)[*]' decoration_suzuki = '[*]c1ncncc1' two_decorations_suzuki = '[*]c1ncncc1|[*]c1ncncc1' two_decorations_one_suzuki = '[*]c1ncncc1|[*]C' scaffold_no_suzuki = '[*...
def solution(max): a = 0 b = 1 if max < 0: print("Incorrect input") elif max == 0: return a elif max == 1: return b else: sum = 0 while a+b < max: c = a + b a = b b = c if b % 2 == 0: ...
def solution(max): a = 0 b = 1 if max < 0: print('Incorrect input') elif max == 0: return a elif max == 1: return b else: sum = 0 while a + b < max: c = a + b a = b b = c if b % 2 == 0: sum +=...
def CFS(data): features = [] score = -1e-9 while True: best_feature = None for feature in range(data.features): features.append(feature) temp_score = calculate_corr(data[F]) if temp_score > score: score = temp_score best_feature = features features.pop() feature...
def cfs(data): features = [] score = -1e-09 while True: best_feature = None for feature in range(data.features): features.append(feature) temp_score = calculate_corr(data[F]) if temp_score > score: score = temp_score best_fe...
# O(n) time | O(d) - where n is the total number of elements in the array, # including sub-elements and d is the greatest depth of arrays in the array def productSum(array, multiplier=1): # Write your code here. sum = 0 for element in array: if type(element) is list: sum += productSum(element, multiplier + 1...
def product_sum(array, multiplier=1): sum = 0 for element in array: if type(element) is list: sum += product_sum(element, multiplier + 1) else: sum += element return sum * multiplier
# "The cake is not a lie!" challenge test_string = "abccbaabccba" def solution(s): s_len = len(s) for pattern_len in range(1, s_len + 1): pattern = s[:pattern_len] pattern_count = s.count(pattern) if pattern_count * pattern_len == s_len: return pattern_count if __name__...
test_string = 'abccbaabccba' def solution(s): s_len = len(s) for pattern_len in range(1, s_len + 1): pattern = s[:pattern_len] pattern_count = s.count(pattern) if pattern_count * pattern_len == s_len: return pattern_count if __name__ == '__main__': print(solution(test_st...
#!/bin/bash with open("version.txt", "r+") as f: version = f.read().split(".") final_string = f"{version[0]}.{int(version[1])+1}.{version[2]}" f.seek(0) f.truncate() # truncate requires cursor at the beginning of the file f.write(final_string)
with open('version.txt', 'r+') as f: version = f.read().split('.') final_string = f'{version[0]}.{int(version[1]) + 1}.{version[2]}' f.seek(0) f.truncate() f.write(final_string)
conditions = { 'test_project_ids': ['*'], 'test_suite_ids': ['*'], 'test_names': ['login'], } def pre_test_run(): pass
conditions = {'test_project_ids': ['*'], 'test_suite_ids': ['*'], 'test_names': ['login']} def pre_test_run(): pass
_debug = True def SetDebug(val=True): global _debug _debug = val class AtlasException(Exception): def __init__(self, message): super().__init__(message) def AtlasAssert(cond, message): if _debug and (not cond): raise AtlasException(message)
_debug = True def set_debug(val=True): global _debug _debug = val class Atlasexception(Exception): def __init__(self, message): super().__init__(message) def atlas_assert(cond, message): if _debug and (not cond): raise atlas_exception(message)
class Account: def __init__(self, owner, amount=0): self.owner = owner self.amount = amount self._transactions = [] def __add__(self, other): account = Account(f'{self.owner}&{other.owner}', self.amount + other.amount) account._transactions = self._transactions + other._...
class Account: def __init__(self, owner, amount=0): self.owner = owner self.amount = amount self._transactions = [] def __add__(self, other): account = account(f'{self.owner}&{other.owner}', self.amount + other.amount) account._transactions = self._transactions + other....
class ScreenType: SSD1306 = 0 SSD1106 = 1 def __init__(self): pass class ConnectionType: I2C = 0 SPI = 1 def __init__(self): pass class Screen: screen_type = "" connection_type = "" bus = "" screen = "" # @timed_function def __init__(self, screen_ty...
class Screentype: ssd1306 = 0 ssd1106 = 1 def __init__(self): pass class Connectiontype: i2_c = 0 spi = 1 def __init__(self): pass class Screen: screen_type = '' connection_type = '' bus = '' screen = '' def __init__(self, screen_type, connection_type, bu...
names_count = int(input()) names = {input() for _ in range(names_count)} [print(x) for x in names]
names_count = int(input()) names = {input() for _ in range(names_count)} [print(x) for x in names]
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "" services_str = "/home/ubuntu/catkin_ws/src/navigation/robot_pose_ekf/srv/GetStatus.srv" pkg_name = "robot_pose_ekf" dependencies_str = "std_msgs" langs = "gencpp;genlisp;genpy" dep_include_paths_str = "std_msgs;/opt/ros/indigo/share/std_msgs/cmake/....
messages_str = '' services_str = '/home/ubuntu/catkin_ws/src/navigation/robot_pose_ekf/srv/GetStatus.srv' pkg_name = 'robot_pose_ekf' dependencies_str = 'std_msgs' langs = 'gencpp;genlisp;genpy' dep_include_paths_str = 'std_msgs;/opt/ros/indigo/share/std_msgs/cmake/../msg' python_executable = '/usr/bin/python' package_...
# # PySNMP MIB module Nortel-Magellan-Passport-VoiceMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-VoiceMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:19:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ...
SQLALCHEMY_DATABASE_URI = 'postgresql://shepard:shepard@localhost/sheparddb' SECRET_KEY = 'fda890t43nlba8i9pr32jl' MONGODB_SETTINGS = { 'db': 'sheparddb', 'host': '127.0.0.1', 'port': 27017 } PORT = 9999 DEBUG_LOG_FILE = '/var/log/sheparddb/info.log' WTF_CSRF_ENABLED = False...
sqlalchemy_database_uri = 'postgresql://shepard:shepard@localhost/sheparddb' secret_key = 'fda890t43nlba8i9pr32jl' mongodb_settings = {'db': 'sheparddb', 'host': '127.0.0.1', 'port': 27017} port = 9999 debug_log_file = '/var/log/sheparddb/info.log' wtf_csrf_enabled = False sqlalchemy_track_modifications = True
# For the drifters to work, you need to fill in your Twitter APP key. # The probability values are hidden here. You can decide the values by youself. # The values used in our paper can be found in the manuscript. ################# Access Keys ####################### mashape_key = '' customer_API_key = '' customer_API...
mashape_key = '' customer_api_key = '' customer_api_secret_key = '' access_token = '' access_token_secret = '' twitter_app_auth = {'consumer_key': customer_API_key, 'consumer_secret': customer_API_secret_key, 'access_token': access_token, 'access_token_secret': access_token_secret} conn_save_freq = 12 num_friends = 1 n...
a,b,c = int(input()),input().split(),0 key = [b[i-a:i] for i in range(1, len(b)+1)if i%a==0 and b.count("0")!=a*a] for i in range(a): for j in range(a): if len(key) > 1 and key[i][j] == key[j][i]: c=c+1 if c == a*a: print("yes",end="") else: print("no",end="") ...
(a, b, c) = (int(input()), input().split(), 0) key = [b[i - a:i] for i in range(1, len(b) + 1) if i % a == 0 and b.count('0') != a * a] for i in range(a): for j in range(a): if len(key) > 1 and key[i][j] == key[j][i]: c = c + 1 if c == a * a: print('yes', end='') else: print('no', end=''...
class Solution: #given a string #return an integer def romanToInt(self, s): key = ['M','CM','D','CD','C','XC','L','XL','X','IX','V','IV','I'] val = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] res = 0 for i in range(len(key)): while len(key[i]) <= len(s)...
class Solution: def roman_to_int(self, s): key = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] val = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] res = 0 for i in range(len(key)): while len(key[i]) <= len(s) and key[i] == s[:len(key[i]...
# While loop will run until the specified condition is true i = 1 while i < 5: print(i) i += 1 # Using break statement we can stop the flow of the loop print() i =1 while i < 5: print (i) if i == 3: # Our loop will stop executing from 3 break i += 1 # Example 2 # Continue: this wl...
i = 1 while i < 5: print(i) i += 1 print() i = 1 while i < 5: print(i) if i == 3: break i += 1 print('\nContinue Statement') i = 0 while i < 5: i += 1 if i == 3: continue print(i) print() i = 0 while i < 6: i += 1 if i == 3: continue print(i) print('\n...
# from math import ceil, floor, trunc # a=12.3456 # b=(a) # # print(b) # list=[1,2,3,4,5] # # here we use the shallow copy method to both has the different memory address. using the "copy.copy". # # list1=copy(list) # help(copy.copy) # print("list : ",id(list)) # print("list1 : ",id(list1)) def uppers(z): for i...
def uppers(z): for i in range(0, len(z)): print('i : ', i) if i % 2 == 0: return z[i].upper() else: i = i + 1 txt = 'arfa is a good gril' result = uppers(txt) print(result)
SEARCH_LOCATIONS = [ [-54.1962894, -69.223033], [-51.7628454, -58.8519393], [-48.263197, -70.2777205], [-45.8935737, 168.8783417], [-44.0028155, -68.519908], [-42.8152797, 171.8666229], [-42.1020234, 146.8177948], [-39.1408438, -72.3870955], [-38.7580781, 175.8217011], [-38.73065...
search_locations = [[-54.1962894, -69.223033], [-51.7628454, -58.8519393], [-48.263197, -70.2777205], [-45.8935737, 168.8783417], [-44.0028155, -68.519908], [-42.8152797, 171.8666229], [-42.1020234, 146.8177948], [-39.1408438, -72.3870955], [-38.7580781, 175.8217011], [-38.7306509, -63.598033], [-37.4311589, 144.289902...
SECRET_KEY = '*&GJD%KDjy' DEBUG = True ENV_CONF = { 'world_size': 12, 'capacity': 10, 'player1_home': (5,5), 'player2_home': (6,6), 'num_walls': 24, 'num_jobs': 24, 'value_range': (6,12), 'max_steps': 200 } # REPLAY_DIR = "/replays" REPLAY_DIR = "/Users/st491/LocalStore/tmp/competition3_repl...
secret_key = '*&GJD%KDjy' debug = True env_conf = {'world_size': 12, 'capacity': 10, 'player1_home': (5, 5), 'player2_home': (6, 6), 'num_walls': 24, 'num_jobs': 24, 'value_range': (6, 12), 'max_steps': 200} replay_dir = '/Users/st491/LocalStore/tmp/competition3_replay' timeout = 1.5 retry = 20
a=5 b=3 print(a+b) c=input() #d=input() d=4 e=c*d print(e)
a = 5 b = 3 print(a + b) c = input() d = 4 e = c * d print(e)
def cut_candy(arr): size = len(arr) memo = [0 for x in range(size+1)] memo[0] = 0 for i in range(1, size+1): max_profit = -float('inf') for j in range(i): max_profit = max(max_profit, arr[j] + memo[i-j-1]) memo[i] = max_profit print(memo) return memo[size] ...
def cut_candy(arr): size = len(arr) memo = [0 for x in range(size + 1)] memo[0] = 0 for i in range(1, size + 1): max_profit = -float('inf') for j in range(i): max_profit = max(max_profit, arr[j] + memo[i - j - 1]) memo[i] = max_profit print(memo) return memo[s...
class ItemValue: #Class to store items data def __init__(self, wt, val, index): self.wt = wt #Weight of item self.val = val #Value of item self.index = index #Index of item in list self.cost = val / wt #Figure of merit def __lt__(self, other)...
class Itemvalue: def __init__(self, wt, val, index): self.wt = wt self.val = val self.index = index self.cost = val / wt def __lt__(self, other): return self.cost < other.cost class Solution: def get_max_knapsack(self, wt, val, capacity): i_val = [] ...