content stringlengths 7 1.05M |
|---|
'''Write a program that returns a list that contains common
elements between two input lists without duplicates. Ensure
it works for lists of two different sizes.'''
# list of random numbers
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
# newlist:
# sets ensure unique v... |
class StrategyStateMachine :
def discovery() :
pass
def composition() :
pass
def usage() :
pass
def end() :
pass
|
# This file is generated by sync-deps, do not edit!
load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@rules_jvm_external//:specs.bzl", "maven")
def default_install(artifacts, repositories, excluded_artifacts = []):
maven_install(
artifacts = artifacts,
fetch_sources = True,
rep... |
skill = input()
command = input()
while command != "For Azeroth":
command = command.split(" ")
command = command[0]
if command == "GladiatorStance":
skill = skill.upper()
print(skill)
break
elif command == "DefensiveStance":
skill = skill.lower()
print(skill)
... |
product_list = ["풀", "가위", "크래파스"]
price_list = [800, 2500, 5000]
product_dict = {x:y for x, y in zip(product_list,price_list)}
print(product_dict) |
class DropboxException(Exception):
"""All errors related to making an API request extend this."""
def __init__(self, request_id, *args, **kwargs):
# A request_id can be shared with Dropbox Support to pinpoint the exact
# request that returns an error.
super(DropboxException, self).__ini... |
{
"targets": [
{
"target_name": "waznutilities",
"sources": [
"src/main.cc",
"src/cryptonote_core/cryptonote_format_utils.cpp",
"src/crypto/tree-hash.c",
"src/crypto/crypto.cpp",
"src/crypto/crypto-ops.c"... |
# We must set a certain amount of money
my_money = 13
# We make a decision
if my_money > 20:
print("I'm going to the cinema and buy popcorn!")
elif my_money > 10:
print("I'm going to the cinema, but not buy popcorn!")
else:
print("I'm staying home!")
|
ix.enable_command_history()
app = ix.application
clarisse_win = app.get_event_window()
app.open_rename_item_window(clarisse_win)
ix.disable_command_history() |
# Input: 2D array of "map"
# Output: Shortest distance to exit from cell
# Revision 2 with help from my python book and some documentation
class deque(object):
# A custom implementation of collections.deque that is about 0.4s faster
def __init__(self, iterable=(), maxsize=-1):
if not hasattr(self, 'data'... |
# encoding=utf-8
class Expression(object):
pass
|
# -*- coding: utf-8 -*-
"""
This software is licensed under the License (MIT) located at
https://github.com/ephreal/rollbot/Licence
Please see the license for any restrictions or rights granted to you by the
License.
"""
def check_author(author):
"""
Checks to see if the author of a message is the same as th... |
# -*- coding: utf-8 -*-
'''Snippets for combination.
'''
# Usage:
# combination = Combination(max_value=10 ** 5 + 100)
# combination.count_nCr(n, r)
class Combination:
''' Count the total number of combinations.
nCr % mod.
nHr % mod = (n + r - 1)Cr % mod.
Args:
... |
class Command(object):
"""
Abstract command class
"""
name = ''
description = ''
parser = None
def __init__(self, args):
self.args = args
@classmethod
def create_parser(cls, subparsers):
cls.parser = subparsers.add_parser(cls.name, help=cls.description)
cls... |
# -*- coding: utf-8 -*-
class Student(object):
def __init__(self, name, score):
self.__name = name
self.__score = score
def print_score(self):
print('%s: %s' % (self.__name, self.__score))
def get_name(self):
return self.__name
def get_score(self):
return sel... |
# Copyright (c) 2015 Filipe Negrão
# Version 0.1
#------------------------------------------------------------
# FUNCTIONS
#------------------------------------------------------------
def draw_ruling(x,y):
spaceBetween = 1.5*cm #space between ruling lines
line((x, y), (x, y+xHeight+descender+ascender)) #ve... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author:_defined
@Time: 2018/8/28 19:18
@Description:
"""
__all__ = ["Timeout", "NoCookiesException", "VerificationCodeError",
"OverrideAttrException", "NoTaskException", "SpiderBanError"]
class Timeout(Exception):
"""
Functions run out of time
... |
# import simplejson as json
# import pandas as pd
# import numpy as np
# import psycopg2
# from itertools import repeat
# from psycopg2.extras import RealDictCursor, DictCursor
def execSql(cursor):
out = None
sqlString = '''
set search_path to demounit1;
-- GstInputAll (ExtGstTranD only) based on "isIn... |
class ListenKeyExpired:
def __init__(self):
self.eventType = ''
self.eventTime = 0
@staticmethod
def json_parse(json_data):
result = ListenKeyExpired()
result.eventType = json_data.get_string('e')
result.eventTime = json_data.get_int('E')
return r... |
class Option:
"""Description of a single configurable option.
Args:
name: The name of the option, i.e. its key in the config.
description: Description of the option.
default: Default value of the option.
path: Path segments to the option in the config.
"""
def __init__(s... |
b1 = float(input('Primeiro Bimestre: '))
b2 = float(input('Segundo Bimestre: '))
tot = (b1 + b2) / 2
if tot < 6:
print('''
Sua nota do primeiro bimestre é {:.1f} e no segundo é {:.1f}, sua média final é de {:.1f}.
Infelizmente você foi reprovado.
'''.format(b1, b2, tot))
else:
print('''
Sua not... |
self.description = "Remove a package with a modified file marked for backup and has existing pacsaves"
self.filesystem = ["etc/dummy.conf.pacsave",
"etc/dummy.conf.pacsave.1",
"etc/dummy.conf.pacsave.2"]
p1 = pmpkg("dummy")
p1.files = ["etc/dummy.conf*"]
p1.backup = ["etc/dummy.c... |
"""
Exercise 3
PART 1: Gather Information
Gather information about the source of the error and paste your findings here. E.g.:
- What is the expected vs. the actual output?
- What error message (if any) is there?
- What line number is causing the error?
- What can you deduce about the cause of the error?
PART 2: Sta... |
# =====================================
# generator=datazen
# version=2.1.0
# hash=ae83e4ad65b0e39560e7ca039248aa55
# =====================================
"""
Useful defaults and other package metadata.
"""
DESCRIPTION = "Simplify project workflows by standardizing use of GNU Make."
PKG_NAME = "vmklib"
VERSION = "1.... |
def quote():
# TODO store to indexes.json
indexes = [
{ source : 'BOVESPA', ticker:'IBOV'},
{ source : 'CRYPTO', ticker:'BTCBRL'}
]
return indexes |
class AttributeRange(object):
# value_start: float
# value_end: float
# duration_seconds: int
def __init__(self, left: float,
right: float, duration_seconds: int):
self.left = left
self.right = right
self.duration_seconds = duration_seconds
def __iter__(s... |
# coding=utf-8
"""
**The brief introduction**:
This package (:py:mod:`poco.sdk.interfaces`) defines the main standards for communication interfaces between poco and
poco-sdk. If poco-sdk is integrated with an app running on another host or in different language, then poco-sdk is
called `remote runtime`. The implement... |
'''
Filippo Aleotti
filippo.aleotti2@unibo.it
29 November 2019
I PROFESSIONAL MASTER'S PROGRAM, II LEVEL "SIMUR", Imola 2019
Modify the function realised in the previous exercise to return (inside the dict, using the key min) also the value with minimum frequency.
If more values have the same minimum frequency, then... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"say_hello": "test_example.ipynb",
"say_goodbye": "00_core.ipynb"}
modules = ["core.py",
"test_example.py"]
doc_url = "https://daviderzmann.github.io/designkit_test/"
git_url = "https:/... |
n=int(input())
S=input()
k=int(input())
i=S[k-1]
for s in S:print(s if s==i else "*",end="") |
class Solution:
def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:
if len(timeSeries) == 0:
return 0
total_poisoned = 0
for i in range(len(timeSeries)-1):
total_poisoned += min(duration, timeSeries[i+1] - timeSeries[i])
total_poisoned... |
#
# PySNMP MIB module CISCO-LWAPP-RF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-RF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:06:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
def bubble_sort(array):
for i in range(len(array)):
for j in range(len(array) - 1):
if array[j] > array[j + 1]:
array[j], array[j + 1] = array[j + 1], array[j]
|
class FilePathSimilarityCalculator:
"""
This class handles file path similarity score calculating operations.
"""
@staticmethod
def path_separator(file_string):
return file_string.split("/")
def longest_common_prefix_similarity(self, file1, file2):
file1 = self.path_separator(f... |
n=int(input())
if n<3:
print("NO")
else:
a=[]
b=[]
asum=0
bsum=0
for i in range(n,0,-1):
if asum<bsum:
asum+=i
a.append(i)
else:
bsum+=i
b.append(i)
if asum==bsum:
print("YES")
print(len(a))
print(' '.joi... |
DESCRIPTION = "sets a variable for the current module"
def autocomplete(shell, line, text, state):
# todo, here we can provide some defaults for bools/enums? i.e. True/False
if len(line.split(" ")) >= 3:
return None
env = shell.plugins[shell.state]
options = [x.name + " " for x in env.options... |
"""
RSA Private/Public Key Parameters
----------------------------------
KEY_BIT_SIZE: bit size of keys
e: exponent
"""
KEY_BIT_SIZE = 4000
e = int("""130499359017053281556458431345533123778363781651270565436082977439613579949
54717322917425749364642943354291308521375017815197673634269952642064... |
class When_we_have_a_test:
def when_things_happen(self):
pass
def it_should_do_this_test(self):
assert 1 == 1
def test_we_still_run_regular_pytest_scripts():
assert 2 == 2
|
# -*- coding:utf-8-*-
stop = ""
print("欢迎来到贝拉贝拉电影院")
stop_1 = 0
stop_2 = ""
while stop_1 < 5:
stop = raw_input("请问您的年龄是?")
stop_1 = stop_1 + 1
stop_2 = stop
if stop_2 == "q!":
break
else:
if int(stop) < 3:
z = 3
elif int(stop) < 13:
z = 10
elif int(stop) < 100:
z = 15
print("您的年龄所对应的票价是... |
######################## Errors ##########################
PAYLOAD_NOT_FOUND_ERROR = 'Payload can not be found.'
KEYWORD_NOT_FOUND_ERROR = "Keywords can to be empty."
TYPE_NOT_CORRECT_ERROR = 'Payload type is incorrect, please upload text.'
MODEL_NOT_FOUND_ERROR = 'The ML model not found. (default name: en_core_web_sm)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is Webmention tools!
"""
__version__ = '0.4.1'
|
class Solution:
def findLengthOfLCIS(self, nums: List[int]) -> int:
if not nums:
return 0
dp = [1] * len(nums)
if len(nums) < 2:
return 1
result = 1
for i in range(1, len(nums)):
if nums[i] > nums[i - 1]:
dp[i] = dp... |
class Symbol:
key = '#'
author = '@'
goto = '>'
condition = '?'
action = '!'
comment = '%'
left = '{'
right = '}'
def prefixcount(string, prefix):
i = 0
while string[i] == prefix:
i += 1
return i
def extract(string, startsymbol, endsymbol):
if not startsymbol in string and endsymbol in string:
return... |
#value=input().split()
#B,G=value
#B=int(B) #B=ball
#G=int(G) #G=need
B=int(input())
G=int(input())
result = G//2
also_need=result-B
if (result<=B):
print("Amelia tem todas bolinhas!")
else:
print("Faltam",also_need,"bolinha(s)") |
def GenerateCombination(N, ObjectNumber):
# initiate the object B and C positions
# Get all permutations of length 2
combinlist = []
for i in range(N):
if i < N-1:
j = i + 1
else:
j = 0
combin = [ObjectNumber, i, j]
combinlist.append(combin)
r... |
class OTBDeepConfig:
fhog_params = {'fname': 'fhog',
'num_orients': 9,
'cell_size': 4,
'compressed_dim': 10,
# 'nDim': 9 * 3 + 5 -1
}
#cn_params = {"fname": 'cn',
# "table_name": "CNnorm",
... |
DECOY_PREFIX = 'decoy_'
HEADER_SPECFILE = '#SpecFile'
HEADER_SCANNR = 'ScanNum'
HEADER_SPECSCANID = 'SpecID'
HEADER_CHARGE = 'Charge'
HEADER_PEPTIDE = 'Peptide'
HEADER_PROTEIN = 'Protein'
HEADER_GENE = 'Gene ID'
HEADER_SYMBOL = 'Gene Name'
HEADER_DESCRIPTION = 'Description'
HEADER_PRECURSOR_MZ = 'Precursor'
HEADER_PRE... |
# The path to the ROM file to load:
# SpaceInvaders starts to render visible pixels when
# the cpu halfClkCount reaches about 11000
#romFile = 'roms/SpaceInvaders.bin'
#romFile = 'roms/Pitfall.bin'
romFile = 'roms/DonkeyKong.bin'
# 8kb ROM, spins reading 0x282 switches
#romFile = 'roms/Asteroids.bin'
# 2kb ROM
#... |
# https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/
# Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
#
# Find all the elements of [1, n] inclusive that do not appear in this array.
#
# Could you do it without extra space and in... |
def setStringLength(string,length,align:"left"):
"""
:param string: A str which is you want to set length
:param length: Integer
:param align: left, mid or right
:return:
"""
real_str_len=len(string)
if real_str_len<length:
if align=="left":
text_which_add=""
... |
# 全排列
def dfs(u):
# 说明走到头了,该输出了
if u == n:
for i in range(n):
print(path[i], end=" ")
print()
for i in range(1, n + 1):
if not st[i]: # 如果这个点没有被用过
path[u] = i
st[i] = True
dfs(u + 1)
st[i] = False # 恢复现场
N = 10
path, st... |
class RegionModel:
def __init__(self, dbRow):
self.ID = dbRow["ID"]
self.RegionName = dbRow["RegionName"]
self.RegionCode = dbRow["RegionCode"]
self.RegionChat = dbRow["RegionChat"] |
def test_correct_abi_right_padding(tester, w3, get_contract_with_gas_estimation):
selfcall_code_6 = """
@external
def hardtest(arg1: Bytes[64], arg2: Bytes[64]) -> Bytes[128]:
return concat(arg1, arg2)
"""
c = get_contract_with_gas_estimation(selfcall_code_6)
assert c.hardtest(b"hello" * 5, b"hell... |
def primera_letra(lista_de_palabras):
primeras_letras = []
for palabra in lista_de_palabras:
assert type(palabra) == str, f'{palabra} no es str'
assert len(palabra) > 0, 'No se permiten str vacios'
primeras_letras.append(palabra[0])
return primeras_letras |
load("@bazel_skylib//lib:paths.bzl", "paths")
load(":common.bzl", "declare_caches", "write_cache_manifest")
load("//dotnet/private:context.bzl", "dotnet_exec_context", "make_builder_cmd")
load("//dotnet/private:providers.bzl", "DotnetPublishInfo")
def pack(ctx):
info = ctx.attr.target[DotnetPublishInfo]
restor... |
'''
FISCO BCOS/Python-SDK is a python client for FISCO BCOS2.0 (https://github.com/FISCO-BCOS/)
FISCO BCOS/Python-SDK is free software: you can redistribute it and/or modify it under the
terms of the MIT License as published by the Free Software Foundation. This project is
distributed in the hope that it will b... |
numbers = [value**3 for value in range(1,11)]
for number in numbers:
print(number)
#value不能用,局部变量 |
#===============================================================
# DMXIS Macro (c) 2010 db audioware limited
#===============================================================
RgbColour(255,127,80)
|
def remote_pip_install_simple(name, silent):
return remote_pip_install(name, True, 'python3', 'pip3', silent)
def remote_pip_install(name, usermode, py, pip, silent):
return lib_install(name, usermode=usermode, py=py, pip=pip, silent=silent)
|
class RandomObjects:
prefix = ''
postfix = ''
def __init__(self):
self.displacements = {}
self.velocities = {}
self.accelerations = {}
self.load_vectors = {}
self.spc_forces = {}
self.mpc_forces = {}
self.crod_force = {}
self.conrod_force = {}... |
N = int(input())
hh = 0
mm = 0
ss = 0
count = 0
while not(hh == N and mm == 59 and ss == 59):
# tic toc
ss += 1
if ss == 60:
ss = 0
mm += 1
if mm == 60:
mm = 0
hh += 1
# print(f'{hh}:{mm}:{ss}')
# count
if '3' in str(hh):
count += 1
continue
... |
"""
python 是顺序执行的
若遇到函数,则将函数添加到属性中,暂不调用。
等到实际执行的时候,才会寻找函数来调用。
其中,dir()函数的作用是:返回当前范围内的变量、方法和定义的类型列表
举例如下
"""
def test():
print('222')
fun()
print(dir())
# test() # 若在此处调用,则会在打印完222之后报错
def fun():
print('111')
print(dir())
test()
|
# @Title: 快速公交 (快速公交)
# @Author: KivenC
# @Date: 2020-09-13 13:17:50
# @Runtime: 180 ms
# @Memory: 15.3 MB
class Solution:
def busRapidTransit(self, target: int, inc: int, dec: int, jump: List[int], cost: List[int]) -> int:
@functools.lru_cache(None)
def helper(target):
if target == 0... |
largura = float(input('largura da parede: '))
altura = float(input('altura da parede: '))
area = largura*altura
print('A área da parede é de {}m².\n Sabendo que um 1l de tinta pintam 2m², serão necessários {}l de tinta.'.format(area,area/2))
|
"""
Raise: Sirve para lanzar (de forma intencional) excepciones en Python.
Esto tambien hace que el programa, pare su ejecución como si de un error se tratara.
"""
def evaluar_nota(nota):
if nota < 0:
raise ValueError("No se permiten valores negativos...") # El mensaje es personalizado.
elif nota >= ... |
###########################################
# EXERCICIO 062 #
###########################################
'''MELHORE O DESAFIO EX061, PERGUNTANDO PARA
O USUARIO SE ELE QUER MOSTAR MAIS ALGUNS TERMOS
O PROGRAMA ENCERRA QUANDO ELE DISSER QUE QUER
MOSTRAR 0 TERMOS'''
num = int(input('DIGITE O PR... |
def pytest_addoption(parser):
selenium_class_names = ("Android", "Chrome", "Firefox", "Ie", "Opera", "PhantomJS", "Remote", "Safari")
parser.addoption("--webdriver", action="store", choices=selenium_class_names,
default="PhantomJS",
help="Selenium WebDriver interface t... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Simone Persiani <iosonopersia@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copie... |
# Time: O(m * n)
# Space: O(min(m, n))
class Solution(object):
def longestCommonSubsequence(self, text1, text2):
"""
:type text1: str
:type text2: str
:rtype: int
"""
if len(text1) < len(text2):
return self.longestCommonSubsequence(text2, text1)
... |
class FeatureGenerator():
"""
Base class for feature generators
"""
def fit(self, timeseries):
"""
Fit the feature generator
inputs:
timeseries: the timeseries (numpy array) (num_series x series_length)
"""
raise NotImplementedError('FeatureGenerator.f... |
dpi = 400
dpcm = dpi / 2.54
INFTY = float('inf')
PAPER = {
'letter': {
'qr_left': (0.0, 0.882, 0.152, 1.0),
'qr_right': (0.848, 0.882, 1.0, 1.0),
'tick': (0.17, 0.88, 0.91, 1.0),
'uin': (0.49, 0.11, 0.964, 0.54)
}
}
|
'''Soma Simples'''
A = int(input())
B = int(input())
def CalculaSomaSimples(a: int, b: int):
resultado = int(a+b)
return('SOMA = {}'.format(resultado))
print(CalculaSomaSimples(A,B))
|
pkgname = "libgpg-error"
pkgver = "1.43"
pkgrel = 0
build_style = "gnu_configure"
hostmakedepends = ["pkgconf"]
pkgdesc = "Library for error values used by GnuPG components"
maintainer = "q66 <q66@chimera-linux.org>"
license = "LGPL-2.1-or-later"
url = "https://www.gnupg.org"
source = f"{url}/ftp/gcrypt/{pkgname}/{pkgn... |
class Person:
name = None
age = 0
gender = None
def __init__(self, n, a, g):
self.name = n
self.age = a
self.gender = g
def walk(self):
print('I am walking')
def eat(self):
print('I am eating :)')
def __str__(self): # string representation of the o... |
list=input().split()
re=[int(e) for e in input().split()]
new=[]
for i in re:
new.append(list[i])
for l in new:
print(l,end=" ")
|
shopping_list = []
def show_help():
print("Enter the items/amount for your shopping list")
print("Enter DONE once you have completed the list, Enter Help if you require assistance")
def add_to_list(item):
shopping_list.append(item)
print("Added! List has {} items.".format(len(shopping_list)))
def show_li... |
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
"""Defines the Constant strings related to Error Analysis."""
class ErrorAnalysisDashboardInterface(object):
"""Dictionary properties shared between python and javascript object."""
TREE_URL = "treeUrl"
MATRIX_URL = "matrixUrl"
E... |
"""
LIST: MINIMUM AND MAXIMUM ITEMS
"""
__author__ = 'Sol Amour - amoursol@gmail.com'
__twitter__ = '@solamour'
__version__ = '1.0.0'
"""
SYNTAX: min(iterable[, key = x])
min = Return the smallest item in an iterable or the smallest of two or more arguments
iterable = An iterable element (Such as a list,... |
def safe_chr(data, oneline=False):
"""Returns a byte or iterable of bytes as ASCII, using ANSI color codes to
represent non-printables. If oneline is set, \n is treated as a special
character, otherwise it is passed through unchanged. The following color
codes are used:
- green 'n': newline
... |
GET_HOSTS = [
{
'device_id': '00000000000000000000000000000000',
'cid': '11111111111111111111111111111111',
'agent_load_flags': '0',
'agent_local_time': '2021-12-08T15:16:24.360Z',
'agent_version': '6.30.14406.0',
'bios_manufacturer': 'Amazon EC2',
'bios_versi... |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... |
"""
1. Faça X = 0.0 e Y = 18. Verifique o tipo de dado que o Python atribuiu a cada um.
Faça Z = X + Y e verifique o resultado calculado e armazenado em Z.
Verifique com qual tipo de dado foi criado o objeto Z.
"""
x = 0.0
y = 18
print(type(x))
print(type(y))
z = x + y
print('O resultado calculado: {} '.format(z))
pr... |
class Solution(object):
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
nc = len(grid)
nr = len(grid[0])
for x in range(1, nr):
grid[0][x] += grid[0][x-1]
for x in range(1, nc):
grid[x][0] += grid[x-1... |
class WordWithTag:
word = ""
tag = ""
separator = ''
def __init__(self, separator):
self.separator = separator
|
class NvramBatteryStatusEnum(basestring):
"""
ok|partially discharged|fully discharged|not present|near
eol|eol|unknown|over charged|fully charged
Possible values:
<ul>
<li> "battery_ok" ,
<li> "battery_partially_discharged" ,
<li> "battery_fully_discharged" ,
<... |
#!/usr/bin/env python3
def hash_tabla_letrehoz():
tabla = []
for i in range(26):
tabla.append([])
return tabla
def key(szo):
if ord(szo[0]) >= 97 and ord(szo[0]) <= 122:
return ord(szo[0])
else:
raise ValueError("A(z) '{}' karakter nem hashelhető, adj meg ékezet nélküli, kisbetűvel kezdődő... |
class Solution:
def minOperations(self, n: int) -> int:
num_ops = 0
for i in range(0, n // 2, 1):
num_ops += n - (2 * i + 1)
return num_ops |
input = """
3 2 2 3 1 0 4
2 5 2 0 1 2 3
1 1 2 1 5 4
2 6 2 0 2 2 3
1 1 2 0 6 4
1 4 0 0
3 3 7 8 9 1 0 10
2 11 3 0 1 7 8 9
1 1 2 1 11 10
2 12 3 0 2 7 8 9
1 1 2 0 12 10
1 10 0 0
1 13 1 0 9
1 14 1 0 8
1 15 1 0 7
1 16 1 0 9
1 17 1 0 7
1 18 1 1 17
1 19 2 0 14 13
1 20 3 0 14 18 15
1 1 2 1 20 2
1 1 2 1 19 3
0
16 i
3 e
20 s
13 f... |
'''
Largest Continuous Sum Problem
Given an array of integers (positive and negative) find the largest continous sum
'''
def large_cont_sum(arr):
#if array is all positive we return the result as summ of all numbers
#the negative numbers int he array will cause us to need to begin checkin sequences
## Che... |
data = (
's', # 0x00
't', # 0x01
'u', # 0x02
'v', # 0x03
'w', # 0x04
'x', # 0x05
'y', # 0x06
'z', # 0x07
'A', # 0x08
'B', # 0x09
'C', # 0x0a
'D', # 0x0b
'E', # 0x0c
'F', # 0x0d
'G', # 0x0e
'H', # 0x0f
'I', # 0x10
'J', # 0x11
'K', # 0x12
'L', # 0x13
'M', # 0... |
salario = float(input('Meu salario atual é de R$: '))
nsal = salario + (salario * 15 / 100)
print(f'Meu salário era {salario:.2f} para R${nsal:.2f}')
|
# -*- coding: utf-8 -*-
"""
"main concept of MongoDB is embed whenever possible"
Ref: http://stackoverflow.com/questions/4655610#comment5129510_4656431
"""
transcript = dict(
# The ensemble transcript id
transcript_id=str, # required=True
# The hgnc gene id
hgnc_id=int,
### Protein specific predic... |
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
GEMS_URL = 'https://rubygems.org/api/v1/versions/%s.json'
async def get_version(name, conf, *, cache, **kwargs):
key = conf.get('gems', name)
data = await cache.get_json(GEMS_URL % key)
return data[0]['number']
|
def msgme(*names):
for i in names:
print(i)
msgme("abc")
msgme("xyz",100)
msgme("apple","mango",1,2,3,7)
|
n1= int(input('digite um numero : '))
n2 = int(input('digi um segundo número :'))
if n1<n2:
print(' o primeiro numero {} é menor que o segundo número {}'.format( n1,n2 ))
elif n1>n2:
print('o segundo número {} é menor que o primeiro número {}'.format(n2,n1))
elif n1==n2:
print('os numeros {} e {} são nume... |
class Dog:
species = 'caniche'
def __init__(self, name, age):
self.name = name
self.age = age
bambi = Dog("Bambi", 5)
mikey = Dog("Rufus", 6)
blacky = Dog("Fosca", 9)
coco = Dog("Coco", 13)
perla = Dog("Neska", 3)
print("{} is {} and {} is {}.". format(bambi.name, bambi.age, mikey.name, mike... |
class Student:
def __init__(self, name="", age=0, score=0, sex=""):
self.name = name
self.age = age
self.score = score
self.sex = sex
list_student = [
Student("悟空", 26, 96, "男"),
Student("八戒", 25, 50, "男"),
Student("唐僧", 23, 53, "女"),
Student("小白龙", 29, 85, "女"),
]
... |
"""
[11/3/2012] Challenge #110 [Difficult] You can't handle the truth!
https://www.reddit.com/r/dailyprogrammer/comments/12k3xw/1132012_challenge_110_difficult_you_cant_handle/
**Description:**
[Truth Tables](http://en.wikipedia.org/wiki/Truth_table) are a simple table that demonstrates all possible results
given a B... |
# Exercico 36
# Emprestimo bancario, valor, salario, não pode exeder 30% do salario.
casa = float(input('Valor das casa:R$ '))
salario = float(input('Salario do comprador:R$ '))
anos = int (input('Quantos anos de financiamemto:R$ '))
prestação = casa / ( anos * 12)
minimo = salario * 30 / 100
print('Para pagas uma ca... |
# Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto.
preco = float(input("\nDigite o preço do produto: R$"))
desconto = preco - (preco * 0.05)
print("\nO novo preço do produto com 5% de desconto é R${:.2f}.".format(desconto))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.