content stringlengths 7 1.05M |
|---|
#
# gambit
#
# This file contains the information to make the mesh for a subset of the original point data set.
#
#
# The original data sets are in csv format and are for 6519 observation points.
# 1. `Grav_MeasEs.csv` contains the cartesian coordinates of the observation points (m).
# 2. `Grav_gz.csv` contains the Bou... |
"""
148. Sort List
Sort a linked list in O(n log n) time using constant space complexity.
Example 1:
Input: 4->2->1->3
Output: 1->2->3->4
Example 2:
Input: -1->5->3->4->0
Output: -1->0->3->4->5
"""
class Solution:
def sortList(self, head):
"""
:type head: ListNode
:... |
i = 1
while i < 6:
print(i)
if i == 3:
break
i += 1
i = 1
while i < 6:
print(i)
if i == 3:
continue
i += 1
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
if x == "banana":
break
fruits = ["apple", "banana", "cherry"]
for x in fruits:
if x == "ba... |
def config():
return None
def watch():
return None |
"""
This file contains all of the display functions for model management
"""
def display_init_model_root(root):
"""display function for creating new model folder"""
print("Created model directory at %s" % (root))
def display_init_model_db(db_root):
"""display function for initializing the model db"""
... |
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("@bazel_skylib//lib:versions.bzl", _bazel_versions = "versions")
load("@os_info//:os_info.bzl", "is_windows")
def _semver_components(version):
"""Separates a semver into its... |
"""Class implementation for type name interface.
"""
class TypeNameInterface:
_type_name: str
@property
def type_name(self) -> str:
"""
Get this instance expression's type name.
Returns
-------
type_name : str
This instance expression'... |
def transposition(key, order, order_name):
new_key = ""
for pos in order:
new_key += key[pos-1]
print("Permuted "+ order_name +" = "+ new_key)
return new_key
def P10(key):
P10_order = [3, 5, 2, 7, 4, 10, 1, 9, 8, 6]
P10_key = transposition(key, P10_order, "P10")
return P10_key
... |
"""
Add a counter at a iterable and return the this
counter .
"""
# teste
fruits = ["apple", "pineapple", "lemon", "watermelon", "grapes"]
enumerate_list = enumerate(fruits)
# print(list(enumerate_list))
for index, element in enumerate_list:
filename = f"file{index}.jpg"
print(filename)
|
class laptop:
brand=[]
year=[]
ram=[]
def __init__(self,brand,year,ram,cost):
self.brand.append(brand)
self.year.append(year)
self.ram.append(ram)
self.cost.append(cost)
|
year_str = input('あなたの生まれ年を西暦4桁で入力してください: ')
year = int(year_str)
number_of_eto = (year + 8) % 12
eto_tuple = ('子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥')
eto_name = eto_tuple[number_of_eto]
print('あなたの干支は', eto_name, 'です。')
|
print('==== SERA QUE O ANO É BISSEXTO ? ====')
ano = int(input('Digite um ano que deseja verificar se é bissexto: '))
if ano % 4 ==0 and ano % 100 != 0 or ano % 400 ==0:
print('O ano é BISSEXTO.')
else:
print('O ano não é BISSEXTO.')
|
"""uVoyeur Application Bus"""
class PublishFailures(Exception):
delimiter = '\n'
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
self._exceptions = list()
def capture_exception(self):
self._exceptions.append(sys.exc_info()[1])
def get_instance... |
# 没想到用dp
# 状态转移方程:=之前的一家不偷,这家偷(dp(i-2) + val(i))和上一家偷了(dp(i-1))的较大值
class Solution:
def rob(self, nums):
if len(nums)==0:
return 0
dp=[0]*len(nums)
dp[0]=nums[0]
if len(nums)>=2:
dp[1]=max(nums[0:2])
for i in range(2,len(nums)):
dp[i]=max(... |
dataset_type = 'TextDetDataset'
data_root = 'data/synthtext'
train = dict(
type=dataset_type,
ann_file=f'{data_root}/instances_training.lmdb',
loader=dict(
type='AnnFileLoader',
repeat=1,
file_format='lmdb',
parser=dict(
type='LineJsonParser',
keys=['... |
class Solution:
def judgeSquareSum(self, c: int) -> bool:
left = 0
right = int(c ** 0.5)
while left <= right:
cur = left ** 2 + right ** 2
if cur < c:
left += 1
elif cur > c:
right -= 1
else:
retu... |
#!/usr/bin/env python3
def score_word(word):
score = 0
for letter in word:
# add code here
pass
return score
|
"""
Advent of Code 2021: Day 02 Part 1
tldr: Find two dimensional ending position
"""
input_file = "input.solution"
totals = {
"forward": 0,
"down": 0,
"up": 0,
}
with open(input_file, "r") as file:
for line in file:
direction, magnitude = line.split()
totals[direction] += int(magn... |
#!/bin/python3
# https://www.hackerrank.com/challenges/alphabet-rangoli/problem
#ll=limitting letter
#sl=starting letter
#df=deduction factor
#cd=character difference
#rl=resulting letter
while True:
ll=ord(input("Enter the limitting letter in the pattern:> "))
sl=65 if ll in range(65,91) else (97 if ll in ran... |
# -*- coding:utf-8 -*-
"""
@Author:Charles Van
@E-mail: williananjhon@hotmail.com
@Time:2019-07-26 17:27
@Project:InterView_Book
@Filename:violentEnumeration.py
@description:
暴力枚举法
"""
# S定义股票开盘价数组
S = [10,4,8,7,9,6,2,5,3]
maxProfit = 0
buyDay = 0
sellDay = 0
for i in range(len(S) - 1):
for j in range(i+1,len(S... |
# initialize step_end
step_end = 25
with plt.xkcd():
# initialize the figure
plt.figure()
# loop for step_end steps
for step in range(step_end):
t = step * dt
i = i_mean * (1 + np.sin((t * 2 * np.pi) / 0.01))
plt.plot(t, i, 'ko')
plt.title('Synaptic Input $I(t)$')
plt.xlabel('time (s)')
pl... |
S = list(map(str, input()))
for i in range(len(S)):
if S[i] == '6':
S[i] = '9'
elif S[i] == '9':
S[i] = '6'
S = reversed(S)
print("".join(S)) |
global_variable = "global_variable"
print(global_variable + " printed at the module level.")
class GeoPoint():
class_attribute = "class_attribute"
print(class_attribute + " printed at the class level.")
def __init__(self):
global global_variable
print(global_variable + " printed at th... |
#!/usr/bin/env python3
#!/usr/bin/python
str1 = 'test1'
if str1 == 'test1' or str1 == 'test2':
print('1 or 2')
elif str1 == 'test3' or str1 == 'test4':
print("3 or 4")
else:
print("else")
str1 = ''
if str1:
print(("'%s' is True" % str1))
else:
print(("'%s' is False" % str1))
str1 = ' '
if str1:
... |
"""This module handles numbers"""
class NAN(ValueError):
def __init__(self, value):
super().__init__(f"NAN: {value}")
def _eval(value, kind, default=None):
try:
return kind(value)
except (ValueError, TypeError):
# if default is None:
# raise NAN(value)
if isinstan... |
# Python Class 1
# variable <-- Left
# = <-- Assign
# data = int, String, char, boolean, float
name = "McGill University"
age = 10
is_good = False
height = 5.6
print("Name is :" + name)
print("Age is :" + str(age))
print("He is good :" +str(is_good))
|
# -*- coding: utf-8 -*-
"""Utility exception classes."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
class AlreadyExists(Exception):
"""Exception for adding an item to a col... |
e,f,c = map(int,input().split())
bottle = (e+f)//c
get = (e+f)%c + bottle
while 1:
if get < c: break
bottle += get//c
get = get//c + get%c
print(bottle) |
TESTING = True
HOST = "127.0.0.1"
PORT = 8000
|
def to_star(word):
vowels = ['a', 'e' ,'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
for char in vowels:
word = word.replace(char,"*")
return word
word = input("Enter a word: ")
print(to_star(word)) |
"""
Constants for 'skills' table
"""
table_ = "skillsScores"
timestamp = "timestamp"
team_num = "teamNum"
skills_type = "type"
skills_type_driving = 1
skills_type_programming = 2
red_balls = "redBalls"
blue_balls = "blueBalls"
owned_goals = "ownedGoals"
score = "score"
stop_time = "stopTime"
referee = "refere... |
"""
To create a cli command add a new file appended by the command
for example:
if I want to create a command called test:
- I will create a file cmd_test
- create a function cli and run my command
To run command on cli:
with docker: docker-compose exec your-image yourapp your-... |
print ("Welcome to the mad lib generator. Please follow along and type your input to each statement or question.")
print ("Name an object")
obj1 = input()
print ("Name the plural of your previous object")
obj3 = input()
print ("Name a different plural object")
obj2 = input()
print ("Name a color")
color1 = i... |
students = {
"ivan": 5.50,
"alex": 3.50,
"maria": 5.50,
"georgy": 5.50,
}
for k,v in students.items():
if v > 4.50:
print( "{} - {}".format(k, v) ) |
#!/usr/bin/python
# pylint: disable=W0223
"""
Utilities for formatting html pages
"""
def wrap(headr, data):
"""
Input:
headr -- text of html field
data -- text to be wrapped.
Returns a corresponding portion of an html file.
"""
return '<%s>%s</%s>' % (headr, data, headr)
def fmt_... |
#crie um programa que leia varios numeros inteiros pelo teclado, no final
#deve mostrar a média entre todos os valores e qual foi o maior e menor valor digitado
#o programa deve perguntar se deseja continuar ou não digitando valores
resp = 'S'
soma = 0
quantidade = 0
media = 0
menor = 0
maior = 0
while resp != 'N':
... |
# This script will track two lists through a 3-D printing process
# Source code/inspiration/software
# Python Crash Course by Eric Matthews, Chapter 8, example 8+
# Made with Mu 1.0.3 in October 2021
# Start with a list of unprinted_designs to be 3-D printed
unprinted_designs = ['iphone case', 'robot pend... |
# from typing import Counter
# counter={}
words=input().split(" ")
counter ={ x:words.count(x) for x in set(words)}
print('max: ', max(counter))
print('min: ', min(counter))
# a = input().split()
# d = {}
# for x in a:
# try:
# d[x] += 1
# except:
# d[x] = 1
# print('max: ', max(d))
# prin... |
fajl=open("egyszamjatek.txt", "r")
#sdkjfhsdkfjh
jatekos=[]
for sor in fajl:
rekord=sor.rstrip().split()
Fszam=len(rekord)-1
for i in range(Fszam):
rekord[i]=int(rekord[i])
jatekos.append(rekord)
fajl.close()
Jszam=len(jatekos)
print("3. feladat: Játékosok száma: ", Jszam)
print("4. feladat: For... |
# This file is part of the Extra-P software (http://www.scalasca.org/software/extra-p)
#
# Copyright (c) 2020, Technical University of Darmstadt, Germany
#
# This software may be modified and distributed under the terms of a BSD-style license.
# See the LICENSE file in the base directory for details.
class Recoverable... |
"""
Examples will be published soon ...
"""
|
def greet(first_name, last_name):
print(f"Hi {first_name} {last_name}")
greet("Tom", "Hill")
|
"""
Desafio 005
Problema: Faça um programa que leia um número inteiro e mostre na tela
o seu sucessor e antecessor.
Resolução do problema:
"""
num = int(input('Informe um valor: '))
sucessor = num + 1
antecessor = num - 1
print('Antecessor: {}\nInformado: {}\nSucessor: {}' .format(antecessor, num, sucessor... |
"""
This script takes two input strings and compare them to check if they are anagrams or not.
"""
def mysort(s): #function that splits the letters
d=sorted(s)
s=''.join(d)
return s
s1=input("enter first word ")
n1=mysort(s1) #function invocation /calling the function
s2=input("enter second word ")
n2=mysort(s... |
# Copyright (c) 2022, INRIA
# Copyright (c) 2022, University of Lille
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, t... |
print()
print("--- Math ---")
print(1+1)
print(1*3)
print(1/2)
print(3**2)
print(4%2)
print(4%2 == 0)
print(type(1))
print(type(1.0)) |
directions = [(-1,0), (0,1), (1,0), (0,-1), (0,0)]
dirs = ["North", "East", "South", "West", "Stay"]
def add(a, b):
return tuple(map(lambda a, b: a + b, a, b))
def sub(a,b):
return tuple(map(lambda a, b: a - b, a, b))
def manhattan_dist(a, b):
return abs(a[0]-b[0]) + abs(a[1]-b[1])
def direction_t... |
def even_fibo():
a =1
b = 1
even_sum = 0
c =0
while(c<= 4000000):
c = a + b
a = b
b = c
if(c %2 == 0):
even_sum = c + even_sum
print(even_sum)
if __name__ == "__main__":
print("Project Euler Problem 1")
even_fibo()
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 24 16:18:39 2018
@author: pamelaanderson
"""
def clean_ad_ev_table(df):
""" This function cleans the adverse event reporting data- correcting for drug labeling information
using CMS database as the 'truth' to correct to """
df['dru... |
MULTI_ERRORS_HTTP_RESPONSE = {
"errors": [
{
"code": 403,
"message": "access denied, authorization failed"
},
{
"code": 401,
"message": "test error #1"
},
{
"code": 402,
"message": "test error #2"
... |
name = 'shell_proc'
version = '1.1.1'
description = 'Continuous shell process'
url = 'https://github.com/justengel/shell_proc'
author = 'Justin Engel'
author_email = 'jtengel08@gmail.com'
|
def open_input():
with open("input.txt") as fd:
array = fd.read().splitlines()
array = list(map(int, array))
return array
def part_one(array):
lenght = len(array)
increased = 0
for i in range(0, lenght - 1):
if array[i] < array[i + 1]:
increased += 1
print("part... |
# ===========================================================================
# dictionary.py -----------------------------------------------------------
# ===========================================================================
# function ----------------------------------------------------------------
# -----... |
# selectionsort() method
def selectionSort(arr):
arraySize = len(arr)
for i in range(arraySize):
min = i
for j in range(i+1, arraySize):
if arr[j] < arr[min]:
min = j
#swap values
arr[i], arr[min] = arr[min], arr[i]
# method to print an array
def printList(arr):
for i in rang... |
# -*- coding: utf-8 -*-
"""Exceptions used in this module"""
class CoincError(Exception):
"""Base Class used to declare other errors for Coinc
Extends:
Exception
"""
pass
class ConfigError(CoincError):
"""Raised when there are invalid value filled in Configuration Sheet
Extends:
... |
logo = '''
______ __ __ _ __ __
/ ____/__ __ ___ _____ _____ / /_ / /_ ___ / | / /__ __ ____ ___ / /_ ___ _____
/ / __ / / / // _ \ / ___// ___/ / __// __ \ / _ \ / |/ // / / // __ `__ \ / __ \ / _ \ / ___/
/ /_/ // ... |
class AzureBlobUrlModel(object):
def __init__(self, storage_name, container_name, blob_name):
"""
:param storage_name: (str) Azure storage name
:param container_name: (str) Azure container name
:param blob_name: (str) Azure Blob name
"""
self.storage_name = storage_n... |
'''https://leetcode.com/problems/symmetric-tree/'''
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isMirror(self, left, right):
if left is None and right is None:
... |
def convert_to_bool(string):
"""
Converts string to bool
:param string: String
:str string: str
:return: True or False
"""
if isinstance(string, bool):
return string
return string in ['true', 'True', '1'] |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 27 10:49:39 2020
@author: Arthur Donizeti Rodrigues Dias
"""
class Category:
def __init__(self, categories):
self.ledger=[]
self.categories = categories
self.listaDeposito=[]
self.listaRetirada=[]
self.total_entr... |
def defaults():
return dict(
actor='mlp',
ac_kwargs={
'pi': {'hidden_sizes': (64, 64),
'activation': 'tanh'},
'val': {'hidden_sizes': (64, 64),
'activation': 'tanh'}
},
adv_estimation_method='gae',
epochs=300, # ... |
def ceulcius(x):
return (x - 32)/1.8
x = int(input('Digite uma temperatura em (F°): '))
print(f'A temperatura digitada em {x}F°, é igual a {ceulcius(x):.1f}C°') |
class INestedContainer(IContainer,IDisposable):
""" Provides functionality for nested containers,which logically contain zero or more other components and are owned by a parent component. """
def __enter__(self,*args):
"""
__enter__(self: IDisposable) -> object
Provides the implementation of __ent... |
'''
LeetCode LinkedList Q.876 Middle of the Linked List
Recusion and Slow/Fast Pointer Solution
'''
def middleNode(self, head: ListNode) -> ListNode:
def rec(slow, fast):
if not fast:
return slow
elif not fast.next:
return slow
return rec(slow.next, fast.next.nex... |
class ParameterDefinition(object):
def __init__(self, name, param_type=None, value=None):
self.name = name
self.param_type = param_type
self.value = value
class Parameter(object):
def __init__(self, definition):
self.definition = definition
self.value = definition.val... |
def check_kwargs(input_kwargs, allowed_kwargs, raise_error=True):
"""Tests if the input `**kwargs` are allowed.
Parameters
----------
input_kwargs : `dict`, `list`
Dictionary or list with the input values.
allowed_kwargs : `list`
List with the allowed keys.
raise_error : `bool... |
load(":import_external.bzl", import_external = "import_external")
def dependencies():
import_external(
name = "org_apache_httpcomponents_client5_httpclient5",
artifact = "org.apache.httpcomponents.client5:httpclient5:5.1",
artifact_sha256 = "b7a30296763a4d5dbf840f0b79df7439cf3d2341c8990aee4... |
class Solution:
def imageSmoother(self, M: list) -> list:
l = len(M)
if l == 0:
return M
m = len(M[0])
res = []
for i in range(l):
res.append([0] * m)
# print(res)
for x in range(l):
for y in range(m):
summ =... |
#!/usr/bin/env python3
# pylint: disable=invalid-name,missing-docstring
def test_get_arns(oa, shared_datadir):
with open("%s/saml_assertion.txt" % shared_datadir) as fh:
assertion = fh.read()
arns = oa.get_arns(assertion)
# Principal
assert arns[0] == 'arn:aws:iam::012345678901:saml-provider/... |
de = {
"client_id": "Client ID:",
"title": "Titel:",
"details": "Details:",
"state": "Status:",
"buttons": "Buttons:",
"image": "Bild:",
"edit_title": "Titel bearbeiten",
"manage_images": "Bilder verwalten",
"update_rich_presence": "Rich Presence aktualisieren",
"sync_with_apple_... |
__all__ = [
"cart_factory",
"cart",
"environment",
"job_factory",
"job",
"location",
"trace",
]
|
TITLE = "The World of Light and Shadow"
ALPHABET = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
ALPHABET += ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", ... |
class Solution:
def closedIsland(self, grid: List[List[int]]) -> int:
def dfs(r, c, val):
grid[r][c] = val
for nr, nc in (r-1, c), (r+1, c), (r, c-1), (r, c+1):
if 0 <= nr < len(grid) and 0 <= nc < len(grid[0]) and grid[nr][nc] != val:
dfs(nr, nc, ... |
# you can use print for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
# write your code in Python 2.7
N = len(A)
counter = []
leader = -1
leader_count = 0
left_leader_count = 0
equi_count = 0
for i in xrange(N):
if not counter:
... |
# this py file will be strictly dedicated to "Boolean Logic"
# Boolean Logic is best defined as the combination of phrases that can result in printing different values
# define two variables
a = True
b = False
# if-statement... output: True
# the if condition prints, if the "if statement" evaluates to True
i... |
class Solution(object):
def robot(self, command, obstacles, x, y):
"""
:type command: str
:type obstacles: List[List[int]]
:type x: int
:type y: int
:rtype: bool
"""
# zb = [0, 0]
# ind = 0
# while True:
# if command[ind] ==... |
"""Contains the ItemManager class, used to manage items.txt"""
class ItemManager:
"""A class to manage items.txt."""
def __init__(self):
self.items_file = 'txt_files/items.txt'
def clear_items(self):
with open(self.items_file, 'w') as File:
File.write("Items:\n")
prin... |
words = set(
(
"scipy",
"Combinatorics",
"rhs",
"lhs",
"df",
"AttributeError",
"Cymru",
"FiniteSet",
"Jupyter",
"LaTeX",
"Modularisation",
"NameError",
"PyCons",
"allclose",
"ax",
"bc",
... |
class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[List[int]]
:rtype: List[List[int]]
"""
if not intervals: return[]
# 按区间的 start 升序排列
intervals.sort(key=lambda intv : intv[0])
res = []
res.append(intervals[0])
... |
#Booleans are operators that allow you to convey True or False statements
print(True)
print(False)
type(False)
print(1>2)
print(1==1)
b= None #None is used as a placeholder for an object that has not been assigned , so that object unassigned errors can be avoided
type(b)
print(b)
type(True)
|
class ServerState:
"""Class for server state"""
def __init__(self):
self.history = set()
self.requests = 0
def register(self, pickup_line):
self.requests += 1
self.history.add(pickup_line)
def get_status(self):
return "<table> " + \
wrap_in_row(... |
eso_races = {}
eso_desc = {}
eso_passive = {}
eso_alliance = {}
eso_raceimg = {}
eso_allianceinfo = {}
eso_allianceimg = {}
"""
Daggerfall Covenant (Breton, Redguard, Orc)
"""
eso_allianceimg["daggerfall"] = "http://esoacademy.com/wp-content/uploads/2014/12/DC.png"
eso_allianceinfo["daggerfall"] = "Dagge... |
def for_g():
for row in range(6):
for col in range(3):
if row-col==2 or col-row==1 or row+col==4 or col==2 and row>0 or row==5 and col==1 or row==1 and col==0:
print("*",end=" ")
else:
print(" ",end=" ")
print()
def while_g():
row=... |
ERR_SVR_NOT_FOUND = 1
ERR_CLSTR_NOT_FOUND = 2
ERR_IMG_NOT_FOUND = 3
ERR_SVR_EXISTS = 4
ERR_CLSTR_EXISTS = 5
ERR_IMG_EXISTS = 6
ERR_IMG_TYPE_INVALID = 7
ERR_OPR_ERROR = 8
ERR_GENERAL_ERROR = 9
ERR_MATCH_KEY_NOT_PRESENT = 10
ERR_MATCH_VALUE_NOT_PRESENT = 11
ERR_INVALID_MATCH_KEY = 12
|
def swap_case(s):
# sWAP cASE in Python - HackerRank Solution START
Output = ''
for char in s:
if(char.isupper()==True):
Output += (char.lower())
elif(char.islower()==True):
Output += (char.upper())
else:
Output += char
return Output |
a=10
b=1.5
c= 'Arpan'
print (c,"is of type",type(c) )
|
nome = input('Qual é seu nome? ')
print('Prazer em te conhecer {}!'.format(nome))
#print('Prazer em te conhecer {:20}!'.format(nome)) exemplo terá 20 espaços vazios
#print('Prazer em te conhecer {:>20}!'.format(nome))exemplo será alinhado à direita
#print('Prazer em te conhecer {:<20}!'.format(nome)) exemplo será alinh... |
# Given n non-negative integers representing an elevation map where the width of each bar is 1,
# compute how much water it is able to trap after raining.
# The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1].
# In this case, 6 units of rain water (blue section) are being trapped.
# Thanks Mar... |
KNOWN_BINARIES = [
"*.avi", # video
"*.bin", # binary
"*.bmp", # image
"*.docx", # ms-word
"*.eot", # font
"*.exe", # binary
"*.gif", # image
"*.gz", # compressed
"*.heic", # image
"*.heif", #... |
ecc_fpga_constants_v128 = [
[
# Parameter name
"p192",
# base word size
16,
# extended word size
128,
# number of bits added
9,
# number of words
2,
# prime
6277101735386680763835789423207666416083908700390324961279,
# prime size in bits
192,
# prime+1
6277101735386680763835789423207666416083908700390324961280,... |
OpenVZ_EXIT_STATUS = {
'vzctl': {0: 'Command executed successfully',
1: 'Failed to set a UBC parameter',
2: 'Failed to set a fair scheduler parameter',
3: 'Generic system error',
5: 'The running kernel is not an OpenVZ kernel (or some OpenVZ modules are not lo... |
# -*- coding: utf-8 -*-
""" Parameters """
"""
Annotated transcript filtering
Setting TSL threshold to 1 excludes some Uniprot canonical transcripts, e.g.,
DDP8_HUMAN with the first 18 amino acids.
"""
tsl_threshold = 2 # the transcript levels below which (lower is better) to consider
"""
Stop codon forced trans... |
"""
Provide help messages for command line interface's receipt commands.
"""
RECEIPT_TRANSACTION_IDENTIFIERS_ARGUMENT_HELP_MESSAGE = 'Identifiers to get a list of transaction\'s receipts by.'
|
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/4/16 13:02
# @Author : Yunhao Cao
# @File : exceptions.py
__author__ = 'Yunhao Cao'
__all__ = [
'CrawlerBaseException',
'RuleManyMatchedError',
]
class CrawlerBaseException(Exception):
pass
class RuleManyMatchedError(CrawlerBaseExcep... |
"""
A. Football
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals.
Unfortunately he didn't find the overall score of the match; however, he got hold
of a p... |
"""
Permutation where the order the way the elements are arranged matters
Using a back tracking we print all the permutations
E.g.
abc
There are total 3! permutations
abc
acb
acb
bac
bca
cab
cba
"""
def calculate_permutations(element_list, result_list, pos, r=None):
n = len(element_list)
if pos == n:
i... |
class Cat:
name = ''
age = 0
color = ''
def __init__(self, name, age=0, color ='White'):
self.name = name
self.age = age
self.color = color
def meow(self):
print(f'{self.name} meow')
def sleep(self):
print(f' {self.name} zzz')
def hungry(self):
... |
"""
Creating a custom error by extending the TypeError class
"""
class MyCustomError(TypeError):
"""
Raising a custom error by extending the TypeError class
"""
def __init__(self, error_message, error_code):
super().__init__(f'Error code: {error_code}, Error Message: {error_message}')
... |
######################################################################
#
# File: b2/sync/file.py
#
# Copyright 2018 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
class File(object):
"""
Hold... |
def ascending_order(arr):
if(len(arr) == 1):
return 0
else:
count = 0
for i in range(0, len(arr)-1):
if(arr[i+1]<arr[i]):
diff = arr[i] - arr[i+1]
arr[i+1]+=diff
count+=diff
return count
if __name__=="__main__":
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.