content stringlengths 7 1.05M |
|---|
def basic_align(seq1, seq2):
score = 0
if len(seq1) == len(seq2):
for base1, base2 in zip(seq1, seq2):
if base1 == base2:
score += 1
else:
score -= 0
return score
def aa_extract(file):
aa_list = []
for line in file:
if line.s... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 20 20:51:09 2017
@author: sruti
"""
#python learning
# This program prints Hello, world!
print('Hello, world!') |
## after apply any leyer of the forward function in pytorch
iimg=input[:,:3,:,].cpu().data.numpy()
# print(img.shape)
img = np.squeeze(img)
# print(img.shape)
img=np.transpose(img,(1,2,0))
img = cv2.resize(img,(256,256))
cv2.imshow('out',img)
cv2.waitKey(0)
|
b=int(input())
x_1=b
i=0
while True:
a=b//10+(b%10)
b=(b%10)*10+a%10
i+=1
x=b
if x==x_1:
break
print(i)
|
class Stack:
def __init__ (self):
self.elements = []
def is_empty(self):
return self.elements == []
def push(self, item):
self.elements.append(item)
def pop(self):
return self.elements.pop()
def peek(self):
return self.elements[-1]
def size(self):
... |
# -*- coding: utf-8 -*-
# open repositories
"""Todo: move src for acquiring data"""
'http://www.opendoar.org/countrylist.php'
better = 'http://oaister.worldcat.org/'
# Should access Terms and Conditions all the time.
|
n = int(input())
l = []
for i in range(1, n):
if (i < 3):
l.append(1)
else:
l.append(l[len(l) - 1] + l[len(l) -2])
print(i, ": ", l[i-1])
|
python = Runtime.createAndStart("python","Python")
mouth = Runtime.createAndStart("Mouth","MouthControl")
arduino = mouth.getArduino()
arduino.connect('COM11')
jaw = mouth.getJaw()
jaw.detach()
jaw.attach(arduino,11)
mouth.setmouth(110,120)
mouth.autoAttach = False
speech = Runtime.createAndStart("Speech","AcapelaSpeec... |
"""
Counting power sets
http://www.codewars.com/kata/54381f0b6f032f933c000108/train/python
"""
def powers(lst):
return 2 ** len(lst) |
# -*- coding: utf-8 -*-
if __name__ == '__main__':
s = input()
t = input()
mod_s = s
for i in range(len(s)):
mod_s = mod_s[1:] + mod_s[0]
if mod_s == t:
print('Yes')
exit()
print('No')
|
"""
백준 16727번 : ICPC
"""
p1, s1 = map(int, input().split())
s2, p2 = map(int, input().split())
if p1 + p2 > s1 + s2:
print('Persepolis')
elif p1 + p2 == s1 + s2:
if p2 > s1:
print('Persepolis')
elif p2 < s1:
print('Esteghlal')
else:
print('Penalty')
else:
print('Esteghlal')... |
def test_cep_match(correios):
matches = correios.match_cep(cep="28620000", cod="QC067757494BR")
assert matches
def test_cep_not_match_wrong_digit(correios):
matches = correios.match_cep(cep="28620000", cod="QC067757490BR")
assert not matches
def test_cep_not_match(correios):
matches = correios... |
# This problem was recently asked by Apple:
# You are given an array. Each element represents the price of a stock on that particular day.
# Calculate and return the maximum profit you can make from buying and selling that stock only once.
def buy_and_sell(arr):
# Fill this in.
maxP = -1
buy = 0
sell... |
#reference_number = 9
text = ' is a prime number '
print('................................')
#print('This are numbers which can be divided into ' + str(reference_number))
for i in range(1, 100):
first = i / i
second = i/1
# print('Residual value of dividing ' + str(i) + ' / ' + str(reference_number) + ' = '... |
def test_a():
x = "this"
assert "h" in x
def test_b():
x = "hello"
assert "h" in x
def test_c():
x = "world"
assert "w" in x |
#
# PySNMP MIB module AIPPP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AIPPP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:00:42 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:23... |
#000403_01_10_ex03_Div.py
a = int(input())
b = int(input())
if b != 0:
print(a/b)
else:
print("Деление невозможно, b = ", b)
# дополняем условие: просим еще раз ввести "b" (если произошел случай "else", просим еще раз ввести "b")
if b != 0:
print(a/b)
else:
# print("Деление невозможно, b = ", b)
b =... |
class S:
"""
Gets all keys from a dict and adds them
as attribute to a class (also works with nested dicts)
Parameters
----------
data : ``dict`
The dict you want to convert
"""
def __init__(self, data: dict) -> None:
self.__raw = data
class _(dict):
... |
#350111
#a3_p10.py
#Alexandru Sasu
#a.sasu@jacobs-university.de
def printframe(n, m, c):
for j in range(0,m):
print(c,end="")
print()
for i in range (1,n-1):
print(c,end="")
for j in range(1,m-1):
print(" ",end="")
print(c)
for j in range(0,m):
print(c,end="")
print()
n=int(input())
m=int(input())
c=i... |
x = True
y=False
print(x,y)
num1=1
num2=2
resultado=num1<num2
print(resultado)
if(num1 < num2):
print("el valor num1 es menor que num2")
else:
print("el valor de num1 No es menor que num2") |
class Solution:
def isMirrorImage(self, left, right):
if left is None and right is None:
return True
if left is None or right is None:
return False
if left.val != right.val:
return False
return self.isMirrorImage(left.left, right.right) a... |
# -*- coding: utf-8 -*-
#
# DVR-Scan: Find & Export Motion Events in Video Footage
# --------------------------------------------------------------
# [ Site: https://github.com/Breakthrough/DVR-Scan/ ]
# [ Documentation: http://dvr-scan.readthedocs.org/ ]
#
# This file contains all code for the ma... |
# flake8: noqa
def test_variable_substitution(variable_transform):
text = "cd $HOME"
assert variable_transform(text) == "cd %s" % HOME
def test_variable_substitution_inverse(variable_transform):
text = "cd %s" % HOME
assert variable_transform(text, inverse=True) == "cd $HOME"
def test_variable_sub... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
if not head or head.next == None:
return head
temp_dict = dict()
pre = head
... |
cores = {'limpo': '\033[m',
'vermelho': '\033[1;31m',
'verde': '\033[1;32m',
'azul': '\033[1;34m'}
C = float(input('Indique a temperatura em °C: '))
F = 9 * C / 5 + 32
if C > 32:
print(f'A temperatura {cores["vermelho"]}{C}°C{cores["limpo"]} é igual à {cores["vermelho"]}{F}°F{cores["limpo... |
def binary_search(data, value):
min = 0
max = len(data) - 1
while min <= max:
mid = (min + max) // 2
if data[mid] == value:
return mid
elif data[mid] < value:
min = mid + 1
else:
max = mid - 1
return -1
if __name__ == '__main__':
d... |
def jac_uniform(mesh, mask):
# create Jacobian
cv = mesh.get_control_volumes(cell_mask=mask)
cvc = mesh.get_control_volume_centroids(cell_mask=mask)
return 2 * (mesh.node_coords - cvc) * cv[:, None]
|
def pig_it(text):
l=text.split()
count=0
for i in l:
if i.isalpha():
tmp=list(i)
tmp.append(tmp[0])
tmp.pop(0)
tmp.extend(list('ay'))
l[count]=''.join(tmp)
count+=1
return ' '.join(l)
'''
def pig_it(text):
lst = text.split... |
{
"targets": [
{
"target_name": "glfw",
"sources": [
"src/native/glfw.cc",
"src/native/glad.c"
],
"include_dirs": [
"src/native/deps/include",
"<!@(pkg-config glfw3 --cflags-only-I | sed s/-I//g)"... |
def foo():
return 'bar'
COMMAND = foo
|
class HomeEventManager:
def __init__(self, model):
self._model = model
def handle_mouse_event(self, event):
for button in self.model.buttons:
if button.rect.collidepoint(event.pos):
return button
return None
@property
def model(self):
return... |
class HashMap:
def __init__(self, size):
self.size = size
self.map = [None] * self.size
self.index = -1
def __str__(self):
"""
Method from HashMap that prints indices, keys, and values in map
In: None
Out: string
"""
if self.map is not N... |
errors = {
"BadRequest": {"message": "Bad Request", "status": 400},
"Forbidden": {"message": "Forbidden", "status": 403},
"NotFound": {"message": "Resource Not Found", "status": 404},
"MethodNotAllowed": {"message": "Method Not allowed", "status": 405},
"Conflict": {
"message": "You can not ... |
class Node:
def __init__(self, data, depth):
children_count = int(data.pop(0))
metadata_count = int(data.pop(0))
self.children = []
self.metadata = []
self.depth = depth
for i in range(children_count):
self.children.append(Node(data, depth + 1))
... |
"""
Tuples:
1. immutable
2. heterogeneous data structures (i.e., their entries have different meanings)
3. ordered data structure that can be indexed and sliced like a list.
4. defined by listing a sequence of elements separated by commas, optionally contained within parentheses: ()
ex:
my_... |
primeiro = int(input('Primeiro termo:'))
razão = int(input('Razão: '))
decimo = primeiro + ( 10 - 1) * razão
for c in range (primeiro ,decimo + razão ,razão):
print(f'{c}', end='->')
print('Acabou ;)') |
#WAP to print the grade
s1 = float(input("Enter marks for subject 1 :"))
s2 = float(input("Enter marks for subject 2 :"))
s3 = float(input("Enter marks for subject 3 :"))
s4 = float(input("Enter marks for subject 4 :"))
total = s1 + s2 + s3 + s4
avg = total / 4
print('Average marks:',avg)
if avg >= 90:
... |
pets = []
simba = {
'tipo': 'leão',
'dono': 'lucas',
}
barney = {
'tipo': 'gato',
'dono': 'miguel',
}
margarida = {
'tipo': 'tartaruga',
'dono': 'adriana',
}
pets.append(simba)
pets.append(barney)
pets.append(margarida)
for pet in pets:
for key, value in pet.items():
print(f"{ke... |
SAMPLEEXECUTION_TYPE_URI = "https://w3id.org/okn/o/sd#SampleExecution"
SAMPLEEXECUTION_TYPE_NAME = "SampleExecution"
GRID_TYPE_URI = "https://w3id.org/okn/o/sdm#Grid"
GRID_TYPE_NAME = "Grid"
DATASETSPECIFICATION_TYPE_URI = "https://w3id.org/okn/o/sd#DatasetSpecification"
DATASETSPECIFICATION_TYPE_NAME = "DatasetSpecifi... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
total = 0
n = int(input(''))
size = list(map(int, input().split()))
m = int(input(''))
for i in range(m):
order = list(map(int, input().split()))
if order[0] in size:
total = total + order[1]
size.remove(order[0])
print(total)... |
def missingTwo(nums: [int]) -> [int]:
ret = 0
for i, num in enumerate(nums):
ret ^= (i + 1)
ret ^= num
ret ^= len(nums) + 1
ret ^= len(nums) + 2
mask = 1
while mask & ret == 0:
mask <<= 1
a, b = 0, 0
for i in range(1, len(nums) + 3):
if i & mask:
... |
def diff_records(left, right):
'''
Given lists of [year, value] pairs, return list of [year, difference] pairs.
Fails if the inputs are not for exactly corresponding years.
'''
assert len(left) == len(right), \
'Inputs have different lengths.'
num_years = len(left)
results = []
... |
#!/usr/bin/python3
# -*- encoding="UTF-8" -*-
#parameters
listR = [] #
listC = []
listL = []
listM = []
listE = []
listF = []
listG = []
listH = []
listD = []
listDCV = []
listSinV = []
listPulseV = []
listACV = []
listDCI = []
listSinI = []
listDCParam = []
listACParam = []
listTranParam = []
listPlotDC = []
list... |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
The symmetry package implements symmetry tools, e.g., spacegroup determination,
etc.
"""
|
def math():
while True:
i_put = int(input())
if i_put == 0:
break
else:
for i in range(1, i_put+1):
for j in range(1, i_put+1):
print(i, end=' ')
j += 1
print()
if __name__ == '__main__':
m... |
PLUGIN_NAME = 'plugin'
PACKAGE_NAME = 'mock-plugin'
PACKAGE_VERSION = '1.0'
def create_plugin_url(plugin_tar_name, file_server):
return '{0}/{1}'.format(file_server.url, plugin_tar_name)
def plugin_struct(file_server, source=None, args=None, name=PLUGIN_NAME,
executor=None, package_name=PACKAG... |
"""
Author Samuel Souik
License MIT
endswith.py
"""
def endswith(string, target):
"""
Description
----------
Check to see if the target string is the end of the string.
Parameters
----------
string : str - string to check end of\n
target : str - string to search for
Returns
... |
v1 = int(input("Digite um número: "))
v2 = int(input("Digite outro número: "))
v3 = int(input("Digite o último número: "))
# verificando o maior
if v1 > v2 and v1 > v3:
maior = v1
else:
if v2 > v3:
maior = v2
else:
maior = v3
# verificando o menor
if v2 > v1 and v3 > v1:
menor = v1
else... |
# Title: Reverse Linked List II
# Link: https://leetcode.com/problems/reverse-linked-list-ii/
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Problem:
def reverse_between(self, head: ListNode, m: int, n: int) -> ListNode:
cur = head
... |
# -*- coding: utf-8 -*-
"""Collection of exceptions raised by requests-toolbelt."""
class StreamingError(Exception):
"""Used in :mod:`requests_toolbelt.downloadutils.stream`."""
pass
|
class TestImporter:
domain_file = "test/data/domain-woz.xml"
dialogue_file = "test/data/woz-dialogue.xml"
domain_file2 = "test/data/example-domain-params.xml"
dialogue_file2 = "test/data/dialogue.xml"
# def test_importer(self):
# system = DialogueSystem(XMLDomainReader.extract_domain(self.d... |
# define a function that:
# has one parameter, a number, and returns that number tripled.
# Q1: What do you name the function?
# A: number_tripled
# Q2: What are the parameters, and what types of information do they refer to?
# A: one parameter of type number
# Q2: What calculations are you doing with that informat... |
#Programa que leia o salário de um funcionario e depois o novo salario
#com aumento de 15%
oldsal = float(input('Digite o salário atual: '))
amnt = 0.15
newsal = oldsal + (oldsal*amnt)
print('O salário de {:.2f} com aumento de 15% ficará {:.2f}'.format(oldsal,newsal)) |
#Crie um programa que leia o nome de uma pessoa e diga se ela tem 'SILVA' no nome.
nome = str(input("Digite um nome qualquer: "))
print('\nOlá {}. Seu nome tem SILVA?: {}'.format(nome, 'SILVA'in nome.upper()))
|
n1= int(input('Digite um número '))
db= n1*2
tpl= n1*3
rz= n1 ** (1/2)
print('o dobro do número é {}, e o seu triplo é {}, e ele é a raiz quadrada de {}'.format(db, tpl, rz))
|
def factorial(x):
if x <= 0:
return x+1
else:
return x * factorial(x-1)
result = []
while True:
try:
n = input().split()
a = int(n[0])
b = int(n[1])
result.append(factorial(a) + factorial(b))
except EOFError:
break
for i in range(0,len(result)):
print(r... |
# OUT OF PLACE retuns new different dictionary
def replace_dict_value(d, bad_val, good_val):
new_dict = {}
for key, value in d.items():
if bad_val == value:
new_dict[key] = good_val
else:
new_dict[key] = value
return new_dict
og_dict = {'a':5,'b':6,'c':5}
print(og_d... |
Dict = {1:'Amrik', 2: 'Abhi'}
print (Dict)
##call
print(Dict[1])
print(Dict.get(2)) |
##HEADING: Primality algorithm
#PROBLEM STATEMENT:
"""
TO CHECK WHETHER AN INTEGER IS PRIME OR NOT.
IF THE INTEGER IS PRIME RETURN TRUE.
ELSE RETURN FALSE.
"""
#SOLUTION-1: (BRUTE_FORCE) --> O(n)
def isPrime1(n: int) -> bool:
if(n<=1):
return False
elif(n==2):
return True
else:... |
"""
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
... |
# Copyright (c) 2016-2017 Dustin Doloff
# Licensed under Apache License v2.0
load(
"@bazel_toolbox//labels:labels.bzl",
"executable_label",
)
load(
":internal.bzl",
"web_internal_generate_variables",
)
generate_variables = rule(
attrs = {
"config": attr.label(
mandatory = True,... |
"""title
https://adventofcode.com/2021/day/1
"""
def solve(data):
return data
def solve2(data):
return data
if __name__ == '__main__':
input_data = open('input_data.txt').read()
result = solve(input_data)
print(f'Example 1: {result}')
result = solve2(input_data)
print(f'Example 2: {re... |
#!/usr/bin/env python
# encoding: utf-8
class Insertion(object):
"""Insertions do affect an applied sequence and do not store a sequence
themselves. They are a skip if the length is less than 0
Args:
index (int): the index into the `StrandSet` the `Insertion` occurs at
length (int): leng... |
'''Exercício Python 089: Crie um programa que leia nome e duas notas de vários alunos e guarde tudo em uma lista composta.
No final, mostre um boletim contendo a média de cada um e permita que o usuário possa mostrar as notas de cada aluno individualmente.'''
lista = list()
while True:
aluno = str(input('Nome: ')).... |
#https://www.codechef.com/problems/CHEFEZQ
for _ in range(int(input())):
q,k=map(int,input().split())
l=list(map(int,input().split()))
rem=0
c=0
f=0
for i in range(q):
rem+=l[i]
if(rem-k<0):
f=1
break
c+=1
rem-=k
print(c+1) if f else p... |
# python_version >= '3.8'
#: Okay
class C:
def __init__(self, a, /, b=None):
pass
#: N805:2:18
class C:
def __init__(this, a, /, b=None):
pass
|
# Write your solution here
def count_matching_elements(my_matrix: list, element: int):
count = 0
for row in my_matrix:
for item in row:
if item == element:
count += 1
return count
if __name__ == "__main__":
m = [[1, 2, 1], [0, 3, 4], [1, 0, 0]]
print(count_matchin... |
{
"version": "eosio::abi/1.0",
"types": [],
"structs": [
{
"name": "newaccount",
"base": "",
"fields": [
{"name":"account", "type":"name"},
{"name":"pub_key", "type":"public_key"}
]
}
],
"actions": [{
... |
iput = input('Multiphy number')
divi = input ('Multiply By?')
try:
put = int(iput)
di = int(divi)
ans = put * di
except:
print('Invalid Value')
quit()
print(ans)
|
# Python3 program to find the
# max LRproduct[i] among all i
# Method to find the next greater
# value in left side
def nextGreaterInLeft(a):
left_index = [0] * len(a)
s = []
for i in range(len(a)):
# Checking if current
# element is greater than top
... |
"""
We can set t equal to the exponent:
t = a^4 + 1
r(t) = e^t
Then:
dt/da = 4a^3
dr/dt = e^t
Now we can use the chain rule:
dr/da = dr/dt * dt/da
= e^t(4a^3)
= 4a^3e^{a^4 + 1}
""" |
CALENDAR_CACHE_TIME = 5*60 # seconds
CALENDAR_COLORS = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854']
CALENDARS = [
{
'name': 'ATP Tennis 2018',
'color': CALENDAR_COLORS[0],
'url': '''https://p23-calendars.icloud.com/published/2/PMXFAiuTnEBHpFCFP8YdjnQt3zIkrpTgDwH58V9EWgy0_sZKiUMsrUl_DTyynnz5iCTEdu-h3ojPtsT... |
class AbstractNotification(object):
def show_message(self, title, message):
"""
Show message in the notification system of the OS.
Parameters:
title: The title of the notification.
message: The notification message.
"""
raise NotImplementedError()
|
"""
File with rsa test keys.
CAUTION:
DO NOT USE THEM IN YOUR PRODUCTION
CODE!
"""
private = '-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7VJTUt9Us8cKj\nMzEfYyjiWA4R4/M2bS1GB4t7NXp98C3SC6dVMvDuictGeurT8jNbvJZHtCSuYEvu\nNMoSfm76oqFvAp8Gy0iz5sxjZmSnXyCdPEovGhLa0VzMaQ8s+CLOyS56YyCFGe... |
#
# PySNMP MIB module ZYXEL-CFM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-CFM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:43:08 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... |
N,M=map(int,input().split())
if M == 1 or M == 2:
print("NEWBIE!")
elif M<=N:
print("OLDBIE!")
else:
print("TLE!") |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 22 17:55:16 2019
@author: penko
Return team information for the current set of OWL teams.
Elements such as team colors, which may change from season to season, only
return their current values. For example, the Florida Mayhem colors return
Black and Pink instead of their... |
class AccountSetting:
"""Class for several configs"""
username = 'loodahu' # Set username here
password = '123456' # Set password here
def get_username(self):
return self.username
def get_password(self):
return self.password
|
class MetricObjective:
def __init__(self, task):
self.task = task
self.clear()
def clear(self):
self.total = 0
self.iter = 0
def step(self):
self.total = 0
self.iter += 1
def update(self, logits, targets, args, metadata={}):
self.total += args[... |
a = input("give numbers ")#1
while a.isdigit() != True:
a = input("give numbers ")#1
b = input("give numbers ")
while b == 0 or b.isdigit() != True:
b = input("give numbers ")
a = int(a)
b = int(b)
if str(a)[-1] in [0,2,4,6,8]:
print("even")
else:
print("odd")
print(int(a)/int(b))#2
x = 0#3
b = 0
whi... |
def setup():
size(500,500);
background(0);
smooth();
noLoop();
def draw():
strokeWeight(10);
stroke(200);
line(10, 10, 400, 400)
|
def lower(o):
t = type(o)
if t == str:
return o.lower()
elif t in (list, tuple, set):
return t(lower(i) for i in o)
elif t == dict:
return dict((lower(k), lower(v)) for k, v in o.items())
raise TypeError('Unable to lower %s (%s)' % (o, repr(o)))
|
#!/usr/bin/python3
'''Generate SPICE models for Transmission Lines'''
'''
L1 N002 N001 0.4µ
C1 N001 N004 10p
C2 N002 N004 20p
C3 N003 N004 10p
L2 N003 N002 0.4µ
.backanno
.end
'''
def node_str(num: int) -> str:
return f'N{num:05d}'
def model_str(name: str, num: int, value: float, nodes: tuple) -> str:
ret... |
def extractAlbedo404BlogspotCom(item):
'''
Parser for 'albedo404.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterou... |
class FeatureDataResponseDto:
def __init__(self,
value = None,
iterationCount = None,
featureKey = None,
sampleKey = None
):
self.value = value
self.iterationCount = iterationCount
self.featureKey = featureKey
self.sampleKey = sampleKey
class Feat... |
#zero
if n == 0:
yield []
return
#modify
for ig in partitions(n-1):
yield [1] + ig
if ig and (len(ig) < 2 or ig[1] > ig[0]):
yield [ig[0] + 1] + ig[1:]
|
N = int(input())
for i in range(N):
S = input().split()
print(S)
# ......
for string in S:
if string.upper() == "THE":
count += 1
|
print("BMI Calculator\n")
weight = float(input("Input your weight (kg.) : "))
height = float(input("Input your height (cm.) : ")) / 100
bmi = weight / height ** 2
print("\nYour BMI = {:15,.2f}".format(bmi))
# print("\nYour BMI = {0:.2f}".format(float(input("Input your weight (kg.) : ")) / ((float(input("In... |
"""
* User: lotus_zero
* Date: 11/17/18
* Time: 16:25 PM
* Brief: A program to calculate Multiple Circle Area with Check
"""
PI = 3.14159
def process (radius):
return PI * radius * radius
def main ():
radius = 0.0
area = 0.0
n = int(input("# of Circles? \n"))
for i in range (0,n):
ra... |
# O(N) Solution:
def leftIndex(n,arr,x):
for i in range(n):
if arr[i] == x:
return i
return -1
#______________________________________________________________________________________
# O(logN) Solution: Using Binary Search to find the first occurence of the element
def leftI... |
ext = ('zero', 'um', 'dois', 'três', 'quatro',
'cinco', 'seis', 'sete', 'oito', 'nove',
'dez', 'onze', 'doze', 'treze', 'quatorze',
'quinze', 'dezesseis', 'dezessete', 'dezoito',
'dezenove', 'vinte')
while True:
num = int(input('Digite um número entre 0 e 20: '))
if num > 20 or num <... |
'''
Given an array of characters, compress it in-place.
The length after compression must always be smaller than or equal to the original array.
Every element of the array should be a character (not int) of length 1.
After you are done modifying the input array in-place, return the new length of the array.
Follow... |
class Try(object):
@staticmethod
def print_hi():
print('hi')
|
class Endpoint:
def __init__(self, ID, data_center_latency):
self.ID = ID
self.data_center_latency = data_center_latency
self.cache_server_connections = []
# def get_connection(self, cs):
# if(cs in self.cache_server_connections_hash.keys()):
# return self.cache_serv... |
# 1038
code, quantity = input().split(" ")
code = int(code)
quantity = int(quantity)
if code == 1:
print("Total: R$ {0:.2f}".format(quantity * 4.00))
elif code == 2:
print("Total: R$ {0:.2f}".format(quantity * 4.50))
elif code == 3:
print("Total: R$ {0:.2f}".format(quantity * 5.00))
elif code == 4:
prin... |
expected_output = {
"route-information": {
"route-table": {
"active-route-count": "929",
"destination-count": "929",
"hidden-route-count": "0",
"holddown-route-count": "0",
"rt": [
{
"rt-destination": "10.220.0.0... |
# -*- coding: utf-8 -*-
class Incrementor:
def __init__(self, inf_bound, increment, sup_bound, step_duration):
"""Build a new Incrementor.
Args:
inf_bound (int or float): The inf bound (included).
increment (int or float): The step increment.
sup_bound (int or f... |
# Modulo
for i in range(0, 101):
if i % 2 == 0:
print (str(i) + " is even")
else:
print (str(i) + " is odd")
print ("----------------------")
# Without modulo
for i in range (0,101):
num = int(i/2)
if (num * 2 == i):
print (str(i) + " is even")
else:
print (str(i) + " is odd")
|
# csamiselo@github.com 15.10.2019
print("This is how i count my livestock")
print("Goats",12 + 30 + 60)
print("Cows", 13 + 15 + 10)
print ("Layers" ,1000 + 250 + 503 )
print ("Are the layers more than the goats")
print (12 + 30 + 60 < 1000 + 250 +503 )
|
class CeleryConfig:
# List of modules to import when the Celery worker starts.
imports = ('apps.tasks',)
## Broker settings.
broker_url = 'amqp://'
## Disable result backent and also ignore results.
task_ignore_result = True
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.