content stringlengths 7 1.05M |
|---|
##Afficher les communs diverseurs du nombre naturel N
n = int(input())
for a in range (1, n + 1) :
if n % a == 0 :
print(a)
else :
print(' ') |
MAIL_USERNAME = 'buildasaasappwithflask@gmail.com'
MAIL_PASSWORD = 'helicopterpantswalrusfoot'
STRIPE_SECRET_KEY = 'sk_test_nycOOQdO9C16zxubr2WWtbug'
STRIPE_PUBLISHABLE_KEY = 'pk_test_ClU5mzNj1YxRRnrdZB5jEO29'
|
#Called when SMU is in List mode
class SlaveMaster:
SLAVE = 0
MASTER = 1
|
#coding:utf-8
def replace_waf(pt):
main_addr = 0x4011e6 #main函数入口地址
new_main = pt.inject(asm=r'''
push rbp;
mov rbp,rsp;
mov r15,6;
push r15;
mov r15,7FFF000000000006H;
push r15;
mov r15,3B00010015H;
push r15;
mov r15 , 3800020015h;
push r15;
mov r15 , 3200030015h;
push r15;
mov r15 , 3100040015h;
push... |
# 比如有如下三行代码,这三行代码是一个完整的功能
# print('Hello')
# print('你好')
# print('再见')
# 定义一个函数
def fn():
print('这是我的第一个函数!')
print('hello')
print('今天天气真不错!')
# 打印fn
# print(fn) <function fn at 0x03D2B618>
# print(type(fn)) <class 'function'>
# fn是函数对象 fn()调用函数
# print是函数对象 print()调用函数
# fn()
# 定义... |
def private():
pass
class Abra:
def other():
private()
|
class Solution:
def majorityElement(self, nums: List[int]) -> int:
counter, target = 0, nums[0]
for i in nums:
if counter == 0:
target = i
if target != i:
counter -= 1
else:
counter += 1
return target
|
class QuotaOptions(object):
def __init__(self,
start_quota: int = 0,
refresh_by: str = "month",
warning_rate: float = 0.8):
self.start_quota = start_quota
self.refresh_by = refresh_by
self.warning_rate = warning_rate
|
# Задание 6.1
yourIP = input("Enter your IP: ")
sepIP = yourIP.split('.')
sepIP = list(map(int, sepIP))
if sepIP[-1] in range(1,224):
print('unicast')
elif sepIP[-1] in range(224,240):
print('multicast')
elif yourIP == '255.255.255.255':
print('local broadcast')
elif yourIP == '0.0.0.0':
print('unassigned')
... |
#!/usr/bin/python
# https://practice.geeksforgeeks.org/problems/find-equal-point-in-string-of-brackets/0
def sol(s):
"""
Build an aux array from left that stores the no.
of opening brackets before that index
Build an aux array from right that stores the no. of closing
brackets from that index
... |
def FoodStoreLol(Money, time, im):
print("What would you like to eat?")
time.sleep(2)
print("!Heres the menu!")
time.sleep(2)
im.show()
time.sleep(2)
eeee = input("Say Any Key to continue.")
FoodList = []
cash = 0
time.sleep(5)
for Loopies in range(3):
ord... |
'''
An array is monotonic if it is either monotone increasing or monotone decreasing.
An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array A is monotone decreasing if for all i <= j, A[i] >= A[j].
Return true if and only if the given array A is monotonic.
Example 1:
Input: [1,2,2,3]
Outpu... |
'''Crie um programa onde o usuário digite uma expressão qualquer que use parênteses.
Seu aplicativo deverá analisar se a expressão passada está com os parênteses abertos e fechados na ordem correta.'''
expr=str(input('Digite sua experessão: '))
fat=[]
i=0
abertura=0
fechamento=0
while i<len(expr):
fat.append(exp... |
#!/usr/local/bin/python3
def imprime(maximo, atual):
if atual >= maximo:
return
print(atual)
imprime(maximo, atual + 1)
if __name__ == '__main__':
imprime(100, 1)
|
project = 'pydatastructs'
modules = ['linear_data_structures']
backend = '_backend'
cpp = 'cpp'
dummy_submodules = ['_arrays.py']
|
# Given a list of numbers and a number k.
# Return whether any two numbers from the list add up to k.
#
# For example:
# Give [1,2,3,4] and k of 7
# Return true since 3 + 4 is 7
def input_array():
print("Len of array = ", end='')
array_len = int(input())
print()
array = []
for i in range(array_le... |
operator = input()
num_one = int(input())
num_two = int(input())
def multiply_nums(x, y):
result = x * y
return result
def divide_nums(x, y):
if y != 0:
result = int(x / y)
return result
def add_nums(x, y):
result = x + y
return result
def subtract_nums(x, y):
result = x ... |
print(" I will now count my chickens:")
print("Hens",25+30/6)
print("Roosters", 100-25*3%4)
print("Now I will continue the eggs:")
print(3+2+1-5+4%2-1/4+6)
print("Is it true that 3+2<5-7?")
print(3+2<5-7)
print("What is 3+2?", 3+2)
print("What is 5=7?", 5-7)
print("Oh, that;s why it;s false.")
print("How abao... |
# Created by MechAviv
# Wicked Witch Damage Skin | (2433184)
if sm.addDamageSkin(2433184):
sm.chat("'Wicked Witch Damage Skin' Damage Skin has been added to your account's damage skin collection.")
sm.consumeItem() |
n = int(input())
votos = []
for i in range(n):
x = int(input())
votos.append(x)
if votos[0] >= max(votos):
print("S")
else:
print("N")
|
# Dasean Volk, dvolk@usc.edu
# Fall 2021, ITP115
# Section: Boba
# Lab 9
# --------------------------------------SHOW RECOMMENDER & FILE CREATOR----------------------------------------------- #
def display_menu():
print("TV Shows \nPossible genres are action & adventure, animation, comedy, "
"\ndocument... |
print('Mind Mapping')
print('')
q = input('1) ')
q1 = input('1.1) ')
q2 = input('1.2) ')
print('')
w = input('2) ')
w1 = input('2.1) ')
w2 = input('2.2) ')
print('')
e = input('3) ')
e1 = input('3.1) ')
e2 = input('3.2) ')
print('')
r = input('4) ')
r1 = input('4.1) ')
r2 = input('4.2) ')
print('')
print('')
print('1) ... |
def ejercicio_1(cadena):
i=0
while cadena[i]== " ":
i+=1
return cadena[i:]
print (ejercicio_1("programacion_1"))
|
mask, memory, answer = None, {}, 0
for line in open('input.txt', 'r').readlines():
inst, val = line.strip().replace(' ', '').split('=')
if 'mask' in inst:
mask = val
elif 'mem' in inst:
mem_add = '{:036b}'.format(int(inst[4:-1]))
num = '{:036b}'.format(int(val))
masked_num = [mask[i] if mask[i] in ['1', '0']... |
def get_sec(time_str):
"""Get Seconds from time."""
h, m, s = time_str.split(':')
return int(h) * 3600 + int(m) * 60 + int(s)
|
km = float(input('Qual foi a quilometragem andada? '))
dia = float(input('Quantos dias que o carro ficou alugado? '))
valor = (0.15 * km) + (60 * dia)
print('O valor total a ser pago é R${:.2f}'.format(valor))
|
# Part 1
counter = 0
for line in open('input.txt', 'r').readlines():
# iterate output
for entry in line.split(" | ")[1].split(" "):
entry = entry.strip()
# count trivial numbers
if len(entry) == 2 or len(entry) == 3 or len(entry) == 4 or len(entry) == 7:
counter += 1
print("... |
# -*- coding: utf-8 -*-
"""
magrathea.core.feed.info
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2014 by the RootForum.org team, see AUTHORS.
:license: MIT License, see LICENSE for details.
"""
class FeedInfo(object):
"""
A simple namespace object for passing information to an entry
""... |
#coding=utf-8
'''
Created on 2016-10-28
@author: Administrator
'''
class TestException(object):
'''
classdocs
'''
@staticmethod
def exception_1():
raise Exception("fdsfdsfsd")
|
class Token:
def __init__(self, token_index_in_sentence, text, pos_tag=None, mate_tools_pos_tag=None, mate_tools_lemma=None,
tree_tagger_lemma=None,
iwnlp_lemma=None, polarity=None, spacy_pos_stts=None, spacy_pos_universal_google=None,
spacy_ner_type=None,
... |
#OS_MA_NFVO_IP = '192.168.1.219'
OS_MA_NFVO_IP = '192.168.1.197'
OS_USER_DOMAIN_NAME = 'Default'
OS_USERNAME = 'admin'
OS_PASSWORD = '0000'
OS_PROJECT_DOMAIN_NAME = 'Default'
OS_PROJECT_NAME = 'admin'
|
a = int(input())
l1 = []
i=0
temp = 1
print(2^3)
while i<a:
if temp^a==0:
i+=1
else:
l1.append(i)
temp+=1
print(temp)
print(l1)
|
"""
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
from https://github.com/amdegroot/ssd.pytorch ssd.pytorch/data/voc0712.py file
"""
configuration = {
'labels': [
'aeroplane', 'bicycle', 'bird', 'boat',
... |
def solve():
ab=input()
ans=ab[0]
ans+="".join(ab[1:-1:2])
ans+=ab[-1]
print(ans)
if __name__ == '__main__':
t=int(input())
for _ in range(t):
solve()
|
def configure(ctx):
ctx.env.has_mpi = False
mpiccpath = ctx.find_program("mpicc")
if mpiccpath:
ctx.env.has_mpi = True
envmpi = ctx.env.copy()
ctx.setenv('mpi', envmpi)
ctx.env.CC = [mpiccpath]
ctx.env.LINK_CC = [mpiccpath]
envmpibld = envmpi = ctx.env.copy()
... |
#Faça um programa que peça o tamanho de um arquivo para download (em MB) e
# a velocidade de um link de Internet (em Mbps), calcule e informe o tempo aproximado
# de download do arquivo usando este link (em minutos).
tamanho_arq = int(input("Informe o tamanho do arquivo em MB:"))
velocidade_inter = int(input("Inform... |
# These inheritance models are distinct from the official OMIM models of inheritance for variants
# which are specified by GENETIC_MODELS (in variant_tags.py).
# The following models are used while describing inheritance of genes in gene panels
# It's a custom-compiled list of values
GENE_PANELS_INHERITANCE_MODELS = (
... |
#
# PySNMP MIB module CABH-PS-DEV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CABH-PS-DEV-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:26:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
def spliceOut(self):
if self.isLeaf():
if self.isLeftChild():
self.parent.leftChild = None
else:
self.parent.rightChild = None
elif self.hasAnyChildren():
if self.hasLeftChild():
if self.isLeftChild():
self.parent.leftChild = self.leftC... |
def string_starts(s, m):
return s[:len(m)] == m
def split_sentence_in_words(s):
return s.split()
def modify_uppercase_phrase(s):
if s == s.upper():
words = split_sentence_in_words( s.lower() )
res = [ w.capitalize() for w in words ]
return ' '.join( res )
else:
return s... |
finding_target = 14
finding_numbers = [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16]
#선행 탐색 O(N) - 배열 크기만큼 다 돌기 때문에
#이진 탐색 O(logN) -
def is_existing_target_number_binary(target, array):
start_index = 0
end_index = len(array) - 1
count = 0
#나는 for문을 썼다. 어쨌든 range를 사용하면 무한루프까지는 아니니까 하지만 이 방법은 false일때를... |
string = "3113322113"
for loop in range(50):
output = ""
count = 1
digit = string[0]
for i in range(1, len(string)):
if string[i] == digit:
count += 1
else:
output += str(count) + digit
digit = string[i]
count = 1
output += str(count) + digit
#print(loop, output)
string =... |
class Color:
"""Class for RGB colors"""
def __init__(self, *args, **kwargs):
"""
Initialize new color
Acceptable args:
String with hex representation (ex. hex = #1234ab)
Named parameters (ex. r = 0.2, green = 0.44, blue = 0.12)
Acceptable keywords:
... |
class PoolRaidLevels(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_pool_raid_levels(idx_name)
class PoolRaidLevelsColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_pools()
|
# Python3 program to find Intersection of two
# Sorted Arrays (Handling Duplicates)
def IntersectionArray(a, b, n, m):
'''
:param a: given sorted array a
:param n: size of sorted array a
:param b: given sorted array b
:param m: size of sorted array b
:return: array of intersection of two array o... |
print('=' * 5, 'EX_005', '=' * 5)
# antecessor e sucessor
n1 = int(input('Digite um número: '))
a = n1 - 1
s = n1 + 1
print('O antecessor de {} é {} e seu sucessor é {}!'.format(n1, a, s))
|
def ask_yes_no(question):
response = None
expected_responses = ('no', 'n', 'yes', 'y')
while response not in expected_responses:
response = input(question + "\n").lower()
# Error message
if response not in expected_responses:
print('Wrong input please <yes/no... |
def selectSort(arr):
_len = len(arr)
for i in range(_len):
index = i # 最小值索引
for j in range(i, _len):
if arr[index] > arr[j]:
index = j
arr[index], arr[i] = arr[i], arr[index]
return arr
a = [31, 42, 13, 54, 5]
print(selectSort(a))
|
"""Olap Client exceptions module
Contains the errors and exceptions the code can raise at some point during execution.
"""
class EmptyDataException(Exception):
"""EmptyDataException
This exception occurs when a query against a server returns an empty dataset.
This might want to be caught and reported to ... |
"""
Hypercorn application server settings
"""
bind = "0.0.0.0:8080"
workers = 4
|
# -*- coding: utf-8 -*-
#
# view.py
# aopy
#
# Created by Alexander Rudy on 2014-07-16.
# Copyright 2014 Alexander Rudy. All rights reserved.
#
"""
:mod:`aperture.view`
====================
""" |
class Config:
epochs = 50
batch_size = 8
learning_rate_decay_epochs = 10
# save model
save_frequency = 5
save_model_dir = "saved_model/"
load_weights_before_training = False
load_weights_from_epoch = 0
# test image
test_single_image_dir = ""
test_images_during_training = F... |
class Polygon():
def __init__(self, no_of_sides):
self.n = no_of_sides
self.sides = [0 for i in range (no_of_sides)]
def inputSides(self):
self.sides = [float(input('Enter side '+str(i+1)+' : ')) for i in range(self.n)]
def dispSides(self):
for i in range(self.n):
... |
class DaiquiriException(Exception):
def __init__(self, errors):
self.errors = errors
def __str__(self):
return repr(self.errors)
|
# 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")
def glib():
http_archive(
name="glib" ,
build_file="//bazel/deps/glib:build.BUILD" ,
sha256="80753e02bd0baddfa0380... |
class Environment(object):
"""Base class for environment."""
def __init__(self):
pass
@property
def num_of_actions(self):
raise NotImplementedError
def GetState(self):
"""Returns current state as numpy (possibly) multidimensional array.
If the current state is terminal, returns None.
""... |
# QI = {"AGE": 1, "SEX": 1, "CURADM_DAYS": 1, "OUTCOME": 0, "CURRICU_FLAG":0,
# "PREVADM_NO":0, "PREVADM_DAYS":0, "PREVICU_DAYS":0, "READMISSION_30_DAYS":0}
# K = 20
CATEGORICAL_ATTRIBUTES = {"AGE": 0, "SEX": 1, "CURADM_DAYS": 0, "OUTCOME": 1, "CURRICU_FLAG":1,
"PREVADM_NO":0, "PREV... |
# Given 3 int values, a b c, return their sum.
# However, if any of the values is a teen
# -- in the range 13..19 inclusive --
# then that value counts as 0,
# except 15 and 16 do not count as a teens
#
# For example:
# no_teen_sum(1, 2, 3) → 6
# no_teen_sum(2, 13, 1) → 3
# no_teen_sum(2, 1, 14) → 3
class Exercise00... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
アプリケーション、バージョン情報
"""
APP_NAME = 'VReducer'
VERSION = '0.2.0'
def app_name():
return '{}-{}'.format(APP_NAME, VERSION)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 350 17:10:37 2020
@author: daniel
"""
mat02 = [[1,2,3], [4,5,6], [7,8,9]]
n = int ( input ("dimension del cuadro? "))
mat01 = [ [0] * n for i in range(n) ]
ren = 0
col = n // 2
for x in range (1,n*n + 1):
mat01[ren][col] = x
if x %... |
_base_ = [
'../../_base_/models/retinanet_r50_fpn.py',
'../../_base_/datasets/dota_detection_v2.0_hbb.py',
'../../_base_/schedules/schedule_2x.py', '../../_base_/default_runtime.py'
]
model = dict(
bbox_head=dict(
num_classes=18,
)
)
optimizer =dict(lr=0.01)
work_dir = './work_d... |
# -*- coding: utf-8 -*-
"""This file contains the Windows NT Known Folder identifier definitions."""
# For now ignore the line too long errors.
# pylint: disable=line-too-long
# For now copied from:
# https://code.google.com/p/libfwsi/wiki/KnownFolderIdentifiers
# TODO: store these in a database or equiv.
DESCRIPTI... |
#
# PySNMP MIB module ALCATEL-IND1-TIMETRA-SAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-TIMETRA-SAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:04:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Este programa intenta mostrar un ejemplo clásico pero considerando
la codificación (UTF8, UNICODE, TERMINAL). Además muestra como
solicitar información al usuario y como codificar/decodificar esta.
Ejemplos de ejecución:
>> python helloWorldUTF8.py
"""
# la función... |
"""
937. Reorder Data in Log Files
Easy
You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier.
There are two types of logs:
Letter-logs: All words (except the identifier) consist of lowercase English letters.
Digit-logs: All words (except the identifie... |
class Product:
def doStuff(self): pass
def foo(product):
product.doStuff() |
'''input
-1 -1 1 1
'''
a = list(map(int, input().split()))
print(abs(a[2]-a[0]) + abs(a[3]-a[1]))
|
def histogram(s):
d = dict()
for c in s:
d[c] = d.get(c, s.count(c))
return d
def invert_dict(d):
inverse = dict()
for key in d:
value = d[key]
inverse.setdefault(value, [])
inverse[value].append(key)
return inverse
h = histogram('brontosaurus')
print(invert_dic... |
# CPU: 0.06 s
line = input()
length = len(line)
upper_count = 0
lower_count = 0
whitespace_count = 0
symbol_count = 0
for char in line:
if char == "_":
whitespace_count += 1
elif 97 <= ord(char) <= 122:
lower_count += 1
elif 65 <= ord(char) <= 90:
upper_count += 1
else:
... |
"""
ID: caleb.h1
LANG: PYTHON3
PROG: friday
"""
'''
Test 1: TEST OK [0.025 secs, 9280 KB]
Test 2: TEST OK [0.025 secs, 9276 KB]
Test 3: TEST OK [0.022 secs, 9428 KB]
Test 4: TEST OK [0.025 secs, 9324 KB]
Test 5: TEST OK [0.025 secs, 9284 KB]
Test 6: TEST OK [0.025 secs, 9428 KB]
Test 7: TEST OK [0... |
# Test Program
# This program prints "Hello World!" to Standard Output
print('Hello World!')
|
"""
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Example 1:
Input: nums = [1,2,3,1]
Output: true
Example 2:
Input: nums = [1,2,3,4]
Output: false
Example 3:
Input: nums = [1,1,1,3,3,4,3,2,4,2]
Output: true
Constraints... |
# http://www.practicepython.org/exercise/2014/02/15/03-list-less-than-ten.html
# 3 listLessThanTen.py
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for i in a:
if i < 5:
print(i)
print('')
# Extra 1
b = []
for i in a:
if i < 5:
b.append(i)
print(b)
print('')
# Extra 2
print([x for x in a if ... |
"""
[2015-06-26] Challenge #220 [Hard] Substitution Cryptanalysis
https://www.reddit.com/r/dailyprogrammer/comments/3b668g/20150626_challenge_220_hard_substitution/
# [](#HardIcon) _(Hard)_: Substitution Cryptanalysis
A [substitution cipher](https://en.wikipedia.org/?title=Substitution_cipher) is one where each lette... |
# Calculadora construida em Python
# Calculadora ligada
ligado = 0
print("\n--------Calculadora em Python--------\n")
while ligado == 0:
print(u"Operações disponíveis:\n1. Soma\n2. Subtração\n3. Multiplicação\n4.Divisão\n")
verificador1 = 0
while verificador1 == 0:
operacao = int(input(u"Qual op... |
MAINNET_PORT = 18981
TESTNET_PORT = 28981
LOCAL_ADDRESS = "127.0.0.1"
LOCAL_DAEMON_ADDRESS_MAINNET = "{}:{}".format(LOCAL_ADDRESS, MAINNET_PORT)
LOCAL_DAEMON_ADDRESS_TESTNET = "{}:{}".format(LOCAL_ADDRESS, TESTNET_PORT)
DAEMON_RPC_URL = "http://{}/json_rpc"
|
def main():
compute_deeper_readings('src/december01/depths.txt')
def compute_deeper_readings(readings):
deeper_readings = 0
previous_depth = 0
with open(readings, 'r') as depths:
for depth in depths:
if int(depth) > previous_depth:
deeper_readings += 1
... |
print('=====Desafio 056=====')
somaidade=0
mediaidade=0
maioridadehomem=0
nomevelho= ''
totmulher20 = 0
for p in range(1,5):
print('----- {}ª PESSOA -----'.format(p))
nome=str(input('Nome: ')).strip()
idade=int(input('Idade: '))
sexo=str(input('[M/F]: ')).strip()
somaidade += idade
if p == 1 and... |
## https://leetcode.com/problems/unique-email-addresses/
## goal is to find the number of unique email addresses, given
## some rules for simplifying a given email address.
## solution is to write a function to sanitize a single
## email address, then map it over the inputs, then return
## the size of a set of th... |
#
# Copyright 2013-2016 University of Southern California
#
# 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 applica... |
i = 0
while i == 0:
file1 = open('APPMAKE', 'r')
Lines = file1.readlines()
count = 0
checkpoint = 0
ccount = 1
# Strips the newline character
for line in Lines:
count += 1
ccount += 1
modeset += 1
if ccount > checkpoint:
checkpoint += 1
if modeset > 2:
... |
def main():
with open("input.txt") as f:
nums = [int(line) for line in f.readlines()]
for num in nums:
for num2 in nums:
if num + num2 == 2020:
print(num * num2)
exit(0)
exit(1)
if __name__ == "__main__":
main()
|
"""Define decorators used throughout Celest."""
def set_module(module):
"""Override the module of a class or function."""
def decorator(func):
if module is not None:
func.__module__ = module
return func
return decorator
|
class ISortEntry:
"""
* Basic necessity to sort anything
"""
DIRECTION_ASC = 'ASC'
DIRECTION_DESC = 'DESC'
def set_key(self, key: str):
"""
* Set by which key the entry will be sorted
"""
raise NotImplementedError('TBA')
def get_key(self) -> str:
... |
#
# PySNMP MIB module HP-ICF-BYOD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-BYOD-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:33:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
def ficha(nome='<desconhecido>', gols=0):
print(f'O jogador {nome} fez {gols} gol(s) no campeonato.')
nome = str(input('Nome do jogador: '))
gols = str(input('Número de gols: '))
if gols.isnumeric():
gols = int(gols)
else:
gols = 0
if nome.strip() == '':
ficha(gols=gols)
else:
ficha(nome, gols) |
"""
Finds how many distinct powers generated by a^b given the range 2 ≤ a ≤ n and 2 ≤ b ≤ n
where n is a positive integer
"""
def distinct_powers(a, b):
"""
Finds and returns the number of distinct powers of a and b
Example:
>>> distinct_powers(5, 5)
15
:param a: Limit of a
:type a int
... |
# 입력 받기
n = int(input("n 번째 항: "))
# 변수 설정 및 초기값
fn = 0
fnext1 = 1
fnext2 = 1
# n번째 항 구하기
for i in range(n):
fn = fnext1
fnext1 = fnext2
fnext2 = fnext1 + fn
# 출력
print("fn:", fn)
|
# 3. Repeat String
# Write a function that receives a string and a repeat count n.
# The function should return a new string (the old one repeated n times).
def repeat_string(string, repeat_times):
return string * repeat_times
text = input()
n = int(input())
result = repeat_string(text, n)
print(result)
|
class Interval:
# interval is [left, right]
# note that endpoints are included
def __init__(self, left, right):
self.left = left
self.right = right
def getLeftEndpoint(self):
return self.left
def getRightEndpoint(self):
return self.right
def isEqualTo(self, i):
... |
#!/usr/bin/env python
if __name__ == "__main__":
with open("input") as fh:
data = fh.readlines()
two_letters = 0
three_letters = 0
for d in data:
counts = {}
for char in d:
if char not in counts:
counts[char] = 0
counts[char] += 1
if 2 in counts.values():
two_letter... |
# encoding: utf-8
# module win32uiole
# from C:\Python27\lib\site-packages\Pythonwin\win32uiole.pyd
# by generator 1.147
# no doc
# no imports
# Variables with simple values
COleClientItem_activeState = 3
COleClientItem_activeUIState = 4
COleClientItem_emptyState = 0
COleClientItem_loadedState = 1
COleClientItem_open... |
#
# PySNMP MIB module H3C-VOSIP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-VOSIP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:11:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
{
"targets": [
{
"target_name": "cpp_mail",
"sources": [
"src/cpp/dkim.cpp",
"src/cpp/model.cpp",
"src/cpp/smtp.cpp",
"src/cpp/main.cpp",
],
'cflags_cc': [ '-fexceptions -g' ],
'cflags': [ '-fexceptions -g' ],
"ldflags": ["-z,defs"],
'var... |
"""
言語処理100本ノック 2015
http://www.cl.ecei.tohoku.ac.jp/nlp100/#ch1
第1章: 準備運動
01. 「パタトクカシーー」
「パタトクカシーー」という文字列の1,3,5,7文字目を取り出して連結した文字列を得よ.
"""
strings = 'パタトクカシーー'
result_strings = ''.join([strings[s] for s in (1,3,5,7)])
print(result_strings) |
def binPack(i, array, target, dp):
if (i == len(array)):
return(0)
if (i not in dp):
dp[i] = {}
if (target not in dp[i]):
best = binPack(i + 1, array, target, dp)
if (target - array[i] >= 0):
aux = binPack(i + 1, array, target - array[i], dp) + array[i]
... |
"""
Datos de entrada
capital-->c-->int
Datos de salida
ganancia-->g-->float
"""
#Entradas
c=int(input("Ingrese la cantidad de dinero invertida: "))
#Caja negra
g=(c*0.2)/100
#Salidas
print("Su ganancia mensual es de: ", g) |
"""
0923. 3Sum With Multiplicity
Medium
Given an integer array arr, and an integer target, return the number of tuples i, j, k such that i < j < k and arr[i] + arr[j] + arr[k] == target.
As the answer can be very large, return it modulo 109 + 7.
Example 1:
Input: arr = [1,1,2,2,3,3,4,4,5,5], target = 8
Output: ... |
if __name__ == '__main__':
Str1 = '14:59~15:20'
StrList = Str1.split('~')
print(StrList)
print(StrList[0])
print(StrList[1])
|
# Copyright (C) 2011 MetaBrainz Foundation
# Distributed under the MIT license, see the LICENSE file for details.
__version__ = "0.1.0"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.