content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class MidasConfig(object): def __init__(self, linked: bool): self.linked = linked IS_DEBUG = True
class Midasconfig(object): def __init__(self, linked: bool): self.linked = linked is_debug = True
# Python program showing # a use of input() val = input("Enter your value: ") print(val) # Program to check input # type in Python num = input("Enter number :") print(num) name1 = input("Enter name : ") print(name1) # Printing type of input value print("type of number", type(num)) print("type of name", type(name1))...
val = input('Enter your value: ') print(val) num = input('Enter number :') print(num) name1 = input('Enter name : ') print(name1) print('type of number', type(num)) print('type of name', type(name1))
#!/usr/bin/env python3 """Implements disjoint-set data structures (so-called union-find data structures). Verification: [Union Find](https://judge.yosupo.jp/submission/11774) """ class UnionFind(object): """A simple implementation of disjoint-set data structures. """ def __init__(self, number_of_nodes...
"""Implements disjoint-set data structures (so-called union-find data structures). Verification: [Union Find](https://judge.yosupo.jp/submission/11774) """ class Unionfind(object): """A simple implementation of disjoint-set data structures. """ def __init__(self, number_of_nodes): """Create a dis...
listOfIntegers = [1, 2, 3, 4, 5, 6] for integer in listOfIntegers: if (integer % 2 == 0): print (integer) print ("All done.")
list_of_integers = [1, 2, 3, 4, 5, 6] for integer in listOfIntegers: if integer % 2 == 0: print(integer) print('All done.')
TYPES = ['exact', 'ava', 'like', 'text'] PER_PAGE_MAX = 50 DBS = ['dehkhoda', 'moein', 'amid', 'motaradef', 'farhangestan', 'sareh', 'ganjvajeh', 'wiki', 'slang', 'quran', 'name', 'thesis', 'isfahani', 'bakhtiari', 'tehrani', 'dezfuli', 'gonabadi', 'mazani'] ERROR_CODES = { "400": "f...
types = ['exact', 'ava', 'like', 'text'] per_page_max = 50 dbs = ['dehkhoda', 'moein', 'amid', 'motaradef', 'farhangestan', 'sareh', 'ganjvajeh', 'wiki', 'slang', 'quran', 'name', 'thesis', 'isfahani', 'bakhtiari', 'tehrani', 'dezfuli', 'gonabadi', 'mazani'] error_codes = {'400': 'failed to parse parameters', '401': 'i...
# Script: software_sales # Description: A software company sells a package that retails for $99. # This program asks the user to enter the number of packages purchased. The program # should then display the amount of the discount (if any) and the total amount of the # purchase aft...
discount1 = 50 discount2 = 40 discount3 = 30 discount4 = 20 def main(): print('A software company sells a package that retails for $99.') print('This program asks the user to enter the number of packages purchased. The program') print('should then display the amount of the discount (if any) and the total a...
# https://app.codesignal.com/arcade/code-arcade/lab-of-transformations/dB9drnfWzpiWznESA/ def alphanumericLess(s1, s2): tokens_1 = list(re.findall(r"[0-9]+|[a-z]", s1)) tokens_2 = list(re.findall(r"[0-9]+|[a-z]", s2)) idx = 0 # Tie breakers, if all compared values are the same then the first # diffe...
def alphanumeric_less(s1, s2): tokens_1 = list(re.findall('[0-9]+|[a-z]', s1)) tokens_2 = list(re.findall('[0-9]+|[a-z]', s2)) idx = 0 t_1_zeros = 0 t_2_zeros = 0 while idx < len(tokens_1) and idx < len(tokens_2): (token_1, token_2) = (tokens_1[idx], tokens_2[idx]) if token_1.isd...
""" *Pixel* A pixel is a color in point space. """ class Pixel( Point, Color, ): pass
""" *Pixel* A pixel is a color in point space. """ class Pixel(Point, Color): pass
# coding:utf-8 def redprint(str): print("\033[1;31m {0}\033[0m".format(str)) def greenprint(str): print("\033[1;32m {0}\033[0m".format(str)) def blueprint(str): print("\033[1;34m {0}\033[0m".format(str)) def yellowprint(str): print("\033[1;33m {0}\033[0m".format(str))
def redprint(str): print('\x1b[1;31m {0}\x1b[0m'.format(str)) def greenprint(str): print('\x1b[1;32m {0}\x1b[0m'.format(str)) def blueprint(str): print('\x1b[1;34m {0}\x1b[0m'.format(str)) def yellowprint(str): print('\x1b[1;33m {0}\x1b[0m'.format(str))
"""Settings for the ``cmsplugin_blog`` app.""" JQUERY_JS = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js' JQUERY_UI_JS = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js' JQUERY_UI_CSS = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/smoothness/jquery-ui.css'
"""Settings for the ``cmsplugin_blog`` app.""" jquery_js = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js' jquery_ui_js = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js' jquery_ui_css = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/smoothness/jquery-ui.css'
# ----------------------------------------------------- # Trust Game # Licensed under the MIT License # Written by Ye Liu (ye-liu at whu.edu.cn) # ----------------------------------------------------- cfg = { # Initial number of coins the user has 'initial_coins': 100, # Number of total rounds 'num_ro...
cfg = {'initial_coins': 100, 'num_rounds': 10, 'multiplier': 3, 'agent': {'use_same_gender': True, 'use_same_ethnic': True, 'means': [-0.8, -0.4, 0, 0.4, 0.8], 'variances': [1, 1.5, 2]}}
class Piece: def __init__(self, t, s): self.t = t self.blocks = [] rows = s.split('\n') for i in range(len(rows)): for j in range(len(rows[i])): if rows[i][j] == '+': self.blocks.append((i, j)) def get_color(t, active=False): return...
class Piece: def __init__(self, t, s): self.t = t self.blocks = [] rows = s.split('\n') for i in range(len(rows)): for j in range(len(rows[i])): if rows[i][j] == '+': self.blocks.append((i, j)) def get_color(t, active=False): retu...
# Enter your code here. Read input from STDIN. Print output to STDOUT def getMean(list): sum = 0 for i in list: sum += i mean = float(sum) / len(list) return mean def getMedian(list): median = 0.0 list.sort() if (len(list) % 2 == 0): median = float(list[len(list)//2 - 1] + li...
def get_mean(list): sum = 0 for i in list: sum += i mean = float(sum) / len(list) return mean def get_median(list): median = 0.0 list.sort() if len(list) % 2 == 0: median = float(list[len(list) // 2 - 1] + list[len(list) // 2]) / 2 else: median = list[(len(list) ...
# -*- coding: utf-8 -*- """ Created on Sun Jan 3 09:43:06 2021 @author: SethHarden """ # SLICING ------------------------------------------------ x = 'computer' #[start : end : step] print(x[1:6:2]) print(x[1:4]) #1 - 4 print(x[3:]) #3 - end print(x[:5]) #0 - 5 print(x[-1]) #gets from right side print(x[:-2]) #fro...
""" Created on Sun Jan 3 09:43:06 2021 @author: SethHarden """ x = 'computer' print(x[1:6:2]) print(x[1:4]) print(x[3:]) print(x[:5]) print(x[-1]) print(x[:-2]) print('-----------------------------------------') x = 'horse' + 'shoe' print(x) y = ['pig', 'cow'] + ['horse'] z = ('DoubleDz', 'Seth', 'Aroosh') + ('RickD'...
# Enumerated constants for voice tokens. SMART, STUPID, ORCISH, ELVEN, DRACONIAN, DWARVEN, GREEK, KITTEH, GNOMIC, \ HURTHISH = list(range( 10))
(smart, stupid, orcish, elven, draconian, dwarven, greek, kitteh, gnomic, hurthish) = list(range(10))
{ 'model_dir': '{this_dir}/model_data/', 'out_dir': 'output/masif_peptides/shape_only/', 'feat_mask': [1.0, 1.0, 0.0, 0.0, 0.0], }
{'model_dir': '{this_dir}/model_data/', 'out_dir': 'output/masif_peptides/shape_only/', 'feat_mask': [1.0, 1.0, 0.0, 0.0, 0.0]}
#!/usr/bin/python3 # -*- coding:utf-8 -*- # Project: http://plankton-toolbox.org # Copyright (c) 2010-2018 SMHI, Swedish Meteorological and Hydrological Institute # License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit). # import toolbox_utils # import plankton_core class DataImportUti...
class Dataimportutils(object): """ """ def __init__(self): """ """ def cleanup_scientific_name_cf(self, scientific_name, species_flag): """ """ new_scientific_name = scientific_name new_species_flag = species_flag if ' cf. '.upper() in (' ' + new_scientific_name + '...
def to_rna(dna_strand): rna_dict = { 'C':'G', 'G':'C', 'T':'A', 'A':'U' } ret = '' for char in dna_strand: ret += rna_dict[char] return ret
def to_rna(dna_strand): rna_dict = {'C': 'G', 'G': 'C', 'T': 'A', 'A': 'U'} ret = '' for char in dna_strand: ret += rna_dict[char] return ret
class Subtraction: print('Test Subtraction class') def __init__(self, x, y): self.x = x self.y = y print('This is Subtraction function and result of your numbers is : ', x-y)
class Subtraction: print('Test Subtraction class') def __init__(self, x, y): self.x = x self.y = y print('This is Subtraction function and result of your numbers is : ', x - y)
# number = input('Enter a Number') # w, x, y, z = 5, 10, 10, 20 # if w > x: # print('x equals y') # elif w < y: # print('Second Condition') # elif x == y: # print('Third Condition') # else: # print('Everything is False') # username = 'qaidjohar' # password = 'qwerty' # if not 5 == 5: # if (usern...
print('****Welcome To QJ Amusement Park****') age = int(input('Enter You Age: ')) if age <= 8: print('Your ticket is Rs.500') elif age <= 50: print('Your ticket is Rs.800') else: print('Your ticket is Rs. 300')
paths = \ [dict(steering_angle = -20, target_angle = -20, coords = \ [[0, 53, 91, 97], [0, 64, 97, 107], [15, 76, 107, 119], [33, 86, 119, 132], [47, 95, 132, 146], [59, 102, 146, 160], [69, 108, 160, 175], [76, 112, 175, 190]]), dict(st...
paths = [dict(steering_angle=-20, target_angle=-20, coords=[[0, 53, 91, 97], [0, 64, 97, 107], [15, 76, 107, 119], [33, 86, 119, 132], [47, 95, 132, 146], [59, 102, 146, 160], [69, 108, 160, 175], [76, 112, 175, 190]]), dict(steering_angle=-15, target_angle=-15, coords=[[0, 52, 34, 54], [15, 67, 54, 73], [33, 79, 73, 9...
tests = int(input()) for _ in range(tests): data = [float(num) for num in input().split()] sum = 2*data[0]+3*data[1]+5*data[2] print("%0.1f" % (sum/10))
tests = int(input()) for _ in range(tests): data = [float(num) for num in input().split()] sum = 2 * data[0] + 3 * data[1] + 5 * data[2] print('%0.1f' % (sum / 10))
# Append at the end of /etc/mailman/mm_cfg.py DEFAULT_ARCHIVE = Off DEFAULT_REPLY_GOES_TO_LIST = 1 DEFAULT_SUBSCRIBE_POLICY = 3 DEFAULT_MAX_NUM_RECIPIENTS = 30 DEFAULT_MAX_MESSAGE_SIZE = 10000 # KB
default_archive = Off default_reply_goes_to_list = 1 default_subscribe_policy = 3 default_max_num_recipients = 30 default_max_message_size = 10000
class Palindrome: def __init__(self, word, start, end): self.word = word self.start = int(start / 2) self.end = int(end / 2) def __str__(self): return self.word + " " + str(self.start) + " " + str(self.end) + "\n"
class Palindrome: def __init__(self, word, start, end): self.word = word self.start = int(start / 2) self.end = int(end / 2) def __str__(self): return self.word + ' ' + str(self.start) + ' ' + str(self.end) + '\n'
# -*- coding: utf-8 -*- dictTempoMusica = dict({"W":1,"H":1/2,"Q":1/4,"E":1/8,"S":1/16,"T":1/32,"X":1/64}) listSeqCompasso = list(map(str, input().split("/"))) while listSeqCompasso[0] != "*": listSeqCompasso.pop(0) listSeqCompasso.pop(-1) qntCompassoDuracaoCorreta = 0 for compasso in listSeqCompasso:...
dict_tempo_musica = dict({'W': 1, 'H': 1 / 2, 'Q': 1 / 4, 'E': 1 / 8, 'S': 1 / 16, 'T': 1 / 32, 'X': 1 / 64}) list_seq_compasso = list(map(str, input().split('/'))) while listSeqCompasso[0] != '*': listSeqCompasso.pop(0) listSeqCompasso.pop(-1) qnt_compasso_duracao_correta = 0 for compasso in listSeqCom...
def decode(message): first_4 = message[:4] first = add_ordinals(message[0], message[-1]) second = add_ordinals(message[1], message[0]) third = add_ordinals(message[2], message[1]) fourth = add_ordinals(message[3], message[2]) fifth = add_ordinals(message[-4], message[-5]) sixth = add_ordin...
def decode(message): first_4 = message[:4] first = add_ordinals(message[0], message[-1]) second = add_ordinals(message[1], message[0]) third = add_ordinals(message[2], message[1]) fourth = add_ordinals(message[3], message[2]) fifth = add_ordinals(message[-4], message[-5]) sixth = add_ordinal...
_empty = [] _simple = [1, 2, 3] _complex = [{"value": 1}, {"value": 2}, {"value": 3}] _locations = [ ("Scotland", "Edinburgh", "Branch1", 20000), ("Scotland", "Glasgow", "Branch1", 12500), ("Scotland", "Glasgow", "Branch2", 12000), ("Wales", "Cardiff", "Branch1", 29700), ("Wales", "Cardiff", "Branc...
_empty = [] _simple = [1, 2, 3] _complex = [{'value': 1}, {'value': 2}, {'value': 3}] _locations = [('Scotland', 'Edinburgh', 'Branch1', 20000), ('Scotland', 'Glasgow', 'Branch1', 12500), ('Scotland', 'Glasgow', 'Branch2', 12000), ('Wales', 'Cardiff', 'Branch1', 29700), ('Wales', 'Cardiff', 'Branch2', 30000), ('Wales',...
def hamming_distance(x: int, y: int): """ Calculate the number of bits that are different between 2 numbers. Args: x: first integer to calculate distance on Y: second integer to calculate distance on Returns: An integer representing the number of bits that are different ...
def hamming_distance(x: int, y: int): """ Calculate the number of bits that are different between 2 numbers. Args: x: first integer to calculate distance on Y: second integer to calculate distance on Returns: An integer representing the number of bits that are different ...
""" Objective 14 - Perform basic dictionary operations """ """ Add "Herb" to the phonebook with the number 7653420789. Remove "Bill" from the phonebook. """ phonebook = { "Abe": 4569874321, "Bill": 7659803241, "Barry": 6573214789 } # YOUR CODE HERE phonebook['Herb'] = 7653420789 del phonebook['Bill...
""" Objective 14 - Perform basic dictionary operations """ '\nAdd "Herb" to the phonebook with the number 7653420789.\nRemove "Bill" from the phonebook.\n' phonebook = {'Abe': 4569874321, 'Bill': 7659803241, 'Barry': 6573214789} phonebook['Herb'] = 7653420789 del phonebook['Bill'] if 'Herb' in phonebook: print(...
MYSQL_DB = 'edxapp' MYSQL_USER = 'root' MYSQL_PSWD = '' MONGO_DB = 'edxapp' MONGO_DISCUSSION_DB = 'cs_comments_service_development'
mysql_db = 'edxapp' mysql_user = 'root' mysql_pswd = '' mongo_db = 'edxapp' mongo_discussion_db = 'cs_comments_service_development'
# coding: utf-8 class DataBatch: def __init__(self, torch_module): self._data = [] self._label = [] self.torch_module = torch_module def append_data(self, new_data): self._data.append(self.__as_tensor(new_data)) def append_label(self, new_label): self._label.appen...
class Databatch: def __init__(self, torch_module): self._data = [] self._label = [] self.torch_module = torch_module def append_data(self, new_data): self._data.append(self.__as_tensor(new_data)) def append_label(self, new_label): self._label.append(self.__as_tenso...
""" Problem: Given an integer n, return the length of the longest consecutive run of 1s in its binary representation. For example, given 156, you should return 3. """ def get_longest_chain_of_1s(num: int) -> int: num = bin(num)[2:] chain_max = 0 chain_curr = 0 for char in num: if char == "1...
""" Problem: Given an integer n, return the length of the longest consecutive run of 1s in its binary representation. For example, given 156, you should return 3. """ def get_longest_chain_of_1s(num: int) -> int: num = bin(num)[2:] chain_max = 0 chain_curr = 0 for char in num: if char == '1':...
input = """ p cnf 3 4 -1 2 3 0 1 -2 0 1 -3 0 -1 -2 0 """ output = """ SAT """
input = '\np cnf 3 4\n-1 2 3 0\n1 -2 0\n1 -3 0\n-1 -2 0\n' output = '\nSAT\n'
"""A programe which will find all such numers between 1000 and 3000 such that each digit of the number is an even number""" #num1=0 #num2=0 #num3=0 #num4=0 #real=0 #lresult=[] #def even(num,num1,num2,num3,real): # if (num%2==0) and (num1%2==0) and (num2%2==0) and (num3%2==0): # lresult.append(real) #for value in ran...
"""A programe which will find all such numers between 1000 and 3000 such that each digit of the number is an even number""" 'v is a list containig numbers. write code to find and print the highest two values \nin v. If the list contains only one number, print only that number. If the list is empty,\nprint nothing .\nFo...
def find(A): low = 0 high = len(A) - 1 while low < high: mid = (low + high) // 2 if A[mid] > A[high]: low = mid + 1 elif A[mid] <= A[high]: high = mid return low A = [4, 5, 6, 7, 1, 2, 3] idx = find(A) print(A[idx])
def find(A): low = 0 high = len(A) - 1 while low < high: mid = (low + high) // 2 if A[mid] > A[high]: low = mid + 1 elif A[mid] <= A[high]: high = mid return low a = [4, 5, 6, 7, 1, 2, 3] idx = find(A) print(A[idx])
class ladder: def __init__(self): self.start=0 self.end=0
class Ladder: def __init__(self): self.start = 0 self.end = 0
#$Id: embed_pythonLib.py,v 1.3 2010/10/05 19:24:18 jrb Exp $ def generate(env, **kw): if not kw.get('depsOnly',0): env.Tool('addLibrary', library = ['embed_python']) if env['PLATFORM'] == 'posix': env.AppendUnique(LINKFLAGS = ['-rdynamic']) if env['PLATFORM'] == "win32" and env.get('CONTAIN...
def generate(env, **kw): if not kw.get('depsOnly', 0): env.Tool('addLibrary', library=['embed_python']) if env['PLATFORM'] == 'posix': env.AppendUnique(LINKFLAGS=['-rdynamic']) if env['PLATFORM'] == 'win32' and env.get('CONTAINERNAME', '') == 'GlastRelease': env.Tool('findPkgPath', p...
class Solution: def letterCasePermutation(self, s: str) -> List[str]: """ Time complexity O(N!) - factorial time need to generate all permutations Space complexity O(N!) Approach: Using BFS generate new permutations by append one more char to all previous generat...
class Solution: def letter_case_permutation(self, s: str) -> List[str]: """ Time complexity O(N!) - factorial time need to generate all permutations Space complexity O(N!) Approach: Using BFS generate new permutations by append one more char to all previous gene...
# -*- coding: utf-8 -*- # Copyright by BlueWhale. All Rights Reserved. class ValidateError(ValueError): def __init__(self, val, msg: str, *args): super().__init__(val, msg, *args) self.__val = val self.__msg = msg @property def val(self): return self.__val @property ...
class Validateerror(ValueError): def __init__(self, val, msg: str, *args): super().__init__(val, msg, *args) self.__val = val self.__msg = msg @property def val(self): return self.__val @property def msg(self): return self.__msg class Fieldseterror(Runtime...
# V0 class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def str2tree(self, s): """ :type s: str :rtype: TreeNode """ def str2treeHelper(s, i): start = i if...
class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def str2tree(self, s): """ :type s: str :rtype: TreeNode """ def str2tree_helper(s, i): start = i if ...
def setup(): #this is your canvas size size(1000,1000) #fill(34,45,56,23) #background(192, 64, 0) stroke(255) colorMode(RGB) strokeWeight(1) #rect(150,150,150,150) def draw(): x=mouseX y=mouseY ix=width-x iy=height-y px=pmouseX py=pmouseY ...
def setup(): size(1000, 1000) stroke(255) color_mode(RGB) stroke_weight(1) def draw(): x = mouseX y = mouseY ix = width - x iy = height - y px = pmouseX py = pmouseY background(0, 0, 0) stroke_weight(5) line(x, y, ix, iy) stroke_weight(120) point(40, x) i...
def binary_search(coll, elem): low = 0 high = len(coll) - 1 while low <= high: middle = (low + high) // 2 guess = coll[middle] if guess == elem: return middle if guess > elem: high = middle - 1 else: low = middle + 1 return N...
def binary_search(coll, elem): low = 0 high = len(coll) - 1 while low <= high: middle = (low + high) // 2 guess = coll[middle] if guess == elem: return middle if guess > elem: high = middle - 1 else: low = middle + 1 return None...
# Time Complexity => O(n^2 + log n) ; log n for sorting class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: output = [] nums.sort() for i in range(len(nums)-2): if i>0 and nums[i]==nums[i-1]: continue j = i+1 k = len(nu...
class Solution: def three_sum(self, nums: List[int]) -> List[List[int]]: output = [] nums.sort() for i in range(len(nums) - 2): if i > 0 and nums[i] == nums[i - 1]: continue j = i + 1 k = len(nums) - 1 while j < k: ...
# input 3 number and calculate middle number def Middle_3Num_Calc(a, b, c): if a >= b: if b >= c: return b elif a <= c: return a else: return c elif a > c: return a elif b > c: return c else: return b def Middle_3Num_C...
def middle_3_num__calc(a, b, c): if a >= b: if b >= c: return b elif a <= c: return a else: return c elif a > c: return a elif b > c: return c else: return b def middle_3_num__calc_ver2(a, b, c): if b >= a and c <= ...
# -*- coding: utf-8 -*- class Null(object): def __init__(self, *args, **kwargs): return None def __call__(self, *args, **kwargs): return self def __getattr__(self, name): return self def __setattr__(self, name, value): return self def __delattr__(self, name): ...
class Null(object): def __init__(self, *args, **kwargs): return None def __call__(self, *args, **kwargs): return self def __getattr__(self, name): return self def __setattr__(self, name, value): return self def __delattr__(self, name): return self de...
batch_size = 32 epochs = 200 lr = 0.01 momentum = 0.9 no_cuda =False cuda_id = '0' seed = 1 log_interval = 10 l2_decay = 5e-4 class_num = 31 param = 0.3 bottle_neck = True root_path = "/data/zhuyc/OFFICE31/" source_name = "dslr" target_name = "amazon"
batch_size = 32 epochs = 200 lr = 0.01 momentum = 0.9 no_cuda = False cuda_id = '0' seed = 1 log_interval = 10 l2_decay = 0.0005 class_num = 31 param = 0.3 bottle_neck = True root_path = '/data/zhuyc/OFFICE31/' source_name = 'dslr' target_name = 'amazon'
def solution(record): Change = "Change" entry = {"Enter": " entered .", "Leave": " left." } recs = [] for r in record: r = r.split(" ") recs.append(r) # Change user id for all record first. for r in recs: uid = "" nickname = "" if (Chang...
def solution(record): change = 'Change' entry = {'Enter': ' entered .', 'Leave': ' left.'} recs = [] for r in record: r = r.split(' ') recs.append(r) for r in recs: uid = '' nickname = '' if Change in r: uid = r[1] nickname = r[2] ...
with open("input4.txt") as f: raw = f.read() pp = raw.split("\n\n") ppd = list() for p in pp: p = p.replace("\n", " ") p = p.strip() if not p: continue pairs = p.split(" ") ppd.append({s.split(":")[0]: s.split(":")[1] for s in pairs}) def isvalid(p): if not {"byr", "iyr", "eyr", ...
with open('input4.txt') as f: raw = f.read() pp = raw.split('\n\n') ppd = list() for p in pp: p = p.replace('\n', ' ') p = p.strip() if not p: continue pairs = p.split(' ') ppd.append({s.split(':')[0]: s.split(':')[1] for s in pairs}) def isvalid(p): if not {'byr', 'iyr', 'eyr', 'hg...
class Block(object): def __init__(self, block): self.block = block def get_block(self): return self.block def set_block(self, new_block): self.block = new_block
class Block(object): def __init__(self, block): self.block = block def get_block(self): return self.block def set_block(self, new_block): self.block = new_block
# Author: Nic Wolfe <nic@wolfeden.ca> # URL: http://code.google.com/p/sickbeard/ # # This file is part of Sick Beard. # # Sick Beard 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 3 of the Lice...
ep_regexes = [('standard_repeat', '\n ^(?P<series_name>.+?)[. _-]+ # Show_Name and separator\n s(?P<season_num>\\d+)[. _-]* # S01 and optional separator\n e(?P<ep_num>\\d+) # E02 and separator\n ([. _-]+s(?...
''' Problem 48 @author: Kevin Ji ''' def self_power_with_mod(number, mod): product = 1 for _ in range(number): product *= number product %= mod return product MOD = 10000000000 number = 0 for power in range(1, 1000 + 1): number += self_power_with_mod(power, MOD) number %= MOD ...
""" Problem 48 @author: Kevin Ji """ def self_power_with_mod(number, mod): product = 1 for _ in range(number): product *= number product %= mod return product mod = 10000000000 number = 0 for power in range(1, 1000 + 1): number += self_power_with_mod(power, MOD) number %= MOD print...
# Code for demo_03 def captureInfoCam(): GPIO.setwarnings(False) # Ignore warning for now GPIO.setmode(GPIO.BOARD) # Use physical pin numbering subprocess.call(['fswebcam -r 640x480 --no-banner /home/pi/Desktop/image.jpg', '-1'], shell=True) #Azure face_uri = "https://raspberr...
def capture_info_cam(): GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) subprocess.call(['fswebcam -r 640x480 --no-banner /home/pi/Desktop/image.jpg', '-1'], shell=True) face_uri = 'https://raspberrycp.cognitiveservices.azure.com/vision/v1.0/analyze?visualFeatures=Faces&language=en' path_to_file_in...
wagons = int(input()) wagons_list = [0 for _ in range(wagons)] command = input().split() while "End" not in command: if "add" in command: wagons_list[-1] += int(command[1]) elif "insert" in command: wagons_list[int(command[1])] += int(command[2]) elif "leave" in command: wagons_list...
wagons = int(input()) wagons_list = [0 for _ in range(wagons)] command = input().split() while 'End' not in command: if 'add' in command: wagons_list[-1] += int(command[1]) elif 'insert' in command: wagons_list[int(command[1])] += int(command[2]) elif 'leave' in command: wagons_list[...
# Copyright (C) 2019-2020 Petr Pavlu <setup@dagobah.cz> # SPDX-License-Identifier: MIT """StorePass exceptions.""" class StorePassException(Exception): """Base StorePass exception.""" class ModelException(StorePassException): """Exception when working with a model.""" class StorageException(StorePassExce...
"""StorePass exceptions.""" class Storepassexception(Exception): """Base StorePass exception.""" class Modelexception(StorePassException): """Exception when working with a model.""" class Storageexception(StorePassException): """Base storage exception.""" class Storagereadexception(StorageException): ...
class Solution(object): def average(self, salary): """ :type salary: List[int] :rtype: float """ # Runtime: 24 ms # Memory: 13.4 MB # In Python 2, you need to convert the divisor/dividend into float in order to get a float answer return (sum(salary) -...
class Solution(object): def average(self, salary): """ :type salary: List[int] :rtype: float """ return (sum(salary) - min(salary) - max(salary)) / float(len(salary) - 2)
# -------------- ##File path for the file file_path def read_file(path): file = open(file_path, 'r') sentence = file.readline() file.close() return sentence sample_message = read_file(file_path) # -------------- #Code starts here #Function to fuse message def fuse_msg(message_a,me...
file_path def read_file(path): file = open(file_path, 'r') sentence = file.readline() file.close() return sentence sample_message = read_file(file_path) def fuse_msg(message_a, message_b): quot = int(message_b) // int(message_a) return str(quot) message_1 = read_file(file_path_1) print(message...
class Solution: def partitionLabels(self, string): """O(N) time | O(1) space""" chars = {} for i, char in enumerate(string): if char in chars: chars[char][1] = i else: chars[char] = [i, i] partitions = [] i = prev = 0 ...
class Solution: def partition_labels(self, string): """O(N) time | O(1) space""" chars = {} for (i, char) in enumerate(string): if char in chars: chars[char][1] = i else: chars[char] = [i, i] partitions = [] i = prev = ...
# 3.uzdevums my_name = str(input('Enter sentence ')) words = my_name.split() rev_list = [word[::-1] for word in words] rev_string=" ".join(rev_list) result=rev_string.capitalize() print(result) print(" ".join([w[::-1] for w in my_name.split()]).capitalize())
my_name = str(input('Enter sentence ')) words = my_name.split() rev_list = [word[::-1] for word in words] rev_string = ' '.join(rev_list) result = rev_string.capitalize() print(result) print(' '.join([w[::-1] for w in my_name.split()]).capitalize())
# def math(num1, num2, operation='add'): # if(operation == "mult"): # return num1 * num2 # if(operation == "div"): # return num1 / num2 # if(operation == "sub"): # return num1 - num2 # if(operation == "add"): # return num1 + num2 # else: # print("not a valid o...
def multiply(num1, num2): return num1 * num2 y = multiply(10, 20) print(y)
""" Control Flow II - SOLUTION """ # Write a Python program that prints all the numbers from 0 to 6 except 3 and 6. Note : Use 'continue' statement. for i in range(6): if (i == 3 or i ==6): continue print(i,end=' ') print("\n")
""" Control Flow II - SOLUTION """ for i in range(6): if i == 3 or i == 6: continue print(i, end=' ') print('\n')
""" Euclidean algorithm (greatest common divisor (GCD)) """ def euclidean(a, b): while a != 0 and b != 0: if a > b: a = a % b else: b = b % a gcd = a or b return gcd def test_euclidean(): """ Tests """ assert(euclidean(30, 18) == 6) assert(euclidean(1...
""" Euclidean algorithm (greatest common divisor (GCD)) """ def euclidean(a, b): while a != 0 and b != 0: if a > b: a = a % b else: b = b % a gcd = a or b return gcd def test_euclidean(): """ Tests """ assert euclidean(30, 18) == 6 assert euclidean(10, ...
def binary_search(arr, target): low, high = 0, len(arr)-1 while low < high: mid = (low + high)/2 if arr[mid] == target: return mid elif arr[mid] > target: high = mid - 1 else: low = mid + 1 try: if arr[high] == target: return high else: return -1 except Ind...
def binary_search(arr, target): (low, high) = (0, len(arr) - 1) while low < high: mid = (low + high) / 2 if arr[mid] == target: return mid elif arr[mid] > target: high = mid - 1 else: low = mid + 1 try: if arr[high] == target: ...
MOD_ID = 'id' MOD_RGB = 'rgb' MOD_SS_DENSE = 'semseg_dense' MOD_SS_CLICKS = 'semseg_clicks' MOD_SS_SCRIBBLES = 'semseg_scribbles' MOD_VALIDITY = 'validity_mask' SPLIT_TRAIN = 'train' SPLIT_VALID = 'val' MODE_INTERP = { MOD_ID: None, MOD_RGB: 'bilinear', MOD_SS_DENSE: 'nearest', MOD_SS_CLICKS: 'sparse...
mod_id = 'id' mod_rgb = 'rgb' mod_ss_dense = 'semseg_dense' mod_ss_clicks = 'semseg_clicks' mod_ss_scribbles = 'semseg_scribbles' mod_validity = 'validity_mask' split_train = 'train' split_valid = 'val' mode_interp = {MOD_ID: None, MOD_RGB: 'bilinear', MOD_SS_DENSE: 'nearest', MOD_SS_CLICKS: 'sparse', MOD_SS_SCRIBBLES:...
nmbr = 3 if nmbr % 2 == 0: print("%d is even" % nmbr) elif nmbr == 0: print("%d is zero" % nmbr) else: print("%d is odd" % nmbr) free = "free"; print("I am free") if free == "free" else print("I am not free") # Nested Conditions nmbr = 4 if nmbr % 2 == 0: if nmbr % 4 == 0: print("I can pas...
nmbr = 3 if nmbr % 2 == 0: print('%d is even' % nmbr) elif nmbr == 0: print('%d is zero' % nmbr) else: print('%d is odd' % nmbr) free = 'free' print('I am free') if free == 'free' else print('I am not free') nmbr = 4 if nmbr % 2 == 0: if nmbr % 4 == 0: print('I can pass all the condititions!') i...
class Book: """ Model for Book object """ def __init__(self, title, author): self.title = title self.author = author self.bookmark = None self.read = False def setBookmark(self, page): """ Sets bookmark attribute of a book to given page """ self.bookmark = page def read(self): """ Changes read...
class Book: """ Model for Book object """ def __init__(self, title, author): self.title = title self.author = author self.bookmark = None self.read = False def set_bookmark(self, page): """ Sets bookmark attribute of a book to given page """ self.bookmark = ...
class Node: def __init__(self, key): self.left = None self.right = None self.val = key def insert(root, key): if root is None: return Node(key) else: if root.val == key: return root elif root.val < key: root.right = insert(root.right,...
class Node: def __init__(self, key): self.left = None self.right = None self.val = key def insert(root, key): if root is None: return node(key) elif root.val == key: return root elif root.val < key: root.right = insert(root.right, key) else: ...
#!/usr/bin/python3 """ Part of speech tagging in python using Hidden Markov Model. POS tagging using Hidden Markov model (Viterbi algorithm) """ __author__ = "Sunil" __copyright__ = "Copyright (c) 2017 Sunil" __license__ = "MIT License" __email__ = "suba5417@colorado.edu" __version__ = "0.1" class PennTreebank(obje...
""" Part of speech tagging in python using Hidden Markov Model. POS tagging using Hidden Markov model (Viterbi algorithm) """ __author__ = 'Sunil' __copyright__ = 'Copyright (c) 2017 Sunil' __license__ = 'MIT License' __email__ = 'suba5417@colorado.edu' __version__ = '0.1' class Penntreebank(object): """ Dict...
DEBUG = True SECRET_KEY = 'topsecret' #SQLALCHEMY_DATABASE_URI = 'postgresql://yazhu:root@localhost/matcha' # SQLALCHEMY_DATABASE_URI = 'postgresql://jchung:@localhost/matcha' SQLALCHEMY_DATABASE_URI = 'postgresql://root:1234@localhost/matcha' SQLALCHEMY_TRACK_MODIFICATIONS = False ACCOUNT_ACTIVATION = False ROOT_URL ...
debug = True secret_key = 'topsecret' sqlalchemy_database_uri = 'postgresql://root:1234@localhost/matcha' sqlalchemy_track_modifications = False account_activation = False root_url = 'localhost:5000' redirect_http = False
"""Defines a node for link-based data structures""" class Node: """A node in the linked list""" def __init__(self, next=None, data=None): self.next = next self.data = data def __eq__(self, other): return self.data == other.data def __repr__(self): return repr(self.data...
"""Defines a node for link-based data structures""" class Node: """A node in the linked list""" def __init__(self, next=None, data=None): self.next = next self.data = data def __eq__(self, other): return self.data == other.data def __repr__(self): return repr(self.dat...
PURCHASE_NO_CLIENT_STATE = 0 PURCHASE_WAITING_STATE = 1 PURCHASE_PLAYAGAIN_STATE = 2 PURCHASE_EXIT_STATE = 3 PURCHASE_DISCONNECTED_STATE = 4 PURCHASE_UNREPORTED_STATE = 10 PURCHASE_REPORTED_STATE = 11 PURCHASE_CANTREPORT_STATE = 12 PURCHASE_COUNTDOWN_TIME = 120
purchase_no_client_state = 0 purchase_waiting_state = 1 purchase_playagain_state = 2 purchase_exit_state = 3 purchase_disconnected_state = 4 purchase_unreported_state = 10 purchase_reported_state = 11 purchase_cantreport_state = 12 purchase_countdown_time = 120
# 14. Write a program in Python to calculate the volume of a sphere rad=int(input("Enter radius of the sphere: ")) vol=(4/3)*3.14*(rad**3) print("Volume of the sphere= ",vol)
rad = int(input('Enter radius of the sphere: ')) vol = 4 / 3 * 3.14 * rad ** 3 print('Volume of the sphere= ', vol)
''' Created on Aug 10, 2017 @author: Itai Agmon ''' class ReportElementType(): REGULAR = "regular" LINK = "lnk" IMAGE = "img" HTML = "html" STEP = "step" START_LEVEL = "startLevel" STOP_LEVEL = "stopLevel" class ReportElementStatus(): SUCCESS = "success" WARNING = "warning" FA...
""" Created on Aug 10, 2017 @author: Itai Agmon """ class Reportelementtype: regular = 'regular' link = 'lnk' image = 'img' html = 'html' step = 'step' start_level = 'startLevel' stop_level = 'stopLevel' class Reportelementstatus: success = 'success' warning = 'warning' failur...
{ "targets": [ { "target_name": "strings", "sources": ["main.cpp"], "cflags": ["-Wall", "-Wextra", "-ansi", "-O3"], "include_dirs" : ["<!(node -e \"require('nan')\")"] } ] }
{'targets': [{'target_name': 'strings', 'sources': ['main.cpp'], 'cflags': ['-Wall', '-Wextra', '-ansi', '-O3'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}]}
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: anagrams = {} for str in strs: key = ''.join(sorted(str)) if key not in anagrams: anagrams[key] = [] anagrams[key].append(str) return list(anagrams.values())
class Solution: def group_anagrams(self, strs: List[str]) -> List[List[str]]: anagrams = {} for str in strs: key = ''.join(sorted(str)) if key not in anagrams: anagrams[key] = [] anagrams[key].append(str) return list(anagrams.values())
class Car: # Class-level wheels = 4 def __init__(self, manufacturer: str, model: str, color: str, mileage: int): # Instance-level self.manufacturer = manufacturer self.model = model self.color = color self.mileage = mileage # Method def add_mileage(self, mil...
class Car: wheels = 4 def __init__(self, manufacturer: str, model: str, color: str, mileage: int): self.manufacturer = manufacturer self.model = model self.color = color self.mileage = mileage def add_mileage(self, miles: int) -> str: self.mileage += miles p...
def gcd(a, b): while b != 0: a, b = b, a % b return a def lcm(a, b, g): return a * b // g A, B = (int(term) for term in input().split()) g = gcd(A, B) print(g) print(lcm(A, B, g))
def gcd(a, b): while b != 0: (a, b) = (b, a % b) return a def lcm(a, b, g): return a * b // g (a, b) = (int(term) for term in input().split()) g = gcd(A, B) print(g) print(lcm(A, B, g))
def solution(a, b): answer = 0 for x,y in zip(a,b): answer+=x*y return answer
def solution(a, b): answer = 0 for (x, y) in zip(a, b): answer += x * y return answer
AVAILABLE_OPTIONS = [('doc_m2m_prob_threshold', 'Probability threshold for showing document to mass2motif links'), ('doc_m2m_overlap_threshold', 'Threshold on overlap score for showing document to mass2motif links'), ('log_peakset_intensities', 'Whether or not to log the peakset intensities (...
available_options = [('doc_m2m_prob_threshold', 'Probability threshold for showing document to mass2motif links'), ('doc_m2m_overlap_threshold', 'Threshold on overlap score for showing document to mass2motif links'), ('log_peakset_intensities', 'Whether or not to log the peakset intensities (true,false)'), ('heatmap_mi...
phi, d, t, coll = input().split() phi = float(phi) phi_1 = phi - 0.01 phi_2 = phi + 0.01 print(str(phi) + " " + "0.00001" + " " + "0.1 " + str(t) + " 10 20")
(phi, d, t, coll) = input().split() phi = float(phi) phi_1 = phi - 0.01 phi_2 = phi + 0.01 print(str(phi) + ' ' + '0.00001' + ' ' + '0.1 ' + str(t) + ' 10 20')
class usuario(object): def __init__(self, nombre, apellido, edad, genero): self.nombre = nombre self.apellido = apellido self.edad = edad self.genero = genero def descripcion_usuario(self): print("Nombre: " + self.nombre.title() + "\nApellido: " + self.apellido.title() +...
class Usuario(object): def __init__(self, nombre, apellido, edad, genero): self.nombre = nombre self.apellido = apellido self.edad = edad self.genero = genero def descripcion_usuario(self): print('Nombre: ' + self.nombre.title() + '\nApellido: ' + self.apellido.title() ...
# Ley d'Hondt def hondt(votes, n): """ Ley d'Hondt; coefficient: c_i = V_i / (s_i + 1) V_i = total number of votes obtained by party i s_i = number of seats assigned to party i (initially 0) """ s = [0] * len(votes) for i in range(n): c = [v[j] / (s[j] + 1) for j in range(len(s...
def hondt(votes, n): """ Ley d'Hondt; coefficient: c_i = V_i / (s_i + 1) V_i = total number of votes obtained by party i s_i = number of seats assigned to party i (initially 0) """ s = [0] * len(votes) for i in range(n): c = [v[j] / (s[j] + 1) for j in range(len(s))] s[c...
class Class1(object): def __init__(self): pass def test1(self): return 5 class Class2(object): def test1(self): return 6 class Class3(object): def test1(self, x): return self.test2(x)-1 def test2(self, x): return 2*x a = Class1() print(a.test1()) a = ...
class Class1(object): def __init__(self): pass def test1(self): return 5 class Class2(object): def test1(self): return 6 class Class3(object): def test1(self, x): return self.test2(x) - 1 def test2(self, x): return 2 * x a = class1() print(a.test1()) a ...
# -*- coding: utf-8 -*- """ sphinxpapyrus ~~~~~~~~~~~~~ Sphinx extensions. :copyright: Copyright 2018 by nakandev. :license: MIT, see LICENSE for details. """ __import__('pkg_resources').declare_namespace(__name__)
""" sphinxpapyrus ~~~~~~~~~~~~~ Sphinx extensions. :copyright: Copyright 2018 by nakandev. :license: MIT, see LICENSE for details. """ __import__('pkg_resources').declare_namespace(__name__)
class Tee: def __init__(self, f, f_tee): self.f = f self.f_tee = f_tee def read(self, nbytes): buf = self.f.read(nbytes) self.f_tee.write(buf) return buf def write(self, buf): self.f_tee.write(buf) self.f.write(buf) def flush(self): self...
class Tee: def __init__(self, f, f_tee): self.f = f self.f_tee = f_tee def read(self, nbytes): buf = self.f.read(nbytes) self.f_tee.write(buf) return buf def write(self, buf): self.f_tee.write(buf) self.f.write(buf) def flush(self): sel...
''' This is all the calculation for the main window '''
""" This is all the calculation for the main window """
__title__ = 'lottus' __description__ = 'An ussd library that will save you time' __version__ = '0.0.4' __author__ = 'Benjamim Chambule' __author_email__ = 'benchambule@gmail.com' __license__ = 'MIT' __copyright__ = 'Copyright 2021 Benjamim Chambule'
__title__ = 'lottus' __description__ = 'An ussd library that will save you time' __version__ = '0.0.4' __author__ = 'Benjamim Chambule' __author_email__ = 'benchambule@gmail.com' __license__ = 'MIT' __copyright__ = 'Copyright 2021 Benjamim Chambule'
extra_annotations = \ { 'ai': [ 'artificial intelligence', 'machine learning', 'statistical learning', 'statistical model', 'supervised model', 'unsupervised model', 'computer vision', 'image analysis', 'object recognistion', 'object detection', 'image segmentation', 'deep learni...
extra_annotations = {'ai': ['artificial intelligence', 'machine learning', 'statistical learning', 'statistical model', 'supervised model', 'unsupervised model', 'computer vision', 'image analysis', 'object recognistion', 'object detection', 'image segmentation', 'deep learning', 'cognitive computing', 'neural network'...
num = int(input()) numdict = { 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine' } print(numdict.get(num, 'number too big'))
num = int(input()) numdict = {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'} print(numdict.get(num, 'number too big'))
# -*- coding: utf-8 -*- class FormFactory(type): """This is the factory required to gather every Form components""" def __init__(cls, name, bases, dct): cls.datas={} for k,v in dct.items(): if k[0]!="_": cls.datas[k]=v return type.__init__(cls, name, ...
class Formfactory(type): """This is the factory required to gather every Form components""" def __init__(cls, name, bases, dct): cls.datas = {} for (k, v) in dct.items(): if k[0] != '_': cls.datas[k] = v return type.__init__(cls, name, bases, dct) class Form...
class Rational: def __init__(self, p, q): self.numerator = p self.denominator = q def __mul__(self, other): return Rational( self.numerator * other.numerator, self.denominator * other.denominator ) def __str__(self): return f"{self.numera...
class Rational: def __init__(self, p, q): self.numerator = p self.denominator = q def __mul__(self, other): return rational(self.numerator * other.numerator, self.denominator * other.denominator) def __str__(self): return f'{self.numerator}/{self.denominator}' r0 = rationa...
# -*- coding: utf-8 -*- db.define_table('Device', Field('device_id', 'string'), Field('device_name', 'string'), Field('model', 'string'), Field('location', 'string') ) db.Device.device_id.requires = [IS_NOT_EMPTY(),IS_NOT_IN_DB(db, 'Device...
db.define_table('Device', field('device_id', 'string'), field('device_name', 'string'), field('model', 'string'), field('location', 'string')) db.Device.device_id.requires = [is_not_empty(), is_not_in_db(db, 'Device.device_id')] db.Device.device_name.requires = is_not_empty() db.define_table('User_Device', field('user_...
lista = [1753, 1858, 1860, 1978, 1758, 1847, 2010, 1679, 1222, 1723, 1592, 1992, 1865, 1635, 1692, 1653, 1485, 848, 1301, 1818, 1872, 1883, 1464, 2002, 1736, 1821, 1851, 1299, 1627, 1698, 1713, 1676, 1673, 1448, 1939, 1506, 1896, 1710, 1677, 1894, 1645, 1454, 1972, 1687, 265, 1923, 1666, 1761, 1386, 2006, 1463, 1759, 1...
lista = [1753, 1858, 1860, 1978, 1758, 1847, 2010, 1679, 1222, 1723, 1592, 1992, 1865, 1635, 1692, 1653, 1485, 848, 1301, 1818, 1872, 1883, 1464, 2002, 1736, 1821, 1851, 1299, 1627, 1698, 1713, 1676, 1673, 1448, 1939, 1506, 1896, 1710, 1677, 1894, 1645, 1454, 1972, 1687, 265, 1923, 1666, 1761, 1386, 2006, 1463, 1759, 1...
class helloworld: def hello(self): print("This is my first task !") def run(): helloworld().hello()
class Helloworld: def hello(self): print('This is my first task !') def run(): helloworld().hello()
# dp class Solution: def lengthOfLIS(self, nums: 'List[int]') -> 'int': if len(nums) < 2: return len(nums) dp = [1] * (len(nums) + 1) for i in range(1, len(nums)): for j in range(0, i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] + 1) return max(dp)
class Solution: def length_of_lis(self, nums: 'List[int]') -> 'int': if len(nums) < 2: return len(nums) dp = [1] * (len(nums) + 1) for i in range(1, len(nums)): for j in range(0, i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] +...
class Configuration: """ Configuration file for Twitter Sentiment """ def __init__(self): self.color = "#00A8E0" self.total_gauge_color = "#FF0102" self.image_path = "static/icon.jpeg" self.default_model = "twitter_sentiment_model" self.title = "Twitter Sentime...
class Configuration: """ Configuration file for Twitter Sentiment """ def __init__(self): self.color = '#00A8E0' self.total_gauge_color = '#FF0102' self.image_path = 'static/icon.jpeg' self.default_model = 'twitter_sentiment_model' self.title = 'Twitter Sentiment...
# -*- coding: utf-8 -*- """ Created on Wed Jun 3 17:48:06 2020 @author: Fernando """ # A = [14,13,12,11,10,9,8,7,6,5,4,3,2,1] A = [3,2,1] B = [] C = [] count = 0 def towers_of_hanoi(A,B,C,n): global count if n == 1: disk = A.pop() C.append(disk) count +=1 else: ...
""" Created on Wed Jun 3 17:48:06 2020 @author: Fernando """ a = [3, 2, 1] b = [] c = [] count = 0 def towers_of_hanoi(A, B, C, n): global count if n == 1: disk = A.pop() C.append(disk) count += 1 else: towers_of_hanoi(A, C, B, n - 1) print(f'First call {(A, B, C)}...
def test_udp_header_with_counter(api, b2b_raw_config, utils): """ Configure a raw udp flow with, - Non-default Counter Pattern values of src and dst Port address, length, checksum - 100 frames of 74B size each - 10% line rate Validate, - tx/rx frame count is as expected - all capt...
def test_udp_header_with_counter(api, b2b_raw_config, utils): """ Configure a raw udp flow with, - Non-default Counter Pattern values of src and dst Port address, length, checksum - 100 frames of 74B size each - 10% line rate Validate, - tx/rx frame count is as expected - all capt...
''' Dict with attr access to keys. Usage: pip install adict from adict import adict d = adict(a=1) assert d.a == d['a'] == 1 See all features, including ajson() in adict.py:test(). adict version 0.1.7 Copyright (C) 2013-2015 by Denis Ryzhkov <denisr@denisr.com> MIT License, see http://opensource.or...
""" Dict with attr access to keys. Usage: pip install adict from adict import adict d = adict(a=1) assert d.a == d['a'] == 1 See all features, including ajson() in adict.py:test(). adict version 0.1.7 Copyright (C) 2013-2015 by Denis Ryzhkov <denisr@denisr.com> MIT License, see http://opensource.or...
while True: n = int(input()) if n == 0: break x, y = [int(g) for g in str(input()).split()] for j in range(n): a, b = [int(g) for g in str(input()).split()] if a == x or b == y: print('divisa') else: if x < a: if y < b: print('NE') else...
while True: n = int(input()) if n == 0: break (x, y) = [int(g) for g in str(input()).split()] for j in range(n): (a, b) = [int(g) for g in str(input()).split()] if a == x or b == y: print('divisa') elif x < a: if y < b: print('NE') ...
""" TW3: Sliced to Order Mohammed Elhaj Sohrab Rajabi Andrew Nalundasan Teamwork exercise 3 code """ # user inputs user_text = input('Enter some text, please: ') start_position = int(input('Slice starting position (zero for beginning): ')) end_position = int(input('Slice ending position (can be negative t...
""" TW3: Sliced to Order Mohammed Elhaj Sohrab Rajabi Andrew Nalundasan Teamwork exercise 3 code """ user_text = input('Enter some text, please: ') start_position = int(input('Slice starting position (zero for beginning): ')) end_position = int(input('Slice ending position (can be negative to count from end): ')) stri...