content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
nums = [12, 34, 5, 7, 8] iter_nums = iter(nums) # def sum_numbers(nums): # for n in nums: # n += sum_numbers(nums) # return n # print(sum_numbers(iter_nums)) def sum_list(list_to_sum, index): if len(list_to_sum) == 0: return 0 if index == 0: return list_to_...
nums = [12, 34, 5, 7, 8] iter_nums = iter(nums) def sum_list(list_to_sum, index): if len(list_to_sum) == 0: return 0 if index == 0: return list_to_sum[0] return list_to_sum[index] + sum_list(list_to_sum, index - 1) string = '123' def recursive_sum_string(list, index): if len(list) == 0...
# Author: OMKAR PATHAK # A Python generator is a function which returns a generator iterator (just an object we can iterate over) # by calling yield def simpleGenerator(numbers): i = 0 while True: check = input('Wanna generate a number? (If yes, press y else n): ') if check in ('Y', 'y') and l...
def simple_generator(numbers): i = 0 while True: check = input('Wanna generate a number? (If yes, press y else n): ') if check in ('Y', 'y') and len(numbers) > i: yield numbers[i] i += 1 else: print('Bye!') break for number in simple_genera...
def _configure_features( ctx, cuda_toolchain, requested_features=[], unsupported_features=[] ): features = cuda_toolchain.features enabled_features = {} # Enable compilation mode feature compilation_mode = ctx.var["COMPILATION_MODE"] if compilation_mode in features: enabled_...
def _configure_features(ctx, cuda_toolchain, requested_features=[], unsupported_features=[]): features = cuda_toolchain.features enabled_features = {} compilation_mode = ctx.var['COMPILATION_MODE'] if compilation_mode in features: enabled_features[compilation_mode] = features[compilation_mode] ...
class Node: def __init__(self,data): self.left=None self.right=None self.data=data def PrintTree(self): if self.left: self.left.PrintTree() print(self.data) if self.right: self.right.PrintTree() def insert(self,data): i...
class Node: def __init__(self, data): self.left = None self.right = None self.data = data def print_tree(self): if self.left: self.left.PrintTree() print(self.data) if self.right: self.right.PrintTree() def insert(self, data): ...
names = ['Simon', 'Sophie', 2] print (names[0] + ' loves ' + names[1] + ' for ' + str(names[2]) + ' years') for name in names : print (name)
names = ['Simon', 'Sophie', 2] print(names[0] + ' loves ' + names[1] + ' for ' + str(names[2]) + ' years') for name in names: print(name)
''' Using sieve of Eratosthenes, primes(x) returns list of all primes less than x Modification: We don't need to check all even numbers, we can make the sieve excluding even numbers and adding 2 to the primes list by default. We are going to make an array of: x / 2 - 1 if number is even, else x / 2 (The -1 with even...
""" Using sieve of Eratosthenes, primes(x) returns list of all primes less than x Modification: We don't need to check all even numbers, we can make the sieve excluding even numbers and adding 2 to the primes list by default. We are going to make an array of: x / 2 - 1 if number is even, else x / 2 (The -1 with even...
# Space: O(1) # Time: O(n) class Solution: def singleNumber(self, nums): res = [] length = len(nums) nums.sort() status = 0 for i in range(length): if i == 0: if nums[i] != nums[i + 1]: res.append(nums[i]) ...
class Solution: def single_number(self, nums): res = [] length = len(nums) nums.sort() status = 0 for i in range(length): if i == 0: if nums[i] != nums[i + 1]: res.append(nums[i]) status += 1 eli...
numbers_list = input().split(', ') new_list = [] for digit in numbers_list: digits = digit.split(', ') current_digit = int(digits[0]) if current_digit == 0: numbers_list.remove('0') numbers_list.append('0') new_list = list(map(int, numbers_list)) print(new_list)
numbers_list = input().split(', ') new_list = [] for digit in numbers_list: digits = digit.split(', ') current_digit = int(digits[0]) if current_digit == 0: numbers_list.remove('0') numbers_list.append('0') new_list = list(map(int, numbers_list)) print(new_list)
# Copyright 2018 The GraphNets Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
def cr_inputs_reference(): reference__range = {'C-reactive protein': {'Male': {'min': '0', 'max': '5'}, 'Female': {'min': '0', 'max': '5'}, 'Unknown': {'min': '0', 'max': '5'}, 'Unspecified': {'min': '0', 'max': '5'}}} input_node_fields = ['C-reactive protein'] return (Reference_Range, input_node_fields)
wt3_3_10 = {'192.168.122.110': [8.5425, 9.6589, 8.3878, 8.9764, 8.5553, 8.1619, 8.5832, 8.1742, 7.8747, 7.6304, 7.6131, 7.5381, 7.3988, 7.2547, 7.2352, 7.1954, 7.0925, 6.9968, 7.8112, 7.7524, 7.6389, 7.5302, 7.4983, 7.4729, 7.4327, 7.3494, 7.2848, 7.2741, 7.2099, 7.1539, 7.2822, 7.2477, 7.3613, 7.315, 7.2783, 7.1005, ...
wt3_3_10 = {'192.168.122.110': [8.5425, 9.6589, 8.3878, 8.9764, 8.5553, 8.1619, 8.5832, 8.1742, 7.8747, 7.6304, 7.6131, 7.5381, 7.3988, 7.2547, 7.2352, 7.1954, 7.0925, 6.9968, 7.8112, 7.7524, 7.6389, 7.5302, 7.4983, 7.4729, 7.4327, 7.3494, 7.2848, 7.2741, 7.2099, 7.1539, 7.2822, 7.2477, 7.3613, 7.315, 7.2783, 7.1005, 7...
names = ['David','Herry','Army'] message1 = "hello " + names[0] print(message1) message1 = "hello " + names[1] print(message1) message1 = "hello " + names[2] print(message1)
names = ['David', 'Herry', 'Army'] message1 = 'hello ' + names[0] print(message1) message1 = 'hello ' + names[1] print(message1) message1 = 'hello ' + names[2] print(message1)
hu = "haha" age = 22 name = "Cat"
hu = 'haha' age = 22 name = 'Cat'
def calculateStats(numbers): val = len(numbers) result = {"max": float('NaN'), "min": float('NaN'), "avg": float('NaN')} if val == 0: return result else: result["max"] = max(numbers) result["min"] = min(numbers) result["avg"] = sum(numbers) / val return result ...
def calculate_stats(numbers): val = len(numbers) result = {'max': float('NaN'), 'min': float('NaN'), 'avg': float('NaN')} if val == 0: return result else: result['max'] = max(numbers) result['min'] = min(numbers) result['avg'] = sum(numbers) / val return result c...
lst = [ ["https://bit.ly/DataStructC", "9:00", "9:58"], ["https://bit.ly/AeroStructures", "11:10", "12:08"], ["https://zoom.us/j/8143311495?pwd=e-space", "12:10", "13:00"] ["https://bit.ly/engMaterials", "13:50", "14:50"] ]
lst = [['https://bit.ly/DataStructC', '9:00', '9:58'], ['https://bit.ly/AeroStructures', '11:10', '12:08'], ['https://zoom.us/j/8143311495?pwd=e-space', '12:10', '13:00']['https://bit.ly/engMaterials', '13:50', '14:50']]
host='localhost' user='root' password='wowilosttwosis$' db='fin_man_db' charset='utf8mb4'
host = 'localhost' user = 'root' password = 'wowilosttwosis$' db = 'fin_man_db' charset = 'utf8mb4'
cx, cy, cd = input().split() cx = float(cx); cy = float(cy); cd = float(cd); r = cd; n = int(input()); coef = input().split(); z = float(input()); for i in range(n+1): coef[i] = float(coef[i]) def f_eval(x): ans = 0 for i in range(0, n+1): ans += coef[i]*(x**(n-i)) return ans lo = cx - r - 10 hi = cx + r + 10 ...
(cx, cy, cd) = input().split() cx = float(cx) cy = float(cy) cd = float(cd) r = cd n = int(input()) coef = input().split() z = float(input()) for i in range(n + 1): coef[i] = float(coef[i]) def f_eval(x): ans = 0 for i in range(0, n + 1): ans += coef[i] * x ** (n - i) return ans lo = cx - r - 1...
class Process: def __init__(self, id, arrvl_time, exec_time): self.id = id self.arrvl_time = arrvl_time self.exec_time = exec_time self.compl_time = 0 self.timeLeft = exec_time def execute(self, quantum): #self.timeLeft = self.timeLeft - quantum if self.timeLeft ...
class Process: def __init__(self, id, arrvl_time, exec_time): self.id = id self.arrvl_time = arrvl_time self.exec_time = exec_time self.compl_time = 0 self.timeLeft = exec_time def execute(self, quantum): if self.timeLeft > quantum: self.timeLeft = s...
words = "Life is short" upper_word_list = ["LIFE", "IS", "SHORT", "USE", "PYTHON"] word_generator = ( lower_w for w in upper_word_list if (lower_w := w.lower()) in words.lower() ) for w in word_generator: print(w, end=" ") # word_generator is StopIteration now
words = 'Life is short' upper_word_list = ['LIFE', 'IS', 'SHORT', 'USE', 'PYTHON'] word_generator = (lower_w for w in upper_word_list if (lower_w := w.lower()) in words.lower()) for w in word_generator: print(w, end=' ')
# overall function that recursively splits an input array in half, and # uses the helper function "merge" to compare items in each half against each # other to sort them def mergeSort(list): # Determine whether the list is broken into # individual pieces. if len(list) < 2: return list # Find th...
def merge_sort(list): if len(list) < 2: return list middle = len(list) // 2 left = merge_sort(list[:middle]) right = merge_sort(list[middle:]) print('Left side: ', left) print('Right side: ', right) merged = merge(left, right) print('Merged ', merged) return merged def merge...
class DockerComposeEntity: def __init__(self): self.sinks = list() def build_state(self): result = dict() services = dict() sink_count = 0 for sink in self.sinks: services[f"sink_{sink_count}"] = sink.__dict__ sink_count += 1 result["ver...
class Dockercomposeentity: def __init__(self): self.sinks = list() def build_state(self): result = dict() services = dict() sink_count = 0 for sink in self.sinks: services[f'sink_{sink_count}'] = sink.__dict__ sink_count += 1 result['vers...
a = input() if len(a) == 1 and 'a' in a: ans = -1 else: ans = 'a' print(ans)
a = input() if len(a) == 1 and 'a' in a: ans = -1 else: ans = 'a' print(ans)
LocalValueDim = 18446744073709551613 dataTypes = { -1: 'unknown', 0: 'byte', 1: 'short', 2: 'integer', 4: 'long', 50: 'unsigned_byte', 51: 'unsigned_short', 52: 'unsigned_integer', 54: 'unsigned_long', 5: 'real', 6: 'double', 7: 'long_double', 9: 'string', 10...
local_value_dim = 18446744073709551613 data_types = {-1: 'unknown', 0: 'byte', 1: 'short', 2: 'integer', 4: 'long', 50: 'unsigned_byte', 51: 'unsigned_short', 52: 'unsigned_integer', 54: 'unsigned_long', 5: 'real', 6: 'double', 7: 'long_double', 9: 'string', 10: 'complex', 11: 'double_complex', 12: 'string_array', 55: ...
list1 = [3, 4, 51, 90.1, False, 'Amresh', 7] # index = 0 # for i in list1: # print (f'index: {index}, Value: {i}') # index += 1 for index, item in enumerate(list1): print (f'index: {index}, Value: {item}')
list1 = [3, 4, 51, 90.1, False, 'Amresh', 7] for (index, item) in enumerate(list1): print(f'index: {index}, Value: {item}')
class Params(object): def __init__(self , data_path='faces/dataset/' , artifacts_path='faces/artifacts/' , models_path='/User/mlrun/demos/faces/notebooks/functions/models.py' , frames_url='framesd:8081' , token='set_token' ...
class Params(object): def __init__(self, data_path='faces/dataset/', artifacts_path='faces/artifacts/', models_path='/User/mlrun/demos/faces/notebooks/functions/models.py', frames_url='framesd:8081', token='set_token', encodings_path='faces/encodings/', container='users'): self.data_path = data_path ...
''' Created on 15.02.2017 @author: emillokal ''' measure0=0 measure1=0
""" Created on 15.02.2017 @author: emillokal """ measure0 = 0 measure1 = 0
# Link to the problem: https://www.codechef.com/MARCH18B/problems/MIXCOLOR def main(): T = int(input()) while T: T -= 1 _ = int(input()) occr = {} colors = list(map(int, input().split())) for i in colors: occr[i] = 0 for val in colors: oc...
def main(): t = int(input()) while T: t -= 1 _ = int(input()) occr = {} colors = list(map(int, input().split())) for i in colors: occr[i] = 0 for val in colors: occr[val] += 1 ans = 0 for (_, v) in occr.items(): ...
# File where I wrote functions that helped parse and make changes to multiple lines of code def read_source_file(name: str)->str: f = open(name) s = f.read() f.close() return s def save_as_new(text: str): f = open('./new.py', mode='w') f.write(text) f.close() def find_brace_close_posit...
def read_source_file(name: str) -> str: f = open(name) s = f.read() f.close() return s def save_as_new(text: str): f = open('./new.py', mode='w') f.write(text) f.close() def find_brace_close_position(text: str, brace_start: int) -> int: scope_level = 1 position = brace_start + 1 ...
# # 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 agreed to in writing, software # ...
def check_c_count(expected_count): test.assertEqual(expected_count, len(reality.resources_by_logical_name('C'))) example_template = template({'A': rsrc_def({'a': 'initial'}, []), 'B': rsrc_def({}, []), 'C': rsrc_def({'!a': get_att('A', 'a')}, ['B']), 'D': rsrc_def({'c': get_res('C')}, []), 'E': rsrc_def({'ca': get_...
class Immutable(type): def __new__(msc, name, bases, nmspc): new_class = type(name, bases, nmspc) original_initialization = new_class.__init__ def set_attribute(self, key, value): raise AttributeError("Attributes are immutable") def wrapper(self, *args, **kwargs): ...
class Immutable(type): def __new__(msc, name, bases, nmspc): new_class = type(name, bases, nmspc) original_initialization = new_class.__init__ def set_attribute(self, key, value): raise attribute_error('Attributes are immutable') def wrapper(self, *args, **kwargs): ...
class CleanPhoneNumber(object): def __init__(self, phone_number): self.phone_number = phone_number def sanitize_phone_number(self): phone_number = self.phone_number phone = list(phone_number) prefix = phone[0] length = len(phone_number) if prefix == '+' and leng...
class Cleanphonenumber(object): def __init__(self, phone_number): self.phone_number = phone_number def sanitize_phone_number(self): phone_number = self.phone_number phone = list(phone_number) prefix = phone[0] length = len(phone_number) if prefix == '+' and leng...
# List of guide files to search guides = ['analytics_guide.md','angular_guide.md','api_guide.md','authentication_guide.md','cache_guide.md','hub_guide.md','i18n_guide.md','interactions_guide.md','logger_guide.md','pub_sub_guide.md','push_notifications_setup.md','service_workers_guide.md','storage_guide.md'] # Start of...
guides = ['analytics_guide.md', 'angular_guide.md', 'api_guide.md', 'authentication_guide.md', 'cache_guide.md', 'hub_guide.md', 'i18n_guide.md', 'interactions_guide.md', 'logger_guide.md', 'pub_sub_guide.md', 'push_notifications_setup.md', 'service_workers_guide.md', 'storage_guide.md'] filestart = '../docs/media/' sn...
x = 9 y = 3 # Arithmetic Operators print(x+y) #Addition print(x-y) #Subtraction print(x*y) #Multiplication print(x/y) #Division print(x%y) #Modulus print(x**y) #Exponantiation x = 9.191823 print(x//y) #Floor Division #Assignment Operators x = 9 # set x = 9 x += 3 # x = x + 3 print(x) x = 9 x -= 3 # x = x - 3 ...
x = 9 y = 3 print(x + y) print(x - y) print(x * y) print(x / y) print(x % y) print(x ** y) x = 9.191823 print(x // y) x = 9 x += 3 print(x) x = 9 x -= 3 print(x) x *= 3 print(x) x /= 3 print(x) x **= 3 print(x) x = 9 y = 3 print(x == y) print(x != y) print(x > y) print(x < y) print(x >= y) print(x <= y)
#!/usr/bin/env python # -*- coding: utf-8 -*- # # File Name: Problem_3.py # Project Name: WebLearn # Author: Benjamin Zhang # Created Time: 2019-01-12 21:45 # Version: 0.0.1.20190112 # # Copyright (c) Benjamin Zhang 2019 # All rights reserved. # name = ["Adam", "Seth", "Enosh", "Ke...
name = ['Adam', 'Seth', 'Enosh', 'Kenan', 'Mahalalel', 'Jared', 'Enoch', 'Methuselah', 'Lamech', 'Noah', 'Shem', 'Ham', 'Japheth'] age = [930, 912, 905, 910, 895, 962, 365, 969, 777, 0, 0, 0, 0] def find_seniority(string): for i in range(0, len(age)): if name[i] == string: return 10 if i > 9 el...
infile = open("./local_models/time-all.normalized","r") outfile = open("./clustering/initial.dat","w") listoflists = [] for line in infile: listoflists.append(line.strip().split()) numtopics = len(listoflists[0])-1 numwords = len(listoflists) for topic in range(1,numtopics+1): #fancy indexing because words are st...
infile = open('./local_models/time-all.normalized', 'r') outfile = open('./clustering/initial.dat', 'w') listoflists = [] for line in infile: listoflists.append(line.strip().split()) numtopics = len(listoflists[0]) - 1 numwords = len(listoflists) for topic in range(1, numtopics + 1): outfile.write(str(topic) + ...
def check_ip_byte(string, i, chars_left, ip, dot='exist'): index, result = i + 1, 'fail' if len(string) - i >= chars_left: n = string[i] if n.isdigit(): i += 1 while n.isdigit(): if i < len(string): if string[i].isdigit(): ...
def check_ip_byte(string, i, chars_left, ip, dot='exist'): (index, result) = (i + 1, 'fail') if len(string) - i >= chars_left: n = string[i] if n.isdigit(): i += 1 while n.isdigit(): if i < len(string): if string[i].isdigit(): ...
class Solution: def findJudge(self, N: int, trust) -> int: helper = [set() for i in range(N)] for i, n in enumerate(trust): helper[n[0] - 1].add(n[1]) for i in range(N): if len(helper[i]) != 0: continue is_major = True for j, n...
class Solution: def find_judge(self, N: int, trust) -> int: helper = [set() for i in range(N)] for (i, n) in enumerate(trust): helper[n[0] - 1].add(n[1]) for i in range(N): if len(helper[i]) != 0: continue is_major = True for (...
i = 0 for i in range(0, 100): if i % 2 == 0: print(i) i+= i
i = 0 for i in range(0, 100): if i % 2 == 0: print(i) i += i
class componente: def equip(self): pass class CharacterConcreteComponent(componente): def __init__(self, name: str): self.name = name self.p1 = '' def e2(x): def a2(self): return f"{self.name} equipment:"+ x(self) return a2 @e2 def equip(self): ...
class Componente: def equip(self): pass class Characterconcretecomponent(componente): def __init__(self, name: str): self.name = name self.p1 = '' def e2(x): def a2(self): return f'{self.name} equipment:' + x(self) return a2 @e2 def equip(sel...
class Meta(dict): def __getattr__(self, name): try: return self[name] except KeyError: raise AttributeError(name) def __setattr__(self, name, value): self[name] = value def bind(self, name, func): setattr(self.__class__, name, func)
class Meta(dict): def __getattr__(self, name): try: return self[name] except KeyError: raise attribute_error(name) def __setattr__(self, name, value): self[name] = value def bind(self, name, func): setattr(self.__class__, name, func)
# Rain_Water_Trapping def trappedWater(a, size) : # left[i] stores height of tallest bar to the to left of it including itself left = [0] * size # Right [i] stores height of tallest bar to the to right of it including itself right = [0] * size # Initialize result waterVolume = 0 ...
def trapped_water(a, size): left = [0] * size right = [0] * size water_volume = 0 left[0] = a[0] for i in range(1, size): left[i] = max(left[i - 1], a[i]) right[size - 1] = a[size - 1] for i in range(size - 2, -1, -1): right[i] = max(right[i + 1], a[i]) for i in range(0, ...
# -*- coding: utf-8 -*- BOT_NAME = 'spider' SPIDER_MODULES = ['spiders'] NEWSPIDER_MODULE = 'spiders' ROBOTSTXT_OBEY = False # change cookie to yours #DEFAULT_REQUEST_HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36', # '...
bot_name = 'spider' spider_modules = ['spiders'] newspider_module = 'spiders' robotstxt_obey = False default_request_headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0', 'Cookie': 'SUB=_2A25MjPT-DeRhGeNM6VcX-SrJzjuIHXVvjpy2rDV6PUJbkdCOLXXzkW1NTiDEuD0Z5qOTeRYpEH6...
#Function to remove a given word from a list and strip it at the same time. def remove_and_split(string, word): newStr = string.replace(word, "") return newStr.strip() this = " Root is a Computer " n = remove_and_split(this, "Root") print(n)
def remove_and_split(string, word): new_str = string.replace(word, '') return newStr.strip() this = ' Root is a Computer ' n = remove_and_split(this, 'Root') print(n)
tableData = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']] def printTable(table): colWidth = [0] * len(table) #List of rjust values to be used for i in range(len(table)): #iterates through the 3 lists ...
table_data = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']] def print_table(table): col_width = [0] * len(table) for i in range(len(table)): rjustlength = 0 for j in table[i]: if len(j) > rjustlength: ...
N = int(input()) M = int(input()) S = int(input()) for num in range(M, N - 1, - 1): if num % 2 == 0 and num % 3 == 0: if num == S: break print(num, end=" ")
n = int(input()) m = int(input()) s = int(input()) for num in range(M, N - 1, -1): if num % 2 == 0 and num % 3 == 0: if num == S: break print(num, end=' ')
f=open('demo1.txt','a') a=int(input('enter number ')) f.write('hello hi\n') f.write('world') f.write(str(a)) f.close()
f = open('demo1.txt', 'a') a = int(input('enter number ')) f.write('hello hi\n') f.write('world') f.write(str(a)) f.close()
ALIEN = {'.----': '1', '..---': '2', '...--': '3', '....-': '4', '.....': '5', '-....': '6', '--...': '7', '---..': '8', '----.': '9', '-----': '0'} def morse_converter(s): return int(''.join(ALIEN[s[a:a + 5]] for a in xrange(0, len(s), 5)))
alien = {'.----': '1', '..---': '2', '...--': '3', '....-': '4', '.....': '5', '-....': '6', '--...': '7', '---..': '8', '----.': '9', '-----': '0'} def morse_converter(s): return int(''.join((ALIEN[s[a:a + 5]] for a in xrange(0, len(s), 5))))
def calculateAverageAge(students): add_age = 0 for thing in students.values(): age = thing['age'] add_age = add_age + age return(add_age / len(students.keys())) students = { "Peter": {"age": 10, "address": "Lisbon"}, "Isabel": {"age": 11, "address": "Sesimbra"}, "Ann...
def calculate_average_age(students): add_age = 0 for thing in students.values(): age = thing['age'] add_age = add_age + age return add_age / len(students.keys()) students = {'Peter': {'age': 10, 'address': 'Lisbon'}, 'Isabel': {'age': 11, 'address': 'Sesimbra'}, 'Anna': {'age': 9, 'address':...
# very old file that isn't very useful but it works with things so I'm keeping it for now class Rectangle: current_id = 0 tolerable_distance_to_combine_rectangles = 0.00005 # buildings need to be this (lat/long degrees) away to merge def __init__(self, init_points, to_id=True): self.points = init_...
class Rectangle: current_id = 0 tolerable_distance_to_combine_rectangles = 5e-05 def __init__(self, init_points, to_id=True): self.points = init_points self.deleted_rect_ids = [] if to_id: Rectangle.current_id += 1 self.id = Rectangle.current_id def merg...
class Solution: def restoreString(self, s: str, indices: List[int]) -> str: res = [0] * len(indices) for i, j in zip(s, indices) : res[j] = i return "".join(res)
class Solution: def restore_string(self, s: str, indices: List[int]) -> str: res = [0] * len(indices) for (i, j) in zip(s, indices): res[j] = i return ''.join(res)
class Move: def __init__(self, dest_rank_id, from_rank_id): self.dest_rank_id = dest_rank_id self.from_rank_id = from_rank_id def output(self): out_str = '' out_str += str(self.from_rank_id) out_str += ' -> ' out_str += str(self.dest_rank_id) print(out_str)
class Move: def __init__(self, dest_rank_id, from_rank_id): self.dest_rank_id = dest_rank_id self.from_rank_id = from_rank_id def output(self): out_str = '' out_str += str(self.from_rank_id) out_str += ' -> ' out_str += str(self.dest_rank_id) print(out_s...
# MatchJoin takes a list of matchers and joins them, to essentially # make a conjunctive matcher class MatchJoin: # @matchers A list of matchers to join into a single match for example # [ # LiteralMatch("hello ") # LiteralMatch("world") # ] def __init__(self, matchers : list): self....
class Matchjoin: def __init__(self, matchers: list): self.to_string_call_count = None self.matchers = matchers def parser(self, body: str, hard_fail=True): result = [] head = 0 for matcher in self.matchers: sub_body = body[head:] out = matcher.pa...
# Finds the optmial cost def find_opt_cost(data): min_cost = data[data.A == -1]['cost'].values[0] return min_cost # Finds the energy corresponding to optimal route def find_opt_energy(data): opt_energy = data[data.A == -1]['energy'].values[0] return opt_energy # Returns true if optimal route is obs...
def find_opt_cost(data): min_cost = data[data.A == -1]['cost'].values[0] return min_cost def find_opt_energy(data): opt_energy = data[data.A == -1]['energy'].values[0] return opt_energy def opt_found(data): min_cost = find_opt_cost(data) data_d = data[(data.cost == min_cost) & (data.valid == T...
class LayeredStreamReaderBase: __slots__ = {'upstream'} def __init__(self, upstream): self.upstream = upstream async def read(self, n): return await self.upstream.read(n) async def readexactly(self, n): return await self.upstream.readexactly(n)
class Layeredstreamreaderbase: __slots__ = {'upstream'} def __init__(self, upstream): self.upstream = upstream async def read(self, n): return await self.upstream.read(n) async def readexactly(self, n): return await self.upstream.readexactly(n)
# class class_name: # def __init__(self): # # def function_name(self): # return class Athlete: def __init__(self, value='Jane'): self.inner_value = value print(self.inner_value) def getInnerValue(self): return self.inner_value class InheritanceClass(Athlete): def _...
class Athlete: def __init__(self, value='Jane'): self.inner_value = value print(self.inner_value) def get_inner_value(self): return self.inner_value class Inheritanceclass(Athlete): def __init__(self): super().__init__() def set_value(self, first_value): self...
Import("env") # # Add -m32 to the linker (since PlatformIo is not capable directly!) # (and since we are at it, make everyting statically linked ;-) # env.Append( LINKFLAGS=[ "-m32", "-static-libgcc", "-static-libstdc++" ] )
import('env') env.Append(LINKFLAGS=['-m32', '-static-libgcc', '-static-libstdc++'])
class Programa: def __init__(self, nome, ano): self._nome = nome.title() self.ano = ano self._likes = 0 @property def likes(self): return self._likes def dar_like(self): self._likes += 1 @property def nome(self): return self._nome ...
class Programa: def __init__(self, nome, ano): self._nome = nome.title() self.ano = ano self._likes = 0 @property def likes(self): return self._likes def dar_like(self): self._likes += 1 @property def nome(self): return self._nome @nome.se...
class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: # Check edge case if not intervals: return [] # Sort the list to make it ascending with respect to the sub-list's first element and then in second element intervals = sorted(interv...
class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: if not intervals: return [] intervals = sorted(intervals, key=lambda x: (x[0], x[1])) res = [intervals[0]] for i in range(1, len(intervals)): if intervals[i][0] <= res[-1][1]: ...
__source__ = 'https://leetcode.com/problems/next-greater-element-iii/description/' # Time: O(n) # Space: O(n) # # Description: same as 556. Next Greater Element III # //xinzyang@tesla.com # // Next closest bigger number with the same digits # // You have to create a function that takes a positive integer number and re...
__source__ = 'https://leetcode.com/problems/next-greater-element-iii/description/' result = '\nIFang Lee ran 238 lines of Java (finished in 11.59s):\n\ngetRealNextBiggerInteger():\n12-> 21 true\n513 -> 531 true\n1342-> 1423 true\n534976-> 536479 true\n9999-> -1 true\n11-> -1 true\n0-> -1 true\n2147483647-> -1 true\n\n...
# Portal & Effect for Evan Intro | Dream World: Dream Forest Entrance (900010000) # Author: Tiger # "You who are seeking a Pact..." sm.showEffect("Map/Effect.img/evan/dragonTalk01", 3000)
sm.showEffect('Map/Effect.img/evan/dragonTalk01', 3000)
#implement STACK/LIFO using LIST stack=[] while True: choice=int(input("1 push, 2 pop, 3 peek, 4 display, 5 exit ")) if choice == 1: ele=int(input("enter element to push ")) stack.append(ele) elif choice == 2: if len(stack)>0: pele=stack.pop() print("poped elemnt ",pele) else: print("sta...
stack = [] while True: choice = int(input('1 push, 2 pop, 3 peek, 4 display, 5 exit ')) if choice == 1: ele = int(input('enter element to push ')) stack.append(ele) elif choice == 2: if len(stack) > 0: pele = stack.pop() print('poped elemnt ', pele) el...
#!/bin/python3 nombre = 3 nombres_premiers = [1, 2] print(2) try: while True: diviseurs = [] for diviseur in nombres_premiers: division = nombre / diviseur if division == int(division): diviseurs.append(diviseur) if len(diviseurs) == 1: pri...
nombre = 3 nombres_premiers = [1, 2] print(2) try: while True: diviseurs = [] for diviseur in nombres_premiers: division = nombre / diviseur if division == int(division): diviseurs.append(diviseur) if len(diviseurs) == 1: print(nombre) ...
DIGS = {1: 'F1D', 2: 'F2D', 3: 'F3D', 22: 'SD', -2: 'L2D'} SEC_ORDER_DIGS = {key: f'{val}_sec' for key, val in DIGS.items()} REV_DIGS = {'F1D': 1, 'F2D': 2, 'F3D': 3, 'SD': 22, 'L2D': -2} LEN_TEST = {1: 9, 2: 90, 3: 900, 22: 10, -2: 100} TEST_NAMES = {'F1D': 'First Digit Test', 'F2D': 'First Two Digits Test', ...
digs = {1: 'F1D', 2: 'F2D', 3: 'F3D', 22: 'SD', -2: 'L2D'} sec_order_digs = {key: f'{val}_sec' for (key, val) in DIGS.items()} rev_digs = {'F1D': 1, 'F2D': 2, 'F3D': 3, 'SD': 22, 'L2D': -2} len_test = {1: 9, 2: 90, 3: 900, 22: 10, -2: 100} test_names = {'F1D': 'First Digit Test', 'F2D': 'First Two Digits Test', 'F3D': ...
# model settings model = dict( type='NPID', neg_num=65536, backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3,), # no conv-1, x-1: stage-x norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict( type='LinearNeck', in_c...
model = dict(type='NPID', neg_num=65536, backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict(type='LinearNeck', in_channels=2048, out_channels=128, with_avg_pool=True), head=dict(type='ContrastiveHead', temperature=0.07), memory_bank=dict(type...
#!/usr/bin/env python3 # coding:utf-8 def estimate_area_from_stock(stock) : return 10000000000;
def estimate_area_from_stock(stock): return 10000000000
# CFG-RATE (0x06,0x08) packet (without header 0xB5,0x62) # payload length - 6 (little endian format), update rate 200ms, cycles - 1, reference - UTC (0) packet = [] packet = input('What is the payload? ') CK_A,CK_B = 0, 0 for i in range(len(packet)): CK_A = CK_A + packet[i] CK_B = CK_B + CK_A # ensure unsigned ...
packet = [] packet = input('What is the payload? ') (ck_a, ck_b) = (0, 0) for i in range(len(packet)): ck_a = CK_A + packet[i] ck_b = CK_B + CK_A ck_a = CK_A & 255 ck_b = CK_B & 255 print('UBX packet checksum:', '0x%02X,0x%02X' % (CK_A, CK_B))
class Course: def __init__(self, **kw): self.name = kw.pop('name') #def full_name(self): # return self.first_name + " " + self.last_name
class Course: def __init__(self, **kw): self.name = kw.pop('name')
'''Extracts the data from the json content. Outputs results in a dataframe''' def get_play_df(content): events = {} event_num = 0 home = content['gameData']['teams']['home']['id'] away = content['gameData']['teams']['away']['id'] for i in range(len(content['liveData']['plays']['allPlays'])...
"""Extracts the data from the json content. Outputs results in a dataframe""" def get_play_df(content): events = {} event_num = 0 home = content['gameData']['teams']['home']['id'] away = content['gameData']['teams']['away']['id'] for i in range(len(content['liveData']['plays']['allPlays'])): ...
def raio_simplificado(lista_composta): for elemento in lista_composta: yield from elemento lista_composta = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
def raio_simplificado(lista_composta): for elemento in lista_composta: yield from elemento lista_composta = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
#trying something new uridine_mods_paths = {'U_to_DDusA' : {'upstream_rxns' : ['U'], 'enzymes' : {20:['DusA_mono'], '20A':['DusA_mono'], 17:['DusA_mono'], ...
uridine_mods_paths = {'U_to_DDusA': {'upstream_rxns': ['U'], 'enzymes': {20: ['DusA_mono'], '20A': ['DusA_mono'], 17: ['DusA_mono'], 16: ['DusA_mono']}}, 'U_to_DDusgen': {'upstream_rxns': ['U'], 'enzymes': {20: ['generic_Dus'], '20A': ['generic_Dus'], 17: ['generic_Dus'], 16: ['generic_Dus']}}, 'U_to_Um': {'upstream_rx...
def run(): # Range can receive a first value that defines start value of range: range(1, 1000) for i in range(1000): print('Value ' + str(i)) if __name__ == '__main__': run()
def run(): for i in range(1000): print('Value ' + str(i)) if __name__ == '__main__': run()
def biggerIsGreater(w): w = list(w) x = len(w)-1 while x > 0 and w[x-1] >= w[x]: x -= 1 if x <= 0: return 'no answer' j = len(w) - 1 while w[j] <= w[x - 1]: j -= 1 w[x-1], w[j] = w[j], w[x-1] w[x:] = w[len(w)-1:x-1:-1] return ''.join(w)
def bigger_is_greater(w): w = list(w) x = len(w) - 1 while x > 0 and w[x - 1] >= w[x]: x -= 1 if x <= 0: return 'no answer' j = len(w) - 1 while w[j] <= w[x - 1]: j -= 1 (w[x - 1], w[j]) = (w[j], w[x - 1]) w[x:] = w[len(w) - 1:x - 1:-1] return ''.join(w)
# Add support for multiple event queues def upgrader(cpt): cpt.set('Globals', 'numMainEventQueues', '1') legacy_version = 12
def upgrader(cpt): cpt.set('Globals', 'numMainEventQueues', '1') legacy_version = 12
class Solution(object): def moveZeroes(self, nums): totalZeros = 0 for i in range(len(nums)): if nums[i] == 0 : totalZeros += 1 continue nums[i - totalZeros] = nums[i] if(totalZeros) : nums[i] = 0
class Solution(object): def move_zeroes(self, nums): total_zeros = 0 for i in range(len(nums)): if nums[i] == 0: total_zeros += 1 continue nums[i - totalZeros] = nums[i] if totalZeros: nums[i] = 0
# This file is created by generate_build_files.py. Do not edit manually. ssl_headers = [ "src/include/openssl/dtls1.h", "src/include/openssl/srtp.h", "src/include/openssl/ssl.h", "src/include/openssl/ssl3.h", "src/include/openssl/tls1.h", ] fips_fragments = [ "src/crypto/fipsmodule/aes/aes.c",...
ssl_headers = ['src/include/openssl/dtls1.h', 'src/include/openssl/srtp.h', 'src/include/openssl/ssl.h', 'src/include/openssl/ssl3.h', 'src/include/openssl/tls1.h'] fips_fragments = ['src/crypto/fipsmodule/aes/aes.c', 'src/crypto/fipsmodule/aes/aes_nohw.c', 'src/crypto/fipsmodule/aes/key_wrap.c', 'src/crypto/fipsmodule...
def possible_combination(string): n = len(string) count = [0] * (n + 1); count[0] = 1; count[1] = 1; for i in range(2, n + 1): count[i] = 0; if (string[i - 1] > '0'): count[i] = count[i - 1]; if (string[i - 2] == '1' or (string[i - 2] == '2' and ...
def possible_combination(string): n = len(string) count = [0] * (n + 1) count[0] = 1 count[1] = 1 for i in range(2, n + 1): count[i] = 0 if string[i - 1] > '0': count[i] = count[i - 1] if string[i - 2] == '1' or (string[i - 2] == '2' and string[i - 1] < '7'): ...
############################################################################### # Copyright (c) 2019, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory # Written by the Merlin dev team, listed in the CONTRIBUTORS file. # <merlin@llnl.gov> # # LLNL-CODE-797170 # All righ...
description = {'description': {}} batch = {'batch': {'type': 'local', 'dry_run': False, 'shell': '/bin/bash'}} env = {'env': {'variables': {}}} study_step_run = {'task_queue': 'merlin', 'shell': '/bin/bash', 'max_retries': 30} parameter = {'global.parameters': {}} merlin = {'merlin': {'resources': {'task_server': 'cele...
# Metadata Create Tests def test0_metadata_create(): return # Metadata Getters Tests def test0_metadata_name(): return def test0_metadata_ename(): return def test0_metadata_season(): return def test0_metadata_episode(): return def test0_metadata_quality(): return def test0_metadata_ex...
def test0_metadata_create(): return def test0_metadata_name(): return def test0_metadata_ename(): return def test0_metadata_season(): return def test0_metadata_episode(): return def test0_metadata_quality(): return def test0_metadata_extension(): return def test0_metadata_year(): ...
# coding: utf-8 # Author: zhao-zh10 # The function localize takes the following arguments: # # colors: # 2D list, each entry either 'R' (for red cell) or 'G' (for green cell). The environment is cyclic. # # measurements: # list of measurements taken by the robot, each entry either 'R' or 'G' # # motions:...
def localize(colors, measurements, motions, sensor_right, p_move): pinit = 1.0 / float(len(colors)) / float(len(colors[0])) p = [[pinit for col in range(len(colors[0]))] for row in range(len(colors))] assert len(motions) == len(measurements) for i in range(len(motions)): p = move(p, motions[i], ...
def foo(): print("In utility.py ==> foo()") if __name__=='__main__': foo()
def foo(): print('In utility.py ==> foo()') if __name__ == '__main__': foo()
count=0 def permute(s,l,pos,n): if pos>=n: global count count+=1 print(l) for k in l: print(s[k],end="") print() return for i in range(n): if i not in l[:pos]: l[pos] = i permute(s,l,pos+1,n) s="shivank" n=len(s) l=[]...
count = 0 def permute(s, l, pos, n): if pos >= n: global count count += 1 print(l) for k in l: print(s[k], end='') print() return for i in range(n): if i not in l[:pos]: l[pos] = i permute(s, l, pos + 1, n) s = 'shivank...
# https://leetcode.com/problems/divide-two-integers/ # class Solution: def divide(self, dividend: int, divisor: int) -> int: if dividend == divisor: return 1 isPositive = (dividend > 0 and divisor > 0) or (dividend < 0 and divisor < 0) dividend = dividend if d...
class Solution: def divide(self, dividend: int, divisor: int) -> int: if dividend == divisor: return 1 is_positive = dividend > 0 and divisor > 0 or (dividend < 0 and divisor < 0) dividend = dividend if dividend > 0 else -dividend divisor = divisor if divisor > 0 else -d...
#!/usr/bin/env python3 def linearSearch(lst,item): isFound = False for x in range(0,len(lst)): if item == lst[x]: isFound = True return "Item found at index " + str(x) elif (x == len(lst)-1) and (isFound == False): return "Item not found" if __name__ == '__main_...
def linear_search(lst, item): is_found = False for x in range(0, len(lst)): if item == lst[x]: is_found = True return 'Item found at index ' + str(x) elif x == len(lst) - 1 and isFound == False: return 'Item not found' if __name__ == '__main__': num_lst = ...
line = input() if line == 's3cr3t!P@ssw0rd': print("Welcome") else: print("Wrong password!")
line = input() if line == 's3cr3t!P@ssw0rd': print('Welcome') else: print('Wrong password!')
#%% def generate_range(min: int, max: int, step: int) -> None: for i in range(min, max + 1, step): print(i) generate_range(2, 10, 2) # %% # %% def generate_range(min: int, max: int, step: int) -> None: i = min while i <= max: print(i) i = i + step generate_range(2, 10, 2)
def generate_range(min: int, max: int, step: int) -> None: for i in range(min, max + 1, step): print(i) generate_range(2, 10, 2) def generate_range(min: int, max: int, step: int) -> None: i = min while i <= max: print(i) i = i + step generate_range(2, 10, 2)
begin_unit comment|'# Copyright 2015 Red Hat Inc' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at' nl|'\n' comment|'#' nl|'\n' comm...
begin_unit comment | '# Copyright 2015 Red Hat Inc' nl | '\n' comment | '# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl | '\n' comment | '# not use this file except in compliance with the License. You may obtain' nl | '\n' comment | '# a copy of the License at' nl | '\n' comment ...
while True: entrada = input() if entrada == '0': break entrada = input() joao = entrada.count('1') maria = entrada.count('0') print(f'Mary won {maria} times and John won {joao} times')
while True: entrada = input() if entrada == '0': break entrada = input() joao = entrada.count('1') maria = entrada.count('0') print(f'Mary won {maria} times and John won {joao} times')
# Age avergage with floating points # Var declarations # Code age1 = 10.0 age2 = 11.0 age3 = 13.0 age4 = 9.0 age5 = 12.0 result = (age1+age2+age3+age4+age5)/5.0 # Result print(result)
age1 = 10.0 age2 = 11.0 age3 = 13.0 age4 = 9.0 age5 = 12.0 result = (age1 + age2 + age3 + age4 + age5) / 5.0 print(result)
class Word: def __init__(self, cells): if not cells: raise ValueError("word cannot contain 0 cells") self.cell = cells[0] self.rest = Word(cells[1:]) if cells[1:] else None def _clear(self): self.cell |= 0 if self.rest: self.rest.clear() def ...
class Word: def __init__(self, cells): if not cells: raise value_error('word cannot contain 0 cells') self.cell = cells[0] self.rest = word(cells[1:]) if cells[1:] else None def _clear(self): self.cell |= 0 if self.rest: self.rest.clear() de...
'''6. Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged. Sample String : 'abc' Expected Result : 'abcing' Sample Strin...
"""6. Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged. Sample String : 'abc' Expected Result : 'abcing' Sample Strin...
# basic tuple functionality x = (1, 2, 3 * 4) print(x) try: x[0] = 4 except TypeError: print("TypeError") print(x) try: x.append(5) except AttributeError: print("AttributeError") print(x[1:]) print(x[:-1]) print(x[2:3]) print(x + (10, 100, 10000))
x = (1, 2, 3 * 4) print(x) try: x[0] = 4 except TypeError: print('TypeError') print(x) try: x.append(5) except AttributeError: print('AttributeError') print(x[1:]) print(x[:-1]) print(x[2:3]) print(x + (10, 100, 10000))
N = int(input()) list = [] for _ in range(N): command = input().rstrip().split() if "insert" in command: i = int(command[1]) e = int(command[2]) list.insert(i, e) elif "print" in command: print(list) elif "remove" in command: i = int(command[1]) list.remo...
n = int(input()) list = [] for _ in range(N): command = input().rstrip().split() if 'insert' in command: i = int(command[1]) e = int(command[2]) list.insert(i, e) elif 'print' in command: print(list) elif 'remove' in command: i = int(command[1]) list.remov...
# Store all kinds of lookup table. # # generate rsPoly lookup table. # from qrcode import base # def create_bytes(rs_blocks): # for r in range(len(rs_blocks)): # dcCount = rs_blocks[r].data_count # ecCount = rs_blocks[r].total_count - dcCount # rsPoly = base.Polynomial([1], 0) # ...
rs_poly_lut = {7: [1, 127, 122, 154, 164, 11, 68, 117], 10: [1, 216, 194, 159, 111, 199, 94, 95, 113, 157, 193], 13: [1, 137, 73, 227, 17, 177, 17, 52, 13, 46, 43, 83, 132, 120], 15: [1, 29, 196, 111, 163, 112, 74, 10, 105, 105, 139, 132, 151, 32, 134, 26], 16: [1, 59, 13, 104, 189, 68, 209, 30, 8, 163, 65, 41, 229, 98...
#!/bin/python3 # coding: utf-8 print ('input name: ') name = input() print ('input passwd: ') passwd = input() if name == 'A': print('A') if passwd == 'BB': print('BB') else: print('Other!')
print('input name: ') name = input() print('input passwd: ') passwd = input() if name == 'A': print('A') if passwd == 'BB': print('BB') else: print('Other!')
# Created by MechAviv # Map ID :: 940001050 # Hidden Street : East Pantheon sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) OBJECT_1 = sm.sendNpcController(3000107, -2000, 20) sm.showNpcSpecialActionByObjectId(OBJECT_1, "summon", 0) sm.setSpeakerID(3000107) sm.re...
sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) object_1 = sm.sendNpcController(3000107, -2000, 20) sm.showNpcSpecialActionByObjectId(OBJECT_1, 'summon', 0) sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(3) sm.s...
subreddit = "quackers987" #CHANGE THIS #Multiple subreddits can be specified by joining them with pluses, for example AskReddit+NoStupidQuestions. fileLog = "imageRemoveLog.txt" neededModPermissions = ['posts', 'flair'] removeSubmission = False logFullInfo = False checkResolution = True minHeight = 800 minWidth = 800...
subreddit = 'quackers987' file_log = 'imageRemoveLog.txt' needed_mod_permissions = ['posts', 'flair'] remove_submission = False log_full_info = False check_resolution = True min_height = 800 min_width = 800 low_res_reply = f'Your submission has been removed as it was deemed to be low resolution (less than {minWidth} x ...
# In Islandora 8 maps to Repository Item Content Type -> field_resource_type field # The field_resource_type field is a pointer to the Resource Types taxonomy # class Genre: def __init__(self): self.drupal_fieldname = 'field_genre' self.islandora_taxonomy = ['tags','genre'] self.mods_xpa...
class Genre: def __init__(self): self.drupal_fieldname = 'field_genre' self.islandora_taxonomy = ['tags', 'genre'] self.mods_xpath = 'mods/genre' self.dc_designator = 'type' self.genre = '' def set_genre(self, genre): if isinstance(genre, str) and genre != '': ...
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -----------------------------------------------------------------------...
project = 'nRF Asset Tracker' copyright = '2019-2021, Nordic Semiconductor ASA | nordicsemi.no' author = 'Nordic Semiconductor ASA | nordicsemi.no' extensions = ['sphinx_rtd_theme'] templates_path = ['_templates'] html_static_path = ['_static'] html_css_files = ['common.css'] exclude_patterns = ['_build', 'Thumbs.db', ...
while True: num = int(input("Enter an even number: ")) if num % 2 == 0: break print("Thanks for following directions.")
while True: num = int(input('Enter an even number: ')) if num % 2 == 0: break print('Thanks for following directions.')
#Tuple is a collection of ordered items. A tuple is immutable in nature. #Refer https://docs.python.org/3/library/stdtypes.html?#tuples for more information person= ("Susan","Christopher","Bill","Susan") print(person) print(person[1]) x= person.count("Susan") print("Occurrence of 'Susan' in tuple is:" + str(x)) l=['a...
person = ('Susan', 'Christopher', 'Bill', 'Susan') print(person) print(person[1]) x = person.count('Susan') print("Occurrence of 'Susan' in tuple is:" + str(x)) l = ['apple', 'oranges'] print(tuple(l))
def get_sdm_query(query,lambda_t=0.8,lambda_o=0.1,lambda_u=0.1): words = query.split() if len(words)==1: return f"#combine( {query} )" terms = " ".join(words) ordered = "".join([" #1({}) ".format(" ".join(bigram)) for bigram in zip(words,words[1:])]) unordered = "".jo...
def get_sdm_query(query, lambda_t=0.8, lambda_o=0.1, lambda_u=0.1): words = query.split() if len(words) == 1: return f'#combine( {query} )' terms = ' '.join(words) ordered = ''.join([' #1({}) '.format(' '.join(bigram)) for bigram in zip(words, words[1:])]) unordered = ''.join([' #uw8({}) '.f...