content stringlengths 7 1.05M |
|---|
[
{
'date': '2020-01-01',
'description': 'Año Neuvo',
'locale': 'es-US',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2020-01-20',
'description': 'Cumpleaños de Martin Luther King, Jr.',
'locale': 'es-US',
'notes': '',
... |
# s -> singular
# m -> multiple
# b -> begin of a compound noun (like "serialized" in "serialized thread")
# e -> end of a compound noun (like "thread" in "serialized thread")
# a -> alone (never part of a compound noun like "garbage collector")
# r -> regular (add s at the end to make it multiple)
# i -> irregular (... |
class PollutionMaps:
@staticmethod
def cracow(size: int):
map = []
connections = []
map.append({
"id": 0,
"name": "Vlastimila Hofmana",
"PM2.5": "t",
"d_PM2.5": "t",
"PM10": 28,
"temperature": 3,
"press... |
n = int(input("Digite o numero máximo: "))
cont = 1
while cont <= n:
if(cont % 2 == 0):
print(cont)
cont = cont + 1
|
class SpineParsingException(Exception):
def __init__(self, message, code_error=None, *args, **kwargs):
self.message = message
self.code_error = code_error
super(SpineParsingException, self).__init__(*args, **kwargs)
def __str__(self):
return str(self.message)
class SpineJsonE... |
## A py module for constants.
##
## Oh, and a license thingy because otherwise it won't look cool and
## professional.
##
## MIT License
##
## Copyright (c) [2016] [Mehrab Hoque]
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (th... |
# https://open.kattis.com/problems/flowfree
def find_color_positions(board):
colors = {}
squares_to_visit = 0
for row in range(4):
for col in range(4):
v = board[row][col]
if v == 'W':
squares_to_visit += 1
continue
if v not in ... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... |
# Time: O(m^2 * n^2)
# Space: O(m^2 * n^2)
# A* Search Algorithm without heap
class Solution(object):
def minPushBox(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
def dot(a, b):
return a[0]*b... |
#
# PHASE: compile
#
# DOCUMENT THIS
#
load(
"@io_bazel_rules_scala//scala/private:rule_impls.bzl",
"compile_or_empty",
"pack_source_jars",
)
load("//tools:dump.bzl", "dump")
def phase_binary_compile(ctx, p):
args = struct(
buildijar = False,
unused_dependency_checker_ignored_targets =... |
VERSION = '1.0'
ALGORITHM_AUTHOR = 'Chris Schnaufer, Ken Youens-Clark'
# ALGORITHM_AUTHOR_EMAIL = 'schnaufer@arizona.edu, kyclark@arizona.edu'
ALGORITHM_AUTHOR_EMAIL = ['schnaufer@arizona.edu', 'kyclark@arizona.edu']
WRITE_BETYDB_CSV = True
|
# Однострочный комментарий
"""
Многострочный
комментарий
"""
print('Hello!') # вывод одной строки
print('Hello!', 'Student!', 123) # вывод нескольких строк
print('Hello!', 'Student!', 123, sep='xxx') # вывод с произвольным сепаратором
print('Hello!', 'Student!', 123, end='yyy') # вывод с произвольным окончание... |
class InvalidArgument(Exception):
def __init__(self, mesaje=""):
super().__init__(mesaje)
class InvalidRef(Exception):
def __init__(self, mesaje="") -> None:
super().__init__(mesaje)
class InvalidCommand(Exception):
def __init__(self, mesaje="") -> None:
super().__init__(mesaje)
|
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
class GenerateGraphvizError(Exception):
"""
Represents a GenerateGraphiz error.
`GenerateGraphiz` will be raised when an error is tied
to generate_graphviz function
"""
pass
|
# https://binarysearch.com/problems/Count-Nodes-in-Complete-Binary-Tree
class Solution:
@staticmethod
def getList(root, lst):
if root == None: return
else:
lst.append(root.val)
Solution.getList(root.left, lst)
Solution.getList(root.right, lst)
def solve(... |
"""Defines the common sense rule class."""
class CommonSenseRule:
"""
A rule brought in from a domain expert.
Common sense rules can be used to bring in expert knowledge and avoid that common sense rules are generated. Goal is
to facilitate more focus on rules not known before.
"""
def __init... |
"""
Copyright (c) 2020 Sam Hume
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, subli... |
def close_catalogue_pop_up(wd):
'''
Close catalogue pop up box if it appears.
:param WebDriver wd: Selenium webdriver with page loaded.
:return: void
:rtype: void
'''
pop_up_buttons = wd.find_elements_by_css_selector('.Button.variant-plain.size-normal.close-control')
for button in pop... |
def flownet_v1_s(input):
pass
|
'''
#E1
C=float(raw_input("<<"))
F=float((9.0 / 5.0) * C + 32)
print(F)
'''
'''
#E2
radius,length = eval(raw_input(">>"))
area = radius * radius * 3.14
volume = area * length
print(area,volume)
'''
'''
#E3
feet = eval(raw_input("<<"))
meter = feet * 0.305
print(meter)
'''
'''
#E4
M = eval(raw_input("Enter the amount of... |
'''
Author: Shuailin Chen
Created Date: 2021-09-14
Last Modified: 2022-01-06
content: fine tuning
'''
_base_ = [
'./deeplabv3_r50-d8-selfsup_512x512_10k_sn6_sar_pro_rotated_ft.py'
]
model = dict(
pretrained='/home/csl/code/PolSAR_SelfSup/work_dirs/pbyol_r18_sn6_sar_pro_ul_ep400_lr03/20211009_142911/mmseg_epo... |
class Solution(object):
def numTimesAllBlue(self, light):
"""
:type light: List[int]
:rtype: int
"""
# N = max(light)
# res = [-1]*N
# i = 0
# maxp = -1
# count = 0
# for l in light:
# if l>maxp:
# maxp = l
... |
class User:
"""
Class that generates new instances of credentials.
"""
user_list = [] #empty credential list
def __init__(self, account_name, user_name, password, email):
# instace variables are viriables that are unique to each new instance of the class
self.account_name = ... |
nome="Ramon"
idade=28
prof="data analyst"
course="ciencia de dados"
dia_nasc=16
mes_nasc=8
ano_nasc=1992
empresa_atual="Vertex"
mae="Estela"
pai="Freitas"
esposa="Ana Caroline"
text=f"Eu me chamo {nome} e tenho {idade} anos. nasci na data {dia_nasc}/{mes_nasc}/{ano_nasc}. Minha mãe se chama {mae}"
print(t... |
"""
Our trie implementation
"""
_SENTINEL = object()
class Trie(dict):
"A trie"
def __init__(self):
super(Trie, self).__init__()
def insert(self, key, value):
"Inserts a key-value pair into the trie"
trie = self
for char in key:
if char not in trie:
... |
class Stack:
def __init__(self, values = []):
self.__stack = values
def push(self, value):
self.__stack.append(value)
def pop(self):
return self.__stack.pop()
def peek(self):
return self.__stack[-1]
def __len__(self):
return len(self.__stack)
if __name__... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution_1:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
head = ListNode()
p = head
p1, p2 = l1, l2
mem = 0
while p1 and p... |
while True:
line = input('> ')
if line == 'done':
break
# Breaks out of loop if done
# Otherwise, the loop continues and prints line.
print(line)
print('Done!') |
# GOAL:
# Convert to human readable information
def format_bytes(bytes):
units = ['B', 'KB','MB','GB']
for unit in units:
out = f'{round(bytes,2)} {unit}'
bytes = bytes / 1024
if bytes < 1:
break
return out
def format_time(sec):
units = [
['s', 60],
... |
numero= int (input('Teclee un número positivo '))
while numero<0:
print('Escribió un número negativo')
numero= int (input('Inténtelo de nuevo'))
else:
print('Bien tecleado ')
|
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( n ) :
x = n
y = 1
e = 0.000001
while ( x - y > e ) :
x = ( x + y ) / 2
y = n / x
... |
f = Function(ControlHandle, 'as_Control',
(Handle, 'h', InMode))
functions.append(f)
as_resource_body = """
return ResObj_New((Handle)_self->ob_itself);
"""
f = ManualGenerator("as_Resource", as_resource_body)
f.docstring = lambda : "Return this Control as a Resource"
methods.append(f)
DisposeControl_body = """
i... |
# nlantau, 2021-11-04
make_string=lambda x:"".join([i[0] for i in x.split()])
print(make_string("sees eyes xray yoat"))
|
"""Rules for writing tests for the IntelliJ aspect."""
load(
"//aspect:fast_build_info.bzl",
"fast_build_info_aspect",
)
def _impl(ctx):
"""Implementation method for _fast_build_aspect_test_fixture."""
deps = [dep for dep in ctx.attr.deps if "ide-fast-build" in dep[OutputGroupInfo]]
inputs = deps... |
# Лучшим местом для изменения этой переменной env является файл project / settings / local_env.py. Он загружается после этого специально для
# позволяет вам управлять env, не касаясь кода проекта.
PRODUCTION = True
DEBUG = False
|
def extractNovelbeartranslation001WordpressCom(item):
'''
Parser for 'novelbeartranslation001.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if item['tags'] == ['Uncategorized']:
titlemap = [... |
del_items(0x80135544)
SetType(0x80135544, "void PreGameOnlyTestRoutine__Fv()")
del_items(0x80137608)
SetType(0x80137608, "void DRLG_PlaceDoor__Fii(int x, int y)")
del_items(0x80137ADC)
SetType(0x80137ADC, "void DRLG_L1Shadows__Fv()")
del_items(0x80137EF4)
SetType(0x80137EF4, "int DRLG_PlaceMiniSet__FPCUciiiiiii(unsigne... |
"""Sensor states."""
OPEN = 0
"""The sensor is open."""
CLOSED = 1
"""The sensor is closed."""
|
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def ubuntu1404Clang10Sysroot():
http_archive(
name = "ubuntu_14_0... |
def arrplus(arr):
return [arr[i] + i for i in range(len(arr))]
if __name__ == '__main__':
arr = [8, 4, 1, 7]
print(arrplus(arr))
'''
[8, 5, 3, 10]
'''
|
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def convert_to_infix(query):
myStack = []
query = query[-1::-1]
for term in query:
if term.data == '_AND':
term.left = myStack.pop()
term.right = myStack.po... |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def toList(ln):
result = []
while ln:
result.append(ln.val)
ln = ln.next
return result
def toLinkedList(aList):
ln = ListNode(None)
curr = ln
for val in aList:
curr.next = ListNode(... |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'cloudbuildhelper',
'recipe_engine/json',
'recipe_engine/step',
]
def RunSteps(api):
api.cloudbuildhelper.report_version()
# Coverage f... |
loads('''(iemen2.Database
User
p1
(dp2
S'username'
p3
S'root'
p4
sS'name'
p5
(S'Database'
S''
S'Administrator'
tp6
sS'creator'
p7
I0
sS'privacy'
p8
I0
sS'creationtime'
p9
S'2008/03/07 10:11:18'
p10
sS'disabled'
p11
I0
sS'record'
p12
NsS'groups'
p13
(lp14
I-1
asS'password'
p15
S'8843d7f92416211de9ebb963ff4ce28125932878'... |
# A palindromic number reads the same both ways.
# The largest palindrome made from the product of two 2-digit
# numbers is 9009 = 91 × 99.
# Find the largest palindrome made from the product of
# two 3-digit numbers.
def solution_v1() -> int:
palindrome = 0
for i in range(1000, 100, -1):
for j in rang... |
def response_struct() -> str:
return """
public struct Response<T: Codable>: Codable {
let data: T
}
""".strip() + '\n'
|
class FilterBase:
def __init__(self) -> None:
pass
def _check_input(self, array_input, array_output):
if not len(array_input.shape) == 2:
raise Exception('array_input does not have 2 dimensions')
if not len(array_output.shape) == 2:
raise Exception('arr... |
class TagFilterMixin(object):
model = None
def _get_tag_filter_value(self):
return self.request.GET.get('tag', None)
def _apply_tag_filter(self, qs):
filter_value = self._get_tag_filter_value()
if filter_value is not None:
qs = qs.filter(tagged_items__tag__slug=filter_v... |
#!/usr/bin/env python
def dummy(num):
pass
print("#1 Else in for loop with break")
for num in range(100):
if num == 2:
print("Break")
break
else:
print("else")
print()
print("#2 Else in for loop without break")
for num in range(100):
dummy(num)
else:
print("else")
print()
print("... |
"""Template tags to assist in adding structured metadata to views and models."""
__version__ = '0.5.1'
default_app_config = "structured_data.apps.StructuredDataConfig"
|
#
# PySNMP MIB module APPIAN-BUFFERS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APPIAN-BUFFERS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:23:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
"""Test Maps of Islands for Hashi Puzzle
"""
test1 = [
[
[1, 0],
[0, 1]
],
[
[0, 0, 1],
[0, 0, 0],
[1, 0, 2]
],
[
[0, 1, 0, 2, 0],
[0, 0, 0, 0, 0],
[0, 1, 0, 2, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
],
[
... |
VALUE = int(input())
recipes = [3, 7]
elf_recipe_idx = [0, 1]
while VALUE + 10 > len(recipes):
new_recipe = sum(map(lambda x: recipes[x], elf_recipe_idx))
recipes.extend((divmod(new_recipe, 10) if new_recipe >= 10 else (new_recipe,)))
elf_recipe_idx = [(x + 1 + recipes[x]) % len(recipes) for x i... |
class PubSpec:
def __init__(self, distribution, prefix="."):
if '/' in distribution:
pref, sep, dist = distribution.rpartition('/')
if len(pref) == 0 or len(dist) == 0:
raise ValueError("refspec invalid")
self._prefix = pref
self._distribution... |
#!/usr/bin/python
# QuickSort
items = [8, 3, 1, 7, 0, 10, 2]
pivot_index = len(items) -1
pivot_value = items[pivot_index]
left_index = 0
while (pivot_index != left_index):
item = items[left_index]
# item = items[0]
# pivot_value = 10
if item <= pivot_value:
left_index = left_index + 1
... |
class Solution:
def isLongPressedName(self, name: str, typed: str) -> bool:
cur = tar = 0
pre = name[0]
while cur < len(name):
if tar >= len(typed):
return False
if name[cur] == typed[tar]:
pre = name[cur]
cur +... |
def countdown():
i = 5
while i > 0:
yield i
i -= 1
for i in countdown():
print(i)
def numbers(x):
for i in range(x):
if i % 2 == 0:
yield i
num = int(input("Digite um numero: "))
print(list(numbers(num)))
|
#!/usr/bin/env python3
# 主要功能是将aishell1的transcript文件中的说话人编号BAC009S0002W0122 转换成AISHELL2格式 IS0002W0122
# 因为aishell2采用结巴分词,移除标注的空格
new_transcripts = []
new_wav_scp = []
aishell_transcripts = open("../transcript/aishell_transcript_v0.8_remove_space.txt", encoding="utf-8")
transcripts = aishell_transcripts.readlines()... |
"""
PRIMEIRO E ÚLTIMO NOME
"""
n = str(input('Digite o nome completo: '))
dividido = n.split()
print(dividido)
print('Seu primeiro nome é: {} '.format(dividido[0]))
print('Seu último nome é: {} '.format(dividido[len(dividido)-1])) |
targets = [int(s) for s in input().split()]
command = input()
shot_targets = 0
while command != 'End':
target = int(command)
if target in range(len(targets)):
for i in range(len(targets)):
if targets[i] != -1 and i != target and targets[i] > targets[target]:
targets[i] -= ta... |
class Hamilton(object):
pass
|
class Encapsulation:
def set_public(self):
print("I am visible to the entire project.")
def _set_protected(self): # _ inainte de metoda indica faptul ca e protected
print("I am visible by child")
def __set_private(self):
print("I am not visible outside the class")
def get(sel... |
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def array_product_except_self(self, nums: [int]) -> [int]:
output = [1]*len(nums)
cumulative = 1
for i in range(1, len(nums)):
cumulative = cumulative * ... |
#
# PySNMP MIB module ALC-OPT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALC-OPT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:01:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... |
#%%
ss ='00 80 e1 13 4f 24 04 0e 3c 90 f5 58 08 00 45 00 00 23 a1 c2 00 00 80 11 15 83 c0 a8 01 17 c0 a8 01 1d 17 71 17 71 00 0f f5 6d 31 36 62 62 62 62 62 00 00 00 00 00 00 00 00 00 00 00 '
ss2='00 80 e1 13 4f 24 04 0e 3c 90 f5 58 08 00 45 00 00 23 a1 c6 00 00 80 11 15 7f c0 a8 01 17 c0 a8 01 1d 17 71 17 71 00 0f 17 ... |
#
# Solution to Project Euler problem 9
# Copyright (c) Project Nayuki. All rights reserved.
#
# https://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
# Computers are fast, so we can implement a brute-force search to directly solve the problem.
def compute():
PER... |
class Method:
def __init__(self, head, goal, precond, subgoals):
self.head = head
self.goal = goal
self.precond = precond
self.subgoals = subgoals |
soma = 0
for c in range(1, 501):
if c % 2 == 1:
if c % 3 == 0:
soma += c
print('A soma de todos os números\n\033[32mimpares de 0 a 500 é {}'.format(soma)) |
def decode_line(line):
wires, display_numbers = line.split('|')
digits = display_numbers.strip().split(' ')
wires = wires.strip().split(' ')
return wires, digits
def count_unique_digits(display_lines):
unique = 0
for line in display_lines:
_, digits = decode_line(line)
for d... |
class MovieRatings:
def __init__(self, user_name):
"""user_name: a string representing the name of the person these movie ratings belong to"""
self.name = user_name
self.scores = {}
def rate(self, movie_name, rating):
"""movie_name: a string representing... |
def inBinary(n):
string = bin(n)
string = string[2:]
return int(string)
def isPalindrome(n):
string = ""
temp = n
while n > 0:
string += str(n % 10)
n = n // 10
return string == str(temp)
sumPalindromes = 0
for i in range(1, 1000000):
if isPalindrome(i) and isPalindrom... |
for g in range(int(input())):
n = int(input())
lim = int(n / 2) + 1
s = 0
for i in range(1, lim):
if n % i == 0: s += i
if s == n: print(n, 'eh perfeito')
else: print(n, 'nao eh perfeito')
|
class RadixSort:
def __init__(self,array):
self.array = array
def sort(self,exp):
count = [0]*(10)
sorted_array = [0]*(len(self.array))
for i in range(len(self.array)):
index = int(self.array[i]/exp)
count[index%10] += 1
for j in range(1,10):
... |
class Plotter:
"""
+---------+
| Plotter |
+---------+---------------------+
| Toolbar |
+------------------------+------+
| Title | |
| | |
| sub1 | |
| | |... |
def show():
# 定义列表,用于存储数据
content = []
while True:
data = input('(end to quit)> ')
if data == 'end':
break
content.append(data)
# 将列表中的内容加上行号输出
for i in range(len(content)):
print("%s: %s" % (i, content[i]))
show()
|
class InvalidExtensionEnvironment(Exception):
pass
class Module:
'''
Modules differ from extensions in that they not only can read the state, but
are allowed to modify the state. The will be loaded on boot, and are not
allowed to be unloaded as they are required to continue functioning in a
co... |
def test_generate_report(testdir, cli_options, report_path, report_content):
"""Check the contents of a generated Markdown report."""
# run pytest with the following CLI options
result = testdir.runpytest(*cli_options, "--md", f"{report_path}")
# make sure that that we get a '1' exit code
# as we h... |
class PropernounError(Exception):
"""
Unknown Propernoun error
"""
def __str__(self):
doc = self.__doc__.strip()
return ': '.join([doc] + [str(a) for a in self.args])
|
#!usr/bin/env python
#-*- coding:utf-8 -*-
"""
@author: James Zhang
@date:
"""
|
print('a')
print("hello" + "world")
print("hello" + str(4))
print(int("5") + 4)
print(float("3.2") + 7)
print("the c is ", 5)
price = 1000
count = 10
print("price ", price, " count is", count)
name = input("Enter you name:")
print("hello", name)
tt = True
if tt and False:
print("Impossible") |
def foo():
pass
class Model(object):
pass
|
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
I=lambda:map(int,input().split())
n,k=I()
a=*I(),
r=min(range(k),key=lambda x:n%a[x])
print(r+1,n//a[r]) |
str = '''#define GLFW_KEY_UNKNOWN -1
#define GLFW_KEY_SPACE 32
#define GLFW_KEY_APOSTROPHE 39 /* ' */
#define GLFW_KEY_COMMA 44 /* , */
#define GLFW_KEY_MINUS 45 /* - */
#define GLFW_KEY_PERIOD 46 /* . */
#define GLFW_KEY_SLASH 47 /* / */
#define GLFW_KEY_0 48
#define GLFW_KEY_1 49
... |
#coding=utf-8
def merge(intervals):
intervals.sort(key=lambda x: x[0])
merged = []
for interval in intervals:
if not merged or merged[-1][1] < interval[0]:
merged.append(interval)
else:
merged[-1][1] = max(merged[-1][1], interval[1])
return merged
if __name__ ==... |
# We are deployed on Goerli and Mainnet
chains = {1: "mainnet", 5: "goerli"}
def get_chain_name(chain_id) -> str:
"""Return a readable network name for current network"""
return chains[chain_id]
def get_eth2_chain_name(chain_id) -> str:
"""Return a readable network name for current network for eth2-depo... |
pkgname = "libiptcdata"
pkgver = "1.0.4"
pkgrel = 0
build_style = "gnu_configure"
hostmakedepends = ["pkgconf"]
pkgdesc = "Library for manipulating the IPTC metadata"
maintainer = "q66 <q66@chimera-linux.org>"
license = "LGPL-2.1-or-later"
url = "http://libiptcdata.sourceforge.net"
source = f"$(SOURCEFORGE_SITE)/{pkgna... |
# Created by Jennifer Langford on 3/24/22 for CMIT235 - Week 1 Assignment
# This is an ongoing effort weekly for the duration of this course.
# The program will be complete at the end of the course.
mySubList1 = [[1, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6], [2, 8, 4, 6, 7, 8, 9, 10, 11, 12, 12, 13]]
mySubList2 = [[0, -1, 3, ... |
'''
Created on 2016年2月3日
给个图,每个节点有value,还有是否是surface (boolean值)。找到一个起点和终点都在surface的path,使得path上的所有节点和最大。
@author: Darren
'''
def add_end(L=None):
print(L)
if L is None:
L = []
L.append('END')
return L
print(add_end())
print(add_end())
print(add_end()) |
def productExceptSelf(nums: [int]) -> [int]:
n = len(nums)
result = [0] * n
result[0] = 1
for i in range(1,n) :
result[i] = result[i-1] * nums[i-1]
tmp = 1
for i in range(n-2,-1,-1) :
tmp *= nums[i+1]
result[i] = result[i] * tmp
return result
if __name__ == "__main__... |
class iRODSMeta(object):
def __init__(self, name, value, units=None, avu_id=None):
self.avu_id = avu_id
self.name = name
self.value = value
self.units = units
def __repr__(self):
return "<iRODSMeta {avu_id} {name} {value} {units}>".format(**vars(self))
class iRODSMeta... |
def simple_poll():
return {
"conversation": "conversation-key",
"start_state": {"uuid": "choice-1"},
"poll_metadata": {
"repeatable": True,
'delivery_class': 'ussd'
},
'channel_types': [],
"states": [
{
# these are c... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... |
def lambda_handler(event, context, params=dict()):
return {
"statusCode": 200,
"body": 'Hello im second lambda!'
} |
#!/usr/bin/env python3
"""
Process five student marks to find the average.
Display average along with the student's name.
"""
__author__ = "Tony Jenkins"
__email__ = "tony.jenkins@elder-studios.co.uk"
__date__ = "2018-09-30"
__license__ = "Unlicense"
name = input ('Enter the student\'s name: ')
mark_... |
def select_min_idx(arr, start, end):
min_idx = start
for i in range(start + 1, end):
if arr[min_idx] > arr[i]:
min_idx = i
return min_idx
def sort(arr):
n = len(arr)
for i in range(n):
min_idx = select_min_idx(arr, i, n)
arr[i], arr[min_idx] = arr[min_idx], arr[... |
class Solution:
def isMatch(self, s: str, p: str) -> bool:
T = [[False] * (len(p) + 1) for _ in range(len(s) + 1)]
T[0][0] = True
for j in range(len(p)):
if p[j] == "*":
T[0][j+1] = T[0][j]
for i in range(len(s)):
for j in range(len(p)):
... |
"""
1. 시간표 검색
/timetable/ ...
2. 고대인증
/authorization
3. 학사일정
/schedule/ ... 전체 보여주기.
4. 학식
고대 / 세종 통합 한꺼번에 제공 - 날짜별로 검색 등 제공
5. 도서관
고대 / 세종 통합 한꺼번에 제공 - 시간별로 사용량 정리해서 통계 자료 사용할 수 있게.
""" |
# -*- coding: utf-8 -*-
# Coded by Sungwook Kim
# 2020-12-24
# IDE: Jupyter Notebook
x, y, w, h = map(int, input().split())
if y / h > 0.5:
t1 = h - y
else:
t1 = y
if x / w > 0.5:
t2 = w - x
else:
t2 = x
if t1 > t2:
print(t2)
else:
print(t1) |
class DirTemplateException(Exception):
pass
class TemplateLineError(DirTemplateException):
def __init__(self, filename, error_type, lineno, message, source):
super(TemplateLineError, self).__init__((
"{error_type} in {filename} on line {lineno}:\n\n"
"{message}\n\n{source}\n"
... |
"""
This module contains common application exit codes and exceptions that map to them.
Author: Sascha Falk <sascha@falk-online.eu>
License: MIT License
"""
EXIT_CODE_SUCCESS = 0
EXIT_CODE_GENERAL_ERROR = 1
EXIT_CODE_COMMAND_LINE_ARGUMENT_ERROR = 2
EXIT_CODE_FILE_NOT_FOUND ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.