content stringlengths 7 1.05M |
|---|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def rightSideView(self, root: TreeNode) -> List[int]:
res = []
if not root:
return res
level... |
rz = int(input('Digite a razao da PA: '))
n = int(input('Digite o primeiro número da PA: '))
for i in range(10):
print(n)
n += rz |
print(True)
print(False, "\n\n") #booleans have to be capitalized or they return false
a =3
b =5
print(a==b) #a is equal to b equal False
print(a!=b) #a is not equal to b equal True
print(a<b) #less than
print(a>b, "\n") #greater than
print(bool(28))
print(bool(-2.1562))
print(bool(0), "\n")
#with strings, trivial ... |
#!/usr/bin/env python3
# https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python
class Terminal:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[... |
A = [[2, 5, 11],
[-9, 4, 6],
[4, 7, 12]]
soma=0
for linha in range(len(A)): # linhas
for coluna in range(len(A[0])): #colunas
#soma+=A[linha][coluna]
soma = soma + A[linha][coluna]
print ("Soma:", soma) |
class PostprocessingPattern:
def __init__(self, condition, success_value=True, condition_args=None):
"""A PostprocessingPattern defines a single condition to check against an entity.
condition (function): A function to call on an entity. If the result of
the function call equals success... |
A = float(input('Qual a altura da sua parede em metros?'))
L = float(input('Qual a largura da sua parede em metros?'))
Ar = float(L*A)
T = float(Ar/2)
print('A sua parede tem {}m²\n e a quantidade de tinta necessária para pintar a parede é:{} litro/s de tinta'.format(Ar, T))
|
service_broadcast_settings_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Set a services broadcast settings",
"type": "object",
"title": "Set a services broadcast settings",
"properties": {
"broadcast_channel": {"enum": ["operator", "test", "severe", "govern... |
sims_pre = []
with open('lpips_sim_waymo.txt') as f:
data = f.read()
sims_pre = data.split('(')[1:]
sims_post = []
for sim in sims_pre:
sim = sim.split('): ')
img1 = sim[0].split(', ')[0]
img2 = sim[0].split(', ')[1]
val = sim[1]
sims_post.append(img1+','+img2+','+val)
with open('lpip... |
class Solution:
# @param head, a ListNode
# @return a boolean
def hasCycle(self, head):
if head == None or head.next == None:
return False
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fa... |
LIGHT = "#"
DARK = "."
iterations = 50
padding = iterations * 2
with open('day20/input.txt') as f:
lines = f.readlines()
map = lines[0].strip()
lines.pop(0)
lines.pop(0)
image = []
h = len(lines)
w = len(lines[0].strip())
def blank():
q = []
for i in range(2 * padding + h):
qq = []
... |
class Student:
name = ""
def __init__(self, name,age=None,num=None):
self.age = age
self.name = name
if num is not None:
self.num = num
print(Student.__name__)
print(Student.__base__)
print(Student.__module__)
print(Student.__doc__)
print(Student.__dict__)
print(Student._... |
print('Hello World')
def circum(r):
""" a docstring for circum but also not... """
return 2*3.14*r
def area(r):
"""een conflicterende docstring MIJN CODE IS BELANGRIJKER"""
return 3.14*r**2
print('Lets kill this code')
|
def computador_escolhe_jogada(n, m):
computador_remove = 1
while computador_remove != m:
if (n - computador_remove) % (m+1) == 0:
return computador_remove
else:
computador_remove += 1
return computador_remove
def usuario_escolhe_jogada(n, m):
jogada_valida = ... |
def proteins(strand):
seq = []
codon_map = {
"AUG": "Methionine",
"UUU": "Phenylalanine",
"UUC": "Phenylalanine",
"UUA": "Leucine",
"UUG": "Leucine",
"UCU": "Serine",
"UCC": "Serine",
"UCA": "Serine",
"UCG": "Serine",
"UAU": "Tyrosi... |
s=input()
d={}
if s in d:
print(s+str(d[s]))
d[s] += 1 |
# This problem was recently asked by Twitter:
# Given a Roman numeral, find the corresponding decimal value. Inputs will be between 1 and 3999.
# Numbers are strings of these symbols in descending order. In some cases, subtractive notation is used to avoid repeated characters.
# The rules are as follows:
# 1.) I place... |
class Relationship(object):
"""Class to represent an relationship between tables
See Also:
:class:`.TableSet`, :class:`.Table`, :class:`.Column`
"""
def __init__(self, parent_column, child_column):
""" Create a relationship
Args:
parent_column (:class:`.Discrete`):... |
class Solution:
def findDuplicate(self, paths):
"""
:type paths: List[str]
:rtype: List[List[str]]
"""
ans = collections.defaultdict(list)
for path in paths:
dir_path, *files = path.split()
dir_path += '/'
for file in files:
... |
class NoComponentForEntityError(Exception):
"""Exception raised when an Entity does not have this Component"""
def __init__(self, entity, component_type):
super().__init__("{entity} has no {component_type}".format(
entity=entity, component_type=component_type))
class NotAComponentError(E... |
class Pizza:
name = "Unknown"
def __init__(self) -> None:
pass
def __str__(self) -> str:
return f"{self.name} Pizza"
class NormalPizza(Pizza):
def __init__(self) -> None:
super().__init__()
self.name = "Normal"
class CheesePizza(Pizza):
def __init__(self) -> Non... |
# -*- coding: UTF-8 -*-
logger.info("Loading 1 objects to table cal_calendar...")
# fields: id, name, description, color
loader.save(create_cal_calendar(1,['General', 'Allgemein', 'G\xe9n\xe9ral'],u'',1))
loader.flush_deferred_objects()
|
class Solution:
def isValid(self, s: str) -> bool:
pairs = {'(': ')', '[': ']', '{': '}'}
stack = []
for p in s:
if p in pairs:
stack.append(p)
else:
if not stack or p != pairs[stack.pop()]:
return False
re... |
"""Apschedular config file."""
class Config(object):
"""Schedular config."""
JOBS = [
{
'id': 'cronjob',
'func': 'app:cron_job',
'trigger': 'cron',
'minute': '*/30',
}
]
SCHEDULER_TIMEZONE = 'UTC'
SCHEDULER_API_ENABLED = True
|
# :information_source: Already implemented via statistics.mean. statistics.mean takes an array as an argument whereas this function takes variadic arguments.
# Returns the average of two or more numbers.
#Takes the sum of all the args and divides it by len(args). The second argument 0.0 in sum is to handle floating p... |
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class AttributeError(Error):
"""Exception raised when the arguments of GeoCAT-comp functions argument
has a mismatch of attributes with other arguments."""
pass
class ChunkError(Error):
"""Exception raised when a Da... |
vl=input().split()
A=int(vl[0])
B=int(vl[1])
if A==B:
print("Nao sao Multiplos")
elif A%B==0 or B%A==0:
print("Sao Multiplos")
else:
print("Nao sao Multiplos")
|
configs = {
'debug': True,
'db': {
'host': '127.0.0.1',
'port': 3306,
'user': 'www',
'password': 'www',
'db': 'router_scan'
},
'session': {
'secret': 'RouterScan'
}
} |
def print_formatted(number):
l = len(str(bin(number)[2:]))
for i in range(1,number+1):
print(str(i).rjust(l) + ' ' + oct(i)[2:].rjust(l) + ' '
+ hex(i)[2:].upper().rjust(l) + ' ' + bin(i)[2:].rjust(l))
|
# -*- coding: utf-8 -*-
class Main:
LIST_OF_IDS = []
RANDOM_MUSIC_LIST = []
SONG_TIME_NOW = "00:00"
LIST_OF_PLAY = {"classes": []}
PLAYER_SETTINGS = {"play": 0, "cycle": False, "random_song": False}
PAST_SONG = {"class": None, "song_id": None, "past_lib": None, "lib_now": None}
S... |
#this file provides a list of file names for mini examples
miniExamplesFileList = ['ObjectMassPoint.py',
'ObjectMassPoint2D.py',
'ObjectMass1D.py',
'ObjectRotationalMass1D.py',
'ObjectRigidBody2D.py',
'ObjectGenericODE2.py',
'ObjectConnectorSpringDamper.py',
'ObjectConnectorCartesianSpringDamper.py',
'ObjectConnectorC... |
pkgname = "qrencode"
pkgver = "4.1.1"
pkgrel = 0
build_style = "gnu_configure"
configure_args = ["--with-tests"]
hostmakedepends = ["pkgconf"]
makedepends = ["libpng-devel"]
pkgdesc = "Library for encoding QR codes"
maintainer = "q66 <q66@chimera-linux.org>"
license = "LGPL-2.1-or-later"
url = "https://fukuchi.org/work... |
#
# PySNMP MIB module CISCO-NS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-NS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:37:23 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,... |
s = "abacaba"
length = 1
while s[0:length] != s:
length = length + 1
length == 7
|
"""
1780 : 종이의 개수
URL : https://www.acmicpc.net/problem/1780
Input :
9
0 0 0 1 1 1 -1 -1 -1
0 0 0 1 1 1 -1 -1 -1
0 0 0 1 1 1 -1 -1 -1
1 1 1 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0
0 1 -1 0 1 -1 0 1 -1
0 -1 1 0 1 -1 0 1 -1
... |
class GenericMeta(type):
def __getitem__(self, args):
pass
class Generic(object):
__metaclass__ = GenericMeta
|
"""
This file contains triangle vertex coordinates of a font
called "Dutch-Blunt" (c) 2015 by Abraham Stolk, commit e1b0044a
The font 'Dutch-Blunt' is licensed under the SIL OPEN FONT LICENSE.
See: https://github.com/stolk/dutch-blunt
"""
widths = [
5.0,
0.55555556,
3.0,
3.54,
2.00065051,
5.0,
5.0,
5.0,
5.0,
5.0,
5... |
a = int(input())
if a % 7 == 0 :
print("multiple")
else :
print("not multiple")
|
#Tuplas
a = 10
b = 5
print(a)
(a,b) = (b,a)
print(a) #Cambio los valores con las tuplas |
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
degree = [0]*numCourses
courseDic = [[] for i in range(numCourses)]
for i, j in prerequisites:
courseDic[j].append(i)
degree[i] += 1
dfs = [i for i in range(numCourse... |
class RetsError(RuntimeError):
pass
class RetsClientError(RetsError):
pass
class RetsParseError(RetsClientError):
pass
class RetsResponseError(RetsClientError):
def __init__(self, content: str, headers: dict):
super().__init__('Unexpected response from RETS')
self.content = conte... |
n,l,r,x=map(int,input().split())
num=list(map(int,input().split()))
ans=0
for i in range(2**n):
st=bin(i)[2:]
st='0'*(n-len(st))+st
if st.count('1')>=2:
pt=[]
for i in range(len(st)):
if st[i]=='1':
pt.append(num[i])
if sum(pt)<=r and sum(pt)>=l and max(pt... |
RUTA_CANCIONES = "D:/proyectos/cocid/cocid_practica_semanal/semana3/canciones/"
CANCIONES = {
1: "Get_Back.txt",
2: "Hey_Jude.txt",
3: "Let_It_Be.txt",
4: "She _Loves_You.txt"
}
|
kitReportMQHost = '***'
kitReportMQPort = 5672
kitReportMQUsername = '***'
kitReportMQPassword = '***'
kitReportMQQueueName = '***'
kitReportMQHeartBeat = 20
kitGitHost = '***'
kitGitUser = '***'
kitDBPort = 3306
kitDBHost = "***"
kitDBName = "***"
kitDBUsername = "***"
kitDBPassword = "***" |
"""
This module lets you practice the ACCUMULATOR pattern
in its simplest classic forms:
SUMMING: total = total + number
Authors: David Mutchler, Vibha Alangar, Dave Fisher, Matt Boutell, Mark Hays,
Mohammed Noureddine, Sana Ebrahimi, Sriram Mohan, their colleagues and
PUT_YOUR_NAME_HERE.
""... |
def validate_fit_event_struct(fitEvent, tester):
tester.assertTrue(hasattr(fitEvent, 'df'))
tester.assertTrue(hasattr(fitEvent, 'spec'))
tester.assertTrue(hasattr(fitEvent, 'model'))
tester.assertTrue(hasattr(fitEvent, 'featureColumns'))
tester.assertTrue(hasattr(fitEvent, 'predictionColumns'))
... |
# Escreva um programa que leia um valor em metros e o exiba convertido em centimetros e milimetros
print("="*10,"Exercicio 8", "="*10)
tamanho = float(input('Digite uma distância em metros: '))
cm = tamanho * 100
mm = tamanho * 1000
print(f"É equivalente a {cm:.2f}cm e a {mm:.2f}mm ") |
class JumpHistory(object):
def __init__(self):
self._history = [ ]
self._pos = 0
def __len__(self):
return len(self._history)
def jump_to(self, addr):
if self._pos != len(self._history) - 1:
self.trim()
if not self._history or self._history[-1] != ad... |
# Given a string s, find the longest palindromic substring in s
# --- Example
# Input: "babad"
# Output: "bab"
# Note: "aba" is also a valid answer.
# Time: O(n^2) | Space: O(1)
# Time complexity: O(n^2) Since expanding a palindrome around its center could take up to O(n), and we do this for each character.
class Sol... |
"""
AOC2020 - day3
"""
FILEPATH = "./day3.txt"
MAP = []
ROWLEN = 0
def doFall(down, right):
cnt = 0
myRight = 0
for ind in range(down, len(MAP), down):
myRight += right
if myRight >= ROWLEN:
myRight -= ROWLEN
if MAP[ind][myRight] == '#':
... |
#!python
def linear_search(array, item):
"""return the first index of item in array or None if item is not found"""
# implement linear_search_iterative and linear_search_recursive below, then
# change this to call your implementation to verify it passes all tests
# return linear_search_iterative(array,... |
def res(x):
a=[]
i=1
for c in x:
a.append(c+i)
i+=1
return a
n=int(input())
x=list(map(int,input().split()))
x.sort(reverse=True)
a=res(x)
print(max(a)+1)
|
"""
Copyright (C) 2017 Open Source Robotics Foundation
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... |
# B_R_R
# M_S_A_W
def fibonacci(num):
if num==0:
return 0
elif num==1:
return 1
else:
return fibonacci(num-1)+fibonacci(num-2)
inp_val=int(input("How many numbers: "))
i=1
while i<inp_val:
fibValue=fibonacci(i)
print(fibValue)
i+=1
print("All Done")
|
"""
PASSENGERS
"""
numPassengers = 34399
passenger_arriving = (
(9, 4, 8, 11, 5, 1, 5, 5, 2, 3, 3, 0, 0, 7, 4, 8, 4, 6, 2, 8, 4, 2, 2, 1, 1, 0), # 0
(6, 9, 9, 6, 5, 1, 3, 5, 3, 1, 3, 0, 0, 9, 7, 4, 4, 7, 4, 3, 5, 5, 2, 2, 0, 0), # 1
(11, 13, 5, 10, 9, 2, 5, 2, 3, 1, 4, 1, 0, 14, 7, 7, 6, 15, 4, 3, 6, 3, 1, 2, 1... |
num = [0 for n in range(4)]
for i in range(4):
num[i] = int(input(""))
failed = False
if (num[0] == 8 or num[0] == 9) and (num[3] == 8 or num[3] == 9) and (num[1] == num[2]):
print("ignore")
else:
print("answer") |
'''
05 - Regression plot parameters
Seaborn's regression plot supports several parameters that can be
used to configure the plots and drive more insight into the data.
For the next exercise, we can look at the relationship between tuition
and the percent of students that receive Pell grants. A Pell grant is
... |
# coding: utf-8
class Confirm(object):
def __init__(self, assume_yes=False):
self.assume_yes = assume_yes
def ask(self):
if self.assume_yes:
return True
message = '\n==> Press "Y" to confirm, or anything else to abort: '
confirmation = input(message)
retur... |
class Node:
def __init__(self, value=None, next_node=None):
self.value = value
self.next = next_node
def add_node(self, node):
self.next = node
def remove_next_node(self):
self.next = None
def add_value(self, value):
self.value = value
|
class Attribute(object):
"""
Args:
target (str): the attribute name in the batch
source (str): the key in the example dict
field (:class:`Field`): the field for target attribute
include_valid (bool): if True, the validation
dataset vocab will be included.
include_test (bool): if True, t... |
# 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 ( num ) :
length = len ( num )
if ( length == 1 and num [ 0 ] == '0' ) :
return True
if ( length ... |
class AutoTest:
def __init__(self, solution, funcName, paramNum):
self.solution = solution
self.funcName = funcName
self.paramNum = paramNum
self.tab = ' '
# 外部调用test方法进行自动测试
def test(self, testCases, keyNames):
'''
param testCases: 测试数据,格式为{'cases': ... |
s = 0
f1 = 1
f2 = 2
f_old = f1
f_new = f1
while f_new < 4000000:
if f_new % 2 == 0:
s += f_new
f_new_temp = f_new
f_new = f_new_temp + f_old
f_old = f_new_temp
print(s) |
# https://leetcode.com/problems/count-of-smaller-numbers-after-self/discuss/445769/merge-sort-CLEAR-simple-EXPLANATION-with-EXAMPLES-O(n-lg-n)
class Solution:
def countSmaller(self, nums: List[int]) -> List[int]:
def mergeAndCount(arr, start, end, result):
if start >= end:
re... |
class Solution:
def leastBricks(self, wall: List[List[int]]) -> int:
gaps = defaultdict(int)
for row in wall:
position = 0
for brick in row[:-1]:
position += brick
gaps[position] += 1
fewestCrossings = len(wall)
if len(gaps) > 0... |
# python3
n, m = map(int, input().split())
edges = [ list(map(int, input().split())) for i in range(m) ]
# This solution prints a simple satisfiable formula
# and passes about half of the tests.
# Change this function to solve the problem.
def printEquisatisfiableSatFormula():
print("3 2")
print("1 2 0")
p... |
SINE = 0
SQUARE = 1
TRI = 2
UP = 3
DOWN = 4
ARB0 = 100
ARB1 = 101
ARB2 = 102
ARB3 = 103
ARB4 = 104
ARB5 = 105
ARB6 = 106
ARB7 = 107
ARB8 = 108
ARB9 = 109
ARB10 = 110
ARB11 = 111
ARB12 = 112
ARB13 = 113
ARB14 = 114
ARB15 = 115
|
N = int(input())
if N <= 999:
print('ABC')
else:
print('ABD')
|
class DtoObject(dict):
@property
def __dict__(self):
return {k: v for k, v in self.items()}
|
"""
Calculate different thread patterns
"""
tx = list(range(0, 256))
#print("sAtx", map(lambda x: (x%2) * 512 + x/2, tx))
print("gmStoreCtx", map(lambda x: (x%16)*2 + (x/16)*16*8, tx))
print("", map(lambda x: (x%16)*2 + (x/16)*16*8 + 32 + 1, tx))
|
expected_output = {
"TenGigabitEthernet1/0/2":{
"port_channel":{
"port_channel_member": False
},
"enabled": True,
"line_protocol":"up",
"oper_status":"up",
"connected": True,
"suspended": False,
"err_disabled": False,
"type":"Ten Gigabit Ethernet",
... |
#!/usr/bin/env python
names = ('ff','ff','sfs','fdfs')
for name in names:
print(name)
lll = list(range(5))
print(lll)
sum =0
for l in lll:
sum+=l
print(sum)
|
#!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
class Aluno:
estuda = "digita os codigos"
boceja = "aaaaahhhh"
def estuda(self):
print(self.estuda)
def boceja(self):
print(self.boceja)
def main():
joao = Aluno()
joao.estuda()
joao.bocej... |
__project__ = 'Synerty Peek'
__copyright__ = '2016, Synerty'
__author__ = 'Synerty'
__version__ = '1.0.0'
|
def primesieve(a,n):
global m
N=n
n+=5
prime=[0 for i in range(n+1)]
p=2
while(p*p<=n):
if(prime[p]==0):
for i in range(p*p,n,p):
prime[i]=1
p+=1
c=0
for i in range(a,N+1):
if prime[i]==0:
m.append(i)
c+=1
re... |
#
# PySNMP MIB module HIRSCHMANN-DVMRP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIRSCHMANN-DVMRP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:30:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
r = int(input())
pi = 3.14159
v = (4/3) *pi * (r ** 3)
print("VOLUME = {0:.3f}".format(v))
|
expected_output = {
"interfaces": {
"Port-channel1": {
"name": "Port-channel1",
"protocol": "lacp",
"members": {
"GigabitEthernet2": {
"interface": "GigabitEthernet2",
"counters": {
"lacp_in_p... |
print("\nCalculadora")
while True:
operador = input("\nDigite o operador matemático desejado (+, -, * ou /) ou \"sair\" para encerrar: ")
if operador == "sair":
break
num1 = float(input("\nDigite o 1º número: "))
num2 = float(input("\nDigite o 2º número: "))
if operador == "+":
print... |
#
# ***** ALERTA SERVER DEFAULT SETTINGS -- DO NOT MODIFY THIS FILE *****
#
# To override these settings use /etc/alertad.conf or the contents of the
# configuration file set by the environment variable ALERTA_SVR_CONF_FILE.
#
# Further information on settings can be found at http://docs.alerta.io
DEBUG = False
LOGGE... |
polish = [
'a',
'aby',
'ach',
'acz',
'aczkolwiek',
'aj',
'albo',
'ale',
'alez',
'ależ',
'ani',
'az',
'aż',
'bardziej',
'bardzo',
'beda',
'bede',
'bedzie',
'bez',
'bo',
'bowiem',
'by',
'byc',
'byl',
'byla',
'byli',
... |
c_player_version_path = '/v1/player/versionInfo'
c_casino_version_path = '/v1/casino/versionInfo'
c_not_ready = 'not_ready_0'
# frontend
c_frontend_src_em = 'EM_FE'
c_frontend_src_operator = 'operator_FE'
# update time
c_job_interval_minutes = 30
c_json_key_operator_group = 'Operator Group'
c_redis_key_operator_g... |
'''A program to distribute candy to boys with array rating
each boy will get one more candy than the boy with less rating than him
example:[0,1,6] will return
1+2+3=6
[1,1,1,2,3,2+10]
=>1+1+1+2+2+3+4
'''
def distr(A:list):
A= sorted(A)
no_candy=1
the_boy=0
total_candy=0
for boy in A:
... |
# Definition for a Node.
class Node:
def __init__(self, x: int, next: "Node" = None, random: "Node" = None):
self.val = int(x)
self.next = next
self.random = random
class Solution:
def copyRandomList(self, head: "Node") -> "Node":
if not head:
return None
no... |
# All things for a HAP characteristic.
class HAP_FORMAT:
BOOL = 'bool'
INT = 'int'
FLOAT = 'float'
STRING = 'string'
ARRAY = 'array'
DICTIONARY = 'dictionary'
UINT8 = 'uint8'
UINT16 = 'uint16'
UINT32 = 'uint32'
UINT64 = 'uint64'
DATA = 'data'
TLV8 = 'tlv8'
NUMERIC = (INT, FLOAT,... |
"""
[2015-06-05] Challenge #217 [Practical Exercise] TeXSCII
https://www.reddit.com/r/dailyprogrammer/comments/38nhgx/20150605_challenge_217_practical_exercise_texscii/
# [](#PEIcon) _(Practical Exercise)_: TeXSCII
LaTeX is a typesetting utility based on the TeX typesetting and macro system which can be used to outpu... |
# encoding: utf-8
_default_allow_actions = (
'site_read',
'user_create',
'sysadmin', # pseudo-action that CKAN calls check_access for
'dashboard_new_activities_count',
'dashboard_activity_list',
'package_search',
'organization_list_for_user',
'organization_list',
'group_list',
... |
""" Dont duplicate errors same type. """
DUPLICATES = (
# multiple statements on one line
[('pep8', 'E701'), ('pylint', 'C0321')],
# missing whitespace around operator
[('pep8', 'E225'), ('pylint', 'C0326')],
# unused variable
[('pylint', 'W0612'), ('pyflakes', 'W0612')],
# undefined va... |
'''from rasa.core.agent import Agent
from rasa.utils.endpoints import EndpointConfig
import asyncio
import logging
logger = logging.getLogger("app.main")
class RasaAgent():
def __init__(self, **kwargs):
self.model_name = kwargs.get('model')
self.response = None
self.message = None
... |
# https://www.codewars.com/kata/5667e8f4e3f572a8f2000039/train/python
#Take each letters index
#Add to string each letters multiplied by its index (first letter must be uppercase and others lowercase)
#Add - between each set
def accum(s):
accummedStr=s[0].upper()
for i in range(1,len(s)): accummedStr+="-"+s[i... |
with open('test.txt', 'r+') as f:
f.seek(15)
print(f.readline())
with open('test.txt') as f:
data = []
for d in f:
data.append(d)
print(data) |
def figure_layout(annotations=None, title_text=None, x_label=None, y_label=None, show_legend=False):
"""Customize plotly figures
Parameters
----------
annotations: a list of dictionaries informing the values of parameters
to format annotations.
x_label: str. Title ... |
#
# @lc app=leetcode id=66 lang=python3
#
# [66] Plus One
#
# https://leetcode.com/problems/plus-one/description/
#
# algorithms
# Easy (40.72%)
# Total Accepted: 372.5K
# Total Submissions: 909.9K
# Testcase Example: '[1,2,3]'
#
# Given a non-empty array of digits representing a non-negative integer, ... |
def move_zeros_to_left(A):
if len(A) < 1: return
lengthA = len(A)
write_index = lengthA - 1
read_index = lengthA - 1
while(read_index >= 0):
if A[read_index] != 0:
A[write_index] = A[read_index]
write_index -= 1
read_index -= 1
while (write_index >= 0)... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
INSTALLED_APPS=[
'tests',
]
DEBUG = False
SITE_ID = 1 |
class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá {id(self)}'
@staticmethod
def metodo_estatico():
return 42
@classmethod
def... |
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 30 18:07:30 2020
@author: user
"""
|
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = 0
for i in range(0,n,2):
c = c + a[i+1]-a[i]
print(c)
|
# Do not edit the class below except
# for the breadthFirstSearch method.
# Feel free to add new properties
# and methods to the class.
class Node:
def __init__(self, name):
self.children = []
self.name = name
def addChild(self, name):
self.children.append(Node(name))
return sel... |
confThreshold= 0.5
nmsThreshold = 0.4
inpWidth = 416
inpHeight = 416
classesFile = "coco.names"
classes = None
with open(classesFile,"rt") as f:
classes = f.read().rstrip("\n").split("\n")
print(classes) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.