content stringlengths 7 1.05M |
|---|
"""
DO NOT COMMIT THIS FILE WITH INFORMATION FILLED OUT!
DO NOT COMMIT THIS FILE WITH INFORMATION FILLED OUT!
DO NOT COMMIT THIS FILE WITH INFORMATION FILLED OUT!
DO NOT COMMIT THIS FILE WITH INFORMATION FILLED OUT!
"""
DB_USERNAME = ''
DB_PASSWORD = ''
SECRET_KEY = ''
|
# https://www.hackerrank.com/challenges/equal-stacks
def equal_stacks(stacks):
stacks_size = [sum(stack) for stack in stacks]
while len(set(stacks_size)) > 1:
higher = stacks_size.index(max(stacks_size))
poped = stacks[higher].pop(0)
stacks_size[higher] -= poped
return stacks_size... |
# Ex. 044
print("≈"*19)
print("Vendinha do Brian")
print("≈"*19)
print("")
preco = float(input("Digite o preço do produto: R$"))
print("-"*32)
print("Condições de pagamento:")
print("[1] À vista em dinheiro/cheque")
print("[2] À vista no cartão")
print("[3] Em 2x no cartão")
print("[4] Em 3x ou mais no cartão")
fPaga... |
#!/usr/env/bin python3
#
#-----------------------------------------------------------------------
#
# Mathematical and physical constants.
#
#-----------------------------------------------------------------------
#
# Pi.
pi_geom = 3.14159265358979323846264338327
# Degrees per radian.
degs_per_radian = 360.0 / (2.0 ... |
#!/usr/local/bin/python3.4
"""
## Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO [, ANY ADDITIONAL AFFILIATION]
## ALL RIGHTS RESERVED.
##
## 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
##
##... |
n1 = int(input('Primeiro número: '))
n2 = int(input('Segundo número: '))
if n1 > n2:
print('O primeiro valor é maior.')
elif n2 > n1:
print('O segundo valor é maior.')
else:
print('\033[31mNão existe valor maior, os dois são iguais.\033[m') |
# common.py
#
# Module common infrastructure
#
_FORMATTERS = dict()
def register_formatter(descriptor):
"""Decorator that registers a formatter class"""
def passthrough(cls):
_FORMATTERS[descriptor] = cls
return cls
return passthrough
def get_formatter(descriptor):
if not descriptor i... |
"""
Refaça o DESAFIO 051, lendo o primeiro termo e a razão de uma PA, mostrando os 10 primeiros termos da progressão
usando a estrutura WHILE.
"""
print('Gerador de PA')
print('-=' * 10)
primeiro = int(input('Primeiro termo: '))
razao = int(input('Razão da PA: '))
termo = primeiro
cont = 1
while cont <= 10:... |
x = 1
for i in range (0, 5):
y = 7
for j in range (0, 3):
print(f"I={x} J={y}")
y -= 1
x += 2
|
n = int(input("enter a no: "))
for i in range (n*10, n-1 ,-n):
print(i)
|
class Solution:
def minRemoveToMakeValid(self, s: str) -> str:
stack = []
bad = set()
for index, c in enumerate(s):
if c == "(":
stack.append(index)
elif c == ")":
if len(stack) > 0:
stack.pop()
els... |
#
# 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... |
class Arrival:
def __init__(self, time_from_stop, dist_from_stop):
self.time_from_stop = time_from_stop
self.dist_from_stop = dist_from_stop
def __repr__(self):
return f'''{self.__class__.__name__}(
{self.time_from_stop!r}, {self.dist_from_stop!r})'''
def __str__(self)... |
ES_HOST = 'localhost:9200'
ES_INDEX = 'pending-cord_cell'
ES_DOC_TYPE = 'cell'
API_PREFIX = 'cord_cell'
API_VERSION = ''
|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
@author : zzw
@time : 2019/8/3 14:33
@file : __init__.py
@description :
"""
__version__ = "0.1.0"
|
num1 = 11
num2 = 22
num3 = 33
num4 = 44
num5 = 55
num6 = 66
num7 = 77
num8 = 88
num10 = 100
numm11 = 111
|
def make_style_sheet():
style = """
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px;
color: #333;
}
body > *:first-child {
margin-... |
class Instrumentable (object):
def __init__(self):
self.instrumentation = []
def add_instrumentation(self, ins):
self.instrumentation.append(ins)
def get_context(self):
return []
def initialize_instrumentation(self):
for i in self.instrumentation: i.ini... |
model = dict(
type='FasterRCNN',
pretrained='open-mmlab://msra/hrnetv2_w32',
backbone=dict(
type='HRNet',
extra=dict(
stage1=dict(
num_modules=1,
num_branches=1,
block='BOTTLENECK',
num_blocks=(4, ),
... |
# Create by Zwlin
parts = ['Is', 'Chicago', 'Not', 'Chicago?']
print(' '.join(parts))
data = ['ACME', 50, 91.1]
print(','.join(str(d) for d in data))
print('a','b','c',sep=":")
def sample():
yield 'Is'
yield 'Chicago'
yield 'Not'
yield 'Chicago?'
print(' '.join(sample()))
def combine(source,maxsi... |
bot1_wieght_layer_one = [[0.9236090789486788, 0.9210637151227483, 0.16119690767556938, 0.8891669007445379, 0.7530696859511529, 0.9684743676682231, 0.9140001906787625, 0.5462343790375778, 0.4625067913831683, 0.10294585839313619, 0.4659734634943964, 0.673851063496881, 0.4119975257359164, 0.4119836779033137, 0.78659108761... |
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) All Rights Reserved.
#
# 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 ap... |
class A:
def __init__(self):
self.l=[1,2,3,4,5,6,7,8,9]
def __getitem__(self,i):
if isinstance(i,int):
return self.l[i]
else:
print(i.start,i.stop,i.step)
return self.l[i]
a=A()
#for i in a.l:
# print(i,end='\t')
print(a[4])
print(a[:])
print(a[2:])
print(a[:5])
print(a[3:8])
print(a[::2])
print(a[:4... |
NAME = 'diary.py'
ORIGINAL_AUTHORS = [
'Angelo Giacco'
]
ABOUT = '''
Keeps a record of your diary
'''
COMMANDS = '''
>>>.diary record <diary entry>
Adds to that day's diary entry
>>>.diary show <date>
Will show the diary entry of specified date (can also accept "today", "yesterday")
>>>.diary delete
Will delet... |
#
# PySNMP MIB module DLINK-3100-SOCKET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-SOCKET-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:49:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
'''Faça um programa que leia do número 0 ao 9999 e mostre cada número na tela separado:
Unidade:
Dezena:
Centana:
Milhar: '''
num = (input('Digite um número de 0 até 9999\n'))
y=-1
if num.isnumeric():
if (int(num)>= 0 and int(num) <= 9999):
for x in num:
if y == -1:
print(f'\nUn... |
class DirectedEdge:
def __init__(self, v, w, weight):
self.v = v
self.w = w
self.weight = weight
def from_v(self):
return self.v
def to_v(self):
return self.w
def get_weight(self):
return self.weight
def compare_to(self, that):
return self... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------------
#
# ,--.
# | |-. ,---. ,---. ,--.--.,--,--,
# | .-. '| .-. :| .-. || .--'| \
# | `-' |\ --.' '-' '| | ... |
# Copyright 2012 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.
"""This module provides the global variable options_for_unittests.
This is set to a BrowserOptions object by the test harness, or None
if unit tests are not... |
# Ali
# Adobis's Mission I: The Room of Tragedy
# not sure what function this room has but it has no portals
sm.sendNext("Why are you here? You shouldn't be here..")
sm.warp(211000000) # warps to El Nath |
class DuplicateCategoryException(Exception):
"""Exception indicating a Category of the same name exists."""
class DuplicateTallyException(Exception):
"""Exception for creating a tally that exists under the same category."""
|
# Input
boss = {'h': 58, 'd': 9}
play = {'h': 50, 'm': 500}
spell = [
{'m': 53, 'd': 4, 'a': 0, 't': 1, 'h': 0},
{'m': 73, 'd': 2, 'a': 0, 't': 1, 'h': 2},
{'m': 113, 'd': 0, 'a': 7, 't': 6, 'h': 0},
{'m': 173, 'd': 3, 'a': 0, 't': 6, 'h': 0},
{'m': 229, 'd': 0, 'a': 0, 't': 5, 'h': 101}
]... |
#################################################################################
#
# Project : University Courses / Modelagem Matemática em Finanças I
#
# Program name : binomial.py
#
# Author : gilmiranda
#
# Date created : 03-30-2019
#
# Purpose : Take a binomial one step tre... |
def permutations(s):
if len(s) == 1:
return [s]
result = []
for char in s:
tail_list = permutations(s.replace(char, ''))
mapped = list(map(lambda x : char + x, tail_list))
result += mapped
return result
if __name__ == '__main__':
print(permutations('abc')) |
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
load("//dotnet/private:copy_files.bzl", "copy_files")
load(
"//dotnet:selenium-dotnet-version.bzl",
"SUPPORTED_NET_FRAMEWORKS",
"SUPPORTED_NET_STANDARD_VERSIONS",
)
def _nuget_push_impl(ctx):
args = [
"push",
]
apikey... |
# Copyright 2011 Google Inc. All Rights Reserved.
#
# 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 a... |
encoded_colors = {
'black': 0,
'brown': 1,
'red': 2,
'orange': 3,
'yellow': 4,
'green': 5,
'blue': 6,
'violet': 7,
'grey': 8,
'white': 9
}
def color_code(color):
"""
Resistors have color coded bands, where each color maps to a... |
def get_conclusion_page_number(doc):
for i in reversed(range(doc.pageCount)):
page = doc.loadPage(i)
text = page.getText()
text_lowered = text.lower()
if 'conclusion' in text_lowered:
return i
else:
# Page before the last page which is usually the Printing Sp... |
def find_smallest(arr):
"""返回数组中最小值的索引。"""
smallest = arr[0]
smallest_i = 0
for i in range(1, len(arr)):
if arr[i] < smallest:
smallest = arr[i]
smallest_i = i
return smallest_i
def selection_sort(arr):
"""对数组进行排序。"""
result = []
for i in range(len(ar... |
'''
Created on Feb 26, 2014
@author: efarhan
'''
physics_events = []
def add_physics_event(event):
global physics_events
physics_events.append(event)
def get_physics_event():
global physics_events
return physics_events
def clear_physics_event():
global physics_events
del physics_events[:]
cl... |
# Given a collection of integers that might contain duplicates, nums,
# return all possible subsets (the power set).
# Note: The solution set must not contain duplicate subsets.
# Example:
# Input: [1,2,2]
# Output:
# [
# [2],
# [1],
# [1,2,2],
# [2,2],
# [1,2],
# []
# ]
class Solution(object):
# M1.... |
class SumRow(object):
"""A list that keeps track of tableQa info: db, name, type, statistics, and error status."""
def __init__(self, db, table, tableType):
if tableType == None:
tableType = 'none'
self.__row = [db, table, tableType, '', 'n/a', 'n/a', 'no']
def __repr__(self):
... |
def xo(s):
return len(s.lower().replace('x', '')) == len(s.lower().replace('o', ''))
print(xo('xo'))
#############大佬的最佳实践
# def xo(s):
# s = s.lower()
# return s.count('x') == s.count('o') |
def sum(a):
if a <= 1:
return 1
else:
return a+sum(a-1)
print(sum(5))
|
# class Solution:
# ## with division
# def productExceptSelf(self, nums: List[int]) -> List[int]:
# N = len(nums)
# # traverse the list
# ## 1st pass, get the total product
# total_prod = 1
# zero_counter = 0
# for num in nums:
# if zero_count... |
bet=100
myCard=list(map(int,input().split(" ")))
turn=int(input())
combo=int(input())
if myCard[0]==0:
print(bet) # 賭けチップ数
else:
if sum(myCard) < 14: # ★カードを引く条件の合計値を変えてみよう!★
print("HIT") # カード引く
else:
print("STAND") # 勝負
|
velocidade = float(input("Qual é a velocidade atual do carro ? "))
if velocidade > 80:
print("Multado !")
multa = (velocidade-80) * 7
print("Você deve pagar uma multa de RS{:.2f}!".format(multa))
print("Tenha um Bom dia") |
#!/usr/bin/env python3
def read_list_from_file(file_name):
f = open(file_name)
list = []
dict={}
for x in f:
list.append(x.strip())
f.close()
i=0
while i< len(list):
dict[list[i]] = list[i+1]
i=i+2
return dict
def is_verified(vin, password) -> bool:
dict = rea... |
class KaraboException(Exception):
"""
Base Exception thrown by the Karabo Pipeline
"""
|
class Solution(object):
def numUniqueEmails(self, emails):
"""
:type emails: List[str]
:rtype: int
"""
seen = set()
for em in emails:
local,domain = em.split("@")
local = local.split("+")[0].replace(".","")
seen.add(local+"@"+domain... |
class StringHash:
def __init__(self, text, base=997, mod=10 ** 18 + 3):
n = len(text)
self.text = text
self.base = base
self.mod = mod
self.power = [1] * (n + 2)
self.prefix_hash = [0] * (n + 2)
for i in range(1, n + 1):
self.power[i] = self.powe... |
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-09-23 22:21:37
# Description:
class Solution:
def kthSmallest(self, matrix: List[List[int]], k: int) -> int:
m, n = len(matrix), len(
matrix[0]) # For general, the matrix need not be a square
def countLessO... |
# John McDonough
# github - movinalot
# Advent of Code 2015
testing = 0
debug = 0
day = "02"
year = "2015"
part = "1"
answer = None
with open("puzzle_data_" + day + "_" + year + ".txt") as f:
puzzle_data = f.read()
if testing:
puzzle_data = "2x3x4\n"\
"1x1x10\n"
if de... |
class UserProfile:
def __init__(self, name: str = None):
self.name = name
def __str__(self):
return f"name:{self.name}" |
# Guess the encoding in .sav files created with SPSS v14 or earlier.
# Encoding information was added to the .sav file header in SPSS v15. Unicode support appeared in SPSS v16
# If the file is created on Windows [1], with SPSS v14 or older [2], and then opened on Linux/MacOS, the dict
# below is used to look up the Wi... |
#!/usr/bin/env python3
"""
Program purpose: Splits a string on ' ' and join same string with '-'
Program author : Happi Yvan
Author email :
"""
def split_and_join(some_str):
_list = some_str.split(' ')
return '-'.join(_list)
def main():
data = input("\n\tEnter a string: ")
data_joi... |
class Result:
def __init__(self, text, value):
self.text = text
self.value = value
|
# Small alphabet r using fucntion
def for_r():
""" *'s printed in the shape of r """
for row in range(5):
for col in range(5):
if col ==1 and row !=0 or row ==0 and col in (0,2,3) or row ==1 and col ==4:
print('*',end=' ')
else:
print(' ',e... |
expected_output = {
'our_address': {
'10.229.1.2': {
'neighbor_address': {
'10.229.1.1': {
'demand_mode': 0,
'elapsed_time_watermarks': '0 0',
'elapsed_time_watermarks_last': 0,
'handle': 1,
... |
# https://leetcode.com/problems/check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def... |
SECRET_KEY = '00000000'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'news'
]
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a = [1, 2, 3]
b = [*a, 4, 5, 6]
if __name__ == '__main__':
print(b)
|
difference_list=[]
prime_num=open("/home/grey/Desktop/Primenum/prime.txt","r")
prime_list = prime_num.readlines()
length_of_primelist=len(prime_list)
def get_patterns(prime_list):
size_of_list=len(prime_list)
i=0
while(i<size_of_list-1):
d=int(prime_list[i+1])-int(prime_list[i])
difference_... |
DEPS = [
'depot_tools/depot_tools',
'depot_tools/gsutil',
'flutter/os_utils',
'flutter/zip',
'recipe_engine/buildbucket',
'recipe_engine/file',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/runtime',
'recipe_engine/step',
'recipe_engine/uuid',
]
|
class Solution:
def minTransfers(self, transactions: List[List[int]]) -> int:
balance = [0] * 21
for u, v, amount in transactions:
balance[u] -= amount
balance[v] += amount
debt = [b for b in balance if b]
def dfs(s: int) -> int:
while s < len(debt) and not debt[s]:
s += 1... |
_base_ = [
'../common/mstrain-poly_3x_coco_instance.py',
'../_base_/models/mask_rcnn_r50_fpn.py'
]
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
|
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def reverseBetween(self, head: ListNode, m: int, n: int) -> ListNode:
if not head:
return head
prevNode, curr ... |
class FrontEnd:
def dropdown_from_dataframe(self, name, df, chosen_col):
"""
Create text to use for rendering an HTML dropdown from a DataFrame.
Render by using {{ df|safe }} in your HTML file.
Parameters
--------
name: str
Name you'd like for the dropdo... |
# 103. Binary Tree Zigzag Level Order Traversal
# Runtime: 28 ms, faster than 91.36% of Python3 online submissions for Binary Tree Zigzag Level Order Traversal.
# Memory Usage: 14.5 MB, less than 42.40% of Python3 online submissions for Binary Tree Zigzag Level Order Traversal.
# Definition for a binary tree node.
... |
def extractEachKth(inputArray, k):
index = []
z = [x for x in range(0,len(inputArray)) if (x+1)%k!=0]
[index.append(inputArray[z[y]]) for y in range(len(z))]
return(index)
|
class intCodeVM():
def __init__(self, inp : str):
self.__input = inp
self.__instructionList = [int(i) for i in open(inp).read().split(",")]
self.__programCounter = 0
self.__correspondingInputs = {
1:3,
2:3,
3:1,
4:1,
5:2,
... |
DATA_DIR = "C:/Users/udiyo/OneDrive - mail.tau.ac.il/Research/data"
EXTENSION = "csv.gz"
COMPRESSION = "infer"
COL_NAMES = {
0: "_id",
1: "raw_time",
2: "temperature",
3: "pressure",
4: "humidity",
5: "light",
6: "magnetic_tot",
7: "magnetic_x",
8: "magnetic_y",
9: "magnetic_z",
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 8 11:08:46 2022
@author: Pedro
"""
def greet(name):
"""Return a string to greet someone.
Arguments:
Name – name of the person to greet
""" #es una buena practica usar el docstring#
return "Hello, " + name + "."
print ("el archivo fue ejecutado")
msg = gree... |
class Settings():
class QQ():
position_a = (10,10)
position_c = (1500,10)
size = (300,400)
|
# Sequence Reconstruction
# Check whether the original sequence org can be uniquely reconstructed from the sequences in seqs.
# The orginal sequence is a permutation of the integers from 1 to n, with 1 ≤ n ≤ 104.
# Reconstruction means building a shortest common supersequence of the sequences in seqs
# (i.e., a shortes... |
# CollatzSequence
# Objective: When entering in any number, the Collatz Sequence will evaluate down to 1.
def collatz():
try:
number = int(input("Enter number: "))
while True:
if number == 1 or number == 0:
break
elif number % 2 == 0:
numbe... |
"""
Entradas
Chelines--->float--->CHA
Dracmas--->float-DRG
Pesetas--->float--->PST
Salidas
Pesetas--->float---PST
Francos Franceses--->float--->FRA
dolares--->float--->USD
Liras--->float--->LIR
"""
print("Chelines a Pesetas: ")
CHA=float(input("Ingrese el valor en chelines: "))
PST=((CHA*956871)/100)
print("El valor en... |
class Solution:
def exclusiveTime(self, n: int, logs: List[str]) -> List[int]:
ftimes = [0]*n
stack = []
pre_start_time = 0
for log in logs:
f_id, which, f_time = log.split(":")
f_id, f_time = int(f_id), int(f_time)
i... |
def count_chars(s: str) -> dict:
"""Checking the chars number in a str example
:param s: {str}
:return: {dict}
"""
count_dict = {}
for c in s:
if c in count_dict:
count_dict[c] += 1
else:
count_dict[c] = 1
return count_dict
|
# Copyright 2013-2021 Aerospike, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
# “SarojiniPoem.txt”
# Based on the above file, answer the following questions:
#(e) Modify the program so that each line is printed with a line number at beginning.
fileObj = open("sarojiniPoem.txt","r")
text = fileObj.readlines()
for index in range(len(text)):
print (index + 1, " = ", text[index])
fileObj.c... |
def part1(rows):
return go(rows, 1)
def part2(rows):
return go(rows, 2)
def go(rows, part):
position = 0
depth = 0
aim = 0
for row in rows:
command, arg = row.split()
match command, int(arg):
case "forward", value:
position += value
... |
class Solution:
# @param A : list of integers
# @return an integer
def merge(self,A, aux, low, mid, high):
k = i = low
j=mid+1
inversionCount = 0
while i <= mid and j <= high:
if A[i] <= A[j]:
aux[k] = A[i]
i = i + 1
els... |
lista_Itens = ['a', 'b', 'c'] #Lista Criada
for itens in lista_Itens: #for para imprimir itens da lista
print (itens)
lista_Itens.append('d')
lista_Itens.extend(['e', 'f', 'g'])
for itens in lista_Itens:
print (itens)
print ("Resultado final: {}, {}, {}, {}, {}, {}, {}.".format(lista_Itens[0], lista_Itens[1], l... |
# -*- coding: utf-8 -*-
"""
Predicate for use within Forseti
"""
# pylint: disable=too-few-public-methods,missing-docstring
class Formula(object):
args = []
def __init__(self):
pass
def __repr__(self):
raise NotImplementedError("Not implemented")
def __str__(self):
raise Not... |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/abiantorres/Documentos/tfg/autonomous-vehicles-system-simulation/low_level_simulation/src/rosbridge_suite/rosapi/msg/TypeDef.msg"
services_str = "/home/abiantorres/Documentos/tfg/autonomous-vehicles-system-simulation/low_level_simulation/src/ros... |
"""
The SSJ dataset has an unusual bug: all of the sentences end with SpaceAfter=no
This script fixes them and writes the fixed files to the given location.
"""
def process(input_txt, input_conllu, input_txt_copy, input_conllu_copy):
conllu_lines = open(input_conllu).readlines()
txt_lines = open(input_txt).r... |
"""Ambra exceptions."""
class AmbraException(Exception):
"""Base ambra exception."""
class AmbraResponseException(AmbraException):
"""Ambra response exception."""
def __init__(self, code, description=None, response_text=None):
"""Init.
:param code: response code
:param descript... |
# https://leetcode.com/contest/weekly-contest-68/problems/reorganize-string/
class Solution:
def reorganizeString(self, S):
"""
:type S: str
:rtype: str
"""
# sort S by character occurrence, return value is a list
S = sorted(sorted(S), key=S.count, reverse=True)
... |
# -*- coding: utf-8 -*-
def sample() -> str:
return "hoge"
def main() -> None:
print("Hello Python")
if __name__ == "__main__":
main()
|
"""
usage: sleep.py [-h] SECS
delay what happens next
positional arguments:
SECS decimal number of how many seconds to wait before exiting
optional arguments:
-h, --help show this help message and exit
quirks:
exits faster if you mess with it, such as pressing ⌃C SIGINT
examples:
Oh no! No examples... |
class Context(object):
@staticmethod
def click(x, y, new_context, ctrl):
ctrl.move(x=x, y=y)
ctrl.click()
return new_context
class MainMenu(Context):
@classmethod
def click_play(cls, ctrl):
return cls.click(x=270, y=210, new_context=LevelMenu, ctrl=ctrl)
class Lev... |
class Atoi():
def myatoi(self, s: str) -> int:
start = True
ret = ""
for i in list(s):
if i == " ":
if not start:
break
elif i == "+" or i == "-":
if start:
start = False
ret =... |
def get_patient_names(self):
"""
get the list of patient names, if self.data_names id not None, then load patient
names from that file, otherwise search all the names automatically in data_root
"""
# use pre-defined patient names
if (self.data_names is not None):
assert (os.path.isfile(self.data_names))
with ... |
LIST_OF_STATES = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "S... |
# Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head.
# def removeElements(head,val):
# while head and head.val == val:
# head = head.next
# q = head
# p = q.next
# while p:
# if p.val == val:
# ... |
#poder ou nao formar um triangulo
print('='*25)
a = float(input('Digite o 1º segmento: '))
b = float(input('Digite o 2º segmento: '))
c = float(input('Digite o 3º segmento: '))
print('='*25)
if a+b>c and b+c>a and c+a>b:
print('Os segmentos acima podem formar um triângulo.')
else:
print('Os segmentos acima ... |
def main() -> None:
print("Yes" if sorted(input()) < sorted(input(), reverse=1) else "No")
if __name__ == "__main__":
main()
|
# What are Functions?
#
# Functions are a convenient way to divide your code into useful blocks.
# That way we can reuse the code.
# Python uses indentation to define code blocks, instead of brackets
# def myFunction():
# print("Hello From My Function!")
# print("Hi")
#
# myFunction()
# def myFunctionWithArgs... |
# A collection of functions to create displays of different ABI RGB
# products and band subtractions.
# abitrucol is derived from McIDAS-X's ABITRUCOL function
# which creates an ABI RGB by deriving a green band
# McIDAS-X's ABITRUCOL is based on the CIMSS Natural True Color method
# http://cimss.ssec.wisc.edu/goes/OC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.