content stringlengths 7 1.05M |
|---|
#encontrar o primeiro e o ultimo nome
n = str(input('digite seu nome: ')).strip()
a = n.split()
b = int(len(a))
print('Olá {}'.format(n))
print('seu primeiro nome é {}'.format(a[0]))
print('seu ultimo nome é {}'.format(a[b-1]))
|
def print_pyramid(num):
"""
>>> print_pyramid(5)
o
oo
ooo
oooo
ooooo
>>> print_pyramid(3)
o
oo
ooo
"""
for num in range(num):
line = 'o'
for num in range(num):
line += 'o'
print(line)
|
MASTER = {
"role": "master",
"labels": {
"monitor": "true", "memsql": "true", "postgres": "true", "sw-volume": 'true', "seaweedfs-postgres": "true"
}
}
NODE = {
"role": "node"
} |
# (n/2)(2a+(n-1)d)
def gcd(num1, num2):
res = 0
while True:
remainder = num1 % num2
if remainder != 0:
num1 = num2
num2 = remainder
else:
res = num2
break
return res
def lcm(num1, num2):
mul = num1*num2
return mul/gcd(num1, nu... |
# -*- coding:utf-8 -*-
# https://leetcode.com/problems/add-binary/description/
class Solution(object):
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
a = map(int, a[::-1])
b = map(int, b[::-1])
if len(a) < len(b):
... |
# List slicing
friends = ["Harry", "Tom", "Rohan", "Sam", "Divya", 45]
print(friends[0:4])
print(friends[-4:])
|
__author__ = 'ruddra'
'''
Dummy configuration, so change it with your own
'''
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'test@gmail.com'
SERVER_EMAIL = 'test@gmail.com'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'test@gmail.com'
EMAIL_HOST_PASSWORD = 'test'
EMAIL_BACKEND = 'django.core.mail.backe... |
def fib(a=0, b=1):
a, b = b, a + b
if a % 2 == 0:
return fib(a, b) + a
if b >= 40_00_000:
return 0
return fib(a, b)
print(fib())
|
class Solution:
def selfDividingNumbers(self, left: int, right: int) -> List[int]:
array = []
for num in range(left, right+1):
temp = num
flag = True
while temp > 0:
r = temp % 10
if r != 0 and num%r == 0:
temp /... |
def separate_first_degree(equ):
split_equ = equ.split(' ')
a = b = 0
if len(split_equ) == 2:
n1 = split_equ[0]
n2 = split_equ[1]
pos = n1.find('x')
if pos == 0 or n1[pos - 1] == '+': # +1 is implied
a = 1
elif n1[pos - 1] == '-': # -1 is implied
... |
"""
A collection of helper functions for the DataGenerator classes
"""
|
CLUB_NAME = "UWA Ethical Hacking Club"
CURRENT_YEAR = 2019
COLOR_INFO = 5347285
COLOR_SUCCESS = 2664261
COLOR_DANGER = 14431557
COLOR_WARNING = 16761095
WEDNESDAY = 2
DEFAULT_LOCATION = "G01 at CSSE" |
"""
Entradas
salario=>int=>s
ventas departamento 1-->int-->vd1
ventas departamento 2-->int-->vd2
ventas departamento 3-->int-->vd3
salidas
venta total mes departamentos-->int-->ventotal
"""
s=int(input("ingrese salario "))
vd1=int(input("ingrese ventas echas "))
vd2=int(input("ingrese ventas echas "))
vd3=int(input("in... |
SECRET_KEY = '4w9hda)ra9drvx^+y(eohk_59-35jejud^b_#9^vajx*+h^m-l'
EMAIL_HOST = 'mailsrv-01.va.mk'
EMAIL_HOST_USER='no-reply@va.mk'
EMAIL_HOST_PASSWORD='vZ5KDjmB2n'
DEFAULT_FROM_EMAIL = 'VapourApps Notification <no-reply@va.mk>'
SERVER_EMAIL = 'no-reply@va.mk'
|
# automatically generated by setup.py:get_scm_config()
__version__ = "0.0.3"
__git_revision__ = "2196f14"
|
class Event():
def __init__(self, uuid: str, date: str, time: str, event_type: str):
self._uuid = uuid
self._date = date
self._time = time
self._event_type = event_type
def __str__(self):
return ' '.join([str(self.uuid), str(self.date), str(self.time),
... |
IMG_GROUP_TEST_BLURB = {
"label_hash": "5fbba385-4918-4eee-85a8-8b7a2e71dd16",
"data_title": "image-group-f5ef4",
"data_type": "img_group",
"data_units": {
"76888dd3-1160-4ba9-a638-dacb92e54e3c": {
"data_hash": "76888dd3-1160-4ba9-a638-dacb92e54e3c",
"data_title": "apple1... |
"""
find unique element from an array.
abuse recursion.
"""
global st
def unique(s,start,stop, st):
# base case
st = 0
if stop - start <= 1:
return True
elif not unique(s, start, stop-1, st+1):
return False
elif not unique(s, start+1, stop, st+1):
return False
else:
... |
"""permissions exceptions"""
class ImproperlyConfigured(Exception):
pass
class ParentNotFound(Exception):
pass
class RoleNotFound(Exception):
pass
class InvalidRoleAssignment(Exception):
pass
class InvalidPermissionAssignment(Exception):
pass
class NotAllowed(Exception):
pass
|
# 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 scrabbleWords():
http_archive(
name="scrabble_words" ,
build_file="//bazel/deps/scrabble_words:build.BUILD" ,
... |
project = "asyncache"
version = "0.1.1"
release = version
extensions = ["sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.doctest"]
exclude_patterns = ["_build"]
master_doc = "index"
html_theme = "sphinx_rtd_theme"
|
R, G, B, N = map(int, input().split())
cnt = 0
for r in range(N + 1):
for g in range(N + 1):
b = N - (r * R + g * G)
if b >= 0 and b % B == 0:
cnt += 1
print(cnt)
|
# coding: utf-8
# In[1]:
class Trade(object):
tradeAcct = None
stockCode = None
stockName = None
#买卖方向 0-买 1-卖
tradeType = None
#交易股数
stockNums = 0
#交易价格
tradePrice = 0.0
#交易金额
tradeAmount = 0.0
#交易手续费
tradeFee = 0.0
#交易日期
tradeDate = None
de... |
class PredictPower(BaseTransformer):
'''
Predict freezer power usage from ambient temperature, humidity & hour of day V7
'''
def __init__(self, temperature, humidity, hourofday, predictedpower = 'predictedpower'):
self.temperature = temperature
self.humidity = humidity
self.... |
def leap_year(year):
try:
year = int(year)
if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")
except ValueError:
print("Year should be in numbers")
# Example
leap_year(20... |
class Solution:
def hasPathSum(self, root: Optional[TreeNode], target: int) -> bool:
def dfs (node ,cur) :
if not node : return False
cur += node.val
if not node.left and not node.right :
return cur == target
return dfs(node.left , cur) or ... |
class Solution(object):
def shortestDistance(self, maze, start, destination):
"""
:type maze: List[List[int]]
:type start: List[int]
:type destination: List[int]
:rtype: int
"""
n = len(maze)
m = len(maze[0])
distance = [[float('inf')]*m for _ ... |
class Extension:
'''
Returns filename with corresponding extensions
'''
# file lists
hdfs_files_list = ['hdfs', 'core', 'yarn', 'mapred', 'ssl_client', 'ssl_server']
hbase_files_list = ['hbase']
zookeeper_files_list = ['zoo']
spark_files_list = ['spark_defaults', 'spark_env']
es_fil... |
print(type(True))
# <class 'bool'>
print(type(False))
# <class 'bool'>
print(issubclass(bool, int))
# True
print(True == 1)
# True
print(False == 0)
# True
print(True + True)
# 2
print(True * 10)
# 10
print(sum([True, False, True]))
# 2
l = [0, 1, 2, 3, 4]
print([i > 2 for i in l])
# [False, False, False, True... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == '__main__':
a = tuple(map(int, input("Введите 10 чисел: ").split()))
C = int(input("C = "))
t = 0
for i in a:
if i > C:
t += 1
answ = 1
for i in a[a.index(max(a)) + 1:]:
answ *= i
print(... |
address=input()
with open(address,'rb') as f:
l=len(address)-1
while True:
if address[l]=='.':break
elif l==0:
print("file name error")
break
l-=1
with open(address[:l]+' - copy'+address[l:len(address)],'wb') as goalfile:
goalfile.write(f.read())
print... |
# -*- coding: utf-8 -*- #?????
'Copyright (c) 2019 Jacob Colin Stucki III, All Rights Reserved.'
class Dictionary(object):
"""yes"""
def __init__(self, name = None, type = None, fileList = None):
self.name = name
self.type = type #JSON, \n file, text file, etc. MySQL
self.fileList = fil... |
class BaseAgent:
def __init__(self, name=""):
"""Abstract class which represents the agent.
Args:
name: the name of the agent
Attributes:
name: the name of the agent
"""
self.name = name
def set_player_id(self, player_id):
"""Set player'... |
"""
Write a function that accepts a string and a character.
The function should remove all occurrences of the given character from the input string and return the string.
Example:
input_string = 'technique'
char = 'e'
Expected output = 'tchniqu'
"""
def remove_char(input_string, char):
new_str = ""
for i ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 13 21:14:18 2020
"""
class Country:
def __init__(self, cName, continent, life_m, life_f):
self.__country = cName
self.__continent = continent
self.__life_male = life_m
self.__life_female = life_f
def getC... |
row1 = ["🙂", "🙂", "🙂"]
row2 = ["🙂", "🙂", "🙂"]
row3 = ["🙂", "🙂", "🙂"]
matrix = [row1, row2, row3]
print(f"{row1}\n{row2}\n{row3}\n")
coordinates = input("Which coordinate you want to put an 'X' ? ==> ")
row = int(coordinates[0])
column = int(coordinates[1])
matrix[row][column] = 'X'
print(f"{row1}\n{row2}... |
class Validator:
@staticmethod
def validate_request(req_message):
if Validator.check_if_all_keys_in(req_message, 'id', 'message'):
if type(req_message['id']) is str and type(req_message['message']) is str:
if len(req_message['id']) > 0 and len(req_message['message']) > 0:
... |
"""Errors and Warnings."""
class S2ReaderIOError(IOError):
"""Raised if an expected file cannot be found."""
class S2ReaderMetadataError(Exception):
"""Raised if metadata structure is not as expected."""
|
'''class student:
pass
s1 = student()
print(id(s1)) #id func is used to get the address of the object.'''
class student:
def __init__(self):
self.name = "Navin"
self.age = 28
def compare(self,s2): #here self points to s1
if self.age == s2.age:
return True
... |
# Produce command matching code fragment optimized for reduced instruction count - output to stdout
commands = [
('LRS', 'Long Range Scan'),
('MOV', 'Micro Jump Drive in sector'),
('JMP', 'JuMP to a nearby sector'),
('PAC', 'Fire Particle Cannon'),
('AMM', 'Fire AntiMatter Missiles'),
('SDN', '... |
def main():
number = input('Give an integer: ')
number = int(number)
if (number)<0:
print('The absolute value of %i is %i' %(number, number*-1))
else:
print('The absolute value of %i is %i' %(number, number*1))
if __name__=="__main__":
main()
|
class Config:
def __init__(self):
"""
Flaskerk configuration
"""
self.name = 'docs'
#: url path for docs
self.endpoint = '/docs/'
self.url_prefix = None
self.template_folder = 'templates'
#: openapi spec file name
self.filename = 'opena... |
# -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2012 Jens Lindström, Opera Software ASA
#
# 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... |
minhaVar = 'ana'
minha_var = 'aninha'
_minhavar = 'anusa'
minhavar = 'cesio'
MINHAVAR = 'austin'
minhavar2 = ' belmiro'
print (minhaVar)
print (minha_var)
print (_minhavar )
print (minhavar)
print (MINHAVAR)
print (minhavar2) |
class add:
x = 5 + 5 +5 *6
ob = add()
print(ob.x)
|
# coding:utf-8
# 版权信息: All rights Reserved, Designed By XHal.cc
# 代码作者: Hal
# 创建时间: 2021/2/4 22:26
# 文件版本: V1.0.0
# 功能描述: 字典的 key 的判断、新增、修改、删除
'''
字典的特点:
1、所有元素都是一个key/value对,key 不允许重复、value可以重复
2、字典中的元素是无序的
3、字典中的key必须是不可变对象
4、字典也可以根据需要动态伸缩
5、字典会浪费较大的内存,是一种使用空间换时间的数据结构
'''
... |
list=[2,5,9,6,8,4,1]
val= 7
def insertShiftArray(arr,val):
new_array=[0 for i in range (len(arr)+1)]
for i in range (len(arr)+1):
if i == len(arr)//2:
new_array[i]=val
elif i > len(arr)//2:
new_array[i]=arr[i-1]
else:
new_array[i]=arr[i]
print(new_array)
in... |
ERRORS = {
'AudioFormatNotAcceptableError': {
'message': 'Cannot transcode to audio format requested in Accept header',
'status': 406
}
}
class AudioFormatNotAcceptableError(Exception):
'''Exception raised when the Accept headers of a request for an
audio file stream do not match any ... |
platsannons_mappings = {
"settings": {
"analysis": {
"analyzer": {
"simple_word_splitter": {
"type": "custom",
"tokenizer": "whitespace",
"filter": ["lowercase"],
"char_filter": ["punctuation_filter"]... |
def generate_n_chars(n, c):
result = ''
for i in range(n):
result += c
return result
print(generate_n_chars(3, 'c')) |
__author__ = 'johannes'
class RequestParser:
"""
Diese Klasse ist dafür verantwortlich, Anfragen vom Client (Webbrowser) zu empfangen und diese zu parsen.
Gibt ein Dictionary mit den extrahierten/geparsten Informationen zurück.
"""
def __init__(self):
self.host = ''
def start(self, c... |
"""
Memory module
"""
MEMORY_SIZE = 4096
PROGRAM_COUNTER_START: int = 0x200
# Emulator variables
FONTSET = [
0xF0, 0x90, 0x90, 0x90, 0xF0, # 0
0x20, 0x60, 0x20, 0x20, 0x70, # 1
0xF0, 0x10, 0xF0, 0x80, 0xF0, # 2
0xF0, 0x10, 0xF0, 0x10, 0xF0, # 3
0x90, 0x90, 0xF0, 0x10, 0x10, # 4
0xF0, 0x8... |
def pytest_addoption(parser):
parser.addoption('--gulp_path', default='')
def pytest_generate_tests(metafunc):
if 'gulp_path' in metafunc.fixturenames:
gulp_path = metafunc.config.getoption('gulp_path')
metafunc.parametrize('gulp_path', [gulp_path])
|
# a=19
# b=1
# try:
# print (a/b)
# except ZeroDivisionError as divisionperzero:
# print ("tsy mety ny zero")
# except TypeError as typing:
# print ("tsy mety ny chaine de caractère")
def calc(*args):
return args
func = calc("e", 1, 23, 2323, "2222")
|
tabela_Bra = ('são paulo', 'internacional', 'atletico-mg', 'flamengo', 'gremio', 'palmeiras', 'fluminense',
'corinthians', 'santos', 'ceara', 'atletico-go', 'atletico-pr', 'bragantino', 'vasco', 'sport',
'fortaleza', 'bahia', 'goias', 'botafogo', 'coritiba')
print(f'tabela dos times do bras... |
APARTMENT_ABOUT = ["Hey there I'm looking for roomates!",
"Best apartment in the city!",
"Looking for female roomates!",
"Relevant only for 30+ years old!",
"We love CATS!",
"Pizza it's a must!",
"Maccabi o... |
class Phase:
def __init__(self, previous_phase=None, next_phase=None):
self._previous_phase = previous_phase
self._next_phase = next_phase
@property
def previous_phase(self):
return self._previous_phase
@previous_phase.setter
def previous_phase(self, value):
if val... |
def factors(n):
results = []
for k in range(1, n+1):
if n % k == 0:
results.append(k)
return results
if __name__ == "__main__":
print(factors(100)) |
#O Sr. Manoel Joaquim acaba de adquirir uma panificadora e pretende implantar a metodologia
#da tabelinha, que já é um sucesso na sua loja de 1,99. Você foi contratado para desenvolver o
#programa que monta a tabela de preços de pães, de 1 até 50 pães, a partir do preço do pão
#informado pelo usuário, conforme o exempl... |
#%%
"""
- Multiply Strings
- https://leetcode.com/problems/multiply-strings/
- Medium
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Example 1:
Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:
Input: num1 = "123", num2 = "... |
# /$$$$$$$ /$$ /$$ /$$
# | $$__ $$ | $$ | $$ /$ | $$
# | $$ \ $$ /$$$$$$ /$$$$$$$| $$ /$$ /$$$$$$ /$$$$$$ | $$ /$$$| $$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$
# | $$ | $$ /$$__ $$ /$$_____/| $... |
# Elabore um programa que calcule o valor a ser pago
# por um produto, considerando o seu PREÇO NORMAL e CONDIÇÃO DE PAGAMENTO:
# À vista dinheiro/cheque: 10% de desconto
# À vista no cartão: 5% de desconto.
# em até 2x no cartão: preço normal.
# 3x ou mais no cartão: 20% de juros.
print('''=====================
{... |
#!/usr/bin/env python
texVariableTypeNames =\
[
"RWTexture1D",
"RWTexture1DArray",
"RWTexture2D",
"RWTexture2DArray",
"RWTextureCube",
"RWTextureCubeArray",
"RWTexture3D",
"RWTexture2DMS",
"RWTexture2DMSArray"
]
pixelFormatTypes =\
[
"unorm float",
"unorm float2",
"unorm float3",
"unorm float4",
"snorm... |
# common settings for results analysis
AMT_FILE = 'batch_results/100_sentence_9_error_detection.csv'
AMT_SENTENCE_BATCH = 'batch_input/amt_sentence_batch.csv'
AMT_FCE_M2 = 'experiment_output_m2/fce_amt.experiment_two.max.rasp.m2'
TRAINING_DATA_FILE = 'fce_data_sets/fce_train.gold.max.rasp.old_cat.m2'
RESPONSE_COUNT = 9... |
'''
n=int(input("N= "))
x=range(2,n+1)
total=0
for item in x:
total=total+item
print(total)
'''
a=int(input("A= "))
b=int(input("B= "))
x=range(a,b+1,1)
total=0
for item in x:
print(item,end=",")
total=total+item
print(total)
|
# -*- coding: utf-8 -*-
class BaseTopology(object):
def deploy_first_steps(self):
raise NotImplementedError()
def deploy_last_steps(self):
raise NotImplementedError()
def monitoring_steps(self):
return (
'workflow.steps.util.deploy.create_zabbix.CreateZabbix',
... |
""" Package summary:
Modules:
database_setup - Set up restaurantmenu database.
lots_of_farms - Populate the database with dummy data.
"""
|
def permute_chunks(chunks: list) -> list:
"""
Permute all words inside a list to create all possible combinations
:param chunks: list with words to permute
:return: all permuted results
:raise Exception: when chunks is an empty list
"""
if len(chunks) == 0:
raise Exception('chunks ... |
config.load_autoconfig(True)
config.unbind("+")
config.unbind("-")
config.unbind("=")
config.bind("z+", "zoom-in")
config.bind("z-", "zoom-out")
config.bind("zz", "zoom")
config.unbind("O")
config.unbind("T")
config.unbind("th")
config.unbind("tl")
config.bind("O", "set-cmd-text :open {url:pretty}")
config.bind("T", ... |
#
# @lc app=leetcode.cn id=701 lang=python3
#
# [701] 二叉搜索树中的插入操作
#
# https://leetcode-cn.com/problems/insert-into-a-binary-search-tree/description/
#
# algorithms
# Medium (71.98%)
# Likes: 136
# Dislikes: 0
# Total Accepted: 43.4K
# Total Submissions: 60.2K
# Testcase Example: '[4,2,7,1,3]\n5'
#
# 给定二叉搜索树(BST)... |
# Start and end date
gw_start_date = '2010-01-01'
gw_end_date = '2014-01-01'
# Bounds
gw_lower_lat = AutoParam(36)
gw_upper_lat = AutoParam(37)
gw_left_lon = AutoParam(-121)
gw_right_lon = AutoParam(-117)
# Metadata
gw_metadata = WDF.getStationMetadata()
# Create data fetcher
wdf = WDF([gw_lower_lat, gw_upper_lat... |
# Name : Exercise8-4.py
# Author : Ryan Carr
# Date : 02/03/19
# Purpose : Open a file, add unique words to list
# Sort list and display results to user
# Text files are stored in the data folder one level up
filename = input('Enter a filename: ')
if filename == 'romeo.txt':
filename = '../data/ro... |
"""
https://www.hackerrank.com/contests/linguagens-de-programacao-para-ciencia-de-dados/challenges/find-second-maximum-number-in-a-list
"""
n = int(input())
arr = map(int, input().split())
lista = list(set(arr))
lista.sort()
print(lista[-2])
|
"""Constant for AWS component."""
DOMAIN = "aws"
DATA_KEY = DOMAIN
DATA_CONFIG = "aws_config"
DATA_HASS_CONFIG = "aws_hass_config"
DATA_SESSIONS = "aws_sessions"
CONF_REGION = "region_name"
CONF_ACCESS_KEY_ID = "aws_access_key_id"
CONF_SECRET_ACCESS_KEY = "aws_secret_access_key"
CONF_PROFILE_NAME = "profile_name"
CONF... |
class living:
def __init__(self,n,res):
self.name=n
self.res=res
def displayliv(self):
print("name:",self.name)
print("growth:",self.res)
class plant(living):
##super().__init__("flowerplant","carbondioxide")
def __init__(self,mv,sou):
super().__init__("flowerplan... |
# WAP that lets the competitor know which of these prizes they won based on the number of points they scored
'''
Points Prize
1 - 50 wooden rabbit
51 - 150 no prize
151 - 180 wafer-thin mint
181 - 200 penguin
'''
points = int(input("Enter your team points"))
if points <= 50:
result = "... |
# @date 2018-08-07
# @author Frederic Scherma, All rights reserved without prejudices.
# @license Copyright (c) 2018 Dream Overflow
# @brief Author model
class Author(object):
def __init__(self, watcher, author_id, trader_name):
self._watcher = watcher
self._id = author_id
self._name = trader_name
self._succ... |
"""
47 - Leia um número inteiro de 4 dígitos (de 1.000 a 9.999) e imprima 1 dígito
por linha.
"""
inteiro = int(input("Digite um número inteiro de 1.000 a 9.999: "))
digito_0 = str(inteiro)[0]
digito_1 = str(inteiro)[1]
digito_2 = str(inteiro)[2]
digito_3 = str(inteiro)[3]
print(f"Este é o número que você digitou: {i... |
# python3
#DEBUG = False
DEBUG = True
LOG = True
#LOG = False
if DEBUG: test = open("tests\\01x", "r")
EPS = 1e-6
PRECISION = 20
class Equation:
def __init__(self, a, b):
self.a = a
self.b = b
class Position:
def __init__(self, column, row):
self.column = column
self.row = ro... |
"""
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you
climb to the top?
"""
class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
if n<0:
... |
def currency(p):
"""
-> Formats price.
:p: price.
"""
return f'U${p:.2f}'
def increase(p, r, f):
"""
-> Increases a price in percentage.
:p: price to be increased.
:r: percentage to increase the price.
:f: format as US$...
:return: p*(1+r/100)
"""
p *= (1 + r/100)
... |
# this file was generated by "mksmat.py"
table = {
('CC',2,1): {
'nodes': [0.0,
1.0],
'matrix': [
[0.5,
0.5],
] },
('CC',3,1): {
'nodes': [0.0,
0.5,
1.0],
'matrix': [
[0.2083333... |
v = [int(input()) for x in range(50)]
somp, somi, conp, coni = [0 for x in range(4)]
im = []
p = []
for i in range(50):
if v[i] % 2 == 0:
p.append(v[i])
somp += v[i]
conp += 1
else:
im.append(v[i])
somi += v[i]
coni += 1
medias = [somp / conp, somi / coni]
mediap ... |
A, B, C, D = input().split()
A = int(A)
B = int(B)
C = int(C)
D = int(D)
if B > C and D > A and (C + D) > (A + B) and C >= 0 and D >= 0 and A % 2 == 0:
print('Valores aceitos')
else:
print('Valores nao aceitos')
|
def mergesort(arr):
if len(arr)>1:
mid=len(arr)//2
l=arr[:mid]
r=arr[mid:]
mergesort(l)
mergesort(r)
i=j=k=0
while i<len(l) and j <len(r):
if l[i]<r[j]:
arr[k]=l[i]
i+=1
else:
arr[k]=r[j]
... |
# coding=utf-8
class CommonDisambiguationError(Exception):
def __init__(self, options):
self.options = options
def __str__(self):
return "There are more than one articles for that query"
|
settings = {
"DEFAULT_WIDTH": 850,
"DEFAULT_HEIGHT": 400,
"letter_size": 16,
"side_bar_in_pixels": 250,
"active_file_lang": "py"
}
|
def assay_transpose(assay_df):
"""
assay_t_df = assay_transpose(assay_df)
Parameters
----------------
assay_df: dataframe of assay data with genes as rows and patients as columns
Returns
----------------
dataframe transposed with patients as rows and genes as columns
"""
assay... |
def hexstr(name):
output = ''
for n in name:
output += hex(ord(n))[2:]
return output
|
character_checks = {
"Celes" : [
"Magitek Factory Trash",
"Magitek Factory Guard",
"Magitek Factory Finish",
"Opera House Disruption",
"South Figaro Prisoner",
],
"Cyan" : [
"Doma Siege",
"Doma Dream Door",
"Doma Dream Awaken",
"Doma Dr... |
# Settings
class Settings():
MONGO_URI = "localhost:27017"
MONGO_DB = "news"
ES_URI = "localhost:9200"
ES_INDEX_NAME = "all_news"
GENERAL_CRAWL_WAIT_TIME = 30*60
SEBENARNYA_CRAWL_WAIT_TIME = 30*60 #in seconds
SEBENARNYA_RAW_MONGO_COLLECTION = "sebenarnya_raw"
THESTAR... |
S, T = [input() for _ in range(2)]
ans = False
for _ in range(len(S)):
S = S[-1] + S[:-1]
if S == T:
ans = True
print("Yes" if ans else "No")
|
N,H=map(int,input().split())
A,B,C,D,E=map(int,input().split())
ans=C*N
for i in range(N+1):
cost=(H+B*i+D*(N-i)-1)//(D+E)
ans=min(ans,A*i+C*max(0,N-i-cost))
print(ans) |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 24 11:02:45 2019
@author: LENOVO
"""
name = "Dr. Sarvjeet Herald"
print(type(name))
for i in range (0,len(name)):
print(name[i], "=", id(name[i]))
|
def TextStyle(Color="#000000",Margin="0px",FontSize="100%", Background="transparent",Weight="400",LetterSpacing="1"):
return f"""
color:{Color};
font-size: {FontSize};
background: {Background};
font-weight: {Weight};
letter-spacing: {LetterSpacing};
margin: {Margin};
"""
|
# ------------------------------------------------------------------------------
#
# Author:
# Armin Hasitzka (enhancitizer@hasitzka.com)
#
# Licensed under the MIT license.
# See LICENSE in the project root for license information.
#
# -----------------------------------------------------------------------... |
side = input('Enter the corresponding value next to a square: ')
side = int(side)
perimeter = side * 4
area = side ** 2
print('Perimeter:', perimeter, 'Area:', area) |
# coding: utf8
shortcuts = {
"Forklift 3": { #https://defkey.com/forklift-3-shortcuts
"Open selection": "⌘↓",
"Enclosing folder": "⌘↑",
"Quick look": "Space",
"Copy to": "F5",
"Move to": "F6",
"Rename": "⏎",
"Edit": "⌘E",
"Move to trash": "⌘ Backspace"... |
# https://codeforces.com/problemset/problem/69/A
n = int(input())
coordinates = [list(map(int, input().split())) for _ in range(n)]
x, y, z = 0, 0, 0
for c in coordinates:
x += c[0]
y += c[1]
z += c[2]
if x == 0 and y == 0 and z ==0:
print('YES')
else:
print('NO') |
# Copyright 2014 The Bazel Authors. All rights reserved.
#
# 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 applicable la... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.