content stringlengths 7 1.05M |
|---|
vowels = "aeiou"
#user input
word = input("Enter a word ('quit' to quit): ")
word = word.lower()
if word == 'quit':
quit()
#mainloop
while word != 'quit':
if word[0] in vowels:
word = word + "way"
#if word is one letter consonant
elif word[0] not in vowels and len(word) == 1:
word =... |
class Event:
def __init__(self, event_date, event_type, machine_name, user):
self.date = event_date
self.type = event_type
self.machine = machine_name
self.user = user
|
pkgname = "python-urllib3"
pkgver = "1.26.9"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools"]
depends = ["python-six"]
pkgdesc = "HTTP library with thread-safe connection pooling"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://urllib3.readthedocs.io"
source = f... |
# 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:
"""
3
/ \
2 5
/ \ \
1 3 1
@问题: 在binary tree中,找到不相邻节点的最大和,比如上... |
#!/usr/bin/env python
# Full license can be found in License.md
# Full author list can be found in .zenodo.json file
# DOI:10.5281/zenodo.3824979
# ----------------------------------------------------------------------------
# -*- coding: utf-8 -*-
"""Methods supporting the Global Navigation Satellite System platform
"... |
# -*- coding:utf-8; -*-
class SolutionV1:
def permute(self, nums):
result = []
def helper(i, nums, r):
# 1. 终止条件
if i == len(nums):
result.append(r)
return
# 2. 处理当前逻辑
newR = []
for k in set(nums) - set(r):
... |
# coding=utf-8
__author__ = 'menghui'
# =====================================================================================================================
# 配置文件
DEBUG = True # 是否开启调试模式
# =====================================================================================================================
# 日志处理占... |
###tuplas são imutaveis
'''
lanche = ('Hanburguer', 'Suco', 'Batata', 'Pizza')
for c in lanche:
print (c)
print ('-'*30)
for c in range (0, len(lanche)):
print (lanche[c])
for p, c in enumerate(lanche):
print (c)
print (sorted(lanche))
'''
### del(lanche) apaga a variavel
'''
a = (5 ,8 ,4)
b = (4 ,3 ,2)... |
"""Kaprekar's Constant.
Have the function KaprekarsConstant(num) take the num parameter being passed which will be a
4-digit number with at least two distinct digits.
Your program should perform the following routine on the number:
Arrange the digits in descending order and in ascending order (adding leading zeroes if... |
___assertEqual(0**17, 0)
___assertEqual(17**0, 1)
___assertEqual(0**0, 1)
___assertEqual(17**1, 17)
___assertEqual(2**10, 1024)
___assertEqual(2**-2, 0.25)
|
record4 = [[({'t4.103.114.0': {'wcet': 1, 'period': 10, 'deadline': 9}, 't3.103.114.0': {'wcet': 2, 'period': 10, 'deadline': 8}, 't5.103.114.0': {'wcet': 3, 'period': 15, 'deadline': 12}}, {'t4.103.114.0': [0.559, 10.0], 't3.103.114.0': [0.733, 5.0], 't5.103.114.0': [0.413, 5.0]}), 'newmec-3'], [({'t5.103.114.1': {'w... |
class MemberStore:
"""docstring for MemberStore"""
members = []
last_id = 1
def get_all(self):
return MemberStore.members
def add(self, member):
member.id = MemberStore.last_id
self.members.append(member)
MemberStore.last_id += 1
def get_by_id(self, id):
all_mem = self.get_all()
res = None
for me... |
# Initialize step_end
step_end = 10
# Loop for step_end steps
for step in range(step_end):
# Compute value of t
t = step * dt
# Compute value of i at this time step
i = i_mean * (1 + np.sin((t * 2 * np.pi) / 0.01))
# Print value of t and i
print(f'{t:.3f} {i:.4e}') |
"""
##########################################
## Developed By:Mustafa Raad Mutashar ##
## mustafa.raad.7@gmail.com 2020 ##
##########################################
"""
|
# OpenWeatherMap API Key
weather_api_key = "229c3f533e63b8b69792de2ba65d3645"
# Google API Key
g_key = "AIzaSyCv1BWR1Jm0cxoY8oqWxYHWU2g6Aq91SvE"
|
n1 = float(input('Primeira reta: '))
n2 = float(input('Segunda reta: '))
n3 = float(input('Terceira reta: '))
if n1 < n2 + n3 and n2 < n1 + n3 and n3 < n1 + n2:
print('Sim, é possivel fazer um triângulo com essas três retas!')
else:
print('Não é possivel fazer um triângulo com essas três retas: ')
|
# get stem leaf plot in dictionary
def stemleaf(data):
stem_leaf = {}
for x in data:
x_str = str(x)
if (len(x_str) == 1):
x_str = "0" + x_str
stem = int(x_str[:-1])
leaf = int(x_str[-1])
if (stem not in stem_leaf):
stem_leaf[stem] = [leaf]
else:
stem_leaf[stem] = stem_leaf[stem] + [leaf]
ret... |
"""
A small set of functions for math operations
"""
# Write a function named add that adds two values
def add(A, B):
"""
Just writing this comment because it will pop up when asked for help
"""
C=A+B
return C
def mult(A,B):
"""
A*B
"""
return A*B
def div(A,B):
"""
A/B
... |
f1 = 'bully_and_attack_mode'
f2 = 'happy_child_mode'
f3 = 'punishing_parent_mode'
f4 = 'vulnerable_child_mode'
f5 = 'demanding_parent_mode'
f6 = 'compliand_surrender_mode'
f7 = 'self_aggrandizer_mode'
f8 = 'impulsive_child_mode'
f9 = 'undiscilined_child_mode'
f10 = 'engraed_child_mode'
f11 = 'healthyy_adult_mode'
f12 ... |
# Copyright (c) 2012 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.
{
'target_defaults': {
'variables': {
'chromium_code': 1,
'enable_wexit_time_destructors': 1,
},
'include_dirs': [
'<(DEPT... |
'''all custom exceptions should go here'''
class EmptyP2THDirectory(Exception):
'''no transactions on this P2TH directory'''
class P2THImportFailed(Exception):
'''Importing of PeerAssets P2TH privkeys failed.'''
class InvalidDeckIssueModeCombo(Exception):
'''When verfiying deck issue_mode combinations... |
class Templates:
@staticmethod
def simple_react_class_component(name):
return """import {{ Component }} from "react";
import React from "react";
export default class {0} extends Component {{
render() {{
return <div>{{this.props.children}}</div>;
}}
}}
""".format(name)
@staticmethod
def... |
"""
Configuration for docs
"""
# source_link = "https://github.com/[org_name]/wmo"
# docs_base_url = "https://[org_name].github.io/wmo"
# headline = "App that does everything"
# sub_heading = "Yes, you got that right the first time, everything"
def get_context(context):
context.brand_html = "World Memon Organization... |
class Sack:
def __init__(self, wt, val):
self.wt = wt
self.val = val
self.cost = val // wt
def __lt__(self, other):
return self.cost < other.cost
def knapsack(wt, val, W):
item = []
for i in range(len(wt)):
item.append(Sack(wt[i], val[i]))
i... |
"""Constants for all the OCR post-correction experiments with the multisource model.
These can be modified for different languages/settings as needed.
Copyright (c) 2021, Shruti Rijhwani
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of t... |
"""
DESAFIO 060: Cálculo do Fatorial
Faça um programa que leia um número qualquer e mostre seu fatorial.
Ex: 5! = 5 x 4 x 3 x 2 x 1 = 120
"""
"""
# Feito com for
numero = int(input('Digite um número para descobrir seu fatorial: '))
copia = numero
resultado = numero
add = ''
for n in range(numero):
if copia != n... |
'''
It is time now to piece together everything you have learned so far into a pipeline for classification! Your job in this exercise is to build a pipeline that includes scaling and hyperparameter tuning to classify wine quality.
You'll return to using the SVM classifier you were briefly introduced to earlier in this... |
# -*- coding: utf-8 -*-
"""
Copyright Enrique Martín <emartinm@ucm.es> 2020
Custom exceptions when running LearnSQL
"""
class IncorrectNumberOfSentencesException(Exception):
"""Problem solution with an incorrect number of sentences"""
class ZipFileParsingException(Exception):
"""Error while parsing a ZIP f... |
m: int; n: int
m = int(input("Quantas linhas vai ter cada matriz? "))
n = int(input("Quantas colunas vai ter cada matriz? "))
a: [[int]] = [[0 for x in range(n)] for x in range(m)]
b: [[int]] = [[0 for x in range(n)] for x in range(m)]
c: [[int]] = [[0 for x in range(n)] for x in range(m)]
print("Digite os valores d... |
#R바위 P보 S가위
for _ in range(int(input())):
Ascore = 0
Bscore = 0
for i in range(int(input())):
a,b = map(str,input().split())
if a == "R":
if b == "R":
Ascore+=1
Bscore+=1
elif b == "P":
Bscore+=1
elif b =="... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: ying jun
@email: wandy1208@live.com
@time: 2021/12/12 22:55
"""
|
"""
Application constants
"""
REQUEST_TIMEOUT = 100
CONNECTION_TIMEOUT = 30
BASE_URL = 'https://graph.microsoft.com/v1.0'
SDK_VERSION = '0.0.3'
# Used as the key for AuthMiddlewareOption in MiddlewareControl
AUTH_MIDDLEWARE_OPTIONS = 'AUTH_MIDDLEWARE_OPTIONS'
|
##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2020
# Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8
# Segunda edição - Junho/2014 - ISBN 978-85-7522-408-3
# Terce... |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - <short description>
<what this stuff does ... - verbose enough>
@copyright: 2007 MoinMoin:YourNameHere
@license: GNU GPL, see COPYING for details.
"""
|
# © 2019 KidsCanCode LLC / All rights reserved.
# game options/settings
TITLE = "Leapin' Wizards!"
WIDTH = 480
HEIGHT = 600
FPS = 60
FONT_NAME = 'arial'
SPRITESHEET = 'GameSprites2.png'
# Environment options
GRAVITY = 9.8
# Player properties
PLAYER_ACC = 0.5
PLAYER_FRICTION = -0.1
PLAYER_JUMPPOWER = 15
# Monster pr... |
objetivo = int(input('Escoge un numero: '))
epsilon = 0.0001
paso = epsilon**2
respuesta = 0.0
while abs(respuesta**2 - objetivo) >= epsilon and respuesta <= objetivo:
print(abs(respuesta**2 - objetivo), respuesta)
respuesta += paso
if abs(respuesta**2 - objetivo) >= epsilon:
print(f'No se encontro la ra... |
# You can copy consecutive elements of a list to build another list.
# For example, if you have this list…
print("p01")
cities = ["Atlanta", "Baltimore", "Chicago", "Denver", "Los Angeles", "Seattle"]
print(cities)
# …you can copy elements 2 through 4 to create another list…
print("p02")
smaller_list_of_cities = cities... |
# -*- coding: utf-8 -*-
class ImdbScraperPipeline(object):
def process_item(self, item, spider):
return item
|
high_income = True
low_income = False
if high_income == True and low_income == False:
print("u little bitch ")
#above code is noob kind of code
#bettter way
if high_income and low_income:
print("u little bitch")
#high_income and low_income are already boolean so we don't need to compare it with == True and ==... |
def print_artist(album):
print(album['Artist_Name'])
def change_list(list_from_user):
list_from_user[2] = 5
def print_name(album):
print(album["Album_Title"])
def make_album(name, title, numSongs=10):
album = {'Artist_Name': name, 'Album_Title': title}
if numSongs:
album["Song_Count"] = n... |
class Vector:
"""
Constructor
self: a reference to the object we are creating
vals: a list of integers which are the contents of our vector
"""
def __init__(self, vals):
self.vals = vals
# print("Assigned values ", vals, " to vector.")
"""
String Function
Converts... |
class Block:
def __init__(self, block_id, alignment):
self.id = block_id
self.alignment = alignment
self.toroot = self # parent in find-union tree
self.shift = 0 # order relative to parent
self.reorder_shift = 0 # modification caused by edges inserted within group
sel... |
def get_major_dot_minor_version(version):
"""
Convert full VERSION Django tuple to
a dotted string containing MAJOR.MINOR.
For example, (1, 9, 3, 'final', 0) will result in '1.9'
"""
return '.'.join([str(v) for v in version[:2]])
def get_module_short_name(klass):
"""
Return the short ... |
result = []
for line in DATA.splitlines():
d, t, lvl, msg = line.strip().split(', ', maxsplit=3)
d = date.fromisoformat(d)
t = time.fromisoformat(t)
dt = datetime.combine(d, t)
result.append({'when': dt, 'level': lvl, 'message': msg})
|
#!/usr/bin/env python
#####################################
# Installation module for ike-scan
#####################################
# AUTHOR OF MODULE NAME
AUTHOR="Jason Ashton (ninewires)"
# DESCRIPTION OF THE MODULE
DESCRIPTION="This module will install/update ike-scan - a command-line tool for discovering, finger... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: __init__.py.py
Author: limingdong
Date: 12/31/14
Description:
""" |
"""
Vicki Langer
Class: CS 521 - Fall 1
Date: 28 Sep 2021
Homework Problem # 4_1
taking a list of integers and creating a new one
with sum of nearest neighbors and itself
"""
INPUT_LIST = list(range(55, 0, -10)) # [55, 45, 35, 25, 15, 5]
max_index = len(INPUT_LIST) - 1
# output: 55+45=100 55+45+35=135 45+35+25=105 ... |
nr=int(input())
for i in range(1,nr+1):
print("*"*i)
|
# Copyright 2018 AT&T Intellectual Property. All other 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... |
name = 'geo5038801mod'
apical_dendriteEnd = 79
total_user5 = 70
f = open(name + '.hoc','r')
new_ls = ''
for line in f:
if 'user5[' in line and 'create' not in line and 'append' not in line:
parts = line.split('user5[')
#sdfs
if '{user5[51] connect user5[52](0),... |
"""
"""
data = """dataone: 81070
arxiv_oai: 72681
crossref: 71312
pubmed: 47506
figshare: 36462
scitech: 18362
clinicaltrials: 10244
plos: 9555
mit: 2488
vtech: 713
cmu: 601
columbia: 386
calpoly: 377
opensiuc: 293
doepages: 123
stcloud: 47
spdataverse: 40
trinity: 32
texasstate: 31
valposcholar: 2... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
基础协议类
"""
class BaseProtocol(object):
def process_data(self, device_info, data_msg):
"""
返回device_data
:param data_msg:
:return:
"""
return None, None
def process_cmd(self, device_info, device_cmd):
"""
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Automated Action Rules',
'version': '1.0',
'category': 'Sales/Sales',
'description': """
This module allows to implement action rules for any object.
===========================================... |
#!/usr/bin/env python
command += maketx("../common/textures/mandrill.tif --wrap clamp -o mandrill.tx")
command += testshade("-g 64 64 --center -od uint8 -o Cblack black.tif -o Cclamp clamp.tif -o Cperiodic periodic.tif -o Cmirror mirror.tif -o Cdefault default.tif test")
outputs = [ "out.txt", "black.tif", "clamp.tif... |
#!usr/bin/env python
#-*- coding:utf-8 -*-
class Model(object):
"""
DNN LM
"""
def __init__(self, model_path):
pass
def score(self, sentence):
pass
def PPL(self, sentence):
pass
|
"""
This is the PyTurbSim package. For more information visit the `PyTurbSim home page <http://lkilcher.github.io/pyTurbSim/>`_.
"""
#from api import *
|
class Solution(object):
def findDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
return self.noExtraSpace(nums)
def extraSpace(self, nums):
count = {}
for i in range(len(nums)):
count[nums[i]] = count.setdefault(nums[i],... |
# You are given two non-empty linked lists representing two non-negative integers.
# The digits are stored in reverse order and each of their nodes contain a single digit.
# Add the two numbers and return it as a linked list.
# You may assume the two numbers do not contain any leading zero, except the number 0 itself.... |
source_data = 'day17/input.txt'
with open(source_data, 'r') as f:
input = [x.replace('\n', '') for x in f.readlines()]
target = [[int(y) for y in x.split('=')[1].split('..')] for x in input[0].split(',')]
x = target[0]
y = target[1]
options = {}
testing_velocities = range(-200, 200)
for x_test in testing_veloci... |
def strip_name_amount(arg: str):
"""
Strip the name and the last position integer
Args:
arg: string
Returns:
string and integer with the default value 1
"""
strings = arg.split()
try:
first = ' '.join(strings[:-1])
second = int(strings[-1])
except (V... |
atributes = [
{"name":"color", "value":{'amarillo': 0, 'morado': 1, 'azul': 2, 'verde': 3, 'naranja': 4, 'rojo': 5}},
{"name":"size", "value":{'m': 2, 's': 1, 'xxl': 5, 'xs': 0, 'l': 3, 'xl': 4}},
{"name":"brand", "value":{'blue': 0, 'polo': 1, 'adidas': 2, 'zara': 3, 'nike': 4}},
{"name": "precio", "value": {2... |
# 1 point
a = int(input())
b = int(input())
c = int(input())
print(a and b and c and "Нет нулевых значений!!!")
# 2 point
print(a or b or c or "Введены все нули!")
# 3-4 point
if a > (b + c):
print(a - b - c)
else:
print(b + c - a)
# 5 point
if a > 50 and (b > a or c > a):
print("Вася")
# 6 point
if ... |
def repeated(words):
distance = float('inf')
d = {}
for i, word in enumerate(words):
if word in d:
temp = abs(d[word] - i)
if temp < distance:
distance = temp
d[word] = i
return distance
|
class Skin(object):
menu_positions = ["left", "right"]
height_decrement = 150
def get_base_template(self, module):
t = self.base_template
if module and module.has_local_nav():
t = self.local_nav_template
return t
def initialize(self, appshell):
pass
|
# Day5 of my 100DaysOfCode Challenge
# Program to learn is and in
# use of is
number = None
if (number is None):
print("Yes")
else:
print("No")
# use of in
list = [45, 34, 67, 99]
print(34 in list) |
def multiplication(factor, multiplier):
product = factor * multiplier
if (product % 1) == 0:
return int(product)
else:
return product
|
# Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.
# Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
# Example 1:
# Given nums = [1,1,1,2,2,3],
# Your function s... |
[ ## this file was manually modified by jt
{
'functor' : {
'description' : ['returns a scalar integer value composed by the highiest bits.',
'of each vector element'],
'module' : 'boost',
'arity' : '1',
'call_types' : [],
'ret_arity' : '0',... |
sal = float(input('Digite o salário do funcionário: R$'))
if sal > 1250.00:
print('O novo salário será de R${:.2f} com 10% de aumento!'.format(sal + (sal * 10 / 100)))
else:
print('O novo salário será de R${:.2f} com 15% de aumento!'.format(sal + (sal * 15 / 100)))
|
class Source:
source_list = []
def __init__(self, id, description, url, category):
self.id = id
self.description = description
self.url = url
self.category = category
class Articles:
def __init__(self, id,author, title, urlToImage, url):
self.id = id
s... |
#! /usr/bin/python
def _zeros(size):
out = [[0 for _ in range(size)] for _ in range(size)]
return out
def _enforce_self_dist(dist_matrix, scale):
longest = max((max(row) for row in dist_matrix))
longest *= scale
for i in range(len(dist_matrix)):
dist_matrix[i][i] = longest
return di... |
frase = str(input('Digite uma frase: ')).strip().upper()
print('Quantas vezes aparece a letra "A"? {}'.format(frase.count('A')))
print('Em que posição a letra "A" aparece primeiro? {}'.format(frase.find('A')))
print('Em que posição a letra "A" aparece pela última vez? {}'.format((frase.rfind('A'))))
|
# Parameters template.
#
# This should agree with the current params.ini with the exception of the
# fields we wish to modify.
#
# This template is called by run_sample.py for producing many outputs that are
# needed to run a convergence study.
finess_data_template = '''
; Parameters common to FINESS applications
[fi... |
# https://leetcode.com/problems/sort-colors/
class Solution:
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
if len(nums) < 2: return
l, r = 0, len(nums) - 1
while l < r:
... |
A = int(input())
B = int(input())
H = int(input())
if ((H>=A) and (B>=H)):
print("Это нормально")
elif (A>H):
print("Недосып")
else:
print("Пересып") |
class People:
nome = ""
def __init__(self, nome):
self.nome = nome
def talk(self):
print('Meu nome é ' + self.nome)
p1 = People("joão")
p1.talk()
#https://pt.stackoverflow.com/q/514661/101
|
class AST:
def __init__(self, root_symbol, rule, *children):
self.root_symbol = root_symbol
self.rule = rule
self.children = children
def __str__(self):
return str(self.root_symbol)
class Leaf(AST):
def __init__(self, root_symbol, actual_input):
super(L... |
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
"""
OpenSfM to kapture import and export.
"""
|
product = 1
i = 1
while product > 0.5:
product *= (365.0 - i) / 365.0
i += 1
print(product, i)
|
"""Faça um programa que leia um ano qualquer e mostre se ele é BISSEXTO"""
ano = int(input('Informe um ano: '))
if ano % 4 == 0:
print('Ano BISSEXTO')
else:
print('Não é BISSEXTO')
|
class Direcao:
def __init__(self):
self.posicoes = ("Norte", "Leste", "Sul", "Oeste")
self.direcao_atual = 0
def girar_a_direita(self):
self.direcao_atual += 1
self.direcao_atual = min(3, self.direcao_atual)
#if self.direcao_atual > 3:
#self.direcao_atual = ... |
#__author__:baobao
#date:2018/3/24
print("hello"*2)#重复输出字符串
print("hello"[2:])#从第二个开始取到最后
print("he" in "hello")#判断是否在字符串中
a = '123'
b = 'abc'
d = '444'
c = a + b
print(c)
#适用大量拼接
c = '*********'.join([a,b,d]) #【用的比较多】把列表以某个字符拼接成字符串,和php的implode差不多 123*********abc*********444,
p... |
br, bc = map(int, input().split())
dr, dc = map(int, input().split())
jr, jc = map(int, input().split())
bessie = max(abs(br - jr), abs(bc - jc))
daisy = abs(dr - jr) + abs(dc - jc)
if bessie == daisy:
print('tie')
elif bessie < daisy:
print('bessie')
else:
print('daisy')
|
######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
# we write a function that computes x factorial recursively
def recursiveFactorial(x):
# we check that x is positive
if x < 0:
raise exception("factorials of non-negative numbers only")
# we check if x is either 0 or 1
if x <= 1:
# we return the asnwer 1
return 1
else:
# we recurse
return x * recurs... |
#!/bin/python3
def hackerrankInString(s):
find = "hackerrank"
i = 0
for c in s:
if find[i] == c:
i += 1
if i >= len(find):
return("YES")
return("NO")
if __name__ == "__main__":
q = int(input().strip())
for a0 in range(q):
s = input().... |
filein = input('Input an email log txt file please: ')
emaillog = open(filein)
days = dict()
for x in emaillog:
if 'From ' in x:
array = x.split()
day = array[1]
day = day.split('@')
day = day[1]
days[day] = days.get(day, 0)+1
else:
continue
print(days)
# most = ... |
known = {}
def binomial_coeff_memoized(n, k):
"""Uses recursion to compute the binomial coefficient "n choose k", sped up by memoization
n: number of trials
k: number of successes
returns: int
"""
breakpoint()
if k == 0:
return 1
if n == 0:
return 0
if (n, k) in know... |
'''
删除字符串中出现次数最少的字符,
返回与原字符串顺序一致的删除后字符串
'''
while True:
try:
strin=input()
d=[] # d stores char counts
l=[] # l stores str after deleting
for i in strin:
d.append(strin.count(i))
m=min(d)
for i in range(len(d)):
if d[i]!=m:
l.a... |
def attack(encrypt_oracle, decrypt_oracle, iv, c, t):
"""
Uses a chosen-ciphertext attack to decrypt the ciphertext.
:param encrypt_oracle: the encryption oracle
:param decrypt_oracle: the decryption oracle
:param iv: the initialization vector
:param c: the ciphertext
:param t: the tag corre... |
# 21303 - [Job Adv] (Lv.60) Aran
sm.setSpeakerID(1203001)
sm.sendNext("*Sob sob* #p1203001# is sad. #p1203001# is mad. #p1203001# cries. *Sob sob*")
sm.setPlayerAsSpeaker()
sm.sendNext("Wh...What's wrong?")
sm.setSpeakerID(1203001)
sm.sendNext("#p1203001# made gem. #bGem as red as apple#k. But #rthief#k stole gem. #p... |
pkgname = "efl"
pkgver = "1.26.1"
pkgrel = 0
build_style = "meson"
configure_args = [
"-Dbuild-tests=false",
"-Dbuild-examples=false",
"-Dembedded-lz4=false",
"-Dcrypto=openssl",
"-Decore-imf-loaders-disabler=scim",
# rlottie (json) is pretty useless and unstable so keep that off
"-Devas-loa... |
description = 'FOV linear axis for the large box (300 x 300)'
group = 'optional'
excludes = ['fov_100x100', 'fov_190x190']
includes = ['frr']
devices = dict(
fov_300_mot = device('nicos.devices.generic.VirtualReferenceMotor',
description = 'FOV motor',
visibility = (),
abslimits = (275, 9... |
para_str = """this is a long string that is made up of
several lines and non-printable characters such as
TAB ( \t ) and they will show up that way when displayed.
NEWLINEs within the string, whether explicitly given like
this within the brackets [ \n ], or just a NEWLINE within
the variable assignment will also show u... |
'''
.remove(x)
This operation removes element from the set.
If element does not exist, it raises a KeyError.
The .remove(x) operation returns None.
Example
>>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> s.remove(5)
>>> print s
set([1, 2, 3, 4, 6, 7, 8, 9])
>>> print s.remove(4)
None
>>> print s
set([1, 2, 3, 6, 7, 8, ... |
class Article():
def __init__(self, title, authors, link, date):
self.title = title
self.authors = authors
self.link = link
self.date = date
|
# A part of pdfrw (https://github.com/pmaupin/pdfrw)
# Copyright (C) 2006-2015 Patrick Maupin, Austin, Texas
# MIT license -- See LICENSE.txt for details
class _NotLoaded(object):
pass
class PdfIndirect(tuple):
''' A placeholder for an object that hasn't been read in yet.
The object itself is the (o... |
n = int(input())
num_list = list(map(int,input().split()))
# n = 10
# num_list = [1, 5, 2, 1, 4, 3, 4, 5, 2, 1]
dp_f = [0] * (n+1)
dp_b = [0] * (n+1)
dp_f[0] = 1
dp_b[n] = 1
# 주요 아이디어:
# 11053 문제의 가장긴 증가 부분 수열을 정방향으로 구한값과 역방향으로 구한값을 각각 계산하고
# 같은 index에서 그 값을 더해주어서 정방향(증가수열) 역방향(감소수열) 의 관계를 가지도록 계산한다.
# 정방향 : 숫자가 증가하... |
importe,descompte = int(input('Importe: ')),20
preudescomptat = importe*(descompte/100)
noupreu = importe-preudescomptat
print('Descompte: -'+str(descompte)+'%\nPreu: '+str(importe)+'€\nT\'estalvies: '+str(preudescomptat)+'€\nPreu Final: '+str(noupreu)+'€') |
# An irrational decimal fraction is created by concatenating the positive integers:
# 0.123456789101112131415161718192021...
# It can be seen that the 12th digit of the fractional part is 1.
# If dn represents the nth digit of the fractional part, find the value of the following expression.
# d1 × d10 × d100 × d100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.