content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
print(u'\xA9')
print(u'©')
# Via http://www.fabiocrameri.ch/colourmaps.php ACTON = ( (46, 33, 77), (47, 34, 77), (48, 35, 78), (49, 36, 79), (50, 37, 80), (51, 38, 81), (52, 38, 82), (53, 39, 83), (54, 40, 84), (55, 41, 85), (56, 42, 86), (57, 43, 87), (58, 44, 88), (59, 45, 88), (60, ...
acton = ((46, 33, 77), (47, 34, 77), (48, 35, 78), (49, 36, 79), (50, 37, 80), (51, 38, 81), (52, 38, 82), (53, 39, 83), (54, 40, 84), (55, 41, 85), (56, 42, 86), (57, 43, 87), (58, 44, 88), (59, 45, 88), (60, 46, 89), (61, 47, 90), (62, 48, 91), (63, 48, 92), (65, 49, 93), (66, 50, 94), (67, 51, 95), (68, 52, 96), (69...
#!/usr/bin/env python3.8 def starred_return(): my_list = ["value2", "value3"] return "value1", *my_list def starred_yield(): my_list = ["value2", "value3"] yield "value1", *my_list # all right hand side expressions allowed in regular assignments are now also allowed in # annotated assignments a : ...
def starred_return(): my_list = ['value2', 'value3'] return ('value1', *my_list) def starred_yield(): my_list = ['value2', 'value3'] yield ('value1', *my_list) a: Tuple[str, int] = ('1', 2) a: Tuple[int, ...] = (b, *c, d) def t(): a: str = (yield 'a') def starred_return(): my_list = ['value2'...
# -*- coding: utf-8 -*- """ Created on Mon Sep 21 22:46:14 2020 @author: sl7516 """ def write_MacroCoor(pwd, geometry_name, job_name): fr = open('Macro_ExtractCoor.py', 'w') fr.write('# -*- coding: mbcs -*-\n') fr.write('# Do not delete the following import lines\n') fr.write('from abaqus imp...
""" Created on Mon Sep 21 22:46:14 2020 @author: sl7516 """ def write__macro_coor(pwd, geometry_name, job_name): fr = open('Macro_ExtractCoor.py', 'w') fr.write('# -*- coding: mbcs -*-\n') fr.write('# Do not delete the following import lines\n') fr.write('from abaqus import *\n') fr.write('from ab...
path1 = "/Users/traviskochel/Desktop/temp/Kablammo-8-21-d.pdf" path2 = "/Users/traviskochel/Desktop/temp/Kablammo-8-24-b.pdf" exportPath = "/Users/traviskochel/Desktop/temp/Kablammo-8-21-8-24.pdf" # rgba color1 = (1,0,0,1) color2 = (0,0,1,1) # PDF exports in raster, so raise this if it's too pixellated. Lower for ...
path1 = '/Users/traviskochel/Desktop/temp/Kablammo-8-21-d.pdf' path2 = '/Users/traviskochel/Desktop/temp/Kablammo-8-24-b.pdf' export_path = '/Users/traviskochel/Desktop/temp/Kablammo-8-21-8-24.pdf' color1 = (1, 0, 0, 1) color2 = (0, 0, 1, 1) pdf_scale = 2 page_count = number_of_pages(path1) def build_layer(path, color...
# List of ipymd cells expected for this example. output = [ {'cell_type': 'markdown', 'source': '# Test notebook'}, {'cell_type': 'markdown', 'source': 'This is a text notebook. Here *are* some **rich text**, ' '`code`, $\\pi\\simeq 3.1415$ equations.'}, {'cell_type': 'markdown',...
output = [{'cell_type': 'markdown', 'source': '# Test notebook'}, {'cell_type': 'markdown', 'source': 'This is a text notebook. Here *are* some **rich text**, `code`, $\\pi\\simeq 3.1415$ equations.'}, {'cell_type': 'markdown', 'source': 'Another equation:'}, {'cell_type': 'markdown', 'source': '$$\\sum_{i=1}^n x_i$$'}...
i = 0 while i < 5: i = i + 1 if i > 3: break print(i)
i = 0 while i < 5: i = i + 1 if i > 3: break print(i)
class Solution: def findContentChildren(self, g: List[int], s: List[int]) -> int: g.sort() s.sort() i = j = 0 for cookie in s: if i >= len(g): return i if cookie >= g[i]: i += 1 return i
class Solution: def find_content_children(self, g: List[int], s: List[int]) -> int: g.sort() s.sort() i = j = 0 for cookie in s: if i >= len(g): return i if cookie >= g[i]: i += 1 return i
# Write your count_first_letter function here: def count_first_letter(names): letters = {} for key in names: first_letter = key[0] if first_letter not in letters: letters[first_letter] = 0 letters[first_letter] += len(names[key]) return letters # Uncomment these function calls to test your fun...
def count_first_letter(names): letters = {} for key in names: first_letter = key[0] if first_letter not in letters: letters[first_letter] = 0 letters[first_letter] += len(names[key]) return letters print(count_first_letter({'Stark': ['Ned', 'Robb', 'Sansa'], 'Snow': ['Jon...
US_TIMEZONE_CHOICES = ( ('America/Anchorage', 'US/Alaska', ), ('America/Adak', 'US/Aleutian', ), ('America/Phoenix', 'US/Arizona', ), ('America/Chicago', 'US/Central', ), ('America/Indiana/Indianapolis', 'US/East-Indiana', ), ('America/New_York', 'US/Eastern', ), ('Pacific/Honolulu', 'US/Haw...
us_timezone_choices = (('America/Anchorage', 'US/Alaska'), ('America/Adak', 'US/Aleutian'), ('America/Phoenix', 'US/Arizona'), ('America/Chicago', 'US/Central'), ('America/Indiana/Indianapolis', 'US/East-Indiana'), ('America/New_York', 'US/Eastern'), ('Pacific/Honolulu', 'US/Hawaii'), ('America/Indiana/Knox', 'US/India...
""" 1. Clarification 2. Possible solutions - Long division 3. Coding 4. Tests """ # T=O(n), S=O(n) class Solution: def fractionToDecimal(self, numerator: int, denominator: int) -> str: if numerator == 0: return "0" fraction = list() if (numerator < 0) ^ (denominator < 0): ...
""" 1. Clarification 2. Possible solutions - Long division 3. Coding 4. Tests """ class Solution: def fraction_to_decimal(self, numerator: int, denominator: int) -> str: if numerator == 0: return '0' fraction = list() if (numerator < 0) ^ (denominator < 0): frac...
# https://www.codewars.com/kata/5d5a7525207a674b71aa25b5 def odd_row(row): base = row * (row - 1) return [base + n * 2 + 1 for n in range(row)]
def odd_row(row): base = row * (row - 1) return [base + n * 2 + 1 for n in range(row)]
# -*- coding: utf-8 -*- # Copyright 2017-TODAY LasLabs Inc. # License MIT (https://opensource.org/licenses/MIT). class HelpScoutException(Exception): """Base exception for HelpScout library errors.""" def __init__(self, message): self.message = message def __str__(self): return str(self....
class Helpscoutexception(Exception): """Base exception for HelpScout library errors.""" def __init__(self, message): self.message = message def __str__(self): return str(self.message) class Helpscoutremoteexception(HelpScoutException): """Indicates that an error occurred when communic...
# Copyright 2012 Loris Corazza, Sakis Christakidis # # 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 applic...
class Interface(object): specs = {'videoRate': 0, 'audio': 'pulse', 'width': 360, 'height': 240} specs_gui = {'videoRate': {'name': 'Video Rate', 'tooltip': 'The quality of the transcoded video in KBps. 0 for default quality'}, 'audio': {'name': 'Audio Input', 'tooltip': 'Audio Input device. Only for camera inp...
# # Copyright (C) 2018 The Android Open Source Project # # 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 la...
model = model() i1 = input('input', 'TENSOR_FLOAT32', '{1, 4}') beta = float32_scalar('beta', 1e-06) output = output('output', 'TENSOR_FLOAT32', '{1, 4}') model = model.Operation('SOFTMAX', i1, beta).To(output) model = model.RelaxedExecution(True) input0 = {i1: [1.0, 2.0, 10.0, 20.0]} output0 = {output: [0.25, 0.25, 0....
""" RFID =============== """ # from .rfid import RFID
""" RFID =============== """
n = int(input()) for i in range(n): c = False k = int(input()) name = input() items = [input() for _ in range(k)] if 'pea soup' in items and 'pancakes' in items: print(name) c = True break if not c: print('Anywhere is fine I guess')
n = int(input()) for i in range(n): c = False k = int(input()) name = input() items = [input() for _ in range(k)] if 'pea soup' in items and 'pancakes' in items: print(name) c = True break if not c: print('Anywhere is fine I guess')
class Continent: def __init__(self, name, id = None): self.name = name self.id = id
class Continent: def __init__(self, name, id=None): self.name = name self.id = id
class AbstractWeightsLearning(object): def __init__(self, num_data, num_treatment, data_model): self.num_data = num_data self.num_treatment = num_treatment self.data_model = data_model self.policy = None def update_policy(self, policy): # policy is function mapping x v...
class Abstractweightslearning(object): def __init__(self, num_data, num_treatment, data_model): self.num_data = num_data self.num_treatment = num_treatment self.data_model = data_model self.policy = None def update_policy(self, policy): self.policy = policy def che...
# 209. Minimum Size Subarray Sum # Time: O(len(nums)) # Space: O(1) class Solution: def minSubArrayLen(self, s: int, nums: List[int]) -> int: min_range = 1<<32 cur_sum = 0 start = 0 for index,num in enumerate(nums): cur_sum+=num while cur_sum>=s: ...
class Solution: def min_sub_array_len(self, s: int, nums: List[int]) -> int: min_range = 1 << 32 cur_sum = 0 start = 0 for (index, num) in enumerate(nums): cur_sum += num while cur_sum >= s: min_range = min(min_range, index - start + 1) ...
# Lucia Saura 24/03/2018 # factorial # source of information https://www.youtube.com/watch?v=D6qpjk48U6U def factorial3 (num): #first a name is given to the function and a name to the value that we will be calling at the end (when calling the function) #in the video source they are doing that asking a number on the sh...
def factorial3(num): x = 1 for i in range(num): x = x * num num = num - 1 print(x) print(factorial3(7))
# Space: O(n) # Time: O(n) class Solution: def findPaths(self, m, n, maxMove, startRow, startColumn): self.mod = 1000000007 self.board = [[[-1 for _ in range(n)] for _ in range(m)] for _ in range(maxMove + 1)] return self.dfs(m, n, startRow, startColumn, maxMove) % self.mod def dfs...
class Solution: def find_paths(self, m, n, maxMove, startRow, startColumn): self.mod = 1000000007 self.board = [[[-1 for _ in range(n)] for _ in range(m)] for _ in range(maxMove + 1)] return self.dfs(m, n, startRow, startColumn, maxMove) % self.mod def dfs(self, row, column, y, x, n): ...
# Doubly LinkedList ''' head second third | | | | | | +----+------+ +----+------+ +----+------+ | 1 | o-------->| 2 | o-------->| 3 | null | | | o<--------| | o<--------|...
""" head second third | | | | | | +----+------+ +----+------+ +----+------+ | 1 | o-------->| 2 | o-------->| 3 | null | | | o<--------| | o<--------| | | +--...
class BaseMic(object): def __init__(self, *args, **kwargs): pass def set(self): pass def tune(self): pass def listen(self): pass def reset(self): pass def record(self): pass
class Basemic(object): def __init__(self, *args, **kwargs): pass def set(self): pass def tune(self): pass def listen(self): pass def reset(self): pass def record(self): pass
class setu: def __init__( self, url='', type=2, info={}, pic_file='' ): self.url=url self.type=type self.info=info self.pic_file=pic_file
class Setu: def __init__(self, url='', type=2, info={}, pic_file=''): self.url = url self.type = type self.info = info self.pic_file = pic_file
def generate_test_payment_method_code(number): return "stub-" + number VisaPaymentMethodCode = generate_test_payment_method_code("4111111111111111") InvalidPaymentMethodCode = generate_test_payment_method_code("invalid-payment-method-code") Session = "stub-session" InvalidSession = "stub-invalid-session"
def generate_test_payment_method_code(number): return 'stub-' + number visa_payment_method_code = generate_test_payment_method_code('4111111111111111') invalid_payment_method_code = generate_test_payment_method_code('invalid-payment-method-code') session = 'stub-session' invalid_session = 'stub-invalid-session'
name, age = "Sreelakshmi", 19 username = "Sreelakshmi-M.py" print ('Hello!') print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
(name, age) = ('Sreelakshmi', 19) username = 'Sreelakshmi-M.py' print('Hello!') print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username))
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of Advent of Code 2020 # https://github.com/scorphus/advent-of-code-2020 # Licensed under the BSD-3-Clause license: # https://opensource.org/licenses/BSD-3-Clause # Copyright (c) 2020, Pablo S. Blum de Aguiar <scorphus@gmail.com> def part1(lines): ...
def part1(lines): return max(map(get_seat_id, lines)) def part2(lines): seats = sorted(map(get_seat_id, lines)) for (i, seat) in enumerate(seats, seats[0]): if i != seat: return i def get_seat_id(address): (row, col) = (address[:7], address[7:]) row = row.replace('F', '0').repl...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Oct 7 19:05:20 2017 @author: xg7 """ #Question2 #Q2.1 # l = [1, 1, 2.1, 2.5] # #l = [1, 1, 1, 2, 2, 2, 1, 1, 1, 2.5] # d = {1:3, 2:5.5, 6:2.0, 4:2.0} def remove_non_int(l): for e in l[::-1]: if type(e) != int: l.remove(e) ...
""" Created on Sat Oct 7 19:05:20 2017 @author: xg7 """ def remove_non_int(l): for e in l[::-1]: if type(e) != int: l.remove(e) def delete_duplicate(l): for i in range(len(l) - 1, -1, -1): if l[i] in l[:i]: l.remove(l[i]) def do_all(d): v = list(d.values()) r...
def origin_translation(A, p, x0=None, eps=1e-8, max_steps=1000, verbose=False): _I = identity(A.shape[0]) BLOCK = 0 eig = p x = x0 for k in range(int(max_steps)): eig_prev = eig BLOCK = 1 x = linalg.solve(A - eig * _I, x) q = argmax...
def origin_translation(A, p, x0=None, eps=1e-08, max_steps=1000, verbose=False): _i = identity(A.shape[0]) block = 0 eig = p x = x0 for k in range(int(max_steps)): eig_prev = eig block = 1 x = linalg.solve(A - eig * _I, x) q = argmax(abs(x)) xq = x[q] ...
a = list(map(int, input().split())) count = 0 for i in range(len(a)): if a[i] > 0: count += 1 print(count)
a = list(map(int, input().split())) count = 0 for i in range(len(a)): if a[i] > 0: count += 1 print(count)
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def recoverTree(self, root): """ :type root: TreeNode :rtype: void Do not return anything, modify root in-p...
class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def recover_tree(self, root): """ :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. """ ...
age = input("How old are you babe?") race = input("What race are you?") identity = input("How do you identify yourself. a no:") print(f"So if you are {age} old, and you are from {race}, you identify as {identity}")
age = input('How old are you babe?') race = input('What race are you?') identity = input('How do you identify yourself. a no:') print(f'So if you are {age} old, and you are from {race}, you identify as {identity}')
#how to open files my_files=open("people1.txt") files=my_files.read() print(files) my_files.close() #method-2 # with open("people1.txt","r") as file: # print(file.read()) # file.close() # with open("people1.txt", "r") as file: # data = file.readlines() # for line in data: # word = line....
my_files = open('people1.txt') files = my_files.read() print(files) my_files.close()
class Streak: """ Captures checking streaks of the trip. Checking streaks are contiguous checkin sequences separated by given number of days of checking discontinuities """ def __init__(self, first_date, last_date, days, days_gap): self.first_date = first_date self.last_date = last_d...
class Streak: """ Captures checking streaks of the trip. Checking streaks are contiguous checkin sequences separated by given number of days of checking discontinuities """ def __init__(self, first_date, last_date, days, days_gap): self.first_date = first_date self.last_date = last_...
# Level: Easy def isPalindrome(x: int) -> bool: if x < 0: return False y = x back_num = 0 while y > 0: back_num = back_num * 10 + y%10 y = y//10 if x == back_num: return True return False if __name__ == "__main__": x = 12321 print(isPalindrome(x))
def is_palindrome(x: int) -> bool: if x < 0: return False y = x back_num = 0 while y > 0: back_num = back_num * 10 + y % 10 y = y // 10 if x == back_num: return True return False if __name__ == '__main__': x = 12321 print(is_palindrome(x))
def exercise_1(inputs): # DO NOT CHANGE THIS LINE """ This functions receives the input in the parameter 'inputs'. Change the code, so that the output is sqaure of the given input. p, q, r = inputs p => ['t101', 't102', 't103'] q => ['s101', 's102', 's103'] r => { 'l101':[...
def exercise_1(inputs): """ This functions receives the input in the parameter 'inputs'. Change the code, so that the output is sqaure of the given input. p, q, r = inputs p => ['t101', 't102', 't103'] q => ['s101', 's102', 's103'] r => { 'l101':['t101': ['s101', 's102']],...
if __name__ == '__main__': for t in range(int(input())): x1, y1, x2, y2 = map(int, input().split()) print((x2 - x1) * (y2 - y1) + 1)
if __name__ == '__main__': for t in range(int(input())): (x1, y1, x2, y2) = map(int, input().split()) print((x2 - x1) * (y2 - y1) + 1)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isBalanced(self, root: TreeNode) -> bool: flag = True def f(root): nonlocal flag ...
class Solution: def is_balanced(self, root: TreeNode) -> bool: flag = True def f(root): nonlocal flag if root is None: return 0 left = f(root.left) right = f(root.right) if abs(left - right) > 1: flag = Fal...
def get_dict_first_key(dictionary): return next(iter(dictionary)) # ### MAP SIZE MAP_SIZE_DICT = { "TINY_MAP": "Tiny map", "SMALL_MAP": "Small map", "MEDIUM_MAP": "Medium map", "LARGE_MAP": "Large map", "HUGE_MAP": "Huge map", "GIGANTIC_MAP": "Gigantic map", "LUDIKRIS_MAP": "Ludikris m...
def get_dict_first_key(dictionary): return next(iter(dictionary)) map_size_dict = {'TINY_MAP': 'Tiny map', 'SMALL_MAP': 'Small map', 'MEDIUM_MAP': 'Medium map', 'LARGE_MAP': 'Large map', 'HUGE_MAP': 'Huge map', 'GIGANTIC_MAP': 'Gigantic map', 'LUDIKRIS_MAP': 'Ludikris map'} map_resources_dict = {'OTHER_RESOURCES': ...
""" lec 2 this is a regional comment """ #print("hello world") # this is a single line comment #print(type( 123 ) ) #print( type(123.) ) #print(type ("123") ) #print("Tom's cat") #print( "Hello " + "World" ) #my_int = 123 #print(my_int) #my_int = 321 #print(my_int) my_str = "hello world" print(my_str.upper(...
""" lec 2 this is a regional comment """ my_str = 'hello world' print(my_str.upper())
#!/usr/bin/python ROOT_URL = 'http://numismatics.org/' SEARCH_URL = 'ocre/results?q=' JSON_API_URL = 'ocre/id/' NOMISMA_URL = 'http://nomisma.org/id/' BRITISH_MUSEUM_URL = ( 'http://collection.britishmuseum.org/' 'id/person-institution/' ) BRITISH_MUSEUM_NAMES_BY_ID = { '53770': 'Horus', '54025': 'Isis...
root_url = 'http://numismatics.org/' search_url = 'ocre/results?q=' json_api_url = 'ocre/id/' nomisma_url = 'http://nomisma.org/id/' british_museum_url = 'http://collection.britishmuseum.org/id/person-institution/' british_museum_names_by_id = {'53770': 'Horus', '54025': 'Isis', '56979': 'Venus', '56988': 'Apollo', '57...
"""Get Score of Table strategy """ def get_score(table, board): """get_score """ board_info = board.get_board_info() size = board.size score = 0 for y in range(size): for x in range(size): score += table[y][x] * board_info[y][x] return score
"""Get Score of Table strategy """ def get_score(table, board): """get_score """ board_info = board.get_board_info() size = board.size score = 0 for y in range(size): for x in range(size): score += table[y][x] * board_info[y][x] return score
salario: float; novoSalario: float; aumento: float porcentagem: int salario = float(input("Digite o salario da pessoa: ")) if salario <= 1000: porcentagem = 20 elif salario <= 3000: porcentagem = 15 elif salario <= 8000: porcentagem = 10 else: porcentagem = 5 aumento = salario * porcentagem / 100 nov...
salario: float novo_salario: float aumento: float porcentagem: int salario = float(input('Digite o salario da pessoa: ')) if salario <= 1000: porcentagem = 20 elif salario <= 3000: porcentagem = 15 elif salario <= 8000: porcentagem = 10 else: porcentagem = 5 aumento = salario * porcentagem / 100 novo_sa...
# # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
""" Declares dependencies of Privacy on Beam """ load('@bazel_gazelle//:deps.bzl', 'go_repository') def privacy_on_beam_deps(): """ Macro to include Privacy on Beam's critical dependencies in a WORKSPACE. Generated automatically by gazelle. """ go_repository(name='co_honnef_go_tools', importpath=...
username = 'admin' password = 'garahasia' if (username == 'admin') and (password == 'rahasia'): print('user berhasil login') else: print('user gagal login')
username = 'admin' password = 'garahasia' if username == 'admin' and password == 'rahasia': print('user berhasil login') else: print('user gagal login')
args_converter = lambda row_index, rec: \ {'text': rec['text'], 'size_hint_y': None, 'height': 25, 'cls_dicts': [{'cls': ListItemButton, 'kwargs': {'text': rec['text']}}, {'cls': ListItemLabel, 'kwargs': {'text': r...
args_converter = lambda row_index, rec: {'text': rec['text'], 'size_hint_y': None, 'height': 25, 'cls_dicts': [{'cls': ListItemButton, 'kwargs': {'text': rec['text']}}, {'cls': ListItemLabel, 'kwargs': {'text': rec['text'], 'is_representing_cls': True}}, {'cls': ListItemButton, 'kwargs': {'text': rec['text']}}]}
""" Link: https://www.geeksforgeeks.org/find-the-missing-number/ """ # pylint: disable=invalid-name def find_missing_number(array): """ :param array: given integer array from 1 to len(array), missing one of value :return: The missing value Method: Using sum of list plus missing number subtract the lis...
""" Link: https://www.geeksforgeeks.org/find-the-missing-number/ """ def find_missing_number(array): """ :param array: given integer array from 1 to len(array), missing one of value :return: The missing value Method: Using sum of list plus missing number subtract the list of the given array Complex...
self.description = "upgrade package overwriting existing unowned file with directory" lp1 = pmpkg("pkg1") self.addpkg2db("local", lp1) self.filesystem = ["file"] p = pmpkg("pkg1", "1.0-2") p.files = ["file/"] self.addpkg2db("sync", p) self.args = "-S pkg1" self.addrule("PACMAN_RETCODE=1") self.addrule("PKG_VERSION...
self.description = 'upgrade package overwriting existing unowned file with directory' lp1 = pmpkg('pkg1') self.addpkg2db('local', lp1) self.filesystem = ['file'] p = pmpkg('pkg1', '1.0-2') p.files = ['file/'] self.addpkg2db('sync', p) self.args = '-S pkg1' self.addrule('PACMAN_RETCODE=1') self.addrule('PKG_VERSION=pkg1...
#!python3 # Copyright (C) 2016 Chris Liebert def getConglomerates(x, y, z): a,b,c,d,e,f,g,h = 0,0,0,0,0,0,0,0 collections = [] num_collections = 0 a = 0 while x >= 0 and y >= 0 and z >= 0: b = 0 bx,by,bz = x,y,z while x >= 0 and y >= 0 and z >= 0: c = 0 ...
def get_conglomerates(x, y, z): (a, b, c, d, e, f, g, h) = (0, 0, 0, 0, 0, 0, 0, 0) collections = [] num_collections = 0 a = 0 while x >= 0 and y >= 0 and (z >= 0): b = 0 (bx, by, bz) = (x, y, z) while x >= 0 and y >= 0 and (z >= 0): c = 0 (cx, cy, cz)...
# Thirdparty Solution Analysis # https://www.martinkysel.com/codility-commonprimedivisors-solution def gcd(p, q): if q == 0: return p return gcd(q, p % q) def hasSameFactors(p, q): if p == q == 0: return True denom = gcd(p,q) while (p != 1): p_gcd = gcd(p,denom) ...
def gcd(p, q): if q == 0: return p return gcd(q, p % q) def has_same_factors(p, q): if p == q == 0: return True denom = gcd(p, q) while p != 1: p_gcd = gcd(p, denom) if p_gcd == 1: break p /= p_gcd else: while q != 1: q_gcd...
x = int(input('Enter any three number : ')) y = int(input()) z = int(input()) if x > y and x > z: print(str(x)+' is the greatest number among the three numbers') elif y > x and y > z: print(str(y)+' is the greatest number among the three numbers') elif z > x and z > y: print(str(z)+' is the greatest number ...
x = int(input('Enter any three number : ')) y = int(input()) z = int(input()) if x > y and x > z: print(str(x) + ' is the greatest number among the three numbers') elif y > x and y > z: print(str(y) + ' is the greatest number among the three numbers') elif z > x and z > y: print(str(z) + ' is the greatest n...
# rules for variable names: # 1. name cannot start with a number # 2. there can be no spaces in the name, use _ instead # 3. can't use any of the symbols: !@#$%^&*()-+~<>,' # 4. it's considered best practice (PEP8) that names are lowercase # 5. avoid using word words that have special meaning in python like "list" and...
a = 5 print(a) print(type(a)) a = 10 print(a) print(type(a)) a = a * a print(a) print(type(a)) a = 'name' print(a) print(type(a))
# ## There are three cans, all don't have scale, and the capacity respectively are 12 liter, 8 liter, 5 liter, ## at initial: the 12 liter one with full liquid, the others two are empty # ## Find a solution to get two cans of 6 liter liquid. # def equipartition(): def gcd(a, b): if str(a).isdigit() and str(b)...
def equipartition(): def gcd(a, b): if str(a).isdigit() and str(b).isdigit(): if b == 0: return a else: return gcd(b, a % b) def has_solution(a, b, c): if str(a).isdigit() and str(b).isdigit() and str(c).isdigit(): if c % gcd(...
class MapModel: def __init__(self, id, riot_map_id, name, notes): self.id = id self.riot_map_id = riot_map_id self.name = name self.notes = notes
class Mapmodel: def __init__(self, id, riot_map_id, name, notes): self.id = id self.riot_map_id = riot_map_id self.name = name self.notes = notes
# Time: O(n) # Space: O(1) class Solution(object): def secondHighest(self, s): """ :type s: str :rtype: int """ first = second = -1 for c in s: if not c.isdigit(): continue d = int(c) if d > first: ...
class Solution(object): def second_highest(self, s): """ :type s: str :rtype: int """ first = second = -1 for c in s: if not c.isdigit(): continue d = int(c) if d > first: (first, second) = (d, first...
class Hyperparameter: logdir = 'logdir' weights_dir = 'weights' data_dir = 'datasets' rate = 22050 batch_size = 1 generator_lr = 0.0002 discriminator_lr = 0.0001 lambda_cycle = 10 lambda_identity = 5 num_mceps = 36 duration = 5.0 n_frames = 128 output_size = 512 n...
class Hyperparameter: logdir = 'logdir' weights_dir = 'weights' data_dir = 'datasets' rate = 22050 batch_size = 1 generator_lr = 0.0002 discriminator_lr = 0.0001 lambda_cycle = 10 lambda_identity = 5 num_mceps = 36 duration = 5.0 n_frames = 128 output_size = 512 n...
t = int(input()) for _ in range(t): n,k,d = map(int, input().split()) # Taking n integers and storing it in list arr = list(map(int, input().split())) # Finding sum of all elements inside array total = sum(arr) # Floor division would give the answer but # see to it that doesn't excede d, ...
t = int(input()) for _ in range(t): (n, k, d) = map(int, input().split()) arr = list(map(int, input().split())) total = sum(arr) print(min(total // k, d))
class SimpleDisjointSet(): #Simple Disjoint Set Data Structure def __init__(self, nodes): self.prev = {} #Keep track of parent of nodes for node in nodes: self.prev[node] = node def find(self, node): #Return root of Set if self.prev[node] == node: return node ...
class Simpledisjointset: def __init__(self, nodes): self.prev = {} for node in nodes: self.prev[node] = node def find(self, node): if self.prev[node] == node: return node return self.find(self.prev[node]) def union(self, nodeA, nodeB): node_...
user = input("rock, paper or scissors: ") actions = ["rock", "paper", "scissors"] print ("You chose", (user)) if user == "rock": print ("The computer chose paper") print ("tough luck, paper covers rock ") elif user == "scissors": print ("The computer chose rock") print ("GG, you lost") elif user == "paper": ...
user = input('rock, paper or scissors: ') actions = ['rock', 'paper', 'scissors'] print('You chose', user) if user == 'rock': print('The computer chose paper') print('tough luck, paper covers rock ') elif user == 'scissors': print('The computer chose rock') print('GG, you lost') elif user == 'paper': ...
class Singleton: _instance = None def __init__(self): # Singleton pattern must prevent normal instantiation raise Exception("Cannot directly instantiate a Singleton. Access via get_instance()") @classmethod def get_instance(cls): # This is the only way to access the one and onl...
class Singleton: _instance = None def __init__(self): raise exception('Cannot directly instantiate a Singleton. Access via get_instance()') @classmethod def get_instance(cls): if cls._instance is None: cls._instance = cls.__new__(cls) return cls._instance
with open(r"advent_of_code\input2.txt", 'r') as f: intcode = list(map(int,f.read().split(","))) def step_one(intcode): # for i in range(0, len(intcode)-1, 4): pointer = 0 while intcode[pointer] != 99: opcode = intcode[pointer] noun = intcode[pointer+1] verb = intcode[pointer+2] ...
with open('advent_of_code\\input2.txt', 'r') as f: intcode = list(map(int, f.read().split(','))) def step_one(intcode): pointer = 0 while intcode[pointer] != 99: opcode = intcode[pointer] noun = intcode[pointer + 1] verb = intcode[pointer + 2] third = intcode[pointer + 3] ...
img = "2212222102022220222221222222221022220210202222222222222212222222222222221222222222222202221212222212220222202222220222222222212212212222212222220222222222222012022220222222222222222122221222212222222222222222222222222222221222222222222202221212222212220222222222220222222222222212212222212222222222222212222012222...
img = '2212222102022220222221222222221022220210202222222222222212222222222222221222222222222202221212222212220222202222220222222222212212212222212222220222222222222012022220222222222222222122221222212222222222222222222222222222221222222222222202221212222212220222222222220222222222222212212222212222222222222212222012222...
"""Config: like config: type: map repo: path: ./repo map_md: map.md sorted : true """ # pylint: disable=C0116,R0903,E0401,W0703,W1201,redefined-outer-name,missing-function-docstring,E0401,C0114,W0511,W1203,C0200,C0103,W1203 class Config: """Config""" def __init__(self, map_yaml_path, persist_fs): ...
"""Config: like config: type: map repo: path: ./repo map_md: map.md sorted : true """ class Config: """Config""" def __init__(self, map_yaml_path, persist_fs): """persist_fs_load_file: f() to load file as dict[]""" self.map_yaml_path = map_yaml_path self.persist_fs = persis...
def run(): LIMIT = 100000000 counter = 0 power = 2**counter while power < LIMIT: print('2 a la ' + str(counter) + ' = ' + str(power)) counter += 1 power = 2**counter def forloop(): name = input('Type your name: ') # for char in range(len(name)): # print(name[cha...
def run(): limit = 100000000 counter = 0 power = 2 ** counter while power < LIMIT: print('2 a la ' + str(counter) + ' = ' + str(power)) counter += 1 power = 2 ** counter def forloop(): name = input('Type your name: ') for char in name: print(char.upper()) if __na...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Read input a = int(input()) b = int(input()) # Get min and max m = max(a, b) t = min(a, b) # Addition loop r = 0 while t > 0: r += m t -= 1 # Print result print(r)
a = int(input()) b = int(input()) m = max(a, b) t = min(a, b) r = 0 while t > 0: r += m t -= 1 print(r)
# -*- coding: utf-8 -*- """ samsara_sdk.constants ~~~~~~~~~~~~~~~~~~~~~ Samsara SDK client constants """ # Samara specific HTTP Header PUBLISHED_TIMESTAMP_HEADER = "X-Samsara-publishedTimestamp" API_PATH = '/v1/events' DEFAULT_CONFIG = { # a samsara ingestion api endpoint "http://samsara-ingestion.lo...
""" samsara_sdk.constants ~~~~~~~~~~~~~~~~~~~~~ Samsara SDK client constants """ published_timestamp_header = 'X-Samsara-publishedTimestamp' api_path = '/v1/events' default_config = {'start_publishing_thread': True, 'publish_interval': 30000, 'max_buffer_size': 10000, 'min_buffer_size': 100, 'send_timeout'...
class Solution: def isPowerOfFour(self, num: int) -> bool: """ Other solution: There are 2 criteria for a number to be power of 4: is power of 2: n&(n-1) == 0 even number of "0" in binary format For example, 4 in binary is "100". 100&011 == 0 there a...
class Solution: def is_power_of_four(self, num: int) -> bool: """ Other solution: There are 2 criteria for a number to be power of 4: is power of 2: n&(n-1) == 0 even number of "0" in binary format For example, 4 in binary is "100". 100&011 == 0 the...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def __init__(self): self.results = [] def _dfs(self, root, cur_path): if root.left == None and root.right == None: ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def __init__(self): self.results = [] def _dfs(self, root, cur_path): if root.left == None and root.right == None: cur_path += str(root.val) ...
# -*- coding: utf-8 -*- ufUpdate = 0x01 ufLine = 0x02 ufView = 0x04 smExtend = 0x01 smDouble = 0x02 sfSearchFailed = 0xFFFFFFFF cmFind = 82 cmReplace = 83 cmSearchAgain = 84 cmCharLeft = 500 cmCharRight = 501 cmWordLeft = 502 cmWordRight = 503 cmLineStart = 504 cmLineEnd = 505 cmLineUp = 506 cmLineDown = 507 cmPag...
uf_update = 1 uf_line = 2 uf_view = 4 sm_extend = 1 sm_double = 2 sf_search_failed = 4294967295 cm_find = 82 cm_replace = 83 cm_search_again = 84 cm_char_left = 500 cm_char_right = 501 cm_word_left = 502 cm_word_right = 503 cm_line_start = 504 cm_line_end = 505 cm_line_up = 506 cm_line_down = 507 cm_page_up = 508 cm_pa...
"""Tournament view.""" class TournamentView: """Class managing tournament displays.""" def __init__(self) -> None: """Class initializer.""" pass def get_view_name(self) -> str: """Return name for input. Returns: str: Information for name """ r...
"""Tournament view.""" class Tournamentview: """Class managing tournament displays.""" def __init__(self) -> None: """Class initializer.""" pass def get_view_name(self) -> str: """Return name for input. Returns: str: Information for name """ re...
l=int(input("enter length of rectangle:")) b=int(input("enter width of rectangle:")) perimeter=(l+b)*2 area=l*b print("perimeter=",perimeter) print("area=",area)
l = int(input('enter length of rectangle:')) b = int(input('enter width of rectangle:')) perimeter = (l + b) * 2 area = l * b print('perimeter=', perimeter) print('area=', area)
class Solution: """ @param s: The first string @param t: The second string @return: true or false """ def anagram(self, s, t): t = list(t) for ss in s: if ss not in t: return False t.remove(ss) if not t: ...
class Solution: """ @param s: The first string @param t: The second string @return: true or false """ def anagram(self, s, t): t = list(t) for ss in s: if ss not in t: return False t.remove(ss) if not t: return True ...
""" Module for holding XML templates for DirectPayOline requests. """ # XML templates # ================XML templates (header and footer)================ header_xml = """ <?xml version="1.0" encoding="utf-8"?> <API3G> <CompanyToken>{company_token}</CompanyToken> <Request>{request_type}</Request> """ f...
""" Module for holding XML templates for DirectPayOline requests. """ header_xml = '\n <?xml version="1.0" encoding="utf-8"?>\n <API3G>\n <CompanyToken>{company_token}</CompanyToken>\n <Request>{request_type}</Request>\n' footer_xml = '\n <Services>\n <Service>\n <ServiceType>{service_type}</Se...
f=input("Input the Filename: ") x=f.split(".") y=x[-1] if(y=="py"): z=("Python") elif(y=="txt"): z=("Text file") elif(y=="docx"): z=("Word file") else: z=("INVALID") print("The extension of the file is: ",z)
f = input('Input the Filename: ') x = f.split('.') y = x[-1] if y == 'py': z = 'Python' elif y == 'txt': z = 'Text file' elif y == 'docx': z = 'Word file' else: z = 'INVALID' print('The extension of the file is: ', z)
# https://codeforces.com/problemset/problem/4/C n = int(input()) d = {} for i in range(0, n): s = input() if s in d: print(s+str(d[s])) d[s] += 1 else: print("OK") d[s] = 1 # n = input() # l = [] # for _ in range(int(n)): # val = input() # if val in l: # ind ...
n = int(input()) d = {} for i in range(0, n): s = input() if s in d: print(s + str(d[s])) d[s] += 1 else: print('OK') d[s] = 1
class FreqStack: def __init__(self): self.heap = [] self.count = collections.Counter() self.push_count = 0 def push(self, x: int) -> None: self.count[x] += 1 self.push_count += 1 heapq.heappush(self.heap, (-self.count[x], -self.push_count, x)) def pop(self) ...
class Freqstack: def __init__(self): self.heap = [] self.count = collections.Counter() self.push_count = 0 def push(self, x: int) -> None: self.count[x] += 1 self.push_count += 1 heapq.heappush(self.heap, (-self.count[x], -self.push_count, x)) def pop(self)...
#se copian las tablas de las bases aqui class Tabla(object): def __init__(self, basedatos,nombre,columna,modo): self.base=basedatos #nombre base self.tabla = nombre #nombre tabla self.columnas = columna #numero de columnas self.modo=modo #modo en que se guardo la tabla b ...
class Tabla(object): def __init__(self, basedatos, nombre, columna, modo): self.base = basedatos self.tabla = nombre self.columnas = columna self.modo = modo self.pk = None self.fk = None self.datos = [] self.codificado = [] self.compreso = Fa...
def get_stats(): """Statistic about given file: number of lines, number of empty lines, number of lines with 'z', number of 'z' letter, number of lines with 'and'""" file = input("File: ") dict_result = { 'total_lines': 0, 'empty_lines': 0, 'z_lines': 0, 'z_letters': 0,...
def get_stats(): """Statistic about given file: number of lines, number of empty lines, number of lines with 'z', number of 'z' letter, number of lines with 'and'""" file = input('File: ') dict_result = {'total_lines': 0, 'empty_lines': 0, 'z_lines': 0, 'z_letters': 0, 'and_lines': 0} with open(file...
# Python program for implementation of Shell Sort # Shell sort is an algorithm that first sorts the elements far apart # from each other and successively reduces the interval # between the elements to be sorted. It is a generalized version of insertion sort.''' def shellSort(values): # Start with a somewhat bi...
def shell_sort(values): n = len(values) gap = n // 2 while gap > 0: for i in range(gap, n): temp = values[i] j = i while j >= gap and values[j - gap] > temp: values[j] = values[j - gap] j -= gap values[j] = temp ...
x1 = float(input()) y1 = float(input()) x2 = float(input()) y2 = float(input()) a = max(x1, x2) - min(x1, x2) b = max(y1, y2) - min(y1, y2) area = a * b perimeter = 2 * (a + b) print(area) print(perimeter)
x1 = float(input()) y1 = float(input()) x2 = float(input()) y2 = float(input()) a = max(x1, x2) - min(x1, x2) b = max(y1, y2) - min(y1, y2) area = a * b perimeter = 2 * (a + b) print(area) print(perimeter)
BLACKLIST = [ # PRESF --------------------------- 'SetTime', 'DateTime', 'ExternalTemperature', 'CONDUCTIVITY', 'QUARTZ_PRESSURE_SENSOR_SERIAL_NUMBER', 'USE_STOP_TIME', 'USE_START_TIME', 'IOP_MA', 'DEVICE_VERSION', 'LAST_SAMPLE_T', 'QUARTZ_PRESSURE_SENSOR_RANGE', 'LAS...
blacklist = ['SetTime', 'DateTime', 'ExternalTemperature', 'CONDUCTIVITY', 'QUARTZ_PRESSURE_SENSOR_SERIAL_NUMBER', 'USE_STOP_TIME', 'USE_START_TIME', 'IOP_MA', 'DEVICE_VERSION', 'LAST_SAMPLE_T', 'QUARTZ_PRESSURE_SENSOR_RANGE', 'LAST_SAMPLE_P', 'LAST_SAMPLE_S', 'STATUS', 'LOGGING', 'SHOW_PROGRESS_MESSAGES', 'VLITH_V', '...
""" This constant file was automatically generated by a quick script I wrote for the enum part and h2py for the constant part. It aims to help out remembering the enum values and constants, but probably as bugs... please refer to the actual documentation for the correct values (if something is not working) and feel fr...
""" This constant file was automatically generated by a quick script I wrote for the enum part and h2py for the constant part. It aims to help out remembering the enum values and constants, but probably as bugs... please refer to the actual documentation for the correct values (if something is not working) and feel fr...
def largest_prime_factor(n): i = 2 while i * i <= n: if n % i == 0: n //= i else: i += 1 return n if __name__ == '__main__': T = int(input()) for _ in range(T): n = int(input()) print(largest_prime_factor(n))
def largest_prime_factor(n): i = 2 while i * i <= n: if n % i == 0: n //= i else: i += 1 return n if __name__ == '__main__': t = int(input()) for _ in range(T): n = int(input()) print(largest_prime_factor(n))
__title__ = "lpipe" __version__ = "4.0.2" __summary__ = "AWS Lambda framework for writing clear, minimal Python FAAS" __author__ = "Charlie Mathews" __author_email__ = "cmathews@mintel.com" __maintainer__ = "Charlie Mathews" __maintainer_email__ = "cmathews@mintel.com" __uri__ = "https://github.com/mintel/lpipe"
__title__ = 'lpipe' __version__ = '4.0.2' __summary__ = 'AWS Lambda framework for writing clear, minimal Python FAAS' __author__ = 'Charlie Mathews' __author_email__ = 'cmathews@mintel.com' __maintainer__ = 'Charlie Mathews' __maintainer_email__ = 'cmathews@mintel.com' __uri__ = 'https://github.com/mintel/lpipe'
def digit_prod(n): if n%10==n: return n else: return n%10 * digit_prod(n//10) if __name__ == "__main__": n=32146 print(digit_prod(n))
def digit_prod(n): if n % 10 == n: return n else: return n % 10 * digit_prod(n // 10) if __name__ == '__main__': n = 32146 print(digit_prod(n))
# -*- coding: utf-8 -*- """ Created on Wed May 18 20:26:49 2016 @author: ericgrimson """ def search(L, e): def bSearch(L, e, low, high): if high == low: return L[low] == e mid = low + int((high - low)/2) if L[mid] == e: return True if L[mid] > e: ...
""" Created on Wed May 18 20:26:49 2016 @author: ericgrimson """ def search(L, e): def b_search(L, e, low, high): if high == low: return L[low] == e mid = low + int((high - low) / 2) if L[mid] == e: return True if L[mid] > e: return b_search(L, ...
def increment(number, by=2): # Increment always by 2, if not provided with any value process = number + by return process result = increment(number=5) print(result)
def increment(number, by=2): process = number + by return process result = increment(number=5) print(result)
# https://leetcode.com/problems/combinations/ # Given two integers n and k, return all possible combinations of k numbers out of # the range [1, n]. # You may return the answer in any order. ################################################################################ # dfs class Solution: def combine(self,...
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: self.n = n self.k = k self.ans = [] self.holder = [] self.dfs(0) return self.ans def dfs(self, i): if len(self.holder) == self.k: self.ans.append(self.holder.copy()) ...
class FilterTagsTestMixin(object): def assert_have_filter_tags(self, category, value): filter_tags = self.find('#filter-tags').text.lower() filter_tags.should.contain(category.lower()) filter_tags.should.contain(str(value).lower()) def assert_no_filter_tags(self): self.find_all(...
class Filtertagstestmixin(object): def assert_have_filter_tags(self, category, value): filter_tags = self.find('#filter-tags').text.lower() filter_tags.should.contain(category.lower()) filter_tags.should.contain(str(value).lower()) def assert_no_filter_tags(self): self.find_all...
''' Created on 1.12.2016 @author: Darren '''''' Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For example: Given the following binary tree, 1 <--- / \ 2 3 <--- \ ...
""" Created on 1.12.2016 @author: Darren Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For example: Given the following binary tree, 1 <--- / 2 3 <--- \\ 5 4 <---...
# BFS, Map, overtime class Solution: def cutOffTree(self, forest): """ :type forest: List[List[int]] :rtype: int """ height = len(forest) if height == 0: return 0 width = len(forest[0]) if width == 0: return 0 trees = []...
class Solution: def cut_off_tree(self, forest): """ :type forest: List[List[int]] :rtype: int """ height = len(forest) if height == 0: return 0 width = len(forest[0]) if width == 0: return 0 trees = [] for i in ...
# -*- coding: utf-8 -*- """Top-level package for D3b Airflow Plugins for Cavatica.""" __author__ = """Mark Welsh""" __email__ = 'welshm3@chop.edu' __version__ = '0.1.1'
"""Top-level package for D3b Airflow Plugins for Cavatica.""" __author__ = 'Mark Welsh' __email__ = 'welshm3@chop.edu' __version__ = '0.1.1'
def stage(ctx): return { "parent": "root", "triggers": { "parent": True }, "parameters": [], "configs": [], "flow_label": "0.#{KK_FLOW_SEQ}", "jobs": [{ "name": "tarball", "steps": [{ "tool": "git", ...
def stage(ctx): return {'parent': 'root', 'triggers': {'parent': True}, 'parameters': [], 'configs': [], 'flow_label': '0.#{KK_FLOW_SEQ}', 'jobs': [{'name': 'tarball', 'steps': [{'tool': 'git', 'checkout': 'https://github.com/Kraken-CI/kraken.git', 'branch': 'master'}, {'tool': 'shell', 'cmd': 'tar -zcvf kraken.tar...
#! /bin/env python3 ''' Functional wrapper around the bitwise operators. Designed to make their use more intuitive to users not familiar with the underlying C operators. Extends the functionality with bitmask read/set operations. The inputs are integer values and return types are 16 bit integers or boolean. bit indexe...
""" Functional wrapper around the bitwise operators. Designed to make their use more intuitive to users not familiar with the underlying C operators. Extends the functionality with bitmask read/set operations. The inputs are integer values and return types are 16 bit integers or boolean. bit indexes are zero based Fu...
__title__ = 'Flask-SSS' __description__ = 'Server-Side Sessions for Flask implemented as a SessionInterface.' __version__ = '0.1.0' __author__ = 'Steve McCartney' __author_email__ = 'python@reconvergent.com' __license__ = 'Apache 2.0' __url__ = 'https://github.com/stevemccartney/flask-sss'
__title__ = 'Flask-SSS' __description__ = 'Server-Side Sessions for Flask implemented as a SessionInterface.' __version__ = '0.1.0' __author__ = 'Steve McCartney' __author_email__ = 'python@reconvergent.com' __license__ = 'Apache 2.0' __url__ = 'https://github.com/stevemccartney/flask-sss'
# Purpose: constant values # Created: 10.03.2011 # Copyright (c) 2011-2018, Manfred Moitzi # License: MIT License # --- For Unix --- # 0: undefined Rises an error. # 1: ascii $20-$7F,%%c,%%d,%%p Only # 2: iso8859_1 Western Europe(Unix) $20-$FF,%%c,%%d,%%p # 3: iso8859_2 Central Europ...
codepage_to_encoding = {'874': 'cp874', '932': 'cp932', '936': 'gbk', '949': 'cp949', '950': 'cp950', '1250': 'cp1250', '1251': 'cp1251', '1252': 'cp1252', '1253': 'cp1253', '1254': 'cp1254', '1255': 'cp1255', '1256': 'cp1256', '1257': 'cp1257', '1258': 'cp1258'} encoding_to_codepage = {codec: ansi for (ansi, codec) in...
# Time: 0(n) | Space: O(n) # Input: "aba" # Output: True # Input: "abca" # Output: True # Explanation: You could delete the character 'c'. def isPalindrom(s): i = 0 j = len(s)-1 while i < j and s[i] == s[j]: i+=1 j-=1 return i>=j class Solution: def validPalindrome(self, s: str...
def is_palindrom(s): i = 0 j = len(s) - 1 while i < j and s[i] == s[j]: i += 1 j -= 1 return i >= j class Solution: def valid_palindrome(self, s: str) -> bool: i = 0 j = len(s) - 1 while i < j and s[i] == s[j]: i += 1 j -= 1 i...
def userClick(): #get coordinates of mouse click x,y = pg.mouse.get_pos() #get column of mouse click (1-3) if(x<width/3): col = 1 elif (x<width/3*2): col = 2 elif(x<width): col = 3 else: col = None #get row of mouse click (1-3) if(y<height/3): ...
def user_click(): (x, y) = pg.mouse.get_pos() if x < width / 3: col = 1 elif x < width / 3 * 2: col = 2 elif x < width: col = 3 else: col = None if y < height / 3: row = 1 elif y < height / 3 * 2: row = 2 elif y < height: row = 3 ...
# import os JWT_SECRET_KEY = "9e4a7c7020769b8dab4aa38774bc57a454ecf739d62bf46d0ca77e053bbc5cbb" JWT_ALGORITHM = "HS256" JWT_EXPIRATION_TIME_IN_MIN = 60 * 24 * 5 TOKEN_DESCRIPTION = "It verifies username and password from db and returns jwt token" TOKEN_SUMMARY = "It returns jwt token" DB_HOST = "localhost" DB_USER =...
jwt_secret_key = '9e4a7c7020769b8dab4aa38774bc57a454ecf739d62bf46d0ca77e053bbc5cbb' jwt_algorithm = 'HS256' jwt_expiration_time_in_min = 60 * 24 * 5 token_description = 'It verifies username and password from db and returns jwt token' token_summary = 'It returns jwt token' db_host = 'localhost' db_user = 'aman' db_pass...