content stringlengths 7 1.05M |
|---|
# Base node class
class Node():
def __init__(self):
self.children = [None]*26
self.isend = False
#Trie class
class Trie():
def __init__(self):
self.__root = Node()
def __len__(self):
"""
returns length of the trie
Returns:
[int]: [length of... |
sequence = input().split(", ")
my_dict = {}
for el in sequence:
ascii_number = ord(el)
if el not in my_dict:
my_dict[el] = ascii_number
print(my_dict) |
points = [(1,1), (2,2), (2.5,1)]
print(points[2][0])
y=0
x=0
#point -> neue Variable für jeden Listeneintrag
for point in points:
print(point[1])
y = y+point[1]
x = x+point[0]
print(x,y)
avg_x = x / len(points)
avg_y = y / len(points)
print(avg_x,avg_y)
w_enumerator = 0
w_denominator = 0
for point... |
'''
Faça um programa que receba duas notas digitadas pelo usuário. Se a nota for maior ou igual a seis, escreva aprovado, senão escreva reprovado.
'''
nota1 = float(input('Digite a primeira nota: '))
nota2 = float(input('Digite a segunda nota: '))
media = (nota1 + nota2) / 2
resultado = 'aprovado'
if media < 6:
r... |
# @desc Can a triangle be made by these sides?
# @desc By Jake '24
def form_triangle(side1, side2, side3):
if side1 + side2 > side3 and side1 + side3 > side2 and side2 + side3 > side1:
return True
else:
return False
def main():
print(form_triangle(10, 5, 25))
print(form_triangle(3, 4,... |
def main():
# 1 add
# 2 multiply
# 99 halt
# What value is at position 0
part_one()
part_two()
def part_one():
print("Part One")
with open("input.txt", "r") as input_file:
for line in input_file:
numbers = list(map(int, line.split(",")))
# Restore
... |
# Written by Mayank
# This program is used to first parse the dataset files for training
# and testing and then compile them into dataparsed.cpp file
# from where we can load the data into sgx enclave.
accdataAC = ""
accdataBD = ""
acclabelAC = ""
acclabelBD = ""
accdatasample = ""
acclabelsample = ""
#First accdataA... |
# We're going to use a custom timer, so we don't actually have to do anything
# in these functions.
def top():
mid1()
mid2()
mid3(5)
C1.samename()
C2.samename()
def mid1():
bot()
for i in range(5):
mid2()
bot()
def mid2():
bot()
def bot():
pass
def mid3(x):
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu May 18 11:06:15 2017
@author: tomislav
"""
def sliding_window(image, stepSize=20, windowSize=(200, 200)):
for y in xrange(0, image.shape[0]-windowSize[1]+stepSize, stepSize):
for x in xrange(0, image.shape[1]-windowSize[0]+stepSize, stepSi... |
# Copyright 2021 Fabian Meumertzheim
#
# 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 to in ... |
"""
0784. Letter Case Permutation
Medium
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string.
Return a list of all possible strings we could create. You can return the output in any order.
Example 1:
Input: S = "a1b2"
Output: ["a1b2","a1B2","A1b2","A1B2... |
# Questão 1114 - Senha fixa
# Link da questão - https://www.urionlinejudge.com.br/judge/pt/problems/view/1114
correta = False # Flag que indica se a senha indicada foi a correta
while not correta:
senha = str(input()) # Pega a senha da entrada
if senha != '2002':
print('Senha Invalida') # Se a senha d... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 14 19:08:07 2018
@author: Yilin Liu
"""
class Parameter(object):
def __init__(self, re, it, co, no):
self.regularization = re
self.most_iter_num = it
self.convergence = co
self.nonconvexity = no
def print_value(self):
... |
# **Please read this problem entirely!!** The majority of this problem consists of learning how to read code, which is an incredibly useful and important skill. At the end, you will implement a short function. Be sure to take your time on this problem - it may seem easy, but reading someone else's code can be challengi... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
def get_package_data():
return {'pypit.tests': ['files/*']}
|
"""
sm.sendNext("want some item?")
sm.giveAndEquip(1382000)
sm.dispose()
""" |
class Item:
def __init__(self, id, assignment_id = None, inherent = None, max_inherent = None):
self.id = id
self.assignment_id = assignment_id
self.inherent = inherent
self.max_inherent = max_inherent
self.reviews = {}
class User:
def __init__(self, name):
self.... |
# 用途:用4种方法计算出结果为8
print(4 + 4)
print(16 // 2)
print(2 * 4)
print(10 - 2)
#姓名:YB
#日期:2020年8月2日
#用途:说明喜爱数字
x = 414
msg = "My favourite number is " + str(x)
print(msg)
|
#Maior de dois números
#Função
def maximo(x, y):
if x > y:
return x
else:
return y
print(maximo(5, 6))
print(maximo(2, 1))
print(maximo(3, 3)) |
# シンプルな条件分岐
s = str(input())
if s == 'a' or s == 'e' or s == 'i' or s == 'o' or s == 'u':
print('vowel')
else:
print('consonant')
|
description = 'LakeShore 340 cryo controller'
group = 'optional'
includes = ['alias_T']
tango_base = 'tango://miractrl.mira.frm2:10000/mira/'
devices = dict(
T_ls2 = device('nicos.devices.entangle.TemperatureController',
description = 'temperature regulation',
tangodevice = tango_base + 'ls2/ls_c... |
class ActivePetUpdateRequestPacket:
def __init__(self):
self.type = "ACTIVEPETUPDATEREQUEST"
self.commandType = 0
self.instanceId = 0
def write(self, writer):
writer.writeByte(self.commandType)
writer.writeInt32(self.instanceId)
def read(self, reader):
... |
### create tuple of 3 elements:
point3d = (4, 0, 3)
print(point3d[0], point3d[1], point3d[2])
# 4 0 3
print(point3d[-1], point3d[-2], point3d[-3])
# 3 0 4
### retrieve tuple items
address = ('Bulgaria', 'Sofia', 'Nezabravka str', 14)
country = address[0]
town = address[1]
street = address[2]
street_num = address[3]... |
__author__ = "Jason Lin"
__email__ = "jason40418@yahoo.com.tw"
__license__ = "MIT"
__version__ = "1.0.0"
|
# -*- coding: utf-8 -*-
# Scrapy settings for scraper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest... |
class TotoInterface:
def machin(self):
raise NotImplementedError
|
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'build/file',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/step',
'recipe_engine/time',
]
|
def isPrime(n):
if n == 2 or n == 3: return True
if n < 2 or n%2 == 0: return False
if n < 9: return True
if n%3 == 0: return False
r = int(n**0.5)
f = 5
while f <= r:
if n % f == 0: return False
if n % (f+2) == 0: return False
f += 6
return True
def isPal(n):
... |
# Crie um programa que leia o nome de uma cidade diga se ela começa ou não com o nome “SANTO”.
cidade = str(input('Digite o nome de uma cidade: '))
maiusc = cidade.upper()
listacidade = maiusc.split()
primeiro_termo = listacidade[0]
resultado = primeiro_termo.find('SANTO')
print('Se retornar 0: a cidade começa com San... |
# Copyright 2019 FMR LLC <opensource@fidelity.com>
# SPDX-License-Identifer: Apache-2.0
__version__ = "1.3.2"
|
class WhiteBalanceModifier:
white_value = None
|
# Constants without private static final look...wrong.
CASCADE_DIR = 'cascade_files'
DATA_DIR = './data/'
CASCADE_FILE = 'haarcascade_frontalface_default.xml'
DATA_IMAGE_FILE = 'converted_images.npy'
DATA_LABEL_FILE = 'converted_labels.npy'
DATASET_CSV_FILENAME = 'fer2013.csv'
FACE_SIZE = 48
EMOTIONS = ['angry', 'di... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
*What is this pattern about?
The Borg pattern (also known as the Monostate pattern) is a way to
implement singleton behavior, but instead of having only one instance
of a class, there are multiple instances that share the same state. In
other words, the focus is on sha... |
print('=' * 12 + 'Desafio 56' + '=' * 12)
nomehomem = 'Não'
idadetotal = 0
idadevelho = 0
mulheres = 0
for i in range(0, 4):
print('=' * 28)
nome = input(f'Digite o nome da pessoa {i + 1}: ').strip()
idade = int(input(f'Digite a idade da pessoa {i + 1}: '))
sexo = input(f'Digite o sexo da pessoa {i + 1}... |
class WriteEncoder:
def __init__(self, tokenDictionary):
self.tokenDictionary = tokenDictionary
self.streamStarted = False
def reset(self):
self.streamStarted = False
def getStreamStartBytes(self, domain, resource):
data = []
self.streamStarted = True
data.... |
"""
Tenemos que tener en cuenta:
Tenemos dos partes: real e imaginaria
Positivo / negativo
CON / SIN decimales
Ilimitado
Podemos mostrar con un guión bajo para leer mejor los miles
Podemos trabajar con números cientificos
"""
x = 34 + 56j
y = -34.45 + 56.56j
z = -34.45 - 56.56j
print(type(x))
print(type(y))
print(type... |
first_name = [
'Jack',
'Tom',
]
second_name = [
'Smith',
'Johnson',
'Williams',
'Jones',
'Brown',
'Davis',
'Miller',
'Wilson',
'Moore',
'Taylor',
'Anderson',
'Thomas',
'Jackson',
'White',
'Harris',
'Martin',
'Thompson',
'García',
'Mart... |
'''
## Question
### 4. [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/)
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 c... |
# 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 to in writing, software
# d... |
class NodeException(Exception):
def __reduce__(self):
return type(self), ()
class NodeStopException(NodeException):
pass
class RPCError(Exception):
def __init__(self, *args, node=None, **kwargs):
self.node = node
super().__init__(*args, **kwargs)
# def __reduce__(self):
... |
def remove_protocol(addr):
"""
Removes the first occurrence of the protocol string ('://') from the string `addr`
Parameters
----------
addr : str
The address from which to remove the address prefix.
Returns
-------
str
"""
name = addr.split("://", 1) # maxsplit = 1..... |
def compare_with_none(x, y, func):
if x is None and y is None:
return None
elif x is None and y is not None:
return y
elif x is not None and y is None:
return x
return func(x, y)
def max_with_none(x, y):
return compare_with_none(x, y, max)
def min_with_none(x, y):
ret... |
class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
class Queue:
def __init__(self, head=None, tail=None):
self.head = head
self.tail = tail
def enqueue(self, data):
node = Node(data)
if not self.head:
self.head = ... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class ArchivalExternalTarget(object):
"""Implementation of the 'ArchivalExternalTarget' model.
Specifies settings about the Archival External Target (such as Tape or
AWS).
Attributes:
vault_id (long|int): Specifies the id of Archival Va... |
class Solution:
def optimalDivision(self, nums: List[int]) -> str:
nums = list(map(str, nums))
if len(nums) <= 2:
return '/'.join(nums)
else:
return nums[0] + '/(' + '/'.join(nums[1:]) + ')' |
"""Top-level package for Aion Client."""
__author__ = """Brent Sanders"""
__email__ = 'brent@brentsanders.io'
__version__ = '0.4.0'
|
#
# PySNMP MIB module A3COM-AUDL-R1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///home/tin/Dev/mibs.snmplabs.com/asn1/A3COM-AUDL-R1-MIB
# Produced by pysmi-0.3.4 at Fri Jan 31 21:29:15 2020
# On host bier platform Linux version 5.4.0-3-amd64 by user tin
# Using Python version 3.7.6 (default, Jan 19 2020, 22:34... |
#creating empty list
lis = []
#enter the number of elements in list
noofelements = int(input('How many numbers? '))
# iterating till count to append all input elements in list
for n in range(noofelements):
number = int(input('Enter number: '))
lis.append(number)
# displaying largest number
print("Largest num... |
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2015, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... |
#!/usr/bin/env python
class ChatAction(object):
TYPING = 'typing'
UPLOAD_PHOTO = 'upload_photo'
RECORD_VIDEO = 'upload_video'
RECORD_AUDIO = 'upload_audio'
UPLOAD_DOCUMENT = 'upload_document'
FIND_LOCATION = 'find_location'
|
fin = open('../mbox-short.txt')
for line in fin:
s = line.strip()
if s.startswith('From '):
print(s.split()[2])
|
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
"""
该题可以等价于字符串1和字符2中的所有字符都可以在对方中找到,且字符串1中字符出现的次数等于字符串2中出现的此数
:param s:
:param t:
:return:
"""
tmp1 = {}
for i in range(len(s)):
tmp1[s[i]] = 1 if s[i] not in tmp1 else tmp1[s[i]] ... |
project_folder = "/Users/au194693/projects/biomeg_class/"
data_folder = project_folder + "data/"
class_data = project_folder + "class_data/"
|
class SubmissionSpreadsheetAlreadyExists(Exception):
pass
class SubmissionSpreadsheetDoesntExist(Exception):
def __init__(self, submission_uuid: str, missing_path: str):
super().__init__(f'No spreadsheet found for submission with uuid {submission_uuid}')
self.submission_uuid = submission_uuid
... |
n = input("What days of the week is today ? ") #ask user for todays day of the week
if n == "Tuesday": #first possible answer
print("Yes, today begins with a T.")
elif n == "Thursday": #second possible answer
print("Yes, today begins with a T.")
else: #any other answer is incorrect then this is an output
... |
# Задача: Количество сущностей
'''
Условие:
Создайте класс User и добавьте способ для проверки количества пользователй (количество сущностей), которые были созданы.
Примеры:
u1 = User("johnsmith10")
User.user_count ➞ 1
u2 = User("marysue1989")
User.user_count ➞ 2
u3 = User("milan_rodrick")
User.user_co... |
class OutputTooLargeError(Exception):
"""Raised when a message is too long to send to Discord"""
pass
|
order = 1
scoopCost = 0.0
extraCost = 0.0
flavScoop = {}
toppings = []
print("Welcome to John Doe's famous creamery!")
print("~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~")
print("Classic Flavors:")
print("One scoop: 2/ Two scoop: 3.5")
print("Vanilla/ Chocolate/ Strawberry/ Coffee/ Mint")
print("~+~+~+~+~+~+~+~+~+~+~+~... |
number1 = 10
number2 = 20
number4 = 40
number3 = 30
|
n = bool(input('Digite um número. Se for não digitar vai dar falso: '))
print(n)
n = (input('Digite algo: '))
print(n.isnumeric())
n = (input('Digite algo '))
print(n.upper())
n = (input('Digite algo '))
print(n.isalpha()) |
# -*- coding: utf-8 -*-
__author__ = 'Michael Ingrisch'
__email__ = 'michael.ingrisch@gmail.com'
__version__ = '0.1.0' |
"""
Entradas
mesanterior->int-->mesant
kwhmesanterior-->float-->kwhgas
kwhmesactual-->float-->kwsact
salidas
total-->int-->dinerototal
"""
#entrada
mesant=int(input("ingrese monto pagado en el mes anterior: "))
kwhgas=float(input("digite kWh Gastados en el mes anterior: "))
kwsact=float(input("ingrese lectura actual de... |
i = 0
print(i)
def test():
global i
i = i+1
print(i)
test()
print(i)
|
# gameresults.py
# Copyright 2008 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Constants used in the results of games.
"""
# Game score identifiers.
# h... refers to first-named player usually the home player in team context.
# a... refers to second-named player usually the away player in team context.
# No as... |
username = None
password = None
first_run = True
port = "22"
password_len = 50
connections = {}
ssh_host_pwd_map = {}
ssh_config_keys = ('HostName', 'User', 'Port', 'IdentityFile')
use_ssh_config = False
ssh_config_path = None
keepass_db_path = None
keepass_pwd = None
|
# 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:
def trimBST(self, root: Optional[TreeNode], low: int, high: int) -> Optional[TreeNode]:
def iterr(ro... |
def upl(s):
upper = 0
lower = 0
for i in s:
if i.isupper():
upper += 1
elif i.islower():
lower += 1
print(f'No. of Upper case characters : {upper}')
print(f'No. of Lower case characters : {lower}')
upl("sss sss sss S")
|
class Player:
def __init__(self):
self.name = "TeamOne"
self.prec = {}
self.prec['3'] = 1
self.prec['4'] = 2
self.prec['5'] = 3
self.prec['6'] = 4
self.prec['7'] = 5
self.prec['8'] = 6
self.prec['9'] = 7
self.prec['10'] = 8
self... |
class Solution(object):
def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
res = []
self.generate('', n, n, res)
return res
def generate(self, v, left, right, res):
if left == 0:
res.append(v + ')' * right)
... |
'''
https://leetcode.com/contest/weekly-contest-155/problems/minimum-absolute-difference/
'''
class Solution:
def minimumAbsDifference(self, arr: List[int]) -> List[List[int]]:
arr.sort()
min_diff = 10**7
for i in range(1, len(arr)):
min_diff = min(min_diff, arr[i] - arr[i - 1])
... |
print("Let's practice everything.")
print('You\'d need to know \'bout escapes with \\ that do:')
print('\n new lines and \t tabs.')
poem= """
\t The lovely world
with logic so firmly planted
cannot discern \n the needs of love
nore comprehend passion from intutiion
and requires an explanation
\n \t \t where there is ... |
SECRET_KEY = 'dev'
SITES_DICT = {
'www.iie.cas.cn': 'xgs',
'www.is.cas.cn': 'rjs',
}
###############################################
MYSQL_HOST = 'localhost'
MYSQL_PORT = 6761
MYSQL_DB_NAME = 'crawling_db'
MYSQL_USER = 'root'
MYSQL_PASSWORD = 'mysql'
###############################################
S... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
config_file_test.py
Tests for the config_file module.
Created by Chandrasekhar Ramakrishnan on 2015-08-08.
Copyright (c) 2015 Chandrasekhar Ramakrishnan. All rights reserved.
"""
def test_config_basics(smet_bundle):
config = smet_bundle.config
assert config... |
print("\nYou are alone in the frigged woods of a hidden country.\nYou where sent here by the CLIA (Central Linux Intelligence Authority) to find out about this new world.\nYou have a computer running Servbuntu v.0.0.1 with a IRC server which you plan to contact the CLIA with.\nIt is off\nThe night is getting colder and... |
# Create a recursive method that mirrors how a
# factorial would work in math.
def factorial(n):
if n == 0:
# add here and remove "pass"
pass
else:
# add here and remove "pass"
pass
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 15 09:40:31 2021
@author: martin
# This script converts the imperial units for fuel salt and coolant salt of
# the MSRE into metric units. Parameters are taken from (bibtex):
@article{osti_4676587,
title = {MOLTEN-SALT REACTOR PROGRAM SEMIAN... |
#
# Copyright 2021 Splunk Inc.
#
# 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 to in writing, so... |
def sortNums(nums):
counts = {}
for n in nums:
counts[n] = counts.get(n, 0) + 1
return ([1] * counts.get(1, 0) + counts.get(2, 0) + counts.get(3, 0))
def sortNums2(nums):
one_index = 0
three_index = len(nums) - 1
index = 0
while index <= three_index:
if nums[index] == 1:
... |
_base_ = [
'../cascade_rcnn/cascade_rcnn_x101_64x4d_fpn_20e_coco.py'
]
dataset_type = 'DefectDataset'
classes = (
"边异常",
"角异常",
"白色点瑕疵",
"浅色块瑕疵",
"深色点块瑕疵",
"光圈瑕疵"
)
data_root = '/media/samba/weiqiang/Datasets/dataset/'
data = dict(
samples_per_gpu=2,
workers_per_gpu=2,
trai... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: DeepSeaVectorDraw
class FillRule(object):
EvenOdd = 0
NonZero = 1
|
# Error List
def ImportLib():
raise RuntimeError("\n\n>> Erro ao importar biblioteca: Verifique se as bibliotecas do sistema estão instaladas e execute o programa novamente.`")
|
class Solution:
def isIsomorphic(self, s, t):
if len(s) != len(t):
return False
s2t, t2s = {}, {}
for p, w in zip(s, t):
if p not in s2t and w not in t2s:
s2t[p] = w
t2s[w] = p
elif p not in s2t or s2t[p] != w:
... |
class Population:
"""
Class contians info on population of candidate solutions
Instance Members :
----------------
population_size : int
members : List containing the members of population
new_members : List containing members of population after each iteration
Methods :
----------
createMembers() : Genera... |
word=input().lower()
summ=0
d=0
L=list(word)
for ele in L:
num=int(ord(ele)-96)
summ+=num
for i in range (0,summ):
if i*(i+1)/2==summ:
print("triangle word")
d+=1
if d==0:
print("not a triangle word")
|
class Solution(object):
def findItinerary(self, tickets):
"""
:type tickets: List[List[str]]
:rtype: List[str]
"""
ticketmap = {}
self.tickets = tickets
for f, t in tickets:
if f not in ticketmap:
ticketmap[f] = [t]
else... |
def get_close_sim_for_box(sim):
def func():
sim.close()
return func
class Simulation:
def __init__(self):
self.boxes = {}
self.signals = {}
self.advance_order = []
self.running = False
def __str__(self):
return 'Simulation'
def print_diagram(self):... |
# Server id
server_id = 90564452600745770
# Role assigned by default to every member that joins.
# Set it to `None` to not assign any role.
default_role = 'Test' # Role name or None.
# Roles that can be assigned with the `role` command.
assignable_roles = ['Test'] # List of role names.
welcome_channel_id = 201392153... |
# -*- coding: utf-8 -*-
"""
Tests for the model.
"""
__author__ = 'Yves-Noel Weweler <y.weweler@fh-muenster.de>'
|
valores = []
valoresPares = []
valoresImpares = []
while True:
valores.append(int(input('Digite um número: ')))
condicao = str(input('Quer continuar? [S/N] ')).strip().upper()[0]
if condicao == 'N':
break
elif condicao == 'S':
continue
else:
condicao = str(input('ERRO! Digite... |
angou = "he.elk.set.to"
kaidoku = angou.split("e")
print(kaidoku[-1])
|
class Error(Exception):
"""Base class for other customized errors."""
pass
class StockNotFoundError(Error):
"""Raised when the desired stock is not found within the currently recognized stocks in the system."""
pass
class InsufficientFundsError(Error):
"""Raised when the player does not have enoug... |
"""
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
Example :
Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.
Rain water trapped: Example 1
The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1].
In ... |
"""Top level description of your module."""
class TemplateClass(object):
"""
The template class does nothing.
See https://numpydoc.readthedocs.io/en/latest/format.html.
For how this docstring is layed out.
Attributes
----------
foo : int
A useless attribute.
bar : int
... |
"""
Using a search cursor to print all the feature classes in our PGH.gdb
Writing the name of the gdb and all its feature classes to a text file
"""
# Import modules
# Set variables
# Execute operation(s)
|
# Aula 07 - Desafio 15: Aluguel de carros
# Ler os Km rodados por um carro alugado e quantos dias ficou alugado e calcular o valor a ser pago
# O valor do aluguel por dia é R$60,00 e o valor por KM rodado é R$0,15
d = int(input('Informe a quantidade de dias em que o carro ficou alugado: '))
km = int(input('Informe qua... |
"""
Constants used by the protocol
"""
# messages
MSG_REQUEST = 1
MSG_REPLY = 2
MSG_EXCEPTION = 3
# boxing
LABEL_VALUE = 1
LABEL_TUPLE = 2
LABEL_LOCAL_REF = 3
LABEL_REMOTE_REF = 4
# action handlers
HANDLE_PING = 1
HANDLE_CLOSE = 2
HANDLE_GETROOT = 3
HANDLE_GETATTR = 4
H... |
DEBUG = True
SLACK_POST_URL = "https://slack.com/api/chat.postMessage"
SLACK_TOKEN = ""
WEATHER_TOKEN = ""
WEATHER_URL = "https://api.openweathermap.org/data/2.5/weather?q={text}&appid={token}"
|
numero = int(input('digite um número'))
for multiplo in range(1, 11):
# print(numero)
# print(multiplo)
print('{} = {} vezes {}'.format(numero * multiplo, numero, multiplo))
# print(numero * multiplo, '=', numero, 'vezes', multiplo)
# a1 = n*1
# a2 = n*2
# a3 = n*3
# a4 = n*4
# a5 = n*5
#... |
# -*- coding: utf-8 -*-
def main():
n, t = map(int, input().split())
ans = n
remain = t
diff = [0 for _ in range(n)]
for i in range(n):
ai, bi = map(int, input().split())
remain -= bi
diff[i] = ai - bi
if remain < 0:
print(-1)
else:
for d in sorted... |
# -*- coding: utf-8 -*-
lights = ["red","yellow","pink"]
currentLight = lights[2]
print(currentLight)
if currentLight == "red":
print("STOP!")
elif currentLight == "yellow": #elif i değilse gibi düşünebiliriz.
print("READY!")
else: #if ve elifle bi işlem gerçekleşmezse els... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.