content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class ToDoTaskCreateError(Exception): pass class ToDoTaskReadError(Exception): pass class ToDoTaskUpdateError(Exception): pass class ToDoTaskDeleteError(Exception): pass
class Todotaskcreateerror(Exception): pass class Todotaskreaderror(Exception): pass class Todotaskupdateerror(Exception): pass class Todotaskdeleteerror(Exception): pass
#i = 1 #while (i!=10): # i=i+2 #for i in range(1,5): # print('Wow') rating=4 if rating>4: print('Great movie') elif rating>2: print('Good movie') else: print('Bad movie')
rating = 4 if rating > 4: print('Great movie') elif rating > 2: print('Good movie') else: print('Bad movie')
#!/usr/bin/env python3 class PortUtils(): def __init__(self, local_realm): self.local_realm = local_realm def set_ftp(self, port_name="", resource=1, on=False): if port_name != "": data = { "shelf": 1, "resource": resource, "port": po...
class Portutils: def __init__(self, local_realm): self.local_realm = local_realm def set_ftp(self, port_name='', resource=1, on=False): if port_name != '': data = {'shelf': 1, 'resource': resource, 'port': port_name, 'current_flags': 0, 'interest': 0} if on: ...
# -*- coding: utf-8 -*- BOT_NAME = 'spider' SPIDER_MODULES = ['spiders'] NEWSPIDER_MODULE = 'spiders' ROBOTSTXT_OBEY = False # change cookie to yours DEFAULT_REQUEST_HEADERS = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0', 'Cookie': 'OUTFOX_SEARCH_USER_...
bot_name = 'spider' spider_modules = ['spiders'] newspider_module = 'spiders' robotstxt_obey = False default_request_headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0', 'Cookie': 'OUTFOX_SEARCH_USER_ID_NCOO=1521427420.3020706; SCF=AlvwCT3ltiVc36wsKpuvTV8uWF4V1t...
R, G, B, N = map(int, input().split()) ans = 0 for r in range(N + 1): for g in range(N + 1): res = N - r * R - g * G if res >= 0 and res % B == 0: ans += 1 print(ans)
(r, g, b, n) = map(int, input().split()) ans = 0 for r in range(N + 1): for g in range(N + 1): res = N - r * R - g * G if res >= 0 and res % B == 0: ans += 1 print(ans)
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/own_data.py', '../_base_/schedules/schedule_1x_own_data.py', '../_base_/default_runtime.py' ] load_from = 'https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_mstrain_3x_coco/faster_rcnn_r50_fpn_mstrain_3x_...
_base_ = ['../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/own_data.py', '../_base_/schedules/schedule_1x_own_data.py', '../_base_/default_runtime.py'] load_from = 'https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_mstrain_3x_coco/faster_rcnn_r50_fpn_mstrain_3x_coco_20210524_...
# coding=utf-8 # project # test TEST = { "device_id": 0, "DATA_PATH": "/home/xyl/Pycharmproject/YOLOv3/voc_data", "PROJECT_PATH": "/home/xyl/PycharmProjects/YOLOV3_SUPER", "test_path": "../../data/voc/test.txt", "test_labels_path": "../../data/voc/labels_test", 'DATA':{"CLASSES":['aeroplane', 'bicycle', 'bird', '...
test = {'device_id': 0, 'DATA_PATH': '/home/xyl/Pycharmproject/YOLOv3/voc_data', 'PROJECT_PATH': '/home/xyl/PycharmProjects/YOLOV3_SUPER', 'test_path': '../../data/voc/test.txt', 'test_labels_path': '../../data/voc/labels_test', 'DATA': {'CLASSES': ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat',...
def foo1(): print ('NAME..............PRICE...SIZE....COLOUR...FOOTPRINT') print ('Tray..............$2.75...Large...White....12') print ('Tray..............$2.75...Large...Green....12') print ('Tray..............$1.50...Medium..White....8') print ('Tray..............$1.50...Medium..Green.......
def foo1(): print('NAME..............PRICE...SIZE....COLOUR...FOOTPRINT') print('Tray..............$2.75...Large...White....12') print('Tray..............$2.75...Large...Green....12') print('Tray..............$1.50...Medium..White....8') print('Tray..............$1.50...Medium..Green....8') prin...
# -*- coding: utf-8 -*- # Copyright (C) 2020 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'openstackdocstheme'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'microversion-parse' copyright = u'2016, OpenStack' author = u'OpenStack' repository_name = 'openstack/microversion-parse' bug_project = 'microversio...
def ensure_unique_index(data_df): return data_df[~data_df.index.duplicated(keep='first')] def ensure_sorted(data_df): return data_df.sort_index()
def ensure_unique_index(data_df): return data_df[~data_df.index.duplicated(keep='first')] def ensure_sorted(data_df): return data_df.sort_index()
n = int(input()) h = list(map(int, input().split())) h[0] -= 1 for i in range(0, n - 1): diff = h[i + 1] - h[i] if diff >= 1: h[i + 1] -= 1 elif diff < 0: print("No") exit() print("Yes")
n = int(input()) h = list(map(int, input().split())) h[0] -= 1 for i in range(0, n - 1): diff = h[i + 1] - h[i] if diff >= 1: h[i + 1] -= 1 elif diff < 0: print('No') exit() print('Yes')
def parse_arn(arn): # http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html elements = arn.split(':', 5) if len(elements) < 6: raise ValueError("%s is not a valid arn" % arn) result = { 'arn': elements[0], 'partition': elements[1], 'service': elements[...
def parse_arn(arn): elements = arn.split(':', 5) if len(elements) < 6: raise value_error('%s is not a valid arn' % arn) result = {'arn': elements[0], 'partition': elements[1], 'service': elements[2], 'region': elements[3], 'account': elements[4], 'resource': elements[5], 'resource_type': None} i...
N = int(input()) C = [int(input()) for _ in range(N)] divisor_count = [0] * N for i in range(N): for j in range(N): if i != j and C[i] % C[j] == 0: divisor_count[i] += 1 print('{:.20f}'.format(sum(0.5 if c % 2 else (c + 2) / (c + 1) / 2 for c in divisor_count)))
n = int(input()) c = [int(input()) for _ in range(N)] divisor_count = [0] * N for i in range(N): for j in range(N): if i != j and C[i] % C[j] == 0: divisor_count[i] += 1 print('{:.20f}'.format(sum((0.5 if c % 2 else (c + 2) / (c + 1) / 2 for c in divisor_count))))
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def bstFromPreorder(self, preorder: List[int]) -> TreeNode: def helper(lo, hi): if hi <= lo: return N...
class Solution: def bst_from_preorder(self, preorder: List[int]) -> TreeNode: def helper(lo, hi): if hi <= lo: return None root_val = preorder[lo] idx = lo + 1 while idx < hi: if preorder[idx] > root_val: b...
def partition(arr,low,high): i = ( low-1 ) pivot = arr[high] for j in range(low , high): if arr[j] <= pivot: i = i+1 arr[i],arr[j] = arr[j],arr[i] arr[i+1],arr[high] = arr[high],arr[i+1] return ( i+1 ) def heapify(arr, n, i): larg...
def partition(arr, low, high): i = low - 1 pivot = arr[high] for j in range(low, high): if arr[j] <= pivot: i = i + 1 (arr[i], arr[j]) = (arr[j], arr[i]) (arr[i + 1], arr[high]) = (arr[high], arr[i + 1]) return i + 1 def heapify(arr, n, i): largest = i l = 2 ...
# Crie um programa que leia o nome e o preco de varios produtos. O programa devera' perguntar se o usuario vai continuar. No final mostre: # a) Qual e' o total gasto na compra. # b) Quantos produtos custam mais de MZN1000. # c) Qual e' o nome do producto mais barato. maisde1000 = 0 total = 0 menor = 0 contador = 0 bara...
maisde1000 = 0 total = 0 menor = 0 contador = 0 barato = ' ' while True: print('=' * 40) print(' CAIXA DE SUPER MERCADO') print('=' * 40) nome = str(input('Nome do producto: ')).strip().title() preco = float(input('Preco do producto MZN: ')) contador += 1 total += preco if preco ...
counter = 0 while counter < 10: counter += 1 if counter == 3: continue print("No teller vi: " + str(counter))
counter = 0 while counter < 10: counter += 1 if counter == 3: continue print('No teller vi: ' + str(counter))
root = "root" dbPassword = "fladsjf12@110UQ" dbHost = "47.104.172.172"
root = 'root' db_password = 'fladsjf12@110UQ' db_host = '47.104.172.172'
data = ( 'nyaess', # 0x00 'nyaeng', # 0x01 'nyaej', # 0x02 'nyaec', # 0x03 'nyaek', # 0x04 'nyaet', # 0x05 'nyaep', # 0x06 'nyaeh', # 0x07 'neo', # 0x08 'neog', # 0x09 'neogg', # 0x0a 'neogs', # 0x0b 'neon', # 0x0c 'neonj', # 0x0d 'neonh', # 0x0e 'neod', #...
data = ('nyaess', 'nyaeng', 'nyaej', 'nyaec', 'nyaek', 'nyaet', 'nyaep', 'nyaeh', 'neo', 'neog', 'neogg', 'neogs', 'neon', 'neonj', 'neonh', 'neod', 'neol', 'neolg', 'neolm', 'neolb', 'neols', 'neolt', 'neolp', 'neolh', 'neom', 'neob', 'neobs', 'neos', 'neoss', 'neong', 'neoj', 'neoc', 'neok', 'neot', 'neop', 'neoh', '...
def quick_sort(array): length = len(array) if length < 2: return array index = 0 for i in range(1, length): if array[i] <= array[0]: index += 1 array[i], array[index] = array[index], array[i] array[0], array[index] = array[index], array[0] return quick_sort(array[:index]) + [array[index]...
def quick_sort(array): length = len(array) if length < 2: return array index = 0 for i in range(1, length): if array[i] <= array[0]: index += 1 (array[i], array[index]) = (array[index], array[i]) (array[0], array[index]) = (array[index], array[0]) return q...
def check_number(): num = int(input("Enter a number:")) test_data = [1, 5, 8, 3] if num in test_data: return print(True) else: return print(False) check_number()
def check_number(): num = int(input('Enter a number:')) test_data = [1, 5, 8, 3] if num in test_data: return print(True) else: return print(False) check_number()
def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Base spectrum width', 'units': 'm/s'}, {'abbr': 1, 'code': 1, 'title': 'Base reflectivity', 'units': 'dB'}, {'abbr': 2, 'code': 2, 'title': 'Base radial velocity', 'units': 'm/s'}, {'abbr': 3, 'code': 3, ...
def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Base spectrum width', 'units': 'm/s'}, {'abbr': 1, 'code': 1, 'title': 'Base reflectivity', 'units': 'dB'}, {'abbr': 2, 'code': 2, 'title': 'Base radial velocity', 'units': 'm/s'}, {'abbr': 3, 'code': 3, 'title': 'Vertically-integrated liquid water (VIL)', 'unit...
def GREETING(): print('hi!') class myclass: def __init__(self, a, b, C): self.A = a self.B = b self.C = C def myFun(self): print('hello 1') def my_fun(self, QQ): print('hello 2' + QQ) @classmethod def test_fun(first): print('hello 3') valid...
def greeting(): print('hi!') class Myclass: def __init__(self, a, b, C): self.A = a self.B = b self.C = C def my_fun(self): print('hello 1') def my_fun(self, QQ): print('hello 2' + QQ) @classmethod def test_fun(first): print('hello 3') valid_v...
#use common key words TIME_STAMP_FILE_NAME = "loadtimestamp.json" TIME_STAMP_KEY = "timestamp" NAME_OF_STATE_UT = "Name of State / UT" VACCINE_TIMELINE_URL = "VACCINE_TIMELINE_URL" CASES_TIMELINE_STATE = "CASES_TIMELINE_STATE" CONFIG_FILE_NAME = "config.json" STATE_CODE_NAME = "statecode.json" HELP_LINE = "HELP_LINE"...
time_stamp_file_name = 'loadtimestamp.json' time_stamp_key = 'timestamp' name_of_state_ut = 'Name of State / UT' vaccine_timeline_url = 'VACCINE_TIMELINE_URL' cases_timeline_state = 'CASES_TIMELINE_STATE' config_file_name = 'config.json' state_code_name = 'statecode.json' help_line = 'HELP_LINE' portal_url = 'PORTAL_UR...
#Problem 6 Squares of Sums Minus Sum of Squares sum_q = [] for x in range(1,101): y = x**2 sum_q.append(y) print(sum(sum_q)) n=0 for x in range(1,101): n=x+n square = n**2 print(square) total = square-sum(sum_q) print(total)
sum_q = [] for x in range(1, 101): y = x ** 2 sum_q.append(y) print(sum(sum_q)) n = 0 for x in range(1, 101): n = x + n square = n ** 2 print(square) total = square - sum(sum_q) print(total)
# naive approach: sort array and check if the sorted version is an arithmetic progression class Solution: def canMakeArithmeticProgression(self, arr: List[int]) -> bool: if len(arr) <= 2: return True sorted_arr = sorted(arr) d = sorted_arr[1] - sorted_arr[0] for i in ran...
class Solution: def can_make_arithmetic_progression(self, arr: List[int]) -> bool: if len(arr) <= 2: return True sorted_arr = sorted(arr) d = sorted_arr[1] - sorted_arr[0] for i in range(2, len(sorted_arr)): if sorted_arr[i] - sorted_arr[i - 1] != d: ...
def do_twice(function): function() function() def do_four(function): do_twice(function) do_twice(function) def filled_grid_elem(): print('+ - - - - ', end= "") def empty_grid_elem(): print('| ', end= "") def four_filled_elem(): do_four(filled_grid_elem) print('+') ...
def do_twice(function): function() function() def do_four(function): do_twice(function) do_twice(function) def filled_grid_elem(): print('+ - - - - ', end='') def empty_grid_elem(): print('| ', end='') def four_filled_elem(): do_four(filled_grid_elem) print('+') def four_emp...
def videoPart(part, total): partSec = getSeconds(part) totalSec = getSeconds(total) divisor = gcd(partSec, totalSec) print (divisor) return [partSec // divisor, totalSec // divisor] def getSeconds(time): splitted = time.split(':') return int(splitted[0]) * 3600 + int(splitted[1]) * 60 + in...
def video_part(part, total): part_sec = get_seconds(part) total_sec = get_seconds(total) divisor = gcd(partSec, totalSec) print(divisor) return [partSec // divisor, totalSec // divisor] def get_seconds(time): splitted = time.split(':') return int(splitted[0]) * 3600 + int(splitted[1]) * 60 ...
class Score(): def __init__(self, SCREEN_WIDTH=None, decrease_mode=False, points=10): self.value = 0 self.x_pos = 100 self.font_size = 25 self.decrease_mode = decrease_mode self.total_hits = 0 # The ammount of notes correctly hit in a row self._counter = 0 ...
class Score: def __init__(self, SCREEN_WIDTH=None, decrease_mode=False, points=10): self.value = 0 self.x_pos = 100 self.font_size = 25 self.decrease_mode = decrease_mode self.total_hits = 0 self._counter = 0 self.rock_meter = 50 self.points = points ...
class ImproperlyConfiguredError(Exception): def __init__(self, message, *args): super().__init__(message) class UserAborted(Exception): pass
class Improperlyconfigurederror(Exception): def __init__(self, message, *args): super().__init__(message) class Useraborted(Exception): pass
a = "Hello" b = "World" c = a + b print (c) d = a*5 print (d) e = a * 5 + b * 3 print (e) f = a.upper() print (f) e = b.lower() print (e)
a = 'Hello' b = 'World' c = a + b print(c) d = a * 5 print(d) e = a * 5 + b * 3 print(e) f = a.upper() print(f) e = b.lower() print(e)
#!/usr/bin/env python # -*- coding: utf-8 -*- # AUTHOR = 'yenx' SITENAME = 'TFC Mappers Realm' SITEURL = '' PATH = 'content' TIMEZONE = 'America/Sao_Paulo' DEFAULT_LANG = 'en' THEME = 'tfcmappers-theme' # Feed generation is usually not desired when developing FEED_ALL_ATOM = None CATEGORY_FEED_ATOM = None TRANSLA...
author = 'yenx' sitename = 'TFC Mappers Realm' siteurl = '' path = 'content' timezone = 'America/Sao_Paulo' default_lang = 'en' theme = 'tfcmappers-theme' feed_all_atom = None category_feed_atom = None translation_feed_atom = None author_feed_atom = None author_feed_rss = None article_paths = ['blog'] static_paths = ['...
def buscar_Animais(lista, numero): minimo = 0 maximo = len(lista) - 1 encontrado = False while minimo <= maximo and not encontrado: meiodalista = (minimo + maximo) // 2 if lista[meiodalista][0] == numero: encontrado = True else: if numero < lista[meiodali...
def buscar__animais(lista, numero): minimo = 0 maximo = len(lista) - 1 encontrado = False while minimo <= maximo and (not encontrado): meiodalista = (minimo + maximo) // 2 if lista[meiodalista][0] == numero: encontrado = True elif numero < lista[meiodalista][0]: ...
n = float(input("Digite o numero da primeira nota aluno")) n1 = float(input("Digite o numero da segunda nota do aluno ")) s = (n + n1) / 2 print("O resultado do e de {:.2f}".format(s))
n = float(input('Digite o numero da primeira nota aluno')) n1 = float(input('Digite o numero da segunda nota do aluno ')) s = (n + n1) / 2 print('O resultado do e de {:.2f}'.format(s))
# Copyright 2020 Timothy Trippel # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
config_dict = {'experiment_name': 'not-set', 'toplevel': 'not-set', 'soc': 'opentitan', 'version': 'HEAD', 'tb_type': 'cpp', 'tb': 'afl', 'fuzzer': 'afl', 'default_input': 'test.hwf', 'instrument_dut': 1, 'instrument_tb': 0, 'instrument_vltrt': 0, 'manual': 0, 'run_on_gcp': 1, 'hdl_gen_params': {}, 'model_params': {'op...
# Returns index of x in arr if present, else -1 def binary_search(arr, low, high, x): # Check base case if high >= low: mid = (high + low) // 2 # If element is present at the middle itself if arr[mid] == x: return mid # If element is sma...
def binary_search(arr, low, high, x): if high >= low: mid = (high + low) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return binary_search(arr, low, mid - 1, x) else: return binary_search(arr, mid + 1, high, x) else: return -1 ...
def electionsWinners(votes, k): counter = 0 max_vote = max(votes) if k == 0: if votes.count(max_vote) == 1: return 1 else: return 0 for i in range(len(votes)): if votes[i] + k > max_vote: counter += 1 return counter
def elections_winners(votes, k): counter = 0 max_vote = max(votes) if k == 0: if votes.count(max_vote) == 1: return 1 else: return 0 for i in range(len(votes)): if votes[i] + k > max_vote: counter += 1 return counter
load( "//:repositories.bzl", "io_bazel_rules_rust", ) load( "//protobuf:repositories.bzl", "protobuf_repos", ) load( "//rust/raze:crates.bzl", "raze_fetch_remote_crates" ) def rust_repos(**kwargs): protobuf_repos(**kwargs) io_bazel_rules_rust(**kwargs) raze_fetch_remote_crates()
load('//:repositories.bzl', 'io_bazel_rules_rust') load('//protobuf:repositories.bzl', 'protobuf_repos') load('//rust/raze:crates.bzl', 'raze_fetch_remote_crates') def rust_repos(**kwargs): protobuf_repos(**kwargs) io_bazel_rules_rust(**kwargs) raze_fetch_remote_crates()
num = int(input()) if num %5 == 0: final = num//5 elif num % 4==0: final = num//4 elif num %3==0: final = num//3 elif num%2 ==0: final = num //2 else: final = num print(final)
num = int(input()) if num % 5 == 0: final = num // 5 elif num % 4 == 0: final = num // 4 elif num % 3 == 0: final = num // 3 elif num % 2 == 0: final = num // 2 else: final = num print(final)
class BanlistNotFoundError(Exception): pass class CardNotFoundError(Exception): pass class LanguageError(Exception): pass
class Banlistnotfounderror(Exception): pass class Cardnotfounderror(Exception): pass class Languageerror(Exception): pass
snake_case_var = True CamelCaseVar = False lowerCamelCaseVar = False SoMeWieRdCasE = False #Exceptions: class ClassCamelCase: pass #from SQLAlchemy: Session = True Base = True Order = True Address = True
snake_case_var = True camel_case_var = False lower_camel_case_var = False so_me_wie_rd_cas_e = False class Classcamelcase: pass session = True base = True order = True address = True
#!/usr/bin/env python3 class InfoSource(): def __init__(self): self.Name = "" self.Result = None @classmethod def fromDict(cls, src_dict): raise NotImplementedError() def __call__(self): # Should return the info, and also set self.Result. raise NotImplementedEr...
class Infosource: def __init__(self): self.Name = '' self.Result = None @classmethod def from_dict(cls, src_dict): raise not_implemented_error() def __call__(self): raise not_implemented_error()
user_names = [] if user_names: for user_name in user_names: if user_name == 'admin': print ("Hello admin, would you like to see a status report?") else: print ("Hello " + user_name.title() + ", thank for logging in again") else: print ("we need some users!")
user_names = [] if user_names: for user_name in user_names: if user_name == 'admin': print('Hello admin, would you like to see a status report?') else: print('Hello ' + user_name.title() + ', thank for logging in again') else: print('we need some users!')
# https://www.codewars.com/kata/523f5d21c841566fde000009/train/python def array_diff(a, b): output_array = [] for number in a: if number not in b: output_array.append(number) return output_array
def array_diff(a, b): output_array = [] for number in a: if number not in b: output_array.append(number) return output_array
# -*- coding: utf-8 -*- ''' Author: Hannibal Data: Desc: local data config NOTE: Don't modify this file, it's build by xml-to-python!!! ''' fightdungeon_map = {}; class Fightdungeon: def __init__(self, key): config = fightdungeon_map.get(key); for k, v in config.items(): setattr(self, k, v); return def...
""" Author: Hannibal Data: Desc: local data config NOTE: Don't modify this file, it's build by xml-to-python!!! """ fightdungeon_map = {} class Fightdungeon: def __init__(self, key): config = fightdungeon_map.get(key) for (k, v) in config.items(): setattr(self, k, v) return d...
# RUN: test-ir.sh %s # RUN: test-output.sh %s print((1, 2, 3)) # IR: [[buffer:%buffer]] = call i64 @llvmPy_malloc(i64 24) # IR-NEXT: [[array:%[0-9]+]] = inttoptr i64 %buffer to [3 x %PyObj*]* # IR-NEXT: %PyInt.1 = # IR-NEXT: [[ptr1:%[0-9]+]] = getelementptr [3 x %PyObj*], [3 x %PyObj*]* [[array]], i64 0, i64 0 # IR-NE...
print((1, 2, 3))
n = int(input('Enter how many number in Fibonacci Series you want: ')) a, b = 0, 1 print(f'Fibonacci Series is given by: ') for i in range (1, n+1): if i == n: print(b) else: print(f'{b}, ', end='') a, b = b, a+b
n = int(input('Enter how many number in Fibonacci Series you want: ')) (a, b) = (0, 1) print(f'Fibonacci Series is given by: ') for i in range(1, n + 1): if i == n: print(b) else: print(f'{b}, ', end='') (a, b) = (b, a + b)
# makeArrayConsecutive2 # fill in the gaps: # after array is sorted, # how many additional values need to be added # to make the array incrimented by 1? # (User's) Problem # We Have: # a array of int # We Need: # fill in the gaps: # after array is sorted, # how many additional values need to be added #...
def make_array_consecutive2(input_list): cumulative_sum = 0 input_list = sorted(input_list) for i in range(0, len(input_list) - 1): cumulative_sum += input_list[i + 1] - input_list[i] - 1 return cumulative_sum
class _Keyword: def __init__(self, name): self._name = name def __repr__(self): return self._name def __eq__(self, other): return self is other ASC = ASCENDING = _Keyword("ASCENDING") DESC = DESCENDING = _Keyword("DESCENDING") KEEPOLD = _Keyword("KEEPOLD")
class _Keyword: def __init__(self, name): self._name = name def __repr__(self): return self._name def __eq__(self, other): return self is other asc = ascending = __keyword('ASCENDING') desc = descending = __keyword('DESCENDING') keepold = __keyword('KEEPOLD')
expected_output = { "bay": "0", "chassis": { 1: { "cmca_certificate": "MIIEPDCCAySgAwIBAgIKYQlufQAAAAAADDANBgkqhkiG9w0BAQUFADA1MRYwFAYDVQQKEw1DaXNjbyBTeXN0ZW1zMRswGQYDVQQDExJDaXNjbyBSb290IENBIDIwNDgwHhcNMTEwNjMwMTc1NjU3WhcNMjkwNTE0MjAyNTQyWjAnMQ4wDAYDVQQKEwVDaXNjbzEVMBMGA1UEAxMMQUNUMiBTVURJI...
expected_output = {'bay': '0', 'chassis': {1: {'cmca_certificate': 'MIIEPDCCAySgAwIBAgIKYQlufQAAAAAADDANBgkqhkiG9w0BAQUFADA1MRYwFAYDVQQKEw1DaXNjbyBTeXN0ZW1zMRswGQYDVQQDExJDaXNjbyBSb290IENBIDIwNDgwHhcNMTEwNjMwMTc1NjU3WhcNMjkwNTE0MjAyNTQyWjAnMQ4wDAYDVQQKEwVDaXNjbzEVMBMGA1UEAxMMQUNUMiBTVURJIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC...
def execute_steps_and_capture_errors(context, steps_text): context.captured_assertion_error = None try: context.execute_steps(steps_text) except AssertionError as captured_error: context.captured_assertion_error = str(captured_error) def validate_captured_error_contains(context, desired_e...
def execute_steps_and_capture_errors(context, steps_text): context.captured_assertion_error = None try: context.execute_steps(steps_text) except AssertionError as captured_error: context.captured_assertion_error = str(captured_error) def validate_captured_error_contains(context, desired_err...
def byte_to_int(num): return int.from_bytes(num, byteorder='big') def int_to_byte(num): return bytes([num]) def pixel(r, g, b): return (byte_to_int(r), byte_to_int(g), byte_to_int(b)) def printf(string): print(string, end='')
def byte_to_int(num): return int.from_bytes(num, byteorder='big') def int_to_byte(num): return bytes([num]) def pixel(r, g, b): return (byte_to_int(r), byte_to_int(g), byte_to_int(b)) def printf(string): print(string, end='')
__author__ = 'student5' class LSClientException(Exception): def __init__(self, message): super(message)
__author__ = 'student5' class Lsclientexception(Exception): def __init__(self, message): super(message)
# import matplotlib.pyplot as plt # import numpy as np # import sys def readExperimentCentres(file): for item in file: v = [x.split(' ')[:2] for x in item.strip('\n').split(',')] yield [[float(a) for a in x]for x in v] def plotMatchingCentres(fileName): with open(fileName) as file: sc...
def read_experiment_centres(file): for item in file: v = [x.split(' ')[:2] for x in item.strip('\n').split(',')] yield [[float(a) for a in x] for x in v] def plot_matching_centres(fileName): with open(fileName) as file: scatter_plot(read_experiment_centres(file))
# from https://stackoverflow.com/a/51230541 NON_NFKD_MAP = { u"\u0181": u"B", u"\u1d81": u"d", u"\u1d85": u"l", u"\u1d89": u"r", u"\u028b": u"v", u"\u1d8d": u"x", u"\u1d83": u"g", u"\u0191": u"F", u"\u0199": u"k", u"\u019d": u"N", u"\u0220": u"N", u"\u01a5": u"p", u"\...
non_nfkd_map = {u'Ɓ': u'B', u'ᶁ': u'd', u'ᶅ': u'l', u'ᶉ': u'r', u'ʋ': u'v', u'ᶍ': u'x', u'ᶃ': u'g', u'Ƒ': u'F', u'ƙ': u'k', u'Ɲ': u'N', u'Ƞ': u'N', u'ƥ': u'p', u'Ȥ': u'Z', u'Ħ': u'H', u'ƭ': u't', u'Ƶ': u'Z', u'ȴ': u'l', u'ȼ': u'c', u'ɀ': u'z', u'ł': u'l', u'Ʉ': u'U', u'Ⱡ': u'L', u'Ɉ': u'J', u'Ꝋ': u'O', u'Ɍ': u'R', u'Ꝓ'...
''' Created on Feb 7, 2012 @author: marat ''' class AtomOntology: ''' classdocs ''' def __init__(self): ''' Constructor ''' pass @staticmethod def atomName(mydict): if mydict.has_key("name"): name = mydict["name"] else: ...
""" Created on Feb 7, 2012 @author: marat """ class Atomontology: """ classdocs """ def __init__(self): """ Constructor """ pass @staticmethod def atom_name(mydict): if mydict.has_key('name'): name = mydict['name'] else: ...
class Solution: def distanceBetweenBusStops(self, distance: List[int], start: int, destination: int) -> int: totalDistance, currentDist, i = sum(distance), 0, start while i != destination: currentDist += distance[i] i = (i + 1) % len(distance) return min(currentDist, ...
class Solution: def distance_between_bus_stops(self, distance: List[int], start: int, destination: int) -> int: (total_distance, current_dist, i) = (sum(distance), 0, start) while i != destination: current_dist += distance[i] i = (i + 1) % len(distance) return min(cu...
# Logical Operators in Python ''' The logical operators in Python are used to combine conditional statements. These are: - and - or - not - and: Returns True if both statements are True - or: Returns True if one of the statements is True - not: Returns True if the statement is False ''' print('5 < 6 and 4 < 6 is',...
""" The logical operators in Python are used to combine conditional statements. These are: - and - or - not - and: Returns True if both statements are True - or: Returns True if one of the statements is True - not: Returns True if the statement is False """ print('5 < 6 and 4 < 6 is', 5 < 6 and 4 < 6) print('5 < 6 a...
print("Assalam Alaikum") print("This is Islamic game test") print("Let's get started") while True: # Question 1 choice = input("Who was the fourth Khalifa? ") # Correct Answers if choice in ('Ali', 'Ali (ra)', 'ali', 'Ali ra', 'Ali RA'): print("Correct!") break else: ...
print('Assalam Alaikum') print('This is Islamic game test') print("Let's get started") while True: choice = input('Who was the fourth Khalifa? ') if choice in ('Ali', 'Ali (ra)', 'ali', 'Ali ra', 'Ali RA'): print('Correct!') break else: print("Wrong! It was Ali (ra) Let's try again")...
input() x=[*map(int,input().split())] s=[] for n,i in enumerate(x): while s: if s[-1][1]<i: s.pop() else: break if not s: print(0,end=' ') else: print(s[-1][0],end=' ') s.append([n+1,i])
input() x = [*map(int, input().split())] s = [] for (n, i) in enumerate(x): while s: if s[-1][1] < i: s.pop() else: break if not s: print(0, end=' ') else: print(s[-1][0], end=' ') s.append([n + 1, i])
t3 = int(input()) t2 = t3 * 2 t1 = t2 * 2 print(t1)
t3 = int(input()) t2 = t3 * 2 t1 = t2 * 2 print(t1)
def find_it(seq): counter = [{x: seq.count(x)} for x in set(seq)] for n in counter: for i, j in n.items(): if j % 2 != 0: return i if __name__ == "__main__": test_list = [20, 1, -1, 2, -2, 3, 3, 5, 5, 1, 2, 4, 20, 4, -1, -2, 5] # print(find_it(test_list))
def find_it(seq): counter = [{x: seq.count(x)} for x in set(seq)] for n in counter: for (i, j) in n.items(): if j % 2 != 0: return i if __name__ == '__main__': test_list = [20, 1, -1, 2, -2, 3, 3, 5, 5, 1, 2, 4, 20, 4, -1, -2, 5]
# ------------------------------------------------------------------------------ # CodeHawk Java Analyzer # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2016-2020 Kestrel Technology LLC # # Permission is hereby granted, fr...
class Instruction(object): def __init__(self, jmethod, pc, opc, exprstack, tgts=None): self.jmethod = jmethod self.pc = pc self.opc = opc self.exprstack = exprstack self.tgts = tgts def has_targets(self): return not self.tgts is None def get_targets(self): ...
{ 'targets': [ { 'target_name': 'yassl', 'type': 'static_library', 'standalone_static_library': 1, 'includes': [ '../../config/config.gypi' ], 'sources': [ 'src/buffer.cpp', 'src/cert_wrapper.cpp', 'src/crypto_wrapper.cpp', 'src/handshake.cpp', ...
{'targets': [{'target_name': 'yassl', 'type': 'static_library', 'standalone_static_library': 1, 'includes': ['../../config/config.gypi'], 'sources': ['src/buffer.cpp', 'src/cert_wrapper.cpp', 'src/crypto_wrapper.cpp', 'src/handshake.cpp', 'src/lock.cpp', 'src/log.cpp', 'src/socket_wrapper.cpp', 'src/ssl.cpp', 'src/time...
MOCK_DATASET_LIST = [ { 'peername': 'my_peer', 'name': 'first_dataset', 'bodyPath': '/mem/SomeBodyPath', 'structure': { 'format': 'csv', }, }, { 'username': 'my_peer', 'name': 'second_dataset', 'bodyPath': '/mem/AnotherBodyPath', ...
mock_dataset_list = [{'peername': 'my_peer', 'name': 'first_dataset', 'bodyPath': '/mem/SomeBodyPath', 'structure': {'format': 'csv'}}, {'username': 'my_peer', 'name': 'second_dataset', 'bodyPath': '/mem/AnotherBodyPath', 'structure': {'format': 'csv'}, 'readme': {'scriptBytes': 'IyBIZWxsbwoKY29udGVudA=='}}, {'peername...
a = int(input()) m = int(input()) if (a + m) > 50: print("N") else: print("S")
a = int(input()) m = int(input()) if a + m > 50: print('N') else: print('S')
YOUTUBE_URL = "https://www.youtube.com" YOUTUBE_STUDIO_URL = "https://studio.youtube.com" YOUTUBE_UPLOAD_URL = "https://www.youtube.com/upload" DESCRIPTION_CONTAINER = "/html/body/ytcp-uploads-dialog/tp-yt-paper-dialog/div/ytcp-animatable[1]/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[2]...
youtube_url = 'https://www.youtube.com' youtube_studio_url = 'https://studio.youtube.com' youtube_upload_url = 'https://www.youtube.com/upload' description_container = '/html/body/ytcp-uploads-dialog/tp-yt-paper-dialog/div/ytcp-animatable[1]/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[2]/ytcp-m...
#option 1: Verify if a string is a Palindrome table1 = {} def perm_palindrome(pal_str): #eliminate spaces pal_str = pal_str.replace(" ", "") for i in range(len(pal_str)): if pal_str[i] in table1: table1[pal_str[i]] += 1 else: table1[pal_str[i]] = 1 is_odd = False ...
table1 = {} def perm_palindrome(pal_str): pal_str = pal_str.replace(' ', '') for i in range(len(pal_str)): if pal_str[i] in table1: table1[pal_str[i]] += 1 else: table1[pal_str[i]] = 1 is_odd = False for char in table1: if table1[char] % 2 == 1: ...
def methodception(another): return another() def add_two_numbers(): return 35 + 77 print(methodception(add_two_numbers)) my_list = [13, 56, 77, 484] print(list(filter(lambda x: x % 2 == 0, my_list))) res = (lambda x: x * 3)(5) print("Res", res)
def methodception(another): return another() def add_two_numbers(): return 35 + 77 print(methodception(add_two_numbers)) my_list = [13, 56, 77, 484] print(list(filter(lambda x: x % 2 == 0, my_list))) res = (lambda x: x * 3)(5) print('Res', res)
# We have a layout of dominoes. We have it as a list of pairs [a, b]. If we knock over block a, block # b will also fall over. Find the minimum number of blocks that need to be knocked over by hand so that # all dominoes are downed. def DFSUtil(graph, source, visited, stack): visited[source] = True for v in g...
def dfs_util(graph, source, visited, stack): visited[source] = True for v in graph[source]: if not visited[v]: dfs_util(graph, v, visited, stack) stack.append(source) def dfs(graph, source, visited, scc, index): visited[source] = True scc[index].append(source) for v in g...
def findRealEnemy(enemies): for enemy in enemies: name = enemy.id.lower() words = name.split(" ") second = words[1] if second[0] == second[-1]: return enemy while True: ogres = hero.findEnemies() realOgre = findRealEnemy(ogres) if realOgre: while rea...
def find_real_enemy(enemies): for enemy in enemies: name = enemy.id.lower() words = name.split(' ') second = words[1] if second[0] == second[-1]: return enemy while True: ogres = hero.findEnemies() real_ogre = find_real_enemy(ogres) if realOgre: while ...
class Tweet: def __init__(self, tweet_id, message): self.id = tweet_id self.message = message
class Tweet: def __init__(self, tweet_id, message): self.id = tweet_id self.message = message
books = [] def create_book_table(): pass def get_all_books(): return books def insert_book(name, author): books.append({'name': name, 'author': author, 'read': False}) def mark_book_as_read(name): for book in books: if book['name'] == name: book['read'] = True def delete_bo...
books = [] def create_book_table(): pass def get_all_books(): return books def insert_book(name, author): books.append({'name': name, 'author': author, 'read': False}) def mark_book_as_read(name): for book in books: if book['name'] == name: book['read'] = True def delete_book(na...
# A basic code for matrix input from user R = int(input("Enter the number of rows:")) C = int(input("Enter the number of columns:")) # Initialize matrix matrix = [] print("Enter the entries rowwise:") # For user input for i in range(R): # A for loop for row entries a =[] for j in range(C): # A for loop for colu...
r = int(input('Enter the number of rows:')) c = int(input('Enter the number of columns:')) matrix = [] print('Enter the entries rowwise:') for i in range(R): a = [] for j in range(C): a.append(int(input())) matrix.append(a) for i in range(R): for j in range(C): print(matrix[i][j], end=' ...
N = int(input()) S = input() result = 0 i = -1 while i < N: i = S.find('U', i + 1) if i == -1: break j = i while j < N: j = S.find('M', j + 1) if j == -1: break k = 2 * j - i if k < N and S[k] == 'G': result += 1 print(result)
n = int(input()) s = input() result = 0 i = -1 while i < N: i = S.find('U', i + 1) if i == -1: break j = i while j < N: j = S.find('M', j + 1) if j == -1: break k = 2 * j - i if k < N and S[k] == 'G': result += 1 print(result)
def cors_exempt(func): def wrap(request, **args): res = func(request, **args) res["Access-Control-Allow-Credentials"] = "true" res["Access-Control-Allow-Methods"] = "*" res["Access-Control-Allow-Origin"] = request.headers.get("Origin") return res return wrap
def cors_exempt(func): def wrap(request, **args): res = func(request, **args) res['Access-Control-Allow-Credentials'] = 'true' res['Access-Control-Allow-Methods'] = '*' res['Access-Control-Allow-Origin'] = request.headers.get('Origin') return res return wrap
FreeSans24pt7bBitmaps = [ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x76, 0x66, 0x66, 0x00, 0x0F, 0xFF, 0xFF, 0xF1, 0xFE, 0x3F, 0xC7, 0xF8, 0xFF, 0x1F, 0xE3, 0xFC, 0x7F, 0x8F, 0xF1, 0xEC, 0x19, 0x83, 0x30, 0x60, 0x00, 0x70, 0x3C, 0x00, 0x70, 0x3C, 0x00, 0xF0, 0x38, 0x00, 0xF0, 0x38, 0x...
free_sans24pt7b_bitmaps = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 118, 102, 102, 0, 15, 255, 255, 241, 254, 63, 199, 248, 255, 31, 227, 252, 127, 143, 241, 236, 25, 131, 48, 96, 0, 112, 60, 0, 112, 60, 0, 240, 56, 0, 240, 56, 0, 240, 120, 0, 224, 120, 0, 224, 120, 1, 224, 112, 1, 224, 112, 127, 255, 255, 127...
# Selects the top ten rows from a table. top_10 = f''' SELECT * FROM {{ src_tbl }} ORDER BY id desc LIMIT 10; ''' # Creates a view of the top 10 rows from a table name. create_top_10_view = f''' CREATE VIEW {{ view_name }} AS SELECT * FROM {{ src_tbl }} ORDER BY id DESC LIMIT 10; ''' # Select all from a table. sele...
top_10 = f'\nSELECT * FROM {{ src_tbl }} ORDER BY id desc LIMIT 10;\n' create_top_10_view = f'\nCREATE VIEW {{ view_name }} AS\nSELECT * \nFROM {{ src_tbl }}\nORDER BY id DESC\nLIMIT 10;\n' select_all = 'SELECT * FROM {{ src_tbl }}' grab_tbl_schema = f'\nSELECT * FROM {{ src_tbl }} WHERE 1 = 2;\n' drop_tbl = f'\nDROP T...
salario = float(input("Insira um salario: ")) if salario >= 1250: porc = salario * 1.10 print(f'O seu salario de {salario} teve um aumento de {porc:7.2f}') else: porc1 = salario * 1.15 print(f'O seu salario de {salario} teve um aumento de {porc1:7.2f}')
salario = float(input('Insira um salario: ')) if salario >= 1250: porc = salario * 1.1 print(f'O seu salario de {salario} teve um aumento de {porc:7.2f}') else: porc1 = salario * 1.15 print(f'O seu salario de {salario} teve um aumento de {porc1:7.2f}')
class InvalidParentType(Exception): message = "You cannot assign this element to the parent." class DuplicateNode(Exception): message = "This element is already used in the workflow" class InvalidOutcomeOperator(Exception): message = "Operator not implemented" class InvalidArgument(Exception): mes...
class Invalidparenttype(Exception): message = 'You cannot assign this element to the parent.' class Duplicatenode(Exception): message = 'This element is already used in the workflow' class Invalidoutcomeoperator(Exception): message = 'Operator not implemented' class Invalidargument(Exception): messag...
#!/usr/bin/env PYTHONHASHSEED=1234 python3 # item_90_example_08.py # Example 8: Use mypy to find errors before running the program # Check types in this file with: python -m mypy <path> class Counter: def __init__(self) -> None: self.value: int = 0 # Field / variable annotation def add(self, offse...
class Counter: def __init__(self) -> None: self.value: int = 0 def add(self, offset: int) -> None: value += offset def get(self) -> int: self.value counter = counter() counter.add(5) counter.add(3) assert counter.get() == 8
class Solution: def numberOfArrays(self, differences: List[int], lower: int, upper: int) -> int: prefix = [0] + list(accumulate(differences)) return max(0, (upper - lower) - (max(prefix) - min(prefix)) + 1)
class Solution: def number_of_arrays(self, differences: List[int], lower: int, upper: int) -> int: prefix = [0] + list(accumulate(differences)) return max(0, upper - lower - (max(prefix) - min(prefix)) + 1)
class mixin_DS: def departament_ds(self): return 'Open DS department!' class mixin_Dev: def department_dev(self): return 'Open development department!' class mixin_Test: def department_test(self): return 'Open testing department!' class Base_company: pass class Company_dev(...
class Mixin_Ds: def departament_ds(self): return 'Open DS department!' class Mixin_Dev: def department_dev(self): return 'Open development department!' class Mixin_Test: def department_test(self): return 'Open testing department!' class Base_Company: pass class Company_Dev...
def solve(): n = int(input()) child = {} for _ in range(n): node, left, right = input().split() child[node] = (left, right) print_buf = [] def preorder(node): print_buf.append(node) if child[node][0] in child: preorder(child[node][0]) if child[no...
def solve(): n = int(input()) child = {} for _ in range(n): (node, left, right) = input().split() child[node] = (left, right) print_buf = [] def preorder(node): print_buf.append(node) if child[node][0] in child: preorder(child[node][0]) if child[n...
class A: def f1(self): print('f1 in A') class B(A): def f1(self): print('f1 in B') def f1a(self): A().f1() class C(B): def f1(self): print('f1 in c') def f1b(self): B().f1() o = C() o.f1() o.f1a() o.f1b()
class A: def f1(self): print('f1 in A') class B(A): def f1(self): print('f1 in B') def f1a(self): a().f1() class C(B): def f1(self): print('f1 in c') def f1b(self): b().f1() o = c() o.f1() o.f1a() o.f1b()
{ "targets": [ { "include_dirs": [ "<!(node -p \"require('node-addon-api').include_dir\")" ], "target_name": "PSMoveClickerAPI", "sources": [ "api.cc" ], "defines": [ "NAPI_CPP_EXCEPTIONS"...
{'targets': [{'include_dirs': ['<!(node -p "require(\'node-addon-api\').include_dir")'], 'target_name': 'PSMoveClickerAPI', 'sources': ['api.cc'], 'defines': ['NAPI_CPP_EXCEPTIONS'], 'libraries': ['../PSMoveClient_CAPI.lib'], 'copies': [{'destination': '<(module_root_dir)/build/Release/', 'files': ['<(module_root_dir)/...
# Challenge 55, easy # https://www.reddit.com/r/dailyprogrammer/comments/txla7/5212012_challenge_55_easy/ # Sliding window minimum problem # inputs: Array and window size # output: minimum value of array for each window position my_array = [4, 3, 2, 1, 5, 7] my_window = 3 def get_minimum(input_array, window_size): ...
my_array = [4, 3, 2, 1, 5, 7] my_window = 3 def get_minimum(input_array, window_size): min_list = [] for i in range(len(input_array) - window_size + 1): new_window = input_array[i:i + window_size] min_list.append(min(new_window)) print(min_list) get_minimum(my_array, my_window)
text=''' ''' def getStackup(text): lines=[i.split('\t') for i in text.splitlines() if len(i.strip())>0] data=[] n=0 for i in lines: name=i[0].strip() if i[0].strip() else 'UNNAMED_{:03d}'.format(n) n+=1 thickness, Dk, Df=i[1], i[2], i[3] data.append((name,thic...
text = '\n' def get_stackup(text): lines = [i.split('\t') for i in text.splitlines() if len(i.strip()) > 0] data = [] n = 0 for i in lines: name = i[0].strip() if i[0].strip() else 'UNNAMED_{:03d}'.format(n) n += 1 (thickness, dk, df) = (i[1], i[2], i[3]) data.append((na...
class Ability: def __init__(self, name, texts=None): if name is None: name = "" self._name = name self._name = self._name.replace("(", "- ") self._name = self._name.replace(")", "") self._texts = texts if texts is not None else [] def get_name(self): ...
class Ability: def __init__(self, name, texts=None): if name is None: name = '' self._name = name self._name = self._name.replace('(', '- ') self._name = self._name.replace(')', '') self._texts = texts if texts is not None else [] def get_name(self): ...
MARTOR_ENABLE_CONFIGS = { 'imgur': 'true', # to enable/disable imgur/custom uploader. 'mention': 'false', # to enable/disable mention 'jquery': 'true', # to include/revoke jquery (require for admin default django) 'living': 'false', # to enable/disable live updates in preview 'spellcheck': 't...
martor_enable_configs = {'imgur': 'true', 'mention': 'false', 'jquery': 'true', 'living': 'false', 'spellcheck': 'true'} martor_enable_label = False martor_imgur_client_id = 'your-client-id' martor_imgur_api_key = 'your-api-key' martor_markdown_safe_mode = True martor_markdownify_function = 'martor.utils.markdownify' m...
# from controller import * class Bus: _bus_type_capacity = {1:12, 2:60, 3:150} _bus_type_leasing_cost = {1:6000, 2:12000, 3:20000} _bus_type_travel_cost = {1:1, 2:1.5, 3:2} def __init__(self, bus_id, bus_type, init_stop, controller): self.bus_id = bus_id self.bus_type = bus_type ...
class Bus: _bus_type_capacity = {1: 12, 2: 60, 3: 150} _bus_type_leasing_cost = {1: 6000, 2: 12000, 3: 20000} _bus_type_travel_cost = {1: 1, 2: 1.5, 3: 2} def __init__(self, bus_id, bus_type, init_stop, controller): self.bus_id = bus_id self.bus_type = bus_type self.capacity = B...
print("\nHello, and welcome to the miles per hour (MPH) conversion app.\n") name = input("What shall I call you? : ") print(f"\nHello, {name}!!! We hope you are doing well!!\n") def get_speed(): speed = input("What is your current working speed in MPH? ") try: return float(speed) except: ...
print('\nHello, and welcome to the miles per hour (MPH) conversion app.\n') name = input('What shall I call you? : ') print(f'\nHello, {name}!!! We hope you are doing well!!\n') def get_speed(): speed = input('What is your current working speed in MPH? ') try: return float(speed) except: pr...
command = input() corresponding_side = {} while not command == "Lumpawaroo": if len(command.split(" | ")) > 1: command = command.split(" | ") force_side = command[0] force_user = command[-1] if not force_side in corresponding_side: corresponding_side[force...
command = input() corresponding_side = {} while not command == 'Lumpawaroo': if len(command.split(' | ')) > 1: command = command.split(' | ') force_side = command[0] force_user = command[-1] if not force_side in corresponding_side: corresponding_side[force_side] = [] ...
with open('2021/day_06/list.txt', encoding="utf-8") as f: lines = f.readlines() lines = list(map(int,lines[0].split(','))) d, t = {}, [] for x in lines: if x in d: d[x] += 1 else: d[x] = 1 for i in range(0,9): if i in d: t.append(d[i]) else: t.append(0) a, m, count = 0, 0, 0 while a<256: m = ...
with open('2021/day_06/list.txt', encoding='utf-8') as f: lines = f.readlines() lines = list(map(int, lines[0].split(','))) (d, t) = ({}, []) for x in lines: if x in d: d[x] += 1 else: d[x] = 1 for i in range(0, 9): if i in d: t.append(d[i]) else: t.append(0) (a, m, c...
list_users = [ { "id":1, "first_name":"George", "last_name":"Bluth", "avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg" }, { "id":2, "first_name":"Janet", "last_name":"Weaver", "avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg" }, { ...
list_users = [{'id': 1, 'first_name': 'George', 'last_name': 'Bluth', 'avatar': 'https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg'}, {'id': 2, 'first_name': 'Janet', 'last_name': 'Weaver', 'avatar': 'https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg'}, {'id': 3, 'first_name': 'Emma', '...
#The script throws an error (when global c is not there). Fix it so that the script prints the value assigned to c inside the function #A: Add "global c" before "c=1". #C: Worth mentioning that if you remove foo(), variable c will come as undifined because the function has not been run def foo(): #global c c = ...
def foo(): c = 1 return c foo() print(c)
STATS_GOBLIN = { "strength": 8, "dexterity": 14, "constitution": 10, "intelligence": 10, "wisdom": 8, "charisma": 8, } STATS_KENKU = { "strength": 10, "dexterity": 16, "constitution": 10, "intelligence": 11, "wisdom": 10, "charisma": 10, }
stats_goblin = {'strength': 8, 'dexterity': 14, 'constitution': 10, 'intelligence': 10, 'wisdom': 8, 'charisma': 8} stats_kenku = {'strength': 10, 'dexterity': 16, 'constitution': 10, 'intelligence': 11, 'wisdom': 10, 'charisma': 10}
def printInfo(EPOCH, BATCH_SIZE, max_len, USE_CUDA=False): print("++++++++++++++++++++++++++") print("Parameter INFO:") print("--------------------------") print("EPOCH: \t %d" % EPOCH) print("BATCH_SIZE: %d " % BATCH_SIZE) print("Generation Max Len: % d" % max_len) print("Device: ", "USE_C...
def print_info(EPOCH, BATCH_SIZE, max_len, USE_CUDA=False): print('++++++++++++++++++++++++++') print('Parameter INFO:') print('--------------------------') print('EPOCH: \t %d' % EPOCH) print('BATCH_SIZE: %d ' % BATCH_SIZE) print('Generation Max Len: % d' % max_len) print('Device: ', 'USE_C...
def get_urls(releases, **kwargs): return { 'https://raw.githubusercontent.com/websocket-client/websocket-client/master/ChangeLog' }, set() def get_head(line, releases, **kwargs): for release in releases: if "- {}".format(release) == line or "- v{}".format(release) == line: retu...
def get_urls(releases, **kwargs): return ({'https://raw.githubusercontent.com/websocket-client/websocket-client/master/ChangeLog'}, set()) def get_head(line, releases, **kwargs): for release in releases: if '- {}'.format(release) == line or '- v{}'.format(release) == line: return release ...
#!/bin/python3 # A basic python script to extract js files from a log and sort # TODO: Add support for other file extensions # TODO: Add support for multiple files # TODO: Add the ability to specify file location # TODO: Add error handling # Must be run in the directory with the log file filenames = set() with ope...
filenames = set() with open('access_log.txt') as file: for line in file: end = line.rfind('.js') + 3 start = line.rfind('/', 0, end) + 1 filename = line[start:end] if filename.endswith('.js'): filenames.add(filename) for filename in sorted(filenames, key=str.lower): p...