content stringlengths 7 1.05M |
|---|
# Exercício 015:
# Escreva um programa que pergunte a quantide de quilômetros percorridos por um carro alugado e a quantidade de
# dias pelos quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro custa R$ 60 por dia e R$0,15 por
# km rodado.
d = int(input('Digite a quantidade de dias alugados'))
km = fl... |
class Pickleable(object):
"""
Base class that implements getstate/setstate, since most of the classes are overriding getattr.
"""
def __getstate__(self):
return self.__dict__
def __setstate__(self, data):
self.__dict__.update(data) |
conditions = {
'test_project_ids': ['*'],
'test_suite_ids': ['*'],
'test_names': ['logout'],
}
def post_test_run():
pass
|
__author__ = 'tilmannbruckhaus'
class Pandigital:
def __init__(self, digits):
self.p = digits
self.N = len(self.p)
def find(self, n):
for i in range(n - 1):
self.step()
return self.get()
def step(self):
# The algorithm is described in E. W. Dijkstra, A... |
"""
151. Reverse Words in a String
Medium
Given an input string s, reverse the order of the words.
A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.
Return a string of the words in reverse order concatenated by a single space.
Note that s may contain l... |
"""
https://edabit.com/challenge/5D3iXJSkSreRzNS8W
Breaking News!
A local news station needs your help to generate the scrolling text for the headlines!
Create a function which returns a list of strings, where each string contains a single frame of what the scrolling text will look like.
Text will scroll from right ... |
"""
Module: 'io' on LEGO EV3 v1.0.0
"""
# MCU: sysname=ev3, nodename=ev3, release=('v1.0.0',), version=('0.0.0',), machine=ev3
# Stubber: 1.3.2
class BytesIO:
''
def close():
pass
def flush():
pass
def getvalue():
pass
def read():
pass
def readinto():
... |
"""Some additional journal abbreviations which are not provided by Crossref."""
JOURNAL_ABBRVS = {
"American Journal of Mathematics": "Am. J. Math.",
"American Journal of Physics": "Am. J. Phys",
"Annals of Physics": "Ann. Phys.",
"Communications in Mathematical Physics": "Commun. Math. Phys.",
"Jo... |
class Config:
def __init__(self, **kwargs):
self.protocol = kwargs.get('protocol')
self.ip = kwargs.get('ip')
self.port = kwargs.get('port')
self.heavy_traffic = kwargs.get('heavy_traffic')
self.time_patterns = kwargs.get('time_patterns')
self.start_time = kwargs.get(... |
x = [0]
print(x)
x.__setitem__(0,1)
print(x)
x.__setitem__(0,2)
print(x)
x = [4,5,6]
x.__setitem__(1,7)
print(x)
x.__setitem__(2,8)
print(x)
|
""" Constants for data encoding
"""
# MIDI encodings default parameters, used when tokenizing a dataset and using tokens
# These are the parameters from which a MIDI file will be tokenized
PITCH_RANGE = range(21, 109) # the recommended pitches for piano in the GM2 specs are from 21 to 108
BEAT_RES = {(0, 4): 8, (4, ... |
for row in range(1,11):
for col in range(1,21):
prod = row*col
if prod < 10:
print('','', prod, '',end='')
elif prod < 100:
print('', prod, '',end='')
else:
print(prod, '',end='')
print() |
a=100
class A:
b=200
def fn(self,a=1):
print("fn in A")
def mfn():
print("Inside mfn")
print("Mod1")
|
{
"targets": [
{
"target_name": "node_shoom",
"include_dirs": [
"vendor/shoom/include",
"<!(node -e \"require('nan')\")"
],
"sources": [ "addon.cc", "node_shoom.cc" ],
"conditions": [
["OS == 'win'", ... |
def split_annotation(annotation: dict):
context = annotation['@context']
body = annotation['body']
target = annotation['target']
custom_keys = [
key
for key in annotation
if key not in ['body', 'target', '@context', 'id', 'type']
]
custom = {k: annotation[k] for k in cust... |
requirements = [
'marshmallow==3.5.1',
'bumpversion==0.6.0'
]
|
print('Gerador de PA v.2')
print('-=' * 9)
pa = primeiro_termo = int(input('Primeiro termo: '))
razao = int(input('Razão: '))
termos = 0
while termos < 10:
print(pa, end=' → ')
pa = primeiro_termo + razao
primeiro_termo = pa
termos += 1
print('FIM')
|
# # Copyright 2020 MONAI Consortium
# # 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 law or agreed... |
# -*- coding: utf-8 -*-
DEBUG = True
SQLALCHEMY_ECHO = True
SQLALCHEMY_DATABASE_URI = 'mysql://root:123456@127.0.0.1/food_db?charset=utf8mb4'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ENCODING = "utf8mb4" |
k1 = input("birinci kelime:")
k2 = input("ikinci kelime:")
temp1 = k1[0:2]
temp2 = k2[0:2]
for i in k2[2:]:
temp1 += i
for i in k1[2:]:
temp2 += i
print(temp2)
print(temp1) |
def hr(n):
if n % 2 == 0: return int(n // 2)
else: return 3 * n + 1
while True:
n = int(input())
if n == 0: break
m = n
while n != 1:
if m < n: m = n
n = hr(n)
print(m)
|
class Solution:
def largestOverlap(self, A: List[List[int]], B: List[List[int]]) -> int:
C = [[0 for _ in range(len(B[0]) * 3 - 2)]
for _ in range(len(B) * 3 - 2)]
for i in range(len(B)):
for j in range(len(B[0])):
C[i + len(B) - 1][j + len(B[0]) - 1] = B[i]... |
PROXMOX_CLUSTER_SCHEMA = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'nodes': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'ip': {'ty... |
n = int(input('Provide a number: '))
nums = []
for i in range(1, n+1):
nums.append(i)
print(*nums, sep=", ")
|
"""
MicroPython MAX44009 Ambient Light Sensor
https://github.com/mcauser/micropython-max44009
MIT License
Copyright (c) 2020 Mike Causer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without re... |
def hello_method(self):
return 'hello uiMethod'
def hello_func(self, content):
return "<div>{}</h1>".format(content)
def static_url(self, path):
"""
你可能不太了解这个重写的意义,原生tornado已经有了这个方法,如果你不知道这件事,你可以不用看我接下来说的
为了更好的让madtornado控制静态文件,提供更好更遍历的使用,我的服务端入口中根本没有启用原生的staticFileHandler
这样我就可以自己来控制静态文件提供... |
class Solution:
def isPalindrome(self, s: str) -> bool:
if s is None:
return True
s = ''.join(filter(str.isalnum, s)).lower()
return s == s[::-1]
# isalnum 检测字符串是否由字母和数字组成
|
t = int(input())
while t:
N, X = map(int, input().split())
S = input()
arr = []
arr.append(X)
for i in S:
if i=='R':
X += 1
arr.append(X)
if i=='L':
X -= 1
arr.append(X)
arr = set(arr)
print(len(arr))
t = t-... |
netron_link = "https://lutzroeder.github.io/netron"
cors_proxy = "https://cors-anywhere.herokuapp.com"
release_url = "https://github.com/larq/zoo/releases/download"
def html_format(source, language, css_class, options, md):
return f'<a href="{netron_link}/?url={cors_proxy}/{release_url}/{source}">Interactive arch... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Helpers for referring to React Native open source code.
This lets us build React Native:
- At Facebook by running buck from the root of t... |
# Módulo tem como utilidade emoldurar strings.
# Porém, para isso será necessário primeiro
# matriciar a string, ou seja, pegar a linha
# como maior string, e contar tal string para
# ser as colunas do códigos. Contando as quantidade
# de linhas é preciso apenas... contar a quantia
# de linhas.
# transforma ... |
class Stack(list):
def __getitem__(self,key):
try:
return super(Stack, self).__getitem__(key)
except IndexError:
return 0
def pop(self):
try:
return super(Stack, self).pop()
except:
return 0
|
class ValidPalindrome:
def isPalindrome(self, s):
if len(s) == 0:
return True
else:
s = "".join([i for i in s.lower() if i.isalnum()])
i= 0
j=len(s)-1
while j>i:
if s[i] != s[j]:
return False
... |
arr = []
for arr_i in range(6):
arr_t = [int(arr_temp) for arr_temp in input().split(' ')]
arr.append(arr_t)
#print (arr)
hourglass_sums = []
for i in range(4):
for j in range(4):
hourglass_sums.append(sum(arr[i][j:j+3]) + arr[i+1][j+1] + sum(arr[i+2][j:j+3]))
print (max(hourglass_sums))
|
###############################################################################
''''''
###############################################################################
class CoProperty(property):
def __set_name__(self, owner, name):
self.cooperators = tuple( # pylint: disable=W0201
acls.__dic... |
"""
This module contains the result sentences and intents for the English version
of the Pick something random app.
"""
# Result sentences and their parts:
RESULT_HEADS = "Heads"
RESULT_TAILS = "Tails"
# See the following documentation for the format codes:
# https://arrow.readthedocs.io/en/latest/#format
RESULT_MONTH... |
"""Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to both as 'h'.
"""
|
banner = """
_ _ _ _ _____ _
| | | | | | (_) |_ _| (_)
| | | | __ _| | ___ _ __ _ ___ | | ___ __ _ _ __ ___ _________... |
class Node:
def __init__(self,data):
self.data = data
self.left = self.right = None
def sorted_array(nums):
if not nums:
return
mid = len(nums)//2
root = Node(nums[mid])
root.left = sorted_array(nums[:mid])
root.right = sorted_array(nums[mid+1:])
... |
for _ in range(int(input())):
n=input()
if len(n)>10:
print("{}{}{}".format(n[0],len(n)-2,n[-1]))
else:
print(n)
|
# On a plane there are n points with integer coordinates points[i] = [xi, yi]. Your task is to find the minimum time in seconds to visit all points.
# You can move according to the next rules:
# In one second always you can either move vertically,
# horizontally by one unit or diagonally (it means to move one unit ver... |
satz = "Fischers Fritze fischt frische Fische"
# 1Häufigkeit des Buchstabens e
# Ansatz 1) for-Schleife und Zähler anzahl
zaehler = 0
for zeichen in satz:
if zeichen == "e":
zaehler += 1
print (zaehler)
# 2 Häufigkeitsverteilung der buchstaben im satz
d = {}
for zeichen in satz:
if zeiche... |
"""Provides a redirection point for platform specific implementations of Starlark utilities."""
load(
"//tensorflow/core/profiler/builds/oss:build_config.bzl",
_tf_profiler_alias = "tf_profiler_alias",
)
tf_profiler_alias = _tf_profiler_alias
def if_profiler_oss(if_true, if_false = []):
return select({
... |
ONOS_ORIGIN = "ONOS Community"
ONOS_GROUP_ID = "org.onosproject"
ONOS_VERSION = "1.14.0-SNAPSHOT"
DEFAULT_APP_CATEGORY = "Utility"
ONOS_ARTIFACT_BASE = "onos-"
APP_PREFIX = ONOS_GROUP_ID + "."
|
class InputManagerWrongValue(Exception):
pass
class Input:
def __init__(self):
self.a = None
self.b = None
def get_a_value(self):
self.a = self.get_value_stdin("Ustaw wartość A: ")
def get_b_value(self):
self.b = self.get_value_stdin("Ustaw wartość B: ")
def get_... |
# souce from https://stackoverflow.com/a/25471508
'''Stub for fcntl. only for Windows dev/testing.'''
def fcntl(fd, op, arg=0):
return 0
def ioctl(fd, op, arg=0, mutable_flag=True):
if mutable_flag:
return 0
else:
return ""
def flock(fd, op):
return
def lockf(fd, operation, length=0,... |
"""
DAY 34 : Excel Sheet | Part 1.
geeksforgeeks.org/find-excel-column-name-given-number/
QUESTION : Given a positive integer N, return its corresponding column title as it would appear in an Excel sheet.
For N =1 we have column A, for 27 we have AA and so on.
Note: The alphabets are all in uppercase.
Expec... |
class prdError(Exception):
"""Base error raised by pyramdeconv."""
class MainDelegatorError(prdError):
"""Raised when a method in the main delegator fails."""
class DataBaseError(prdError):
"""Raised when interaction with the default database fails"""
|
for i in range(0,6):
if i !=3:
print(i)
result = 1
for i in range(1,6):
result =result*i
print(result)
result = 0
for i in range(1,6):
result = result +i
print(result)
result=0
for word in 'this is my 6th string'.split():
result = result+1
print(result) |
# config.py
# DEBUG = False
# SQLALCHEMY_ECHO = False
# instance/config.py
DEBUG = True
SQLALCHEMY_ECHO = True
ARCFACE_PREBATCHNORM_LAYER_INDEX = -4
ARCFACE_POOLING_LAYER_INDEX = -3
|
class RequestInfoList(object):
"""A data stream from any platform/hub:
"""
def __init__(self):
self.requests = []
def __len__(self):
return len(self.requests)
|
total = 0
for number in range(2, 101, 2):
total += number
print(total)
|
# In the admin panel, when adding new fields,
# sets the 'user' field to be the current logged in user
# as the default
class AutoUserMixin(object):
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'user':
kwargs['initial'] = request.user.id
retu... |
BASE_PATH = 'covid19_scenarios_data'
JSON_DIR = 'assets'
SOURCES_FILE = 'sources.json'
TMP_CASES = 'case_counts.json'
TMP_POPULATION = 'population.json'
TMP_SCENARIOS = "scenario_defaults.json"
|
# Задачи на циклы и оператор условия------
# ----------------------------------------
'''
Задача 1
Вывести на экран циклом пять строк из нулей, причем каждая строка должна быть пронумерована.
'''
# for i in range(1,6):
# print(str(i) + '. ' + '0')
'''
Задача 2
Пользователь в цикле вводит 10 цифр. Найти количеств... |
# Variant 1 - Best
class Parent:
_possible_drinks = ['beer', 'wine']
class Child(Parent):
_possible_drinks = ['beer', 'wine', 'vodka']
# Variant 2 - Ok
class Child2(Parent):
def __init__(self):
self._possible_drinks = super()._possible_drinks + ['vodka']
# Variant 3 - Wrong
class Child3(Parent... |
print("Example 04: [The continue Statement] \n"
" Continue to the next iteration if i is 5")
i = 0
while i < 10:
i += 1
if i == 5:
continue
print(i)
|
pkgname = "python-idna"
pkgver = "3.3"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools"]
depends = ["python"]
pkgdesc = "Internationalized Domain Names in Applications (IDNA) for Python"
maintainer = "q66 <q66@chimera-linux.org>"
license = "BSD-3-Clause"
url = "https://github.com/kjd/idna... |
# https://leetcode.com/problems/word-break
class Solution:
def wordBreak(self, s: str, wordDict: List[str]) -> bool:
s = " " + s
dp = [False for _ in range(len(s))]
dp[0] = True
for i in range(len(s)):
for j in range(i):
if (dp[j] == True) and (s[j + 1 :... |
def run_simulation():
with open('./data/MorningTraffic-b.csv', 'r') as file:
content = file.readlines()
content = [x.strip() for x in content]
timestep = 0
while True:
if len(content) > 0:
parts = content[0].split(';')
start_time = parts[0]... |
# Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo primitivo e todas as informações possíveis sobre ele.
a = input('Digite algo: ')
print('O tipo primitivo desse valor é ', type(a))
print('Só tem espaços? ', a.isspace())
print('É um número? ', a.isnumeric())
print('É alfabético? ', a.isalpha())
p... |
class Solution:
# def romanToInt(self, s):
# """
# :type s: str
# :rtype: int
# """
# roman = {'I': 1, 'V': 5, 'X': 10,
# 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
# result = 0
# last = s[-1]
# for t in reversed(s):
# ... |
_TRANSFORMATIONS = dict()
def register(name):
def add_to_dict(fn):
global _TRANSFORMATIONS
_TRANSFORMATIONS[name] = fn
return fn
return add_to_dict
|
"""
File: constraint.py
Author: Come Bertrand
Email: bertrand.cosme@gmail.com
Github: https://github.com/ComeBertrand
Description: TODO
"""
|
# Branch code with if, elif and else structure
user_input = input("Would you like to continue? ")
if user_input == "no" or user_input == "n":
print("Exiting")
elif user_input == "yes" or user_input == "y":
print("Continuing ...\nComplete!")
else:
print("Please try again and respond with yes or no.") |
# Copyright 2017 The TensorFlow 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 applicab... |
class Solution:
def solve(self, nums, k):
i = 0
j = len(nums) - 1
while i < j:
curSum = nums[i] + nums[j]
if curSum == k:
return True
elif curSum < k:
i += 1
else:
j -= 1
retu... |
class Minus:
reserved = {}
tokens = ('MINUS',)
# Tokens
t_MINUS = r'-'
precedence = (
('left', 'MINUS'),
)
|
# Copyright (c) 2009 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.
{
'includes': [
'../../../../common_settings.gypi', # Common settings
],
'targets': [
{
'target_name': 'test_framework',
'type'... |
# Copyright 2015 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.
"""Recipe to build CIPD package with sealed Conda environment.
Supposed to be used from manually triggered Buildbot builders. We aren't
expecting rebuilding... |
map_collections = {
"user": "Users",
"user_relation": "UsersRelation",
}
|
variavel_global = 'Global'
def funcao():
variavel_local = 'Local'
print(variavel_global)
print(variavel_local)
funcao()
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def greetings(st_1, st_2, st_3=None, st_4=None):
template = "<b>Alumno</b>: {0:30} <b>rol</b>: {1:10}<br>"
hi = ""
hi += template.format(*st_1)
hi += template.format(*st_2)
if st_3:
hi += template.format(*st_3)
if st_4:
hi += templa... |
###########################
# 6.0002 Problem Set 1b: Space Change
# Name: Chintan Singh
# Collaborators:
# Time: 15 minutes
# Author: charz, cdenise
#================================
# Part B: Golden Eggs
#================================
# Problem 1
def dp_make_weight(egg_weights, target_weight, memo = {}):
"""
... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def hasCycle(self, head: ListNode) -> bool:
cur1 = head
cur2 = head
while(cur1 or cur2):
cur1 = cur1 and cur1.next and cur1.next.next
... |
def join_path(row_path, column_path):
if column_path is None:
raise Exception("Column path is empty!")
if row_path is None:
raise Exception("Row path is empty")
column_path = column_path.strip()
row_path = row_path.strip()
if len(row_path) > 0 and row_path[-1] == ".":
... |
#
# LeetCode
#
# Problem - 35
# URL - https://leetcode.com/problems/search-insert-position/
#
class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
return bisect.bisect_left(nums, target)
|
MAX_PERCENT = 100
PERCENT_DENOMINATION = 10
class Category:
width_of_ledger = 30
def __init__(self, title : str) -> None: #to define your own attributes for this category
self.title = title #eg of a constructor Category("Food")
self.currentAmount : float = 0
self.ledger : list = []
... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: Xukun Luo
# Date: 2021.03.31
""" Our settings. """
### For dataset. ###
# origin file path.
origin_train_path = "../datasets/training.txt"
origin_test_path = "../datasets/test.txt"
vocab_path = "../datasets/training_vocab.txt"
# preprocessed file path.
prepro... |
print('-'*40)
numero1 = int(input('Digite o numero 1:'))
numero2 = int(input('Digite o numero 2:'))
print('resultado soma dos numeros:')
resultado = numero1 + numero2
print(resultado)
('\n'*3)
print('resultado subtração dos numeros:')
resultado = numero1 - numero2
print(resultado)
('\n'*3)
print('resultado div... |
print("Abaixo digite o valor da temperatura em graus para saber sua conversão em fahrenheit")
temp = int(input('digite a temperatura: '))
conversor = temp * (9/5) + 32
print(conversor,"°F") |
def y_test(message_list):
if message_list is None:
raise StopIteration
else:
for message in message_list:
yield message[0], message[1], message[2]
message_list = [[1,2,3]]
a = 1 |
# Test global pointers to data and code
test_data = {
"desc": "Global pointers to data and code",
"modules": [["mod_global_ptrs1.c"]],
"required": ["Running test 'mod_global_ptrs1'"]
}
|
# Problem Statement:
# Given N, find the number of ways to express N as a sum of 1,3 and 4
#
# Example:
# - N = 4
# - Number of ways = 4
# - Explanation: There are 4 ways we can express N, {4}, {1,3}, {3,1}, {1,1,1,1}
#
# Algorithm:
# Divide and Conquer method comes handy for solving this problem
# This can be solved... |
class Solution:
"""
给定两个字符串 s 和 t,判断它们是否是同构的。
如果 s 中的字符可以被替换得到 t ,那么这两个字符串是同构的。
所有出现的字符都必须用另一个字符替换,同时保留字符的顺序。两个字符不能映射到同一个字符上,但字符可以映射自己本身。
示例 1:
输入: s = "egg", t = "add"
输出: true
示例 2:
输入: s = "foo", t = "bar"
输出: false
示例 3:
输入: s = "paper", t = ... |
class Util():
def __init__(self,item):
self.item=item
def getUtil(self):
return self.item
u=Util("Ram")
print(u.getUtil())
|
#
# PySNMP MIB module ZHONE-FS-ALARM (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-FS-ALARM
# Produced by pysmi-0.3.4 at Wed May 1 15:47:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... |
# -*- coding: utf-8 -*-
# This file is part of the Ingram Micro Cloud Blue Connect connect-cli.
# Copyright (c) 2019-2022 Ingram Micro. All Rights Reserved.
PARAM_TYPES = [
'email',
'address',
'checkbox',
'choice',
'domain',
'subdomain',
'url',
'dropdown',
'object',
'password',... |
#列表
bicycles = ['trek', 'cannondale', 'redline', 'specialized'];
print(bicycles);
#访问列表的元素
print(bicycles[0])
#可以使用字符串的方法
print(bicycles[0].title())
#列表的索引是从0开始的
#修改,添加,删除元素
print("修改前")
print(bicycles)
print("修改后")
bicycles[0] = 'moto'
print(bicycles)
#在列表末尾添加元素
print("添加前")
print(bicycles)
print("添加后")
bicycles.... |
class BaseNumberConverter(TypeConverter):
""" Provides a base type converter for nonfloating-point numerical types. """
def CanConvertFrom(self,*__args):
"""
CanConvertFrom(self: BaseNumberConverter,context: ITypeDescriptorContext,sourceType: Type) -> bool
Determines if this converter can convert an... |
# find the biggest gap, AB or BC
pos = [int(x) for x in input().split()]
AB = pos[1]-pos[0]
BC = pos[2]-pos[1]
if AB-BC < 0:
#BC greatest
print(BC-1)
else:
# AB or equal
print(AB-1)
|
if __name__ == '__main__':
N =int(input())
l = []
for i in range(0,N):
t = input().split()
if t[0]=="insert" :
l.insert(int(t[1]),int(t[2]))
elif t[0]=="print":
print (l)
elif t[0]=="remove" :
l.remove(int(t[1]))
elif t[0]=="ap... |
"""
test_inceptiontools
~~~~~~~~~~~~~~~~~~~
Houses all unit test cases, supporting the :py:mod:`inceptiontools` package.
This package is not intended to be part of the distribution.
"""
__author__ = "Andrew van Herick"
__copyright__ = "Unpublished Copyright (c) 2020 Andrew van Herick. All Rights Reserved."
__license_... |
begin_unit
comment|'# Copyright 2012 IBM Corp.'
nl|'\n'
comment|'# Copyright (c) AT&T Labs Inc. 2012 Yun Mao <yunmao@gmail.com>'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License");'
nl|'\n'
comment|'# you may not use this file except in compliance with the License.'
nl... |
def r_a(a, b):
return a
def r_b(a, b):
return b
def r_str():
return ''
def r_object():
return object()
class A:
def r_A(self):
return type(self)()
|
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = ""
EMAIL_HOST_USER = ""
KEY = ""
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = ""
# This should be in the format [('A User','user@example.com'), ('B User', 'person@example.com')]
REGISTRATION_ADMINS = []
|
_FUNCTION_NOT_IMPLEMENTED_WARNING = "Denna funktion har inte implementerats i 'sv'"
_MONTHS_SV = ['januari', 'februari', 'mars', 'april', 'maj', 'juni',
'juli', 'augusti', 'september', 'oktober', 'november',
'december']
_NUM_STRING_SV = {
0: 'noll',
1: 'en',
2: 'två',
3: 't... |
def pick_peaks(arr):
prev_dex = prev_val = None
result = {'pos': [], 'peaks': []}
upwards = False
for i, a in enumerate(arr):
if prev_val == a:
continue
elif prev_val is None or prev_val < a:
upwards = True
else:
if prev_dex and upwards:
... |
def displayBanner():
banner = open('./banner/banner.txt', 'r', encoding = 'utf8')
print(banner.read())
def choice():
while True:
choice = int(input(">"))
if choice == 0:
break
elif choice == 1:
exit()
else:
print("Retry") |
def renumerate(iterable):
"""
Enumerates an `iterable` starting from the end.
Examples:
```python
from flashback.iterating import renumerate
# Drop-in replacement for enumerate()
lst = ["a", "b", "c"]
for index, item in renumerate(lst):
print(index, item... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.