content stringlengths 7 1.05M |
|---|
#!/usr/bin/env python3
#!/usr/bin/env python
LIMIT = 32
dict1 = {}
def main():
squares()
a1 = 0
while a1 < LIMIT:
sums(a1)
a1 += 1
results()
def squares():
global dict1
for i1 in range(1, LIMIT * 2):
# print "%s" % str(i1)
s1 = i1 * i1
if not s1 in dic... |
# -*-coding:utf-8-*-
__author__ = "Allen Woo"
DB_CONFIG = {
"redis": {
"host": [
"127.0.0.1"
],
"password": "<Your password>",
"port": [
"6379"
]
},
"mongodb": {
"web": {
"dbname": "osr_web",
"password": "<Your p... |
class NumArray:
def __init__(self):
self.__values = []
def __length_hint__(self):
print('__length_hint__', len(self.__values))
return len(self.__values)
n = NumArray()
print(len(n)) # TypeError: object of type 'NumArray' has no len()
|
#!/usr/bin/env python
'''XML Namespace Constants'''
#
# This should actually check for a value error
#
def xs_bool(in_string):
'''Takes an XSD boolean value and converts it to a Python bool'''
if in_string in ['true', '1']:
return True
return False
|
''' teachers and centers are lists of Teacher objects and ExamCenter objects respectively
class Teacher and class ExamCentre and defined in locatable.py
Both are subclass of Locatable class
Link : https://github.com/aahnik/mapTeachersToCenters/blob/master/locatable.py '''
def sort(locatables, focal_cen... |
list=[1,2,3.5,4,5]
print(list)
sum=0
for i in list:
sum=sum+i
sum/=i
print(sum)
|
'''
PURPOSE
Analyze a string to check if it contains two of the same letter
in a row. Your function must return True if there are two identical
letters in a row in the string, and False otherwise.
EXAMPLE
The string "hello" has l twice in a row, while the string "nono"
does not have two identical ... |
# Python Program to check if there is a
# negative weight cycle using Floyd Warshall Algorithm
# Number of vertices in the graph
V = 4
# Define Infinite as a large enough value. This
# value will be used for vertices not connected to each other
INF = 99999
# Returns true if graph has negative weig... |
def leiaInt(num):
while True:
n = str(input(num))
if n.isnumeric():
n = int(n)
break
else:
print('Erro! Digíte um número inteiro')
return n
n = leiaInt('Type a number: ')
print(f'The number typed was {n}') |
limit = int(input())
current = int(input())
multiply = int(input())
day = 0
total = current
while total <= limit:
day += 1
current *= multiply
total += current
# print('on day', day, ',', current, 'people are infected. and the total is', total)
print(day) |
class Node:
def __init__(self, data):
self.data = data
self.next = None
self.back = None
# inserir na fila
# remover da fila
# consultar o primeiro elemento da fila
class Fila:
def __init__(self):
self.first = None
self.last = None
self.size = 0
... |
# Importação de bibliotecas
# Título do programa
print('\033[1;34;40mEXTRAINDO DADOS DE UMA LISTA\033[m')
# Objetos
lista = []
# Lógica
while True:
lista.append(int(input('Digite um valor: ')))
continuar = ' '
while continuar not in 'SN':
continuar = str(input('Continuar? [S/N] ')).strip().uppe... |
train_sequence = ReportSequence(X_train, y_train)
validation_sequence = ReportSequence(X_valid, y_valid)
model = Sequential()
forward_layer = LSTM(300, return_sequences=True)
backward_layer = LSTM(300, go_backwards=True, return_sequences=True)
model.add(Bidirectional(forward_layer,
backward_l... |
#!/usr/bin/env python
# coding: utf-8
# ## next_permutation
# Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
#
# If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
#
# The replac... |
# Code generated by font-to-py.py.
# Font: dsmb.ttf
version = '0.26'
def height():
return 16
def max_width():
return 9
def hmap():
return True
def reverse():
return False
def monospaced():
return False
def min_ch():
return 32
def max_ch():
return 126
_font =\... |
"""
Выведите все четные элементы списка.
Формат ввода
Вводится список чисел. Все числа списка находятся на одной строке.
Формат вывода
Выведите ответ на задачу.
"""
print(*(i for i in input().split() if not int(i) % 2))
|
class Pessoa:
#Atributos de classe são alocados apenas uma vez na memória
olhos = 2
#Atributos de instância são alocados sempre que um objeto é criado
def __init__(self, *filhos:list, nome=None, idade=None):
self.nome = nome
self.idade = idade
self.filhos = list(filhos)
def... |
orgM = cmds.ls(sl=1,fl=1)
newM = cmds.ls(sl=1,fl=1)
for nm in newM:
for om in orgM:
if nm.split(':')[0] == om.split(':')[0]+'1':
trans = cmds.xform(om,ws=1,piv=1,q=1)
rot = cmds.xform(om,ws=1,ro=1,q=1)
cmds.xform(nm,t=trans[0:3],ro=rot)
cmds.namespace(ren=((nm.split(':')[0]),(nm.split(':')[1])))
|
class Solution:
def isValid(self, s: str):
count = 0
for i in s:
if i == '(':
count += 1
if i == ')':
count -=1
if count < 0:
return False
return count == 0
def removeInvalidParenthes... |
"""
Let's reverse engineer the process.
Imagine you are standing at the last index i
index i-1 will need the value>=1 to go to i (step_need=1)
index i-2 will need the value>=2 to go to i (step_need=2)
...
At a certain index x, the value>=step_need
This means that, from x, we can go to i no problem.
Now we are standing... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'chromium_tests',
'depot_tools/tryserver',
'recipe_engine/platform',
'recipe_engine/properties',
]
def RunSteps(api):
tests = []... |
# -*- coding: utf-8 -*-
description = 'detectors'
group = 'lowlevel' # is included by panda.py
devices = dict(
mcstas = device('nicos_virt_mlz.panda.devices.mcstas.PandaSimulation',
description = 'McStas simulation',
),
timer = device('nicos.devices.mcstas.McStasTimer',
mcstas = 'mcstas... |
k = float(input("Digite uma velocidade em km/h: "))
m = k/3.6
print("Essa velocidade convertida é de {:.2f} m/s" .format(m)) |
n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]]
# Add your function here
def flatten(lists):
results = []
for i in range(len(lists)):
for j in range(len(lists[i])):
results.append(lists[i][j])
return results
print(flatten(n))
|
age=int(input())
washing_machine_price=float(input())
toys_price=float(input())
toys_count = 0
money_amount = 0
for years in range(1,age+1):
if years % 2 == 0:
#price
money_amount += years / 2 * 10
money_amount-=1
else:
#toy
toys_count+=1
toys_price=toys_count*... |
#!/usr/bin/env python
"""Parse arguments for functions in the wmem package.
"""
def parse_common(parser):
parser.add_argument(
'-D', '--dataslices',
nargs='*',
type=int,
help="""
Data slices, specified as triplets of <start> <stop> <step>;
setting any <stop> to 0... |
#Ejercicio
precio = float(input("Ingrese el precio: "))
descuento = precio * 0.15
precio_final = precio - descuento
print (f"el precio final a pagar es: {precio_final:.2f}")
print (descuento)
|
# write your code here
user_field = input("Enter cells: ")
game_board = []
player_1 = "X"
player_2 = "O"
def print_field(field):
global game_board
coordinates = list()
game_board = [[field[0], field[1], field[2]],
[field[3], field[4], field[5]],
[field[6], field[7], fie... |
# takes two inputs and adds them together as ints;
# outputs solution
print(int(input()) + int(input()))
|
"""
PASSENGERS
"""
numPassengers = 2757
passenger_arriving = (
(3, 9, 6, 2, 3, 0, 9, 5, 3, 3, 1, 0), # 0
(2, 11, 10, 1, 1, 0, 2, 4, 2, 2, 0, 0), # 1
(1, 10, 5, 3, 2, 0, 5, 12, 6, 3, 1, 0), # 2
(5, 8, 7, 2, 1, 0, 6, 7, 5, 5, 1, 0), # 3
(3, 5, 5, 3, 2, 0, 9, 8, 4, 0, 1, 0), # 4
(1, 9, 11, 4, 1, 0, 7, 7, 6, ... |
triggers = {
'lumos': 'automation.potter_pi_spell_lumos',
'nox': 'automation.potter_pi_spell_nox',
'revelio': 'automation.potter_pi_spell_revelio'
} |
fh= open("romeo.txt")
lst= list()
for line in fh:
wds= line.split()
for word in wds:
if word in wds:
lst.append(word)
lst.sort()
print(lst)
|
# coding: utf8
{
'%(give2la)s collects Personally Identifiable information (PII) that includes Name, Address, Email address and Telephone number. The City will make every reasonable effort to protect your privacy. It restricts access to your personal identifiable information to those employees that will respond to your... |
#Faça um programa que leia a largura e a altura de uma parede
#em metros, calcule a sua área e a quantidade de tinta necessaria
#para pinta-la, sabendo que cada litro de tinta, pinta uma area
#de 2m²
alt = float(input('Digite a altura: '))
lar = float(input('Digite a largura: '))
print('A quantida de tinta para pintar... |
"""
2675 : 문자열 반복
URL : https://www.acmicpc.net/problem/2675
Input :
2
3 ABC
5 /HTP
Output :
AAABBBCCC
/////HHHHHTTTTTPPPPP
"""
T = int(input())
for _ in range(T):
R, S = input().split()
R = int(R)
P = ""
for s in S:
P += (s * R)
print... |
OEMBED_URL_SCHEME_REGEXPS = {
'slideshare' : r'https?://(?:www\.)?slideshare\.(?:com|net)/.*',
'soundcloud' : r'https?://soundcloud.com/.*',
'vimeo' : r'https?://(?:www\.)?vimeo\.com/.*',
'youtube' : r'https?://(?:(www\.)?youtube\.com|youtu\.be)/.*',
}
OEMBED_BASE_URLS = {
'slideshare' : 'https://w... |
X, M = tuple(map(int,input().split()))
while X != 0 or M != 0:
print(X*M)
X, M = tuple(map(int,input().split()))
|
##HEADING: [PROBLEM NAME]
#PROBLEM STATEMENT:
"""
[PROBLEM STATEMENT LINE1]
[PROBLEM STATEMENT LINE1]
[PROBLEM STATEMENT LINE1]
"""
#SOLUTION-1: ([METHOD DESCRIPTION LIKE BRUTE_FORCE, DP_ALGORITHM, GREEDY_ALGORITHM, ITERATIVE_ALGORITHM, RECURSIVE_ALGORITHM]) --> [TIME COMPLEXITY LIKE O(n), O(log2(n)), O(n... |
FLAG = 'QCTF{4e94227c6c003c0b6da6f81c9177c7e7}'
def check(attempt, context):
return Checked(attempt.answer == FLAG)
|
'''
Created on Mar 3, 2014
@author: rgeorgi
'''
class EvalException(Exception):
'''
classdocs
'''
def __init__(self, msg):
'''
Constructor
'''
self.message = msg
class POSEvalException(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
|
class Solution:
def lengthOfLastWord(self, s: str) -> int:
n=0
last=0
for c in s:
if c==" ":
last=n if n>0 else last
n=0
else:
n=n+1
return n if n>0 else last
|
# -*- coding: utf-8 -*-
# see LICENSE.rst
# ----------------------------------------------------------------------------
#
# TITLE : Data
# AUTHOR : Nathaniel and Qing and Vivian
# PROJECT : JAS1101FinalProject
#
# ----------------------------------------------------------------------------
"""Data Management.
Of... |
class BaseClause:
def __init__(self):
# call super as these classes will be used as mix-in
# and we want the init chain to reach all extended classes in the user of these mix-in
# Update: Its main purpose is to make IDE hint children constructors to call base one,
# as not calling it... |
"""Display system message."""
def display_exit_message():
"""Display exit message and return a user choice."""
print("Tapez la lettre \"q\" pour confirmez l'arrêt de l'application : ")
return input()
|
class RandomVariable:
"""
Basic class for random variable distribution
"""
def __init__(self):
"""
self.parameter is a dict for parameters in distribution
"""
self.parameter = {}
def fit(self):
pass
def ml(self):
pass
def map(self):
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""This file is part of the Scribee project.
"""
__author__ = 'Emanuele Bertoldi <emanuele.bertoldi@gmail.com>'
__copyright__ = 'Copyright (c) 2011 Emanuele Bertoldi'
__version__ = '0.0.1'
def filter(block):
block.filtered = '\n'.join([l.strip().replace('/*', "").replace(... |
"""
https://leetcode.com/problems/reverse-integer/description/
"""
class Solution:
def reverse(self, x: int) -> int:
# sign = -1 if x < 0 else 1
sign = [1, -1][x < 0]
num = sign * x
num_str = str(num)
out = 0
for i in range(len(num_str))[::-1]:
if out >... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Title """
__author__ = "Hiroshi Kajino <KAJINO@jp.ibm.com>"
__copyright__ = "Copyright IBM Corp. 2019, 2021"
MultipleRun_params = {
'DataPreprocessing_params': {
'in_dim': 50,
'train_size': 100,
'val_size': 100,
'test_size': 500},
... |
# -*- coding: utf-8 -*-
"""
Name:LAVOE YAWA JENNIFER
Stud. ID: 20653245
"""
class Point ( object ):
def __init__ (self , x, y):
self .x = x
self .y = y
def __str__ ( self ):
return f"({ self .x},{ self .y})"
def __sub__ (self , other ):
dx = self... |
# Exercise 1
# Напишете програма, която намира лицето на геометрична фигура като първо се въвежда вида на фигурата:
# 1- квадрат
# 2-правоъгълник
# 3- прав.триъгълник
# За пресмятане на лицето на отделните фигури да се напишат подходящи функции.
def square(a):
area = a*a
return area
def rectangle(a, b):
... |
def get_breadcrumb(cat3):
cat2 = cat3.parent
cat1 = cat3.parent.parent
cat1.url = cat1.goodschannel_set.all()[0].url
breadcrumb = {
'cat1': cat1,
'cat2': cat2,
'cat3': cat3,
}
return breadcrumb |
# -*- coding: utf-8 -*-
i = int(input('Podaj i'))
j = int(input('Podaj j'))
print(i, j)
if i ** j > j ** i:
print(i ** j, " większe")
elif j ** i > i ** j:
print(j ** i, " większe")
else:
print("Są równe")
|
"""
Crie um programa que gerencie o aproveitamento de um jogador de futebol. O programa vai ler o nome do jogador e
quantas partidas ele jogou. Depois vai ler a quantidade de gols feitos em cada partida. No final, tudo isso será guarda-
do em um dicionário, incluindo o total de gols feitos durante o campeonato.
"""
jog... |
class DynamicObjectSerializer:
def __init__(self, value, many=False):
self._objects = None
self._object = None
if many:
value = tuple(v for v in value)
self._objects = value
else:
self._object = value
@property
def objects(self):
... |
myTup = 0, 2, 4, 5, 6, 7
i1, *i2, i3 = myTup
print(i1)
print(i2, type(i2))
print(i3) |
"""
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 continuou... |
class Color:
BACKGROUND = 236
FOREGROUND = 195
BUTTON_BACKGROUND = 66
FIELD_BACKGROUND = 238 #241
SCROLL_BAR_BACKGROUND = 242
TEXT = 1
INPUT_FIELD = 2
SCROLL_BAR = 3
BUTTON = 4
# color.py
|
def smallest_positive(arr):
# Find the smallest positive number in the list
min = None
for num in arr:
if num > 0:
if min == None or num < min:
min = num
return min
def when_offered(courses, course):
output = []
for semester in courses:
for course_n... |
def my_abs(x):
if not isinstance(x, (int, float)):
raise TypeError('bad operand type')
if x >= 0:
return x
else:
return -x |
while True:
a, b = map(int, input().split(" "))
if not a and not b:
break
print(a + b) |
class Solution:
"""
@param x: An integer
@return: The sqrt of x
"""
def sqrt(self, x):
if x < 1:
return 0
l, r = 1, x//2 + 1
while r > l:
mid = (l + r) // 2
square = mid * mid
if square > x:
... |
class LetterFrequencyPair:
def __init__(self, letter: str, frequency: int):
self.letter: str = letter
self.frequency: int = frequency
def __str__(self):
return '{}:{}'.format(self.letter, self.frequency)
class HTreeNode:
pass
print(LetterFrequencyPair('A', 23))
|
class HashMap:
def __init__(self, size):
self.array_size = size
self.array = [None] * size
def hash(self, key, count_collisions = 0):
return sum(key.encode()) + count_collisions
def compressor(self, hash_code):
return hash_code % self.array_size
def ass... |
info = {
"%%fem-with-a": {
"0": "a;",
"1": "una;",
"(2, 'inf')": "=%%msco-with-a=;"
},
"%%fem-with-i": {
"0": "i;",
"1": "una;",
"(2, 'inf')": "=%%msco-with-i=;"
},
"%%fem-with-o": {
"0": "o;",
"1": "ouna;",
"(2, 'inf')": "=%... |
"""
Contains a collection of useful functions when working
with strings.
"""
def shorten_to(string: str, length: int, extension: bool = False):
"""
When a user uploaded a plugin with a pretty long file/URL name,
it is useful to crop this file name to avoid weird UI behavior.
This method takes a string... |
def solution(n):
n = str(n)
if len(n) % 2 != 0: return False
n = list(n)
a,b = n[:len(n)//2], n[len(n)//2:]
a,b = list(map(int, a)), list(map(int, b))
return sum(a) == sum(b)
|
def number(lines):
"""
Your team is writing a fancy new text editor and you've been tasked with implementing the line numbering.
Write a function which takes a list of strings and returns each line prepended by the correct number.
The numbering starts at 1. The format is n: string. Notice the colon and ... |
# Copyright 2022 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A wrapper for common operations on a device with Cast capabilities."""
CAST_BROWSERS = [
'platform_app'
]
|
def main():
while True:
userinput = input("Write something (quit ends): ")
if(userinput == "quit"):
break
else:
tester(userinput)
def tester(givenstring="Too short"):
if(len(givenstring) < 10):
print("Too short")
else:
print(givenstring)
if ... |
df = pd.read_csv(DATA, delimiter=';')
df[['EV1', 'EV2', 'EV3']] = df['Participants'].str.split(', ', expand=True)
df['Duration'] = pd.to_timedelta(df['Duration'])
result = (pd.concat([
df[['EV1', 'Duration']].rename(columns={'EV1': 'Astronaut'}),
df[['EV2', 'Duration']].rename(columns={'EV2': 'A... |
class Solution:
def hasValidPath(self, grid):
def dfs(x, y, d):
if x == m or y == n:
return True
if grid[x][y] == 1:
if d == 1:
return dfs(x, y + 1, d)
elif d == 3:
return dfs(x, y - 1, d)
... |
class Solution(object):
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
sum, max, maxIndex = 0, -1, -1
for i, h in enumerate(height):
if max < h:
max = h
maxIndex = i
prev = 0
for i in r... |
class fabrica:
def __init__(self, tiempo, nombre, ruedas):
self.tiempo = tiempo
self.nombre = nombre
self.ruedas = ruedas
print("se creo el auto", self.nombre)
def __str__(self):
return "{}({})".format(self.nombre, self.tiempo)
class listado: #
autos = []# lista q... |
n1 = int(input('digite um valor: '))
n2 = int(input('digite outro valor: '))
s = n1 + n2
m = n1 * n2
p = n1 ** n2
print(f'a soma vale {s}, a mult vale {m}, e a potencia vale {p}', end=', ')
print('testando end')
|
def make_diamond(letter):
"""
makes a diamond from the given letter
:return: a diamond
:rtype: list
"""
diamond = None
# count how far the letter is from A and use that as counter
size = ord(letter.upper()) - ord('A')
for i in range(size, -1, -1):
# gets 1 half of the top o... |
file_name = 'data/PacMan.png'
reader = itk.ImageFileReader.New(FileName=file_name)
smoother = itk.RecursiveGaussianImageFilter.New(Input=reader.GetOutput())
smoother.SetSigma(5.0)
smoother.Update()
view(smoother.GetOutput(), ui_collapsed=True)
|
soma = 0
for n in range(1, 7):
num = (int(input('Informe o {} valor: '.format(n))))
if num % 2 == 0:
soma = soma + num
print('A soma dos numeros pares é {}.'.format(soma))
|
# -*- coding: utf-8 -*-
__all__ = ['Microblog', 'MICROBLOG_SESSION_PROFILE']
MICROBLOG_SESSION_PROFILE = 'mic_profile_session'
class Microblog(object):
def __init__(self):
self.profile = None
|
# https://leetcode.com/problems/binary-tree-postorder-traversal/
# 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
class Solution:
# DFS
def postorderTraversal(self, root... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# file:codeblocktemplate.py
# author:Nathan
# datetime:2021/8/26 11:16
# software: PyCharm
"""
Code block template file for service layer code
"""
class CodeBlockTemplate(object):
"""
Code block template class for service layer code
""... |
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
def stardoc_for_prov(doc_prov):
"""Defines a `stardoc` target for a document provider.
Args:
doc_prov: A `struct` as returned from `providers.create()`.
Returns:
None.
"""
stardoc(
name = doc_prov.name,
out ... |
class Node(object):
def __init__(self, data):
self.data = data
self.next = None
def push(head, data):
node = Node(data)
node.next = head
return node
def build_one_two_three():
return push(push(Node(3), 2), 1)
|
"""
Given two lists, find and print the elements that are
present in both lists. For example: if given the list
L1 = [a, b, c, d] and L2 = [a, c, e, f]
then your program should output: "a c".
"""
def remove_elements(list1, list2):
"""
Returns a list with the repeated elements of the two lists
"""
... |
string = "a" * ITERATIONS
# ---
for char in string:
pass
|
# Tool Types
BRACKEN = 'bracken_abundance_estimation'
KRAKEN = 'kraken_taxonomy_profiling'
KRAKENHLL = 'krakenhll_taxonomy_profiling'
METAPHLAN2 = 'metaphlan2_taxonomy_profiling'
HMP_SITES = 'hmp_site_dists'
MICROBE_CENSUS = 'microbe_census'
AMR_GENES = 'align_to_amr_genes'
RESISTOME_AMRS = 'resistome_amrs'
READ_CLASS_... |
A = [0]
B = [0]
C = [0]
# change your R here
R = [16.6]
for i in range(1,4):
# For A
print("V"+str(i)+"(A) = max(0.8(-1+γ("+str(B[i-1])+")) + 0.2(-1+γ("+str(A[i-1])+"))," + "0.8(-1+γ("+str(C[i-1])+")) + 0.2(-1+γ("+str(A[i-1])+"))")
print("= max(" + str( (0.8*(-1+(0.2*B[i-1]))) + 0.2*(-1+(0.2*A[i-1])) ) +" ... |
begin_unit
comment|'# Copyright 2010 United States Government as represented by the'
nl|'\n'
comment|'# Administrator of the National Aeronautics and Space Administration.'
nl|'\n'
comment|'# All Rights Reserved.'
nl|'\n'
comment|'# Copyright (c) 2010 Citrix Systems, Inc.'
nl|'\n'
comment|'# Copyright 2011 Ken Pepple'
... |
def predict(x_test, model):
# predict
y_pred = model.predict(x_test)
y_pred_scores = model.predict_proba(x_test)
return y_pred, y_pred_scores |
"""
Faça um programa que leia três números
e mostre qual é o maior e qual é o menor.
"""
n1 = int(input('Primeiro número: '))
n2 = int(input('Segundo número: '))
n3 = int(input('Terceiro número: '))
maior = n1
menor = n2
if n2 > n1 and n2 > n3:
maior = n2
if n3 > n2 and n3 > n1:
maior = n3
if n1 < n2 and n1 ... |
"""myeloma_snv cli tests."""
'''
from datetime import datetime
from os.path import isfile, join
from click.testing import CliRunner
from myeloma_snv import cli
def test_main_snv(tmpdir):
"""Test for main command."""
outdir = str(tmpdir)
params = []
with open("../tests/test_args_snv.txt") as f:
... |
r = [int (r) for r in input().split()]
renas = ['Rudolph','Dasher','Dancer','Prancer','Vixen','Comet','Cupid','Donner','Blitzen']
b = 0
for s in range(len(r)):
b = b + r[s]
resto = b%9
for t in range(0,9):
if resto == t:
print(renas[t])
|
"""
Following mappings should be used to map csv headers and database columns
for import and export.
Keys are the columns from the CSV Files, values are col names returned by
database query.
For complex queries, it is much better to write them in pure sql. Return
the table as named tuples and work with that and this... |
s = "MCMXCIV"
sum = 0 # 累加数字
rome = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
i = 0
while i < len(s):
if i < len(s) - 1 and rome.get(s[i]) < rome.get(s[i + 1]):
sum += rome.get(s[i + 1]) - rome.get(s[i])
i += 2
continue
sum += rome.get(s[i])
i += 1
print(sum)... |
# This exercise should be done in Jupyter and in the interpreter
# Print your name
print('My name is Anne.')
|
"""
PigLatinTranslator.py
Simple Programs
Copyright (C) 2018 Ethan Dye. All rights reserved.
"""
print("Hello, World!")
|
n = input()
while len(n) > 1:
x = 1
for c in n:
if c != '0': x *= int(c)
n = str(x)
print(n) |
"""Utility to add editor syntax highlighting to literal code strings.
Example:
from google.colab import syntax
query = syntax.sql('''
SELECT * from tablename
''')
"""
def html(s):
"""Noop function to enable HTML highlighting for its argument."""
return s
def javascript(s):
"""Noop function... |
# from the paper `using cython to speedup numerical python programs'
#pythran export timeloop(float, float, float, float, float, float list list, float list list, float list list)
#pythran export timeloop(float, float, float, float, float, int list list, int list list, int list list)
#bench A=[list(range(70)) for i in ... |
#Python task list example
taskList = []
def commander():
print("\na to add, s to show list, q to quit")
commandOrder = input("Command --> ")
if commandOrder == "a":
addTasks()
if commandOrder == "s":
printTasklist()
if commandOrder == "q":
print("Bye Bye Friend....")
... |
"""
类型转换
语法:
结果 = 目标类型(待转数据)
适用性:
获取数据: 字 --> 数
显示结果: 数 --> 字
练习:exercise05
"""
# input函数的结果一定是字符串类型str
age = int(input("请输入年龄:")) + 1
print("明年" + str(age) + "岁了")
# 1. str <--> int
data01 = int("18")
data02 = str(18)
# 2. str <--> float
data03 = float... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.