content stringlengths 7 1.05M |
|---|
n = int(input())
for i in range(n):
line = input().split()
j = 0
pos = 0
for j in range(len(line)-1):
if j != 0 and j != len(line)-1:
if int(line[j]) + 1 != int(line[j+1]) and pos == 0:
pos = j+1
print(pos) |
def somaImposto(taxa = 0, custo = 0):
total = custo * (taxa/100 + 1)
return print(f'O custo total do produto com imposto será de R${total}')
taxa = float(input('Informe a taxa de imposto para alterar o preço do produto: '))
custo = float(input('Inform o preço do produto: R$'))
somaImposto(taxa, custo) |
def simple_number(n):
if n > 2:
i = 2
lim = n ** 0.5
while i <= lim:
if n % i == 0:
return False
break
i += 1
else: return True
else: return True
def list_of_divs(n):
i = 1
new_list = []
lim = n / 2
while ... |
# https://www.interviewbit.com/problems/repeat-and-missing-number-array/
# Repeat and Missing Number Array
# Input:[3 1 2 5 3] Output:[3, 4] A = 3, B = 4
class Solution:
# @param A : tuple of integers
# @return a list of integers
def repeatedNumber(self, arr):
repeated =0
missing =0
... |
# Tons of built-in Functions
# useful resource to see built-in functions are ...
###
# https://www.w3schools.com/python/default.asp
# https://docs.python.org/3/library/functions.html
# ###
###
# abs(-1515) - absolute value
# bool() -
# input() -
# len()
# range() -
# str() -
# int() -
# ###
i ... |
a = int(input())
b = int(input())
c = int(input())
print('A = {}, B = {}, C = {}'.format(a, b, c))
print('A = {:>10}, B = {:>10}, C = {:>10}'.format(a, b, c))
print('A = {:010}, B = {:010}, C = {:010}'.format(a, b, c))
print('A = {:<10}, B = {:<10}, C = {:<10}'.format(a, b, c))
|
class IExecutor():
def exec(self, query, args=[]):
pass
def find_one(self, query, args=[]):
pass
def find_list(self, query, args=[]):
pass
|
def find_min_coins(v, arr):
res = []
i = 0
arr.sort(reverse=True)
while i < len(arr) and v > 0 :
if arr[i] <= v :
x = v//arr[i]
temp = [arr[i]]*x
res = res + temp
v = v%arr[i]
i+=1
return res
|
class dotWeldGeometry_t(object):
""" dotWeldGeometry_t(weldId: Identifier,position: int,maxPolygonPointsPerRequest: int) """
def CopyAndInitialize(self):
""" CopyAndInitialize(self: dotWeldGeometry_t) -> dotWeldGeometry_t """
pass
@staticmethod
def __new__(self, weldId, positio... |
# Bind a literal string object to a name:
a = "foo"
# Bind an empty list to another name:
b = []
# Classes are "factories" for creating new objects: invoke class name as a function:
class Foo(object):
pass
c = Foo()
# Again, but with optional initialization:
class Bar(object):
def __init__(self, initializer = N... |
"""Function returns the opposite of an input number."""
def opposite(n):
"""Return opposite of number."""
return n * -1
|
'''
字符串类型
s='abc'
type(s) # <class 'str'>
s2='10'
type(s2) # <class 'str'>
# 在字符串中输入特殊值需要转义
s3='ab\'cd'
print(s3) # ab'cd
# 换行举例
print("asd\nfas")
# asd
# fas
# 屏蔽特殊符号 使用 r
print(r"asd\nfas") # asd\nfas
# 关于字符串下标与切片的使用
name='abcde'
print(name[-1]) # e 取倒数第一个字符
print(name[-2]) # d 取倒数第二个字符
print(name[0]) # a
print... |
{
"targets": [
{
"target_name": "process",
"sources": ["src/process.cpp"],
"include_dirs": ["<!(node -e \"require('nan')\")"]
},
{
"target_name": "file",
"sources": ["src/file.cpp"],
"include_dirs": ["<!(node -e \"require('nan')\")"]
},
{
"target_name": "s... |
# Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).
# Example 1:
# Input: [1,3,5,4,7]
# Output: 3
# Explanation: The longest continuous increasing subsequence is [1,3,5], its length is 3.
# Even though [1,3,5,7] is also an increasing subsequence, it's not a c... |
n=int(input())
l1=list(map(int,input().split()))
ans=0
for i in l1:
ans=ans+float(i/100)
s2=float((ans/n)*100)
print(s2) |
# Time complexity: O(nlogn)
def find_max_crossing_subarray(A, low, mid, high):
sum, left_sum = 0, -1000000000000
for i in range(mid, low - 1, -1):
sum += A[i]
if sum > left_sum:
left_sum = sum
max_left = i
sum, right_sum = 0, -1000000000000
for i in range(mid + 1,... |
def mergeSort(list):
print("Divisão ",list)
if len(list)>1:
meio = len(list)//2
esqmet = list[:meio]
dirmet = list[meio:]
mergeSort(esqmet)
mergeSort(dirmet)
i=0
j=0
k=0
while i < len(esqmet) and j < len(dirmet):
if esqmet[i] ... |
"""
TACCJM Exceptions
"""
__author__ = "Carlos del-Castillo-Negrete"
__copyright__ = "Carlos del-Castillo-Negrete"
__license__ = "MIT"
class TJMCommandError(Exception):
"""
Custom exception to wrap around executions of any commands sent to TACC
resource. This exception gets thrown first by the _execute_... |
# https://leetcode.com/problems/house-robber-ii/
class Solution:
def rob(self, nums: List[int]) -> int:
return max(nums[0], self.helper(nums[1:]), self.helper(nums[:-1]))
def helper(self, nums):
rob1, rob2 = 0, 0
for n in nums:
newRob = max(rob1 + n, rob2)... |
x = (5, 6)
def f():
return (7, 8)
f()
|
#023: Faça um programa que leia um número de 0 a 9999 e mostre na tela cada um dos dígitos separados.
numero = input("Digite um numero: ")
space = " ".join(numero)
print(space)
lista = space.split()
print(lista)
tamanho = len(lista)
print(tamanho)
if tamanho == 4:
print(f"Unidade: {lista[3]:>2}\n"
f"Deze... |
class QueryResponse:
key = ""
num_args = 0
arg_types = []
f = None
description = ""
def __init__(self, key, num_args, arg_types, f):
self.key = key
self.num_args = num_args
self.arg_types = arg_types
self.f = f
# TODO: validate arg_types
|
# Modify the checkAnswer method of the Question class so that it does not take into
# account different spaces or upper/lowercase characters. For example, the response
# "GUIDO van Rossum" should match an answer of "Guido van Rossum" .
class Question:
def __init__(self):
self._text = ""
self._answ... |
# Float or double : 34.567839023, 12.345, 8923.1234857, 3456.091
'''
In Python there is only one built in datatype
that handle single point precision - float.
Python3.x has single floating number precision of (17-18) equivalent of C#9's double (16-17 symbols)
'''
float_numbers = [34.567839023,12.345,8923.1234857, 34... |
#Desafio 006
print("\n Desafio 006")
number=int(input('Insira um número, por favor:'))
number1=int(number**2) #Armazena o valor da potência do número digitado acima
number2=float(number**(1/2)) #Armazena o valor flutuante da raíz quadrada do número digitado acima
print('O resultado da potência corresponde a {}'.format... |
base = float(input('Insira a base: '))
altura = float(input('Insira a altura: '))
if base and altura <= 0:
print('Base e/ou altura inválidos. É permitido somente números maiores que 0')
else:
perimetro = 2 * base + 2 * altura
centimetro = perimetro
polegadas = centimetro * 2.54
jardas = polegadas ... |
# Entrada de dados
print('\033[34m{:_^40}'.format('TABUADA'))
numero = int(input('Qual a tabuada que você quer saber?'))
# Saída de dados
print('{} x 1 = {}'.format(numero, numero*1))
print('{} x 2 = {}'.format(numero, numero*2))
print('{} x 3 = {}'.format(numero, numero*3))
print('{} x 4 = {}'.format(numero, numero*4)... |
#
# PySNMP MIB module Juniper-File-Transfer-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-File-Transfer-CONF
# Produced by pysmi-0.3.4 at Wed May 1 14:02:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... |
#author: Luca Rospocher
class Object1:
def __init__(self):
self.field1 = 0
self.field2 = ""
pass
class Object2:
def __init__(self):
self.field1 = 0
self.field2 = False
self.field3 = []
self.field4 = []
pass
list1 = []
list2 = []
def main... |
n=int(input())
x=1
ans=0
while(x<=n):
ans+=n//x
x*=3
print(ans) |
class Node:
def __init__(self, key, val):
self.key = key
self.val = val
self.next = None
self.prev = None
def __str__(self):
# For debugging
return f"(key={self.key}, val={self.val})"
class LinkedList:
def __init__(self):
# Note: sent... |
#Question:
#Take User age as input and check if they are more than 18 or not. If they are more
#than 18 years old allow them to drive else stop them.
#Your answer should look like :
#You are 18 years old so you can drive,Have a good Journey
#or, You can't drive
#Answer:
age = int(input("Enter your age: "))... |
# The Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them. He says: 'A lion is never afraid of a hundred sheep'.
# Nevertheless Shapur has to find weaknesses in the Roman army to defeat them. So he gives the army a weakness number.
# In Shapur's opinion the we... |
'''
Speed: 99.48%
Memory: 81.78%
Time Complexity: O(N*M) where N = len(s1) and M = len(s2)
'''
class Solution:
def minDistance(self, s1: str, s2: str) -> int:
@lru_cache(None)
def editdistance(i,j,s1=s1,s2=s2):
if not i:
return j
... |
"""
Stworz klase Ulamek reprezentujaca liczby ulamkowe.
Kazdy obiekt typu Ulamek powinien miec dwa atrybuty: self.licznik oraz self.mianownik.
Glownym celem zadania jest dorobienie imlementacji, dzieki ktorej mozliwe stanie sie
dodawanie, mnozenie, dzielenie i odejmowanie od siebie dwoch obiektow ty... |
# Ex. 077
palavras = ("macaco", "dinheiro", "cidade", "paralelepipedo", "anticonstitucionalissimamente",
"pneumoultramicroscopicossilicovulcanoconioticos")
for palavra in palavras: # Pega cada palavra de uma vez só
print(f"A palavra {palavra} tem a(s... |
# [剑指 Offer 第 2 版第 52 题] “两个链表的第一个公共结点”做题记录
# 第 52 题:两个链表的第一个公共结点
# 传送门:两个链表的第一个公共结点,牛客网 online judge 地址。
# 输入两个链表,找出它们的第一个公共结点。
# 样例:
# 给出两个链表如下所示: A: a1 → a2 ↘ c1 → c2 → c3 ↗ B:b1 → b2 → b3 输出第一个公共节点 c1。
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def f... |
'''
You all have seen how to write loops in python. Now is the time to implement what you have learned.
Given an array A of N numbers (integers), you have to write a program which prints the sum of the elements of array A with the corresponding elements of the reverse of array A.
If array A has elements [1,2,3], then ... |
#
# PySNMP MIB module ELTEX-MES-IpRouter (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-IpRouter
# Produced by pysmi-0.3.4 at Mon Apr 29 18:47:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
# 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
def __repr__(self):
if self:
return "{} -> {} -> {}".format(self.val,self.left, self.right)
class Trim:
def tr... |
# The setup function is run once at the beginning
def setup():
# Create a canvas of size 800 x 800
size(800, 500)
# Set the background color to white
background(255, 255, 255)
# Color the shapes black
fill(0)
# No shape outline
noStroke()
# The draw function is run every frame of animat... |
class Solution:
def rotateTheBox(self, box: list[list[str]]) -> list[list[str]]:
if len(box) == 0:
return box
rows = len(box)
cols = len(box[0])
ROCK, OBSTACLE, EMPTY = '#', '*', '.'
for row in box:
nearest_obstacle = cols
for index, cell... |
"""
Module version
==============
Just the version of the ASE2SPRKKR package.
"""
#: Version number of the ASE2SPRKKR package
__version__ = "1.0.5"
|
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... |
EXPECTED_OUTPUT = """
fantom
├── opera
│ └── geth (default)
├── testnet
│ └── geth (default)
└── local (default)
└── test (default)
""".strip()
def assert_rich_text(actual: str, expected: str):
"""
The output from `rich` causes a bunch of extra spaces to
appear at the end of each line. For eas... |
def test_counter_ip_dscp(api, b2b_raw_config, utils):
"""
Configure a raw IPv4 flow with,
- all Dscp values
Validate,
- Fetch the IPv4 header config via restpy and validate
against expected
"""
f = b2b_raw_config.flows[0]
f.packet.ethernet().ipv4()
ipv4 = f.packet[1]
phb =... |
nome = str(input('Qual é seu nome? ')).strip().lower()
if nome == 'joão':
print('Que nome lindo você tem!!!')
else:
print('(Seu nome é tão normal...)')
print(f'Olá, {nome.title()}!')
|
frase = str(input('Digite a frase: ')).strip().upper()
palavras = frase.split()
junto = ''.join(palavras)
inverso = ''
for letra in range(len(junto)-1, -1, -1):
inverso += junto[letra]
if inverso == junto:
print('São Palindromos') |
class Worker:
def __init__(self, name: str, surname: str, position: str, income: dict):
self.name = name
self.surname = surname
self.position = position
self._income_wage = income['wage']
self._income_bonus = income['bonus']
class Position(Worker):
def get_full_name(se... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"ls": "01_utils.ipynb",
"Path.ls": "00_dup_finder.ipynb",
"Path.lf": "00_dup_finder.ipynb",
"Path.ld": "00_dup_finder.ipynb",
"ls_print": "01_utils.ipynb"}
modules = ["dup... |
def tsearch (l, r, f):
while (r-l > 0.01): # precision en x
m1 = (r+2*l)/3
m2 = (2*r+l)/3
if f(m1)>f(m2): # maximo
r = m2
else:
l = m1
return l
def bsearch (l, r, v, f):
while (r-l > 0.01): # precision en x
med = (l+r)/2
... |
def print_birthdays(people):
"""print names of people in birthdays dictionary
The birthdays dictionary contains names as keys and birthdays as values.
When the function is invoked, it returns the names of the people in the
dictionary built in the program
:return: None
:rtype: Boolean
"""
... |
class Solution:
def XXX(self, root: TreeNode) -> int:
if root is None:
return 0
st = list()
res = 0
while st or root:
while root:
st.append(root)
root = root.left if root.left else root.right
res = max(res, len(st))
... |
#!/usr/bin/env python3
num_inputs = 16
print(f"""
--------------------------------------------------------------------------------
-- Block: avg{num_inputs}
-- Description:
-- This block implements a big adder with {num_inputs} inputs.
-- There are several add stages to improve timing.
--
----------------------------... |
class Solution:
def calculate(self, s: str) -> int:
res, num, sign, stack = 0, 0, 1, []
for c in s:
if c.isdigit():
num = 10 * num + int(c)
elif c == "+" or c == "-":
res += sign * num
num = 0
sign = 1 if c == "+... |
class PD_FeedbackLinearization_Controller:
"""PD + フィードバック線形化"""
Kd = 200
Kp = 1e4
def __init__(self,):
pass
|
class BadHTTPResponse(Exception):
def __init__(self, code):
msg = f"The bridge returned HTTP response code {code}"
class BadResponse(Exception):
def __init__(self, text):
msg= f"The bridge returned an unrecognized response {text}"
class InvalidColorSpec(Exception):
def __init__(self, colorspec):
msg = "Inval... |
#desafio33. Faça um progama que leia três números e mostre qual é o maior e qual e o menor.
a = int(input())
b = int(input())
c = int(input())
#verificando que é o menor:
menor = a
if b < a and b < c:
menor = b
if c < a and c < b:
menor = c
#verificando quem é o maior:
maior = a
if b > a and b > c:
maior = ... |
def add_zeros(element):
"""This changes the format of postcodes to string with the needed zeros
Args:
element: individual row from apply codes
Returns:
parameter postcode value with zeros
"""
#postinumeroihin etunollat jos on ollut integer
elem... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
de... |
n = input('Digite uma operação: ')
lista = []
for c in n:
if c == '(':
lista.append('(')
elif c == ')':
if len(lista) > 0:
lista.pop()
else:
lista.append(')')
break
if len(lista) == 0:
print('Essa expressão é valida')
else:
print('Essa esxpressão é invalida') |
class Color:
def __init__(self, r, g, b):
self.r = r
self.g = g
self.b = b
def __str__(self):
return f"最大的是的{self.r}"
def __lt__(self, other):
return self.r < other.r
list_color = [Color(102, 178, 120), Color(135, 156, 129),
Color(110, 137, 117)]
pr... |
class BaseExporter(object):
"""
The base class of all exporters.
"""
def __init__(self, document):
self.document = document
def export(self):
raise NotImplementedError
def as_text(self):
return "\n".join(list(self.export()))
class ExporterError(Exception):
pass |
task = {i + 1: 0 for i in range(12)}
for i in range(int(input())):
task[int(input())] += 1
for i in sorted(filter(lambda key: task[key] != 0, task)):
print(i, task[i])
|
def remote_field(field):
# remote_field is new in Django 1.9
return field.remote_field if hasattr(field, 'remote_field') else getattr(field, 'rel', None)
def remote_model(field):
# remote_field is new in Django 1.9
return field.remote_field.model if hasattr(field, 'remote_field') else field.rel.to
d... |
def f():
i: i32
i = 4
print(i // 0)
f()
|
MAX = 1000000
def breakSum(n):
dp = [0] * (n + 1)
dp[0] = 0
dp[1] = 1
for i in range(2, n + 1):
dp[i] = max(dp[int(i / 2)] + dp[int(i / 3)] + dp[int(i / 4)], i);
return dp[n]
n = 24
print(breakSum(n))
|
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
dictIndex = {}
for i in range(len(nums)):
n = target - nums[i]
if n in dictIndex:
return [dictIndex[n], i]
dictIndex[nums[i]] = i
return [-1, -1]
|
"""comprehensions - do more with less!"""
print("===== Intermediate =====")
nested = [
[x * y for y in range(1, 11)]
for x in range(1, 11)
]
print("nested:", nested)
multiple_ifs = [
f"{char}{num}" for char in "AbCDe" for num in range(26)
if char.isupper()
if not num % 5
]
print("multiple_ifs:", m... |
class Solution:
# 1st brute-froce solution
# def maxProfit(self, prices: List[int]) -> int:
# d = len(prices)
# lst = [0]
# for i in range(d):
# for j in range(i + 1, d):
# profit = prices[j] - prices[i]
# if profit > 0:
# l... |
n = 0
tot = 0
soma = 0
while n != 999:
n = int(input('Digite um número inteiro, ou 999 para encerrar o programa: '))
if n != 999:
tot += 1
soma += n
print('Você digitou {} números e a soma de todos eles é {}'.format(tot, soma))
#VERSÃO DO GUANABARA
'''núm = cont = soma = 0
núm = int(input('Dig... |
# String
# Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; otherwise, it will return false.
#
# Each letter in the magazine string can only be used once in your ransom n... |
#Integers Come In All Sizes
#https://www.hackerrank.com/challenges/python-integers-come-in-all-sizes/problem
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(a**b + c**d)
|
class Dummy:
"""
Implements a dummy class that is completely inert.
"""
def __init__(self, *args, **kwargs):
pass
def __getattr__(self, item):
return self.dummy_function
def __setattr__(self, key, value):
pass
def dummy_function(*args, **kwargs):
pass
|
#############################
# www.adventofcode.com/2021 #
# Challenge: Day 4 #
#############################
def main_01():
with open('input_demo.txt', 'r') as f:
data = f.read().splitlines()
# Get the bingo numbers from the input and convert them to integers
bingoNumbers = data[0].spli... |
L=[]
for i in range(1,9): L.append((i,int(input())))
L=sorted(sorted(L,key=lambda x:x[1],reverse=True)[:5],key=lambda x:x[0])
print(sum(i[1] for i in L))
for i in L: print(i[0],end=' ') |
# Задача 1. Вариант 31.
# Напишите программу, которая будет сообщать род деятельности и псевдоним под которым скрывается Эмиль Эрзог.
# Shemyakin A.V.
# 29.02.2016
input ("Андре Моруа, более известный как Эмиль Саломон Вильгельм Эрзог, французский писатель и член Французской академии. Примечание: впоследствии псевдон... |
#
# PySNMP MIB module ELTEX-TAU8 (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-TAU8
# Produced by pysmi-0.3.4 at Wed May 1 13:02:27 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, 09:... |
# * ex10 - Ler um conjunto de 10 dados contendo, cada um, a altura e sexo de alunos. Calcular e escrever - a quantidade de homens da turma. -a média de altura das mulheres.
i = 1
man = media = altura = 0
while i <= 10:
sexo = str(input('Insira "h" para homem e "m" para mulher: '))
if sexo == 'm':
alt... |
class DatabaseConfig:
def __init__(self,
driver: str = None,
host: str = None,
database: str = None,
username: str = None,
password: str = None,
):
self.driver = driver
self.host = host
self... |
names = ['wangfan','wagfan1','wangfan2']
for name in names:
print(name)
for value in range(1,5):
print(value)
numbers = list(range(1,6))
print(numbers)
even_number = list(range(2,11,2))
print(even_number)
squers = []
for value in range(1,11):
squers.append(value ** 2)
print(squers)
print(min(squers))
... |
numInt=int(input("Digite o número inteiro para tabuada"))
numMult=1
while numMult <= 10:
calculo = numMult*numInt
print("A tabuada é", numInt, "x",numMult ,"=", calculo)
numMult=numMult+1
|
class CalibrationProcess:
def __init__(self, calibrator_factory):
if calibrator_factory is None:
raise TypeError('calibrator_factory')
self._calibrator_factory = calibrator_factory
def calibrate(self):
calibrate_another = True
while calibrate_another:
while True:
ready = input('Is the device conne... |
level = 3
name = 'Soreang'
capital = 'Soreang'
area = 25.51
|
class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
# https://leetcode.com/problems/max-consecutive-ones/
maxLength = 0
curLength = 0
for n in nums:
if n == 1:
curLength = curLength + 1
else:
... |
def get_book_by_osis_id(id):
"""
Retrieves book meta data
:param id: the osis book id
:return:
"""
sort = find_key(id, osis_ids)
return get_book_by_sort(sort)
def get_book_by_sort(sort):
"""
Retrieves book metadata
:param sort: the sort order of the book to look up
:return:
... |
try:
age = int(input("Enter your age: "))
if (age > -1 and age < 101):
if (age >= 18):
print("Eligible for voting!")
else:
print("Not Eligible for Voting")
else:
print("Invalid Age!")
except:
print("You've entered invalid age")
... |
# pysam versioning information
__version__ = "0.16.0.1"
__samtools_version__ = "1.10"
__bcftools_version__ = "1.10.2"
__htslib_version__ = "1.10.2"
|
class SHA1():
'''SHA1 Class'''
def __init__(self):
'''Computes SHA1 hashed value of given string'''
self.f_funcs = [self.f1, self.f2, self.f3, self.f4]
K = ['5A827999', '6ED9EBA1', '8F1BBCDC', 'CA62C1D6']
self.K = list(map(self.hex2bin, K))
def __str__(self):
retur... |
# CALCULANDO DESCONTOS
# Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto.
x = float(input('Qual o valor do produto? '))
a = x-(x * 0.05)
print(f'O valor do produto com 5% de desconto é: R${a:.2f}')
|
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
def envoy_py_test(name, package, visibility, envoy_prefix = "@envoy"):
filepath = "$(location %s//tools/testing:base_pytest_runner.py)" % envoy_prefix
output = "$(@D)/pytest_%s.py" % name
native.genrule(
name = "generate_pytest_" + ... |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/lzh/racecar_ws/src/lslidar_ws/src/lslidar_c16/lslidar_c16_msgs/msg/LslidarC16Layer.msg;/home/lzh/racecar_ws/src/lslidar_ws/src/lslidar_c16/lslidar_c16_msgs/msg/LslidarC16Packet.msg;/home/lzh/racecar_ws/src/lslidar_ws/src/lslidar_c16/lslidar_c16_... |
"""
Example .csv file contents that should be parsable as a mapping, or should fail
Used in test_mapping.
"""
BASIC_MAPPING = r"""
## DESCRIPTION ##,,,
some comment by some person,,,
,,,,
## OPTIONS ##,,,
destination_path,\\someserver\share\folder1,,
pims_key,555,,
## MAPPING ##,,,
source,patient_id,patient_name,descr... |
# ------------------------------
# 343. Integer Break
#
# Description:
# Given a positive integer n, break it into the sum of at least two positive integers and maximize
# the product of those integers. Return the maximum product you can get.
#
# Example 1:
# Input: 2
# Output: 1
# Explanation: 2 = 1 + 1, 1 × 1 = 1.... |
# __init__.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:55 PM
# Open GoPro API Versions to test
versions = ["1.0", "2.0"]
# Cameras to test. This assumes that a camera with the given name is advertising.
# TODO m... |
coef = 0.3
sum = 5000000
result = coef * sum
print("На IOS", result, "завантажень")
|
class ResponseQueue:
RESULT_SUCCESS = "success"
RESULT_FAILURE = "failure"
RESULT_CANCEL = "canceled"
CANCEL_RESULT_CANCELLING = "cancelling"
CANCEL_RESULT_FAILURE = RESULT_FAILURE
CANCEL_RESULT_FINISHED = "finished"
def __init__(self, queue):
self.queue = queue
def ack(self, ... |
#coding: utf-8
BASE = ''
routes_in = (
(BASE + '/index', BASE + '/kolaborativa/default/index'),
(BASE + '/principal', BASE + '/kolaborativa/default/principal'),
(BASE + '/user/$anything', BASE + '/kolaborativa/default/user/$anything'),
(BASE + '/user_info/$anything', BASE + '/kolaborativa/default/user_... |
x = int(input())
y = int(input())
range_xy = range(x+1, y)
if (x > y):
range_xy = range(y+1, x)
sum_xy = 0
for i in range_xy:
if i % 2 != 0:
sum_xy = sum_xy + i
print(sum_xy)
|
class Stack(object):
"""Stack"""
def __init__(self):
self.__list = []
def push(self, item):
"""添加一个新的元素item"""
self.__list.append(item)
def pop(self):
"""弹出栈顶元素"""
return self.__list.pop()
def peek(self):
"""返回栈顶元素"""
if self.__list:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.