content stringlengths 7 1.05M |
|---|
_base_ = './solo_r50_fpn_3x_coco.py'
# model settings
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
|
class Foo:
def __init__(self, init_val=1):
self.init_val = init_val
class Boo:
def __init__(self, init_val=1):
print('__init__ 호출')
self.init_val = init_val
def __call__(self, n):
print('__call__ 호출')
self.init_val *= n
return self.init_val
if __name__ =... |
letters = {"a", "b", "c", "d"}
if "e" not in letters:
print(1)
else:
print(2)
# você pode adicionar elementos usando a função "add" dos sets
letters.add("e")
if "e" not in letters:
print(1)
else:
print(2)
# da mesma forma, pode remover elementos usando a função "remove"
letters.remove("e")
if "e"... |
# Time: O(n)
# Space: O(1)
# array
class Solution(object):
def findClosestNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return max(nums, key=lambda x:(-abs(x), x))
|
{
"targets": [
{
"target_name": "compressor",
"sources": [ "./dev/compressor/bit_reader.cpp", "./dev/compressor/bit_writer.cpp", "./dev/compressor/encoding.cpp",
"./dev/compressor/tree_node.cpp", "./dev/compressor/huffman.cpp", "./dev/compressor/node_wrapper... |
# coding: utf-8
"""Module that contains all personalized exceptions used in this library."""
class BaseError(Exception):
"""Base Exception to be inherited by all Githon exceptions.
Args:
kwargs: Dict with attributes that will be logged in message error.
"""
def __init__(self, kwargs):
... |
cur.sendQuery("exec exampleproc");
field00=cur.getFieldByIndex(0,0);
field01=cur.getFieldByIndex(0,1);
field02=cur.getFieldByIndex(0,2);
field10=cur.getFieldByIndex(1,0);
field11=cur.getFieldByIndex(1,1);
field12=cur.getFieldByIndex(1,2);
|
# Worker Processes
worker_class = 'sync'
socket_path = 'unix:/tmp/web-info.sock'
bind = socket_path
|
word="banana"
def bananas(s):
return helper(s, [], "", len(word))
def helper(s, arr, remain, length):
if length==0:
arr.append(remain+len(s)*"-")
return
for i,j in enumerate(s):
if j==word[len(word)-length]:
helper(s[i+1:], arr, remain+"-"*i+j, length-1)
return arr |
#__backpack__.py
"""
"""
class Backpack:
def __init__(self, Player):
self.player = Player
class View:
def __init__(self, Player):
self.player = Player
|
'''Crie um programa que leia o nome completo de uma pessoa e mostre:
> O nome com todas as letras maiúsculas.
> O nome com todas minúsculas.
> Quantas letras ao todo (sem considerar espaços).
> Quantas letras tem o primeiro nome.'''
nome = str(input('\033[35mDigite seu nome:\033[m ')).strip()
nome2 = nome.split()
print... |
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.37.1
工具: python == 3.7.3
"""
"""
思路:
直接统计
结果:
执行用时 : 308 ms, 在所有 Python3 提交中击败了76.94%的用户
内存消耗 : 15.2 MB, 在所有 Python3 提交中击败了5.54%的用户
"""
class Solution:
def repeatedNTimes(self, A):
for num in A:
... |
lst = open("p26.txt", 'r')
biggest = [0, 0]
for z, line in enumerate(lst):
x = line.split()
if int(x[1]) > int(biggest[1]):
print("Old: ", biggest)
biggest[0] = x[0]
biggest[1] = x[1]
print("New: ", biggest)
if z == 999:
break
print(biggest)
|
# Name of the Project : cal-cli.py
# Written by NoobScience : https://github.com/newtoallofthis123
# Modules Used : None
''' The following is registered under the MIT License, NoobScience 2021. You are free to use it
as you like as long as you know what you are doing.
Enjoy using and check some of my other proje... |
{
"variables": {
"module_name": "core",
"module_path": "./dist"
},
'targets': [
{
'target_name': '<(module_name)',
'sources': [
'src/index.cpp',
'src/LameAsyncWorker.cpp',
'src/EncodeWorker.cpp',
'src/lz4dec.c',
],
'includes': [
'./common... |
class MetaPackage:
instances = []
def __init__(self, pkgname, pkgtype=None, pkgorg=None):
self.instances.append(self) # adding the instance to colllective
if len(pkgname.split(':')) == 2:
if pkgtype == "maven":
if pkgorg == None:
self._pkg_name =... |
"""
SUV type with 2 sub-types:
-Super luxury suv
-Electric SUV
"""
class SuvCar:
w_type = 'car'
w_meaning = 'Sport Utility Vehicle'
w_traction = '4x4 drive'
def __init__(self, car_body, gen, color, custom):
self._car_body = car_body
self._gen = gen
self._color = color
... |
LARGURA = 500
ALTURA = 500
CANVAS_L = 400
CANVAS_A = 400
|
class Constants:
# Version data
VERSION_NUMBERS = (0, 1, 3, 0)
VERSION_STR = ".".join([str(num) for num in VERSION_NUMBERS[0:3]])
VERSION_SUFFIX = "b"
VERSION_VSTR = "v" + VERSION_STR + VERSION_SUFFIX
VERSION_FILENAME = "version.py"
WHOAMI = "Brian Yao"
# Process info
PROGRAM_NAME ... |
# https://leetcode.com/problems/flipping-an-image
class Solution:
def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]:
R, C = len(A), len(A[0])
for r in range(R):
for c in range(int(C / 2)):
A[r][c], A[r][C - 1 - c] = A[r][C - 1 - c], A[r][c]
for... |
# Exercício 8.2 - Escreva uma função que receba dois números e retorne True se o
# primeiro número for múltiplo do segundo.
# Valores esperados:
# múltiplo(8,4) == True
# múltiplo(7,3) == False
# múltiplo(5,5) == True
def multiplo(x, y):
if x % y == 0:
print('\nMúltiplo(%d, %d) == True\n' % (x, y))
els... |
#!/usr/bin/env python3
filename = 'p022_names.txt'
with open(filename, 'r') as tfile:
all_names = tfile.read().replace("\"", '')
all_names = all_names.split(',')
all_names.sort()
total_score = 0
print('name, index, name_score, total_score')
for ind, name in enumerate(all_names):
index = ind + 1
name_score... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project: Deep-Learning-in-Action
@File: train.py
@Author: 轩名
@Date: 2021/8/17 5:14 下午
"""
|
#
# main.py
# Mich, 2016-01-15
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
if False:
mldb = None
mldb.log("mldb_py_argv_test_plugin loaded")
|
def mascotas (mascota):
mascotas = {
'firulais': 1,
'venus': 2,
'lira': 3,
'pinto': 4
}
if mascota in mascotas:
return 1
else:
return 0
|
##
# EXCEPTIONS
##
##
# Exchange
##
EXCHANGECONNECTIONERROR = (
"Problem connecting to the Exchange, please check your Exchange credentials"
)
EXCHANGEPRIVILEGESERROR = (
"Problem executing the action on the Exchange, "
"please check the permissions assign to the API key provided"
)
EXCHANGEINVALIDSYMBOLER... |
class Config:
"""
Config Storage.
"""
def __init__(self):
self.MAIN_TABLE_ID = 'WD0176-contentTBody'
|
def gobad(x, y):
return x / y
def gosouth(x):
print(gobad(x, 0))
gosouth(1)
|
'''
-- Nome: Gianluca Capezzuto Sardinha
-- NUSP: 11876933
-- Exercício 4
'''
def main():
x = leu()
spaceL = 0
while x > 0:
i = 0
for _ in range(0, spaceL):
print(" ", end = "")
while i < x:
print("*", end = "")
i += 1
print("\n")
... |
class OptBase:
def __init__(self):
pass
def set_func(self, func):
self.func = func
def set_grad(self, func):
self.grad = func
|
def challenge4():
f = open('challenge4.txt','r')
maxscore = 0
scoredstr = ''
for line in f:
inp = bytearray.fromhex(line.rstrip())
for i in range(ord('0'),ord('Z')):
try:
string = bytearray(x ^ i for x in inp).decode("utf-8")
except UnicodeDecodeEr... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 27 17:25:22 2020
@author: abhi0
"""
class Solution:
def findJudge(self, N: int, trust: List[List[int]]) -> int:
if trust==[]:
if N==1:
return N
else:
return -1
trustDict=d... |
__all__ = []
class relationship(object):
"""Stub for SQLalchemy-like relationship"""
def __init__(self, *args, **kwargs):
pass
class backref(object):
"""Stub for SQLalchemy-like backref"""
def __init__(self, *args, **kwargs):
pass
|
class Trade:
def __init__(self, buyer, seller, assetno, assetname, volume, price, time):
self.buyer = buyer
self.seller = seller
self.assetno = assetno
self.assetname = assetname
self.volume = volume
self.price = price
self.time = time
#fulfill the tr... |
passports, lines = [], []
while True:
try:
line = input().strip()
if line == "":
passports.append(' '.join(lines))
lines = []
else:
lines.append(line)
except Exception:
if lines:
passports.append(' '.join(lines))
break
'''... |
# solution thanks to Nikola Aleksandrov
people = int(input())
capacity = int(input())
trips = people // capacity
people -= trips * capacity
if 0 < people <= capacity:
trips += 1
print(trips)
|
class TestEvengApi:
"""Test cases"""
def test_api_get_server_status(self, authenticated_client):
"""
Verify server status using the API
"""
r = authenticated_client.api.get_server_status()
assert r["data"].get("cpu") is not None
def test_list_node_templates(self, au... |
'''
from dal import autocomplete
class AutocompleteSingleWidget(autocomplete.ListSelect2):
autocomplete_function = "single_autocomplete_init"
class AutocompleteMultiWidget(autocomplete.ModelSelect2Multiple):
autocomplete_function = "multi_autocomplete_init"
''' |
class NotYetSupported(Exception):
def __init__(self, kind, thing=None):
self.msg = 'Support for {}'.format(kind)
if thing is not None:
self.msg += ' "{}"'.format(type(thing).__name__)
self.msg += ' is not yet implemented'
class CheckError(Exception):
pass
class NoSuchName... |
input = """
a(1) | a(2).
b(1).
:- b(N), not #count{ V : a(V) } = N.
"""
output = """
a(1) | a(2).
b(1).
:- b(N), not #count{ V : a(V) } = N.
"""
|
MARKS = {
1: {"label": "5y"},
2: {"label": "3y"},
3: {"label": "1y"},
4: {"label": "6m"},
5: {"label": "3m"},
6: {"label": "1m"},
7: {"label": "7d"},
}
TIME_FRAMES = {1: "5Y", 2: "3Y", 3: "6M", 4: "3M", 5: "1M", 6: "7D"}
FIELD_MAP = {
"fiftyTwoWeekHigh": "52 Week High",
"fiftyTwoWe... |
class Foo:
def __init__(self, a, b):
self.a = a
self.b = b
def foo():
return "cs107_package.subpkg_1.module_1.foo()"
|
# This program is a rock-paper-scissors game that helps to practice nested "if" statements.
print("Rock...")
print("Paper...")
print("Scissors...")
player1 = input("Player 1, make your move: ")
print("*** NO CHEATING ***! \n\n" * 20)
player2 = input("Player 2, make your move: ")
# paper beats rock
# rock beats sciss... |
# [Shaolin Temple] But Everyone Else Has Nice Shoes
TOWN_MISCREANT = 9310580
KID_SHOES = 4034657
sm.removeEscapeButton()
sm.setSpeakerID(TOWN_MISCREANT)
sm.setBoxChat()
sm.sendNext("Hey! My shoes! Thanks for giving them back, demon!")
sm.flipBoxChat()
sm.flipBoxChatPlayerAsSpeaker()
sm.sendNext("I'm not a demon!")
... |
s = list(input())
for i in range(len(s)):
if(s[i] == s[i].upper()):
s[i] = s[i].lower()
elif(s[i] == s[i].lower()):
s[i] = s[i].upper()
for j in range(len(s)):
print(s[j] ,end="")
|
config = {
#
# Save trained model named with 'model_name'.h5.
# The best model at each epoch is saved to the folder ./checkpoint/'model_name'.
#
'model_name': 'MobileNetV3_face_spoof_gavg',
#
# Restore trained weights.
# The architecture must be same with 'model' option.
# checkpoin... |
#!/usr/bin/python3
# https://practice.geeksforgeeks.org/problems/number-of-paths/0
def sol(m, n):
dp = [[0 for i in range(n)] for i in range(m)]
for i in range(m):
dp[i][0] = 1
for i in range(n):
dp[0][i] = 1
for i in range(1, m):
for j in range(1, n):
... |
"""Modules for demonstrating generator execution"""
def take(count, iterable):
"""
This method takes items from iterable
:param count:
:param iterable:
:return: generator
Yields: At most 'count' items from 'iterable'
"""
counter = 0
for item in iterable:
if counter == cou... |
"""
Problem: 1573 - Number of Ways to Split a String
Difficulty: Medium
URL: https://leetcode.com/problems/number-of-ways-to-split-a-string/
"""
class Solution:
def numWays(self, s: str) -> int:
loc = []
count = 0
for i in range(len(s)):
if s[i] == "1":
... |
#!/usr/bin/env python3
''' Internal exceptions '''
class PluginVerifyError(Exception):
''' Exception raised when a plugin's verify_settingsui
needs to fail '''
def __init__(self, message):
self.message = message
super().__init__(self.message)
|
class BaseTrainer(object):
def __init__(self, model, data, config):
self.model = model
self.data = data # DataLoader
self.config = config
def train(self):
raise NotImplementedError
def test(self):
raise NotImplementedError
def evaluate(self):
raise Not... |
n1 = int(input("Enter a numbers of rows for matrix1 : "))
m1 = int(input("Enter a numbers of cols for matrix1 : "))
arr1 = []
arr2 = []
for i in range(n1):
arr3 = []
for j in range(m1):
o1 = int(input("Enter an element for 1st matrix : "))
arr3.append(o1)
arr1.append(arr3)
print("first matri... |
class Something(object):
def __init__(self, value):
self._value = value
def map(self, function):
return Something(function(self._value))
def is_present(self):
return True
def get(self):
return self._value
def get_or_else(self, value):
return self.get()
... |
LOOP_COUNT = 100000
FIRST = "first"
SECOND = "second"
FIRST_SECOND = "first_second"
def run_multi_time(func):
def wrapper():
for _ in range(LOOP_COUNT):
func()
return wrapper
@run_multi_time
def concat_test():
FIRST + SECOND
@run_multi_time
def contains_test():
SECOND in FIRST... |
recorrido = 0
while recorrido < 5:
chance = float(input("total: "))
recorrido += 1
if chance >= 500:
descuento = chance * 0.30
subtotal = chance - descuento
total = subtotal
print("Su total es:{0} " .format(total))
elif chance < 500 and chance >= 200:
descuento = chance * 0.20
subtot... |
#
# PySNMP MIB module HTTPEXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HTTPEXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:30:33 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... |
"""
find minimim cout module
"""
def find_minimum_count(
maze: list, issued: list, minimum_counts: list, zeros: list, x: int, y: int
) -> None:
"""
maze: 2 by 2 list
issued: 2 by 2 list with True or False
minimum_counts: list with results
zeros: list for counting zeros
x: row of startp... |
__title__ = 'glance-times'
__description__ = 'Who will watch the watchman? Glance can.'
__url__ = 'https://github.com/mrice88/glance'
__download_url__ = 'https://github.com/mrice88/glance/archive/master.zip'
__version__ = '0.3.6'
__author__ = 'Mark Rice'
__author_email__ = 'markricejr@gmail.com'
__license__ = 'MIT'
__... |
class Solution:
def minSubArrayLen(self, s, nums):
n = len(nums)
ans = 9999999999
left = 0
sum = 0
for i in range(n):
sum += nums[i]
while sum >= s:
ans = min(ans, i + 1 - left)
sum -= nums[left]
left +=... |
class Solution:
def surfaceArea(self, grid: List[List[int]]) -> int:
result = 0
n = len(grid)
for i in range(n):
for j in range(n):
if grid[i][j]:
result += grid[i][j] * 4 + 2
if i != 0:
result -= min(grid[i]... |
'''
The following iterative sequence is defined for the set of positive integers:
n -> n/2 (n is even)
n -> 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1
It can be seen that this sequence (starting at 13 and finish... |
define = {
"swf": "mujaffa.swf",
"model": "model.h5",
"dataset": "dataset.p",
"action_space": 4,
"action_names": ["terminal", "menu", "score", "lll", "terminal_1", "stage", "score", "stage", "transition"],
"state_space": (84, 84, 3)
} |
#fibonacci from 0-100
list1=list(range(1,10))
x=1
y=0
z=0
for a in list1:
z=x+y
print(y)
y=x
x=z |
#calculo aumento de salario
salario = 1500
aumento = 5
print ( salario+ (salario * aumento / 100))
|
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: fbs
class AttributeType(object):
UNDEFINED = 0
FLOAT = 1
INT = 2
STRING = 3
TENSOR = 4
GRAPH = 5
FLOATS = 6
INTS = 7
STRINGS = 8
TENSORS = 9
GRAPHS = 10
SPARSE_TENSOR = 11
SPARSE_TENSO... |
##Patterns: E0711
##Err: E0711
raise NotImplemented
raise NotImplementedError
|
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
row = [1]
for _ in range(rowIndex):
row = [x + y for x, y in zip([0]+row, row+[0])]
return row
|
def notas(*n, sit=False):
"""
-> Função para analisar notas e situações de vários alunos.
:param n: uma ou mais notas dos alunos (aceita várias)
:param sit: valor opcional, indicando se deve ou não adicionar a situação
:return: dicionário com várias informações sobre a situação da turma.
"""
... |
# https://leetcode.com/problems/binary-tree-inorder-traversal
class Solution:
def __init__(self):
self.inorder_list = []
def inorder_traversal(self, root):
if root:
self.inorder_traversal(root.left)
self.inorder_list.append(root.val)
self.inorder_traversal(r... |
'''
For 35 points, answer the following questions.
You may run any or all of the programs, but run them separately.
Here's an example problem with answers included:
x = 1
name = 'Dahlia'
name = name + x
#What is the error in your words?
#Answer: Can't add str and int
#What is the error in Python's words?
#Answer: Type... |
ano = int(input("informe um ano"))
if ano % 4 == 0:
print("o ano {} é um ano bissexto".format(ano))
else:
print("o ano {} não é bissexto".format(ano))
|
# not equal !=
print("hot dogs" != "sandwiches")
# Greater >
print(6 > 3)
# Smaller <
print(6 < 3)
# greater than equal to
print(42 >= 42)
# Strings does a alphabetical order check.
print("sunshine" > "rain") # s comes before r
|
jogador = {'nome': str, 'gols': [], 'total': int}
jogador['nome'] = input("\nNome do jogador: ")
n = int(input(f'Quantas partidas {jogador["nome"]} jogou? '))
for i in range(n):
jogador['gols'].append(int(input(f'\tQuantos gols na {i+1}ª partida? ')))
print()
jogador['total'] = sum(jogador['gols'])
print('... |
# from itertools import product
# # # 01 solution using itertools.product(*iterables, repeat=)
# # # https://docs.python.org/3/library/itertools.html#itertools.product
# num = int(input())
# result = []
# keywords = ""
# for number in range(97, 97 + num):
# result += chr(number)
# keywords = ["".join(i) for i in pr... |
n = int(input("Digite um número inteiro: "))
soma = 0
while ( n > 0 ):
resto = n % 10
n = n // 10
soma = soma + resto
print(soma) |
alt = float(input('Informe a altura: '))
larg = float(input('Informe a largura: '))
area = larg * alt
print('A parede de {}m x {}m tem de área {:.2f}m²'.format(larg, alt, area))
tinta = area/2
print('Será necessário {:.2f}l de tinta'.format(tinta))
|
# -*- coding: utf-8 -*-
"""
@version: 1.0
@author: James
@license: Apache Licence
@contact: euler52201044@sina.com
@file: 11_rabbit_number.py
@time: 2019/5/2 下午5:27
@description:
"""
f1 = 1
f2 = 1
for i in range(1, 22):
print('%12ld %12ld' % (f1, f2), end='')
if (i % 3) == 0:
print('')
f1 = f1 ... |
class Solution:
def canVisitAllRooms(self, rooms: List[List[int]]) -> bool:
n = len(rooms)
visited = [False] * n
visited[0] = True
stack = [0]
cnt = 0
while stack:
room = stack.pop()
cnt += 1
for nei in rooms[room]:
... |
#
# Berechnung des Maximums natuerlicher Zahlen
#
print("Bitte positive ganze Zahlen eingeben (negativ beendet): ")
user_input = 0 # minimalste positive Zahl
max_value = 0 # dito
while user_input >= 0: # negative Zahl beendet
user_input_text = input("Bitte Zahl eingeben: ")
user_input = int(user_input_text... |
reversed_words = {}
while True:
command = input()
if command == "end":
break
reversed_words[command] = ''.join(reversed(command))
for key, value in reversed_words.items():
print(f"{key} = {value}") |
def slug(text):
'''In reality you may need to implement a better version of it'''
text = text.lower()
text = text.replace(" ", "-")
return text |
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def power(x, y):
return x ** y |
"""
Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
"""
class Option(object):
def __init__(self, key, value):
"""Initialize the Option, used for passing
options into requests
Args:
... |
dimensions = (200, 50)
print(dimensions[0])
print(dimensions[1])
for dimension in dimensions:
print(dimension)
dimensions = [200, 50]
print("Orignal dimensions")
for dimension in dimensions:
print(dimension)
dimensions = [400, 100]
print("\nModified dimensions")
for dimension in dimensions:
print(dimensi... |
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# ... |
def evenDigitsOnly(n):
return all(
(True if digit in ("0", "2", "4", "6", "8") else False for digit in str(n))
)
|
__________________________________________________________________________________________________
class Solution:
def largestUniqueNumber(self, A: List[int]) -> int:
c = collections.Counter(A)
l = sorted(list(c.items()), key=lambda x: (x[1], -x[0]))
return -1 if l[0][1] > 1 else l[0][0]
___... |
# coding=utf-8
# Module arial_32
# generated from Arial 24.75pt
name = "Arial 32"
start_char = '!'
end_char = chr(127)
char_height = 32
space_width = 16
gap_width = 4
bitmaps = (
# @0 '!' (3 pixels wide)
0x00, #
0xE0, # OOO
0xE0, # OOO
0xE0, # OOO
0xE0, # OOO
0xE0, # OOO
... |
#O(n)
class Solution:
"""
Do not return anything, modify nums in-place instead.
"""
def moveZeroes_long(self, nums):
"""
we assume the first zero is at index 0, if the first one is not zero,
the list will not chnage after the first iteration. We move the
first zero index... |
i = 1
while i < 6:
print(i)
if i == 3:
break
i += 1
|
REQ_PKG_TYPE = 0x00
ACK_PKG_TYPE = 0x80
NO_ACK_TYPE = 0x00
NEED_ACK_TYPE = 0x40
NEED_ACK_NO_FINISH_TYPE = 0x20
NO_ENC_TYPE = 0x00
AES_128_ENC_TYPE = 0x01
CUSTOM_ENC_TYPE = 0x02
XOR_ENC_TYPE = 0x03
DES_56_ENC_TYPE = 0x04
DES_112_ENC_TYPE = 0x05
AES_192_ENC_TYPE = 0x06
AES_256_ENC_TYPE = 0x07
MSG_TIMEOUT_FOREVER = 0
MSG... |
# ex-096 - Função que caucula área
def area(a, b):
s = a * b
return s
print('=== CAUCULO DE ÁREA ===')
lar = float(input('Largura: (m) '))
comp = float(input('Comprimento: (m) '))
print(f'A área total é de {area(lar, comp)}m²')
|
#!/usr/bin/python
class GrabzItScrapeHistory:
def __init__(self, identifier, finished):
self.ID = identifier
self.Finished = finished
|
class Node:
def __init__(self, chr = None):
self.chr = None
self.isLeaf = False
self.children = {}
def getChildren(self):
return self.children.keys()
def getChild(self, s: str):
return self.children.get(s)
def addChild(self, s: str):
self.ch... |
#Leia varios int; 999 para o progama; mostre os números digitados e a soma deles
n1 = 0
n = 0
c = 0
n1 = int(input('\033[1;33mESCREVA UM NÚMERO INTEIRO FORA 999: '))
while n1 != 999:
n += n1
c += 1
n1 = int(input('\033[1;33mESCREVA UM NÚMERO INTEIRO FORA 999: '))
print('A SOMA DOS {} NÚMEROS É {}'.format(c,... |
test_input = """
1721
979
366
299
675
1456
"""
input = """
1749
1897
881
1736
1161
1720
1676
305
264
1904
1880
1173
483
1978
1428
1635
1386
1858
1602
1916
1906
1212
1730
1777
1698
1845
1812
1922
1729
1803
1761
1901
1748
1188
1964
1935
1919
1810
1567
1849
1417
1452
54
1722
1784
1261
1744
1594
1526
1771
1762
1894
1717
1... |
n=int(input())
d=list(map(int,input().split()))
g=[[]for i in range(n)]
for i in range(n-1):
s,t=list(map(int,input().split()))
s-=1
t-=1
g[s].append(t)
g[t].append(s)
class reroot:
def __init__(self,g):
self.e=(0,0)
self.g =g
self.p_list=[-1]*len(g)
self.p_check... |
# wczytanie napisow
with open('../dane/binarne.txt') as f:
data = []
for word in f.readlines():
data.append(word[:-1])
# licznik
double_cycle = 0
# rekord
best = ''
# przejscie po kazdym napisie
for word in data:
# jezeli obie polowki sa takie same to napis jest dwucykliczny
if word[:len(word)/... |
"""Define constants for the Somfy component."""
DOMAIN = "somfy"
COORDINATOR = "coordinator"
|
# 0 < pwr < 6 and root^pwr = user input
n = int(input("Enter an integer: "))
root, pwd = 0, 0
while root <= n:
pwd += 1
if pwd == 6:
pwd = 1
root += 1
if root ** pwd == n:
print(root, "^", pwd, "is", n) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.