content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# could be set as random or defined by node num def getdelay(source,destination,size): return 1 def getdownloadspeed(id): return 1000
def getdelay(source, destination, size): return 1 def getdownloadspeed(id): return 1000
def has_print_function(tokens): p = 0 while p < len(tokens): if tokens[p][0] != 'FROM': p += 1 continue if tokens[p + 1][0:2] != ('NAME', '__future__'): p += 1 continue if tokens[p + 2][0] != 'IMPORT': p += 1 continu...
def has_print_function(tokens): p = 0 while p < len(tokens): if tokens[p][0] != 'FROM': p += 1 continue if tokens[p + 1][0:2] != ('NAME', '__future__'): p += 1 continue if tokens[p + 2][0] != 'IMPORT': p += 1 continu...
SCREEN_WIDTH = 700 SCREEN_HEIGHT = 450 SCREEN_CENTER = (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2) BUTTON_COLOR = (0, 0, 0) PADDLE_WIDTH = 10 PADDLE_HEIGHT = 50 BALL_WIDTH = 10 BALL_HEIGHT = 10 AUDIO_ICON_WIDTH = 20 AUDIO_ICON_HEIGHT = 20 AUDIO_ICON_X = SCREEN_WIDTH - AUDIO_ICON_WIDTH AUDIO_ICON_Y = SCREEN_HEIGHT - AUDI...
screen_width = 700 screen_height = 450 screen_center = (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2) button_color = (0, 0, 0) paddle_width = 10 paddle_height = 50 ball_width = 10 ball_height = 10 audio_icon_width = 20 audio_icon_height = 20 audio_icon_x = SCREEN_WIDTH - AUDIO_ICON_WIDTH audio_icon_y = SCREEN_HEIGHT - AUDIO_ICO...
# Source : https://leetcode.com/problems/longest-continuous-increasing-subsequence/ # Author : foxfromworld # Date : 07/12/2021 # First attempt class Solution: def findLengthOfLCIS(self, nums: List[int]) -> int: start, ret = 0, 0 for i, num in enumerate(nums): if i > 0 and nums[i-1] >=...
class Solution: def find_length_of_lcis(self, nums: List[int]) -> int: (start, ret) = (0, 0) for (i, num) in enumerate(nums): if i > 0 and nums[i - 1] >= num: start = i ret = max(ret, i - start + 1) return ret
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import requests\n", "\n", "from finnhub.exceptions import FinnhubAPIException\n", "from finnhub.exceptions import FinnhubRequestException\n", "\n", "class Client:\n", " ...
{'cells': [{'cell_type': 'code', 'execution_count': null, 'metadata': {}, 'outputs': [], 'source': ['import requests\n', '\n', 'from finnhub.exceptions import FinnhubAPIException\n', 'from finnhub.exceptions import FinnhubRequestException\n', '\n', 'class Client:\n', ' API_URL = "https://finnhub.io/api/v1"\n', '\n',...
# Comment1 class Module2(object): command_name = 'module2' targets = [r'products/module2_target.txt'] dependencies = [('module1_target.txt', True)] configs = ['module2a.conf', 'module2b.conf']
class Module2(object): command_name = 'module2' targets = ['products/module2_target.txt'] dependencies = [('module1_target.txt', True)] configs = ['module2a.conf', 'module2b.conf']
n = int(input()) arr = list(map(int, input().rstrip().split())) arr.reverse() for num in arr: print(num , end=" ")
n = int(input()) arr = list(map(int, input().rstrip().split())) arr.reverse() for num in arr: print(num, end=' ')
## Advent of Code 2018: Day 14 ## https://adventofcode.com/2018/day/14 ## Jesse Williams ## Answers: [Part 1]: 8176111038, [Part 2]: 20225578 INPUT = 890691 def createNewRecipes(recipes, elves): newRcpSum = recipes[elves[0]] + recipes[elves[1]] # add current recipes together newRcpDigits = list(map(int, lis...
input = 890691 def create_new_recipes(recipes, elves): new_rcp_sum = recipes[elves[0]] + recipes[elves[1]] new_rcp_digits = list(map(int, list(str(newRcpSum)))) return newRcpDigits def choose_new_current_recipes(recipes, elves): new_elves = [0, 0] for (i, elf) in enumerate(elves): newElves...
#!/usr/local/bin/python3.6 def is_ztest(m): if int(m.author.id) == int(zigID): return True else: return False
def is_ztest(m): if int(m.author.id) == int(zigID): return True else: return False
def read_matrix(c, r): matrix = [] for _ in range(c): row = input().split(' ') matrix.append(row) return matrix c, r = [int(n) for n in input().split(' ')] matrix = read_matrix(c, r) matches = 0 for col in range(c - 1): for row in range(r - 1): if matrix[col][row] == matrix[...
def read_matrix(c, r): matrix = [] for _ in range(c): row = input().split(' ') matrix.append(row) return matrix (c, r) = [int(n) for n in input().split(' ')] matrix = read_matrix(c, r) matches = 0 for col in range(c - 1): for row in range(r - 1): if matrix[col][row] == matrix[col...
# Option for variable 'simulation_type': # 1: cylindrical roller bearing # 2: # 3: cylindrical roller thrust bearing # 4: ball on disk (currently not fully supported) # 5: pin on disk # 6: 4 ball # 7: ball on three plates # 8: ring on ring # global simulation setup simulation_type = 5 # one of the above types simulat...
simulation_type = 5 simulation_name = 'PinOnDisk' auto_print = True auto_plot = True auto_report = False tribo_system_name = 'foo' number_pins = 1 sliding_diameter = 50 e_cb1 = 210000 ny_cb1 = 0.3 diameter_cb1 = 12.7 length_cb1 = 12.7 type_profile_cb1 = 'Circle' path_profile_cb1 = '' profile_radius_cb1 = 6.35 e_cb2 = 2...
BUSINESS_METRICS_VIEW_CONFIG = { 'Write HBase' : [['write operation', 'Write/HBase'], ['log length', 'Write/Log'], ['memory/thread', 'Write/MemoryThread'], ], 'Read HBase' : [['read operation', 'Read/HBase'], ['result size', 'Read/ResultSize'], ...
business_metrics_view_config = {'Write HBase': [['write operation', 'Write/HBase'], ['log length', 'Write/Log'], ['memory/thread', 'Write/MemoryThread']], 'Read HBase': [['read operation', 'Read/HBase'], ['result size', 'Read/ResultSize'], ['memory/thread', 'Read/MemoryThread']]} online_metrics_menu_config = {'Online W...
n=int(input()) for i in range(1,n): if i+sum(map(int,list(str(i))))==n: print(i) exit() print(0)
n = int(input()) for i in range(1, n): if i + sum(map(int, list(str(i)))) == n: print(i) exit() print(0)
edge_array = []; par =[0,0,0,0,0,0] for par[0] in range(0,3): for par[1] in range(0,3): for par[2] in range(0,3): for par[3] in range(0,3): for par[4] in range(0,3): for par[5] in range(0,3): edge_array.append(str(par[0])+" "+str(par[1])+" "+str(par[2])+" "+str(par[3])+" "+str(par[4])+" "+str(par[5...
edge_array = [] par = [0, 0, 0, 0, 0, 0] for par[0] in range(0, 3): for par[1] in range(0, 3): for par[2] in range(0, 3): for par[3] in range(0, 3): for par[4] in range(0, 3): for par[5] in range(0, 3): edge_array.append(str(par[0]) + '...
levels = { 1: { 'ship': (80, 60), 'enemies': ((24, 24), (50, 24), (100, 24), (120, 24)) }, 2: { 'ship': (80, 110), 'enemies': ((10, 10), (80, 10), (150, 10), (10, 30), (80, 30), (150, 30)) }, 3: { 'ship': (10, 60), 'enemies': ((90, ...
levels = {1: {'ship': (80, 60), 'enemies': ((24, 24), (50, 24), (100, 24), (120, 24))}, 2: {'ship': (80, 110), 'enemies': ((10, 10), (80, 10), (150, 10), (10, 30), (80, 30), (150, 30))}, 3: {'ship': (10, 60), 'enemies': ((90, 10), (90, 50), (90, 90), (110, 10), (110, 50), (110, 90), (130, 10), (130, 50), (130, 90))}, 4...
class HttpRequest: def __init__(self, path, method, headers, path_params, query_params, body): self.path = path self.method = method self.headers = headers self.path_params = path_params self.query_params = query_params self.body = body
class Httprequest: def __init__(self, path, method, headers, path_params, query_params, body): self.path = path self.method = method self.headers = headers self.path_params = path_params self.query_params = query_params self.body = body
CURRENT_NEWS_API_KEY = '' # Replace with your news.org API keys news = { 'api_key': '', 'base_everything_url': 'https://newsapi.org/v2/everything' }
current_news_api_key = '' news = {'api_key': '', 'base_everything_url': 'https://newsapi.org/v2/everything'}
''' Given a square matrix of N rows and columns, find out whether it is symmetric or not. >>Input Format: The first line of the input contains an integer number n which represents the number of rows and the number of columns. From the second line, take n lines input with each line containing n integer elements with ea...
""" Given a square matrix of N rows and columns, find out whether it is symmetric or not. >>Input Format: The first line of the input contains an integer number n which represents the number of rows and the number of columns. From the second line, take n lines input with each line containing n integer elements with ea...
ENV='development' DEBUG=True SQLALCHEMY_DATABASE_URI='sqlite:///data_base.db' #SQLALCHEMY_ECHO=True SQLALCHEMY_TRACK_MODIFICATIONS=False SCHEDULER_API_ENABLED = True
env = 'development' debug = True sqlalchemy_database_uri = 'sqlite:///data_base.db' sqlalchemy_track_modifications = False scheduler_api_enabled = True
# Exercise number 2 - Python WorkOut # Author: Barrios Ramirez Luis Fernando # Language: Python3 3.8.2 64-bit def my_sum(*numbers): # The "splat" operator is used when we need an arbitrary amount of arguments output = numbers[0] for i in numbers[1:]: # It returns a tuple output += i return output...
def my_sum(*numbers): output = numbers[0] for i in numbers[1:]: output += i return output print(my_sum(4, 6))
n = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H'] i = sorted(n.index(x) for x in input().split()) c = (i[1] - i[0], i[2] - i[1]) if c in ((4, 3), (3, 5), (5, 4)): print('major') elif c in ((3, 4), (4, 5), (5, 3)): print('minor') else: print('strange')
n = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H'] i = sorted((n.index(x) for x in input().split())) c = (i[1] - i[0], i[2] - i[1]) if c in ((4, 3), (3, 5), (5, 4)): print('major') elif c in ((3, 4), (4, 5), (5, 3)): print('minor') else: print('strange')
template=''' def __init__(self, base_space, **kwargs): super().__init__() # Time scheme is set from Model.__init__() # Set base space (manifold) #------------------------------ assert base_space.dimension == len(self.coordinates), \ "...
template = '\n def __init__(self, base_space, **kwargs):\n\n super().__init__() # Time scheme is set from Model.__init__()\n\n # Set base space (manifold)\n #------------------------------\n assert base_space.dimension == len(self.coordinates), ...
aPL = 4.412E-10 nPL = 5.934 G13 = 5290. enerPlas = aPL/G13*90.65**(nPL + 1.)*nPL/(nPL + 1.)*0.2**3 enerFrac = 0.788*0.2*0.2 enerTotal = enerPlas+enerFrac parameters = { "results": [ { "type": "max", "step": "Step-7", "identifier": { "symbo...
a_pl = 4.412e-10 n_pl = 5.934 g13 = 5290.0 ener_plas = aPL / G13 * 90.65 ** (nPL + 1.0) * nPL / (nPL + 1.0) * 0.2 ** 3 ener_frac = 0.788 * 0.2 * 0.2 ener_total = enerPlas + enerFrac parameters = {'results': [{'type': 'max', 'step': 'Step-7', 'identifier': {'symbol': 'S13', 'elset': 'ALL_ELEMS', 'position': 'Element 1 I...
# -*- coding: utf-8 -*- # Scrapy settings for jn_scraper project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://doc.scrapy.org/en/latest/topics/settings.html # https://doc.scrapy.org/en/latest/to...
bot_name = 'jn_scraper' spider_modules = ['scraper.spiders'] newspider_module = 'scraper.spiders' robotstxt_obey = True item_pipelines = {'scraper.pipelines.ProductItemPipeline': 200}
def rounding(numbers): num = [round(float(x)) for x in numbers] return num print(rounding(input().split(" ")))
def rounding(numbers): num = [round(float(x)) for x in numbers] return num print(rounding(input().split(' ')))
expected_output={ 'interface': { 'HundredGigE2/0/1': { 'if_id': '0x3', 'inst': 0, 'asic': 0, 'core': 5, 'ifg_id': 1, 'port': 0, 'subport': 0, 'mac': 1, 'last_serdes': 1, 'cntx': 0, 'lpn': 1, 'gpn': 769, 'type': 'NIF', 'active': 'Y...
expected_output = {'interface': {'HundredGigE2/0/1': {'if_id': '0x3', 'inst': 0, 'asic': 0, 'core': 5, 'ifg_id': 1, 'port': 0, 'subport': 0, 'mac': 1, 'last_serdes': 1, 'cntx': 0, 'lpn': 1, 'gpn': 769, 'type': 'NIF', 'active': 'Y'}, 'HundredGigE2/0/2': {'if_id': '0x485', 'inst': 0, 'asic': 0, 'core': 5, 'ifg_id': 1, 'p...
class Hero: def __init__(self, nama, attack,health,defense): self.name = nama self.attack = attack self.health = health self.defense = defense
class Hero: def __init__(self, nama, attack, health, defense): self.name = nama self.attack = attack self.health = health self.defense = defense
def compress(string): counter = 1 result = [] for i in range(len(string)): if not (i + 1) == len(string) and string[i] == string[i + 1]: counter += 1 else: result.append(string[i] + str(counter)) counter = 1 final = "".join(result) if len(string...
def compress(string): counter = 1 result = [] for i in range(len(string)): if not i + 1 == len(string) and string[i] == string[i + 1]: counter += 1 else: result.append(string[i] + str(counter)) counter = 1 final = ''.join(result) if len(string) > l...
__project__ = "nerblackbox" __author__ = "Felix Stollenwerk" __version__ = "0.0.13" __license__ = "Apache 2.0"
__project__ = 'nerblackbox' __author__ = 'Felix Stollenwerk' __version__ = '0.0.13' __license__ = 'Apache 2.0'
s=input() s=s.split(" ") n=int(s[0]) k=int(s[1]) m=n//2 if n%2==1: m+=1 if k<=m: print(2*k-1) else: k=k-m print(2*k)
s = input() s = s.split(' ') n = int(s[0]) k = int(s[1]) m = n // 2 if n % 2 == 1: m += 1 if k <= m: print(2 * k - 1) else: k = k - m print(2 * k)
class Solution: d = { 'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900 } def romanToInt(self, s): n,i = 0,0 whil...
class Solution: d = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900} def roman_to_int(self, s): (n, i) = (0, 0) while i < len(s): if i + 1 < len(s) and s[i:i + 2] in Solution.d: n += Solutio...
class Person: def __init__(self, fname, lname): self.fname = fname self.lname = lname def __repr__(self): return f'{self.fname} {self.lname}' p1 = Person('John', 'Smith') class Student(Person): pass if __name__ == '__main__': s = Student('Tom', 'Adams') print(s) p...
class Person: def __init__(self, fname, lname): self.fname = fname self.lname = lname def __repr__(self): return f'{self.fname} {self.lname}' p1 = person('John', 'Smith') class Student(Person): pass if __name__ == '__main__': s = student('Tom', 'Adams') print(s) print(...
# Solution to exercise PermMissingElem # http://www.codility.com/train/ def solution(A): N = len(A) # The array with the missing entry added should sum to (N+2)(N+1)/2 # so the missing entry can be determined by subtracting the sum of # the entries of A missing_element = (N+2)*(N+1)/2 - sum(A)...
def solution(A): n = len(A) missing_element = (N + 2) * (N + 1) / 2 - sum(A) return missing_element
with open("input.txt") as f: lines = f.readlines() S = lines.pop(0).strip() lines.pop(0) rules = {} for r in lines: s = r.strip().split(" -> ") rules[s[0]] = s[1] for n in range(10): S = S[0] + "".join(list(map(lambda x,y: rules[x+y] + y, S[0:-1], S[1:]))) # Histogram f = {} for c in S: ...
with open('input.txt') as f: lines = f.readlines() s = lines.pop(0).strip() lines.pop(0) rules = {} for r in lines: s = r.strip().split(' -> ') rules[s[0]] = s[1] for n in range(10): s = S[0] + ''.join(list(map(lambda x, y: rules[x + y] + y, S[0:-1], S[1:]))) f = {} for c in S: f[c] = f.get(c, 0) + ...
class Solution: def countArrangement(self, n: int) -> int: state = '1' * n # dp[state] means number of targ arrangement # easily dp[state] = sum(dp[possible_next_state]) dp = {} dp['0'*n] = 1 def dfs(state_now, index): # basic if state_now in ...
class Solution: def count_arrangement(self, n: int) -> int: state = '1' * n dp = {} dp['0' * n] = 1 def dfs(state_now, index): if state_now in dp: return dp[state_now] else: dp[state_now] = 0 for i in range(len(sta...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"AlreadyImportedError": "00_core.ipynb", "InvalidFilePath": "00_core.ipynb", "InvalidFolderPath": "00_core.ipynb", "InvalidFileExtension": "00_core.ipynb", "Pdf": "00_core....
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'AlreadyImportedError': '00_core.ipynb', 'InvalidFilePath': '00_core.ipynb', 'InvalidFolderPath': '00_core.ipynb', 'InvalidFileExtension': '00_core.ipynb', 'Pdf': '00_core.ipynb'} modules = ['core.py'] doc_url = 'https://fabraz.github.io/vigilant/' ...
class Solution: def maxPower(self, s: str) -> int: ans = cur = 0 prev = '' for c in s: if c == prev: cur += 1 else: cur = 1 prev = c if cur > ans: ans = cur return ans
class Solution: def max_power(self, s: str) -> int: ans = cur = 0 prev = '' for c in s: if c == prev: cur += 1 else: cur = 1 prev = c if cur > ans: ans = cur return ans
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [x86_const.py] X86_REG_INVALID = 0 X86_REG_AH = 1 X86_REG_AL = 2 X86_REG_AX = 3 X86_REG_BH = 4 X86_REG_BL = 5 X86_REG_BP = 6 X86_REG_BPL = 7 X86_REG_BX = 8 X86_REG_CH = 9 X86_REG_CL = 10 X86_REG_CS = 11 X86_REG_CX = 12 X86_REG_DH = 13 X86_REG_DI = 14 X86_REG_DIL ...
x86_reg_invalid = 0 x86_reg_ah = 1 x86_reg_al = 2 x86_reg_ax = 3 x86_reg_bh = 4 x86_reg_bl = 5 x86_reg_bp = 6 x86_reg_bpl = 7 x86_reg_bx = 8 x86_reg_ch = 9 x86_reg_cl = 10 x86_reg_cs = 11 x86_reg_cx = 12 x86_reg_dh = 13 x86_reg_di = 14 x86_reg_dil = 15 x86_reg_dl = 16 x86_reg_ds = 17 x86_reg_dx = 18 x86_reg_eax = 19 x8...
class FileParser: def __init__(self, filepath): self.filepath = filepath def GetNonEmptyLinesAsList(self): with open(self.filepath, "r") as f: return [line for line in f.readlines() if line and line != "\n"]
class Fileparser: def __init__(self, filepath): self.filepath = filepath def get_non_empty_lines_as_list(self): with open(self.filepath, 'r') as f: return [line for line in f.readlines() if line and line != '\n']
#Altere os exercicios e armazene em um vetor as idades. a=int(input("Digite quantas vezes vc quer informar a idade")) i=0 n=[] for i in range(a): n.append(int(input("Digite uma idade"))) i=i+1 print (n)
a = int(input('Digite quantas vezes vc quer informar a idade')) i = 0 n = [] for i in range(a): n.append(int(input('Digite uma idade'))) i = i + 1 print(n)
num = int(input("Enter Any Number : ")) if num % 2 == 1: print(num, " is odd!") elif num % 2 == 0: print(num, " is even!") else: print("Error")
num = int(input('Enter Any Number : ')) if num % 2 == 1: print(num, ' is odd!') elif num % 2 == 0: print(num, ' is even!') else: print('Error')
def conference_picker(cities_visited, cities_offered): for city in cities_offered: if city not in cities_visited: return city return 'No worthwhile conferences this year!'
def conference_picker(cities_visited, cities_offered): for city in cities_offered: if city not in cities_visited: return city return 'No worthwhile conferences this year!'
# -*- coding: utf-8 -*- # # Automatically generated from unicode.xml by gen_xml_dic.py # uni2latex = { 0x0023: '\\#', 0x0024: '\\textdollar', 0x0025: '\\%', 0x0026: '\\&', 0x0027: '\\textquotesingle', 0x002A: '\\ast', 0x005C: '\\textbackslash', 0x005E: '\\^{}', 0x005F: '\\_', 0x0060: '\\textasciigrave', 0x007B: '\\lbr...
uni2latex = {35: '\\#', 36: '\\textdollar', 37: '\\%', 38: '\\&', 39: '\\textquotesingle', 42: '\\ast', 92: '\\textbackslash', 94: '\\^{}', 95: '\\_', 96: '\\textasciigrave', 123: '\\lbrace', 124: '\\vert', 125: '\\rbrace', 126: '\\textasciitilde', 160: '~', 161: '\\textexclamdown', 162: '\\textcent', 163: '\\textsterl...
n1 = int(input('Enter number 1: ')) n2 = int(input('Enter number 2: ')) n3 = int(input('Enter number 3: ')) menor = n1 if n2 < n1 and n2 < n3: menor = n2 if n3 < n1 and n3 < n2: menor = n3 maior = n1 if n2 > n1 and n2 > n3: maior = n2 if n3 > n1 and n3 > n2: maior = n3 print("Menor e {}".format(menor)) print...
n1 = int(input('Enter number 1: ')) n2 = int(input('Enter number 2: ')) n3 = int(input('Enter number 3: ')) menor = n1 if n2 < n1 and n2 < n3: menor = n2 if n3 < n1 and n3 < n2: menor = n3 maior = n1 if n2 > n1 and n2 > n3: maior = n2 if n3 > n1 and n3 > n2: maior = n3 print('Menor e {}'.format(menor)) ...
# ********************************* # ****** SECTION 1 - CLASSES ****** # ********************************* # A "Class" is like a blueprint for an object # Objects can be many different things # In a grade tracking program objects might be: Course, Period, Teacher, Student, Gradable Assignment, Comment, Etc. # In Mari...
class Unknownstudent: name = 'Unknown' age = 'Unknown' first_student = unknown_student() first_student.name = 'John Smith' first_student.age = 15 print(f"The student's name is {first_student.name} and he is {first_student.age} years old.") class Student: def __init__(self, _name, _age): self.name ...
_base_ = [ # './_base_/models/segformer.py', '../configs/_base_/datasets/mapillary.py', '../configs/_base_/default_runtime.py', './_base_/schedules/schedule_1600k_adamw.py' ] norm_cfg = dict(type='BN', requires_grad=True) backbone_norm_cfg = dict(type='LN', requires_grad=True) model = dict( type='E...
_base_ = ['../configs/_base_/datasets/mapillary.py', '../configs/_base_/default_runtime.py', './_base_/schedules/schedule_1600k_adamw.py'] norm_cfg = dict(type='BN', requires_grad=True) backbone_norm_cfg = dict(type='LN', requires_grad=True) model = dict(type='EncoderDecoder', pretrained='https://github.com/SwinTransfo...
M1, D1 = [int(x) for x in input().split()] M2, D2 = [int(x) for x in input().split()] if M1 != M2: print(1) else: print(0)
(m1, d1) = [int(x) for x in input().split()] (m2, d2) = [int(x) for x in input().split()] if M1 != M2: print(1) else: print(0)
def start_streaming_dataframe(): "Start a Spark Streaming DataFrame from a Kafka Input source" schema = StructType( [StructField(f["name"], f["type"], True) for f in field_metadata] ) kafka_options = { "kafka.ssl.protocol":"TLSv1.2", "kafka.ssl.enabled.protocols":"TLSv1.2", ...
def start_streaming_dataframe(): """Start a Spark Streaming DataFrame from a Kafka Input source""" schema = struct_type([struct_field(f['name'], f['type'], True) for f in field_metadata]) kafka_options = {'kafka.ssl.protocol': 'TLSv1.2', 'kafka.ssl.enabled.protocols': 'TLSv1.2', 'kafka.ssl.endpoint.identifi...
{ 'targets': [ { 'target_name': 'rdpcred', 'conditions': [ [ 'OS=="win"', { 'sources': [ 'rdpcred.cc' ], 'msvs_settings': { 'VCLinkerTool': { 'AdditionalDependencies': [ 'Crypt32.lib' ] } } } ] ] } ] }
{'targets': [{'target_name': 'rdpcred', 'conditions': [['OS=="win"', {'sources': ['rdpcred.cc'], 'msvs_settings': {'VCLinkerTool': {'AdditionalDependencies': ['Crypt32.lib']}}}]]}]}
class Solution: def connect(self, root: 'Optional[Node]') -> 'Optional[Node]': if not root: return d = collections.deque() d.append(root) while d: node = d.popleft() if node.left and node.right: node.left....
class Solution: def connect(self, root: 'Optional[Node]') -> 'Optional[Node]': if not root: return d = collections.deque() d.append(root) while d: node = d.popleft() if node.left and node.right: node.left.next = node.right ...
pro = 1 tar = 1 cur = 1 pos = 1 i = 1 while i < 8 : lcur = list(str(cur)) if len(lcur) > tar - pos: pro *= int(lcur[tar-pos]) i += 1 tar *= 10 pos += len(lcur) cur += 1 print(pro)
pro = 1 tar = 1 cur = 1 pos = 1 i = 1 while i < 8: lcur = list(str(cur)) if len(lcur) > tar - pos: pro *= int(lcur[tar - pos]) i += 1 tar *= 10 pos += len(lcur) cur += 1 print(pro)
n = int(input()) for _ in range(n): store = int(input()) loc = list(map(int, input().split())) dist = 2 * (max(loc) - min(loc)) print(dist)
n = int(input()) for _ in range(n): store = int(input()) loc = list(map(int, input().split())) dist = 2 * (max(loc) - min(loc)) print(dist)
graph_file_name="/home/cluster_share/graph/soc-LiveJournal1_notmap.txt" out_put_file_name='/home/amax/Graph_json/livejournal_not_mapped_json' graph_file = open(graph_file_name) output_file = open(out_put_file_name, 'w') edge = dict() for line in graph_file: #line = line[:-2] res = line.split() #print(res...
graph_file_name = '/home/cluster_share/graph/soc-LiveJournal1_notmap.txt' out_put_file_name = '/home/amax/Graph_json/livejournal_not_mapped_json' graph_file = open(graph_file_name) output_file = open(out_put_file_name, 'w') edge = dict() for line in graph_file: res = line.split() source = int(res[0]) dest =...
text = input() for i in range(len(text)): if text[i] == ":": print(text[i] + text[i + 1])
text = input() for i in range(len(text)): if text[i] == ':': print(text[i] + text[i + 1])
DEBUG = True SERVE_MEDIA = DEBUG TEMPLATE_DEBUG = DEBUG EMAIL_DEBUG = DEBUG THUMBNAIL_DEBUG = DEBUG DEBUG_PROPAGATE_EXCEPTIONS = False # DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. # DATABASE_HOST = '192.168.0.2' # Set to empty s...
debug = True serve_media = DEBUG template_debug = DEBUG email_debug = DEBUG thumbnail_debug = DEBUG debug_propagate_exceptions = False email_host = 'localhost' email_port = 1025
# Example of Iterator Design Pattern def count_to(count): numbers = ["one", "two", "three", "four", "five"] for number in numbers[:count]: yield number count_to_two = count_to(2) count_to_five = count_to(5) for count in [count_to_two, count_to_five]: for number in count: print(number, e...
def count_to(count): numbers = ['one', 'two', 'three', 'four', 'five'] for number in numbers[:count]: yield number count_to_two = count_to(2) count_to_five = count_to(5) for count in [count_to_two, count_to_five]: for number in count: print(number, end=' ') print()
class Layout: def __init__(self, keyboard): if keyboard == "azerty": self.up = 'Z' self.down = 'S' self.left = 'Q' self.right = 'D' self.ok = 'C' self.no = 'K' self.drop = 'L' self.change = 'P' self...
class Layout: def __init__(self, keyboard): if keyboard == 'azerty': self.up = 'Z' self.down = 'S' self.left = 'Q' self.right = 'D' self.ok = 'C' self.no = 'K' self.drop = 'L' self.change = 'P' self....
# Factorial program with memoization using decorators. # Memoization is a technique of recording the intermediate results so that it can be used to avoid repeated calculations and speed up the programs. # memoization can be done with the help of function decorators. def Memoize(func): history={} def wr...
def memoize(func): history = {} def wrapper(*args): if args not in history: history[args] = func(*args) return history[args] return wrapper def factorial(n): if type(n) != int: raise value_error('passed value is not integer') if n < 0: raise value_error(...
NUM, IMG_SIZE, FACE = 8, 720, False def config(): return None config.expName = None config.checkpoint_dir = None config.train = lambda: None config.train.batch_size = 4 config.train.lr = 0.001 config.train.decay = 0.001 config.train.epochs = 10 config.latent_code_garms_sz = 1024 config.PCA_ = 35 co...
(num, img_size, face) = (8, 720, False) def config(): return None config.expName = None config.checkpoint_dir = None config.train = lambda : None config.train.batch_size = 4 config.train.lr = 0.001 config.train.decay = 0.001 config.train.epochs = 10 config.latent_code_garms_sz = 1024 config.PCA_ = 35 config.garmen...
# -*- coding: utf-8 -*- def main(): n = int(input()) b = [0 for _ in range(n)] for i in range(n): ai = int(input()) ai -= 1 b[ai] += 1 y = 0 x = 0 for index, bi in enumerate(b, 1): if bi == 0: x = index elif bi == 2: ...
def main(): n = int(input()) b = [0 for _ in range(n)] for i in range(n): ai = int(input()) ai -= 1 b[ai] += 1 y = 0 x = 0 for (index, bi) in enumerate(b, 1): if bi == 0: x = index elif bi == 2: y = index if x == 0 and y == 0: ...
class VoteBreakdownTotals: def __init__(self, headers: list[str]): self.__headers = headers self.__failures = {} self.__current_row = 0 votes = "votes" if votes in self.__headers: self.__votes_index = self.__headers.index(votes) else: self.__v...
class Votebreakdowntotals: def __init__(self, headers: list[str]): self.__headers = headers self.__failures = {} self.__current_row = 0 votes = 'votes' if votes in self.__headers: self.__votes_index = self.__headers.index(votes) else: self.__v...
def splitCols(saleRow): '''this function will split a string with '. Some columns are quoted with "". So we need to handle it''' saleRow = saleRow.split(',') result = [] flag = True # if flag is false, the current i is within a pair of " for i in range(len(saleRow)): if flag: ...
def split_cols(saleRow): """this function will split a string with '. Some columns are quoted with "". So we need to handle it""" sale_row = saleRow.split(',') result = [] flag = True for i in range(len(saleRow)): if flag: result.append(saleRow[i]) if '"' in saleR...
# # PySNMP MIB module H3C-OBJECT-INFO-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-OBJECT-INFO-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:10:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
# Most football fans love it for the goals and excitement. Well, this problem does not. # You are up to handle the referee's little notebook and count the players who were sent off for fouls and misbehavior. # The rules: Two teams, named "A" and "B" have 11 players each. The players on each team are numbered from 1 to ...
team_a = 11 team_b = 11 cards = input().split() card_list = set(cards) stop = False for i in cards: x = ''.join(i) if 'A' in x: team_a -= 1 elif 'B' in x: team_b -= 1 if team_a < 7 or team_b < 7: stop = True break print(f'Team A - {team_a}; Team B - {team_b}') if stop: ...
K, X = tuple(map(int, input().split())) start = X - K + 1 end = X + K print(*range(start, end))
(k, x) = tuple(map(int, input().split())) start = X - K + 1 end = X + K print(*range(start, end))
# -*- coding: utf-8 -*- config = { "consumer_key": "VALUE", "consumer_secret": "VALUE", "access_token": "VALUE", "access_token_secret": "VALUE", }
config = {'consumer_key': 'VALUE', 'consumer_secret': 'VALUE', 'access_token': 'VALUE', 'access_token_secret': 'VALUE'}
class Solution: # @param {integer[]} nums # @return {integer[][]} def permuteUnique(self, nums): if len(nums) == 0: return nums if len(nums) == 1: return [nums] res = [] bag = set() for i in range(len(nums)): if nums[i] not in bag:...
class Solution: def permute_unique(self, nums): if len(nums) == 0: return nums if len(nums) == 1: return [nums] res = [] bag = set() for i in range(len(nums)): if nums[i] not in bag: tmp = nums[:] head = tmp...
{ "targets": [ { "target_name": "posix", "sources": [ "src/posix.cc" ] } ] }
{'targets': [{'target_name': 'posix', 'sources': ['src/posix.cc']}]}
DATABASE_NAME = "glass_rooms.sqlite" STARTING_ROOM_NUMBER = 1 ENDING_ROOM_NUMBER = 9 TABLE_NAME_HEADER = "Room_" TABLE_NAME = "Bookings" URL_HEADER = "https://www.scss.tcd.ie/cgi-bin/webcal/sgmr/sgmr" URL_ENDER = ".pl" URL_BOOKING = ".request" # Regex Constants # DATE_HEADER_REGEX: regex to match '4 Nov 2015 (Wednesda...
database_name = 'glass_rooms.sqlite' starting_room_number = 1 ending_room_number = 9 table_name_header = 'Room_' table_name = 'Bookings' url_header = 'https://www.scss.tcd.ie/cgi-bin/webcal/sgmr/sgmr' url_ender = '.pl' url_booking = '.request' date_header_regex = '[0-9]{1,2} [A-Z][a-z]+ 20[0-9]{2,2} \\([A-Z][a-z]+\\):'...
#!/usr/bin/python3 def bubbleSort(arr, reverse=False): length = len(arr) for i in range(0, length-1): for j in range(0, length-i-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] if reverse: arr.reverse() return arr
def bubble_sort(arr, reverse=False): length = len(arr) for i in range(0, length - 1): for j in range(0, length - i - 1): if arr[j] > arr[j + 1]: (arr[j], arr[j + 1]) = (arr[j + 1], arr[j]) if reverse: arr.reverse() return arr
# https://www.hackerrank.com/challenges/minimum-loss/problem def minimumLoss(price): min_loss = list() price = [(i,j) for i,j in zip(range(len(price)), price)] price = sorted(price,key=lambda x: x[1]) for i in range(len(price)-1): if(price[i][0]>price[i+1][0] and price[i][1]<price[i+1][1]): ...
def minimum_loss(price): min_loss = list() price = [(i, j) for (i, j) in zip(range(len(price)), price)] price = sorted(price, key=lambda x: x[1]) for i in range(len(price) - 1): if price[i][0] > price[i + 1][0] and price[i][1] < price[i + 1][1]: min_loss.append(price[i + 1][1] - pric...
# recursive function # O(n) time | O(h) space def nodedepth(root, depth=0): if root is None: return 0 return depth + nodedepth(root.left, depth + 1) + nodedepth(root.right, depth+1) # iterative function # O(n) time | O(h) space def findtheddepth(root): stack = [{"node": root, "depth": 0}] sum...
def nodedepth(root, depth=0): if root is None: return 0 return depth + nodedepth(root.left, depth + 1) + nodedepth(root.right, depth + 1) def findtheddepth(root): stack = [{'node': root, 'depth': 0}] sum_of_depth = 0 while len(stack) > 0: node_info = stack.pop() (node, depth...
#!/usr/bin/env python3 # # Copyright (C) 2018 ETH Zurich and University of Bologna # # 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 # # Unl...
class Condor_Pool(object): def __init__(self): machines = ['fenga1.ee.ethz.ch', 'pisoc1.ee.ethz.ch', 'pisoc3.ee.ethz.ch', 'pisoc4.ee.ethz.ch', 'pisoc5.ee.ethz.ch', 'pisoc6.ee.ethz.ch'] self.env = {} self.env['CONDOR_REQUIREMENTS'] = '( TARGET.OpSysAndVer == "CentOS7" )' def get_cmd(sel...
class Event: # TODO: This gonna abstract the concept of row data in traditional ML approach pass
class Event: pass
def parse(file_path): # Method to read the config file. # Using a custom function for parsing so that we have only one config for # both the scripts and the mapreduce tasks. config = {} with open(file_path) as f: for line in f: data = line.strip() if(data and not dat...
def parse(file_path): config = {} with open(file_path) as f: for line in f: data = line.strip() if data and (not data.startswith('#')): (key, value) = data.split('=') config[key] = value return config
# -*- coding: utf-8 -*- ############################################################################### # # Copyright (C) 2021-TODAY Prof-Dev Integrated(<http://www.prof-dev.com>). ############################################################################### { 'name': 'Prof-Dev School MGMT', 'version': '...
{'name': 'Prof-Dev School MGMT', 'version': '1.0', 'license': 'LGPL-3', 'category': 'Education', 'sequence': 1, 'summary': 'Manage Students, School stages,levels, classes and fees', 'complexity': 'easy', 'author': 'Prof-Dev Integrated Solutions', 'website': 'http://www.prof-dev.com', 'depends': ['hr'], 'data': ['views/...
class Solution: def xorOperation(self, n: int, start: int) -> int: nums = [start + 2 * i for i in range(n)]; ret = 0; for val in nums: ret ^= val return ret
class Solution: def xor_operation(self, n: int, start: int) -> int: nums = [start + 2 * i for i in range(n)] ret = 0 for val in nums: ret ^= val return ret
text = '' with open('/home/reagan/code/proj/familienanlichkeiten/data/DeReKo-2014-II-MainArchive-STT.100000.freq', 'r+') as f: text = f.read() def process_line(line: str): parts = line.split('\t') return (parts[1], parts[2]) known = set() lemmas = [] for line in text.splitlines(): lemma = process_lin...
text = '' with open('/home/reagan/code/proj/familienanlichkeiten/data/DeReKo-2014-II-MainArchive-STT.100000.freq', 'r+') as f: text = f.read() def process_line(line: str): parts = line.split('\t') return (parts[1], parts[2]) known = set() lemmas = [] for line in text.splitlines(): lemma = process_line(...
EXCHANGE_COSMOS_BLOCKCHAIN = "cosmos_blockchain" CUR_ATOM = "ATOM" MILLION = 1000000.0 CURRENCIES = { "ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC": "OSMO" }
exchange_cosmos_blockchain = 'cosmos_blockchain' cur_atom = 'ATOM' million = 1000000.0 currencies = {'ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC': 'OSMO'}
class StoreDoesNotExist(Exception): def __init__(self): super(StoreDoesNotExist, self).__init__("Store with the given query does not exist")
class Storedoesnotexist(Exception): def __init__(self): super(StoreDoesNotExist, self).__init__('Store with the given query does not exist')
class LexerFileWriter(): def __init__(self, tokens: dict, lexical_errors: dict, symbol_table: dict, token_filename="tokens.txt", lexical_error_filename="lexical_errors.txt", symbol_table_filename="symbol_table.txt"): self.tokens = tokens self.lexical_errors = lexical_errors ...
class Lexerfilewriter: def __init__(self, tokens: dict, lexical_errors: dict, symbol_table: dict, token_filename='tokens.txt', lexical_error_filename='lexical_errors.txt', symbol_table_filename='symbol_table.txt'): self.tokens = tokens self.lexical_errors = lexical_errors self.symbol_table ...
classes = { # layout = ["name", [attacks],[item_drops], [changes]] 0: ["soldier", [0], [2, 4, 5, 11], ["h+10", "d+2"]], 1: ["mage", [0, 2], [3, 7], ["m+40"]], 2: ["tank", [0], [1, 2, 6, 11], ["h*2", "d*0.7"]], 3: ["archer", [0, 1], [0, 3, 4, 11], ["a+10"]], 100: ["boss", [], [], ["h*1.3", "d*1.5...
classes = {0: ['soldier', [0], [2, 4, 5, 11], ['h+10', 'd+2']], 1: ['mage', [0, 2], [3, 7], ['m+40']], 2: ['tank', [0], [1, 2, 6, 11], ['h*2', 'd*0.7']], 3: ['archer', [0, 1], [0, 3, 4, 11], ['a+10']], 100: ['boss', [], [], ['h*1.3', 'd*1.5', 'a*2', 'm*2']], 101: ['basic', [0], [], []]} def get_all_classes(name_only=F...
def common_settings(args, plt): # Common options if args['--title']: plt.title(args['--title']) plt.ylabel(args['--ylabel']) plt.xlabel(args['--xlabel']) if args['--xlog']: plt.xscale('log') if args['--ylog']: plt.yscale('log')
def common_settings(args, plt): if args['--title']: plt.title(args['--title']) plt.ylabel(args['--ylabel']) plt.xlabel(args['--xlabel']) if args['--xlog']: plt.xscale('log') if args['--ylog']: plt.yscale('log')
#This assignment will allow you to practice writing #Python Generator functions and a small GUI using tkinter #Title: Generator Function of Powers of Two #Author: Anthony Narlock #Prof: Lisa Minogue #Class: CSCI 2061 #Date: Nov 14, 2020 #Powers of two is a gen function that can take multiple parameters, 1 or 2, gives...
def powers_of_twos(*args): number_of_parameters = len(args) if number_of_parameters == 1: starting_pow = 1 num_of_pow = args[0] elif number_of_parameters == 2: starting_pow = args[0] num_of_pow = args[1] else: raise type_error('Expected either one or two parameter...
class FileNames(object): '''standardize and handle all file names/types encountered by pipeline''' def __init__(self, name): '''do everything upon instantiation''' # determine root file name self.root = name self.root = self.root.replace('_c.fit','') self.root = self.ro...
class Filenames(object): """standardize and handle all file names/types encountered by pipeline""" def __init__(self, name): """do everything upon instantiation""" self.root = name self.root = self.root.replace('_c.fit', '') self.root = self.root.replace('_sobj.fit', '') ...
# -*- coding: utf-8 -*- class Hero(object): def __init__(self, forename, surname, hero): self.forename = forename self.surname = surname self.heroname = hero def __repr__(self): return 'Hero({0}, {1}, {2})'.format( self.forename, self.surname, self.heroname)
class Hero(object): def __init__(self, forename, surname, hero): self.forename = forename self.surname = surname self.heroname = hero def __repr__(self): return 'Hero({0}, {1}, {2})'.format(self.forename, self.surname, self.heroname)
result = [] with open(FILE, mode='r') as file: reader = csv.reader(file, lineterminator='\n') for *features, label in reader: label = SPECIES[int(label)] row = tuple(features) + (label,) result.append(row)
result = [] with open(FILE, mode='r') as file: reader = csv.reader(file, lineterminator='\n') for (*features, label) in reader: label = SPECIES[int(label)] row = tuple(features) + (label,) result.append(row)
def spec(x, y, color="run ID"): def subfigure(params, x_kwargs, y_kwargs): return { "height": 400, "width": 600, "encoding": { "x": {"type": "quantitative", "field": x, **x_kwargs}, "y": {"type": "quantitative", "field": y, **y_kwargs}, ...
def spec(x, y, color='run ID'): def subfigure(params, x_kwargs, y_kwargs): return {'height': 400, 'width': 600, 'encoding': {'x': {'type': 'quantitative', 'field': x, **x_kwargs}, 'y': {'type': 'quantitative', 'field': y, **y_kwargs}, 'color': {'type': 'nominal', 'field': color}, 'opacity': {'value': 0.1, ...
# Option for variable 'simulation_type': # 1: cylindrical roller bearing # 2: # 3: cylindrical roller thrust bearing # 4: ball on disk (currently not fully supported) # 5: pin on disk # 6: 4 ball # 7: ball on three plates # 8: ring on ring # global simulation setup simulation_type = 8 # one of the above type numbers ...
simulation_type = 8 simulation_name = 'RingOnRing' auto_print = True auto_plot = False auto_report = False tribo_system_name = 'bla' number_planets = 2 e_cb1 = 210000 ny_cb1 = 0.3 diameter_cb1 = 37.5 length_cb1 = 10 type_profile_cb1 = 'ISO' path_profile_cb1 = 'tribology/p3can/BearingProfiles/NU206-RE-1.txt' profile_rad...
e={'Eid':100120,'name':'vijay','age':21} e1={'Eid':100121,'name':'vijay','age':21} e3={'Eid':100122,'name':'vijay','age':21} print(e) print(e.get('name')) e['age']=22; for i in e.keys(): print(e[i]) for i,j in e.items(): print(i,j)
e = {'Eid': 100120, 'name': 'vijay', 'age': 21} e1 = {'Eid': 100121, 'name': 'vijay', 'age': 21} e3 = {'Eid': 100122, 'name': 'vijay', 'age': 21} print(e) print(e.get('name')) e['age'] = 22 for i in e.keys(): print(e[i]) for (i, j) in e.items(): print(i, j)
def all_doe_stake_transactions(): data = { 'module': 'account', 'action': 'txlist', 'address':'0x60C6b5DC066E33801F2D9F2830595490A3086B4e', 'startblock':'13554136', 'endblock':'99999999', # 'page': '1', # 'offset': '5', 'sort': 'asc', 'apikey'...
def all_doe_stake_transactions(): data = {'module': 'account', 'action': 'txlist', 'address': '0x60C6b5DC066E33801F2D9F2830595490A3086B4e', 'startblock': '13554136', 'endblock': '99999999', 'sort': 'asc', 'apikey': hidden_details.etherscan_key} return requests.get('https://api.etherscan.io/api', data=data).json...
class Thinker: def __init__(self): self.velocity = 0 def viewDistance(self): return 20 def step(self, deltaTime): self.velocity = 30 def getVelocity(self): return self.velocity
class Thinker: def __init__(self): self.velocity = 0 def view_distance(self): return 20 def step(self, deltaTime): self.velocity = 30 def get_velocity(self): return self.velocity
__author__ = 'fernando' class BaseAuth(object): def has_data(self): raise NotImplementedError() def get_username(self): raise NotImplementedError() def get_password(self): raise NotImplementedError()
__author__ = 'fernando' class Baseauth(object): def has_data(self): raise not_implemented_error() def get_username(self): raise not_implemented_error() def get_password(self): raise not_implemented_error()
# -*- coding: utf-8 -*- def test_readuntil(monkey): pass
def test_readuntil(monkey): pass
class dotRebarSpacing_t(object): # no doc EndOffset = None EndOffsetIsAutomatic = None EndOffsetIsFixed = None NumberSpacingZones = None StartOffset = None StartOffsetIsAutomatic = None StartOffsetIsFixed = None Zones = None
class Dotrebarspacing_T(object): end_offset = None end_offset_is_automatic = None end_offset_is_fixed = None number_spacing_zones = None start_offset = None start_offset_is_automatic = None start_offset_is_fixed = None zones = None
# You can create a generator using a generator expression like a lambda function. # This function does not need or use a yield keyword. # Syntax : Y = ([ Expression ]) y = [1,2,3,4,5] print([x**2 for x in y]) print("\nDoing this without using the generator expressions :") length = len(y) print((x**2 for x in y).__ne...
y = [1, 2, 3, 4, 5] print([x ** 2 for x in y]) print('\nDoing this without using the generator expressions :') length = len(y) print((x ** 2 for x in y).__next__()) input('Press any key to exit ')
# Mock out starturls for ../spiders.py file class MockGenerator(object): def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return [] class FeedGenerator(MockGenerator): pass class FragmentGenerator(MockGenerator): pass
class Mockgenerator(object): def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return [] class Feedgenerator(MockGenerator): pass class Fragmentgenerator(MockGenerator): pass
class Time: def gettime(self): self.hour=int(input("Enter hour: ")) self.minute=int(input("Enter minute: ")) self.second=int(input("Enter seconds: ")) def display(self): print(f"Time is {self.hour}:{self.minute}:{self.second}\n") def __add__(self,other): sum=Time() sum.hour=self.hour+other.hour ...
class Time: def gettime(self): self.hour = int(input('Enter hour: ')) self.minute = int(input('Enter minute: ')) self.second = int(input('Enter seconds: ')) def display(self): print(f'Time is {self.hour}:{self.minute}:{self.second}\n') def __add__(self, other): sum...
n = int(input()) for i in range(n): a = input() set1 = set(input().split()) b = input() set2 = set(input().split()) print(set1.issubset(set2))
n = int(input()) for i in range(n): a = input() set1 = set(input().split()) b = input() set2 = set(input().split()) print(set1.issubset(set2))
def estimator(data): reportedCases=data['reportedCases'] totalHospitalBeds=data['totalHospitalBeds'] output={"data": {},"impact": {},"severeImpact":{}} output['impact']['currentlyInfected']=reportedCases * 10 output['severeImpact']['currentlyInfected']=reportedCases * 50 days=28 if days: factor=int(da...
def estimator(data): reported_cases = data['reportedCases'] total_hospital_beds = data['totalHospitalBeds'] output = {'data': {}, 'impact': {}, 'severeImpact': {}} output['impact']['currentlyInfected'] = reportedCases * 10 output['severeImpact']['currentlyInfected'] = reportedCases * 50 days = 2...