content stringlengths 7 1.05M |
|---|
"""
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
Example:
Given array nums = [-1, 2, 1, -4], and target = 1.
The sum that is closest to... |
__version__ = "0.0.1"
def func(a: int, b: int = 0, c: int = 0) -> int:
"""Test function.
Args:
a (int): Parameter A.
b (int, optional): Parameter B.
c (int, optional): Parameter C.
Returns:
sum: The sum of A, B, and C.
"""
return a + b + c
|
class UserInputError( Exception):
pass |
real_number = int(input())
numbers = []
names = []
def find_closer():
diferences = []
closers = []
global numbers
global real_number
for i in numbers:
diference = real_number - i
if diference < 0:
diferences.append(-diference)
else:
diferences.append(... |
NODE_LEFT = "LEFT"
NODE_RIGHT = "RIGHT"
NODE_ROOT = "ROOT"
class BinarySearchTree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
self.parent = None
self.type = None
def insert(self, tree):
current = self
while 1:
... |
load("//apple:string_dict_select_values.bzl", "string_dict_select_values")
def _impl(ctx):
substitutions = {}
for key, value in ctx.attr.items():
substitutions["${" + key + "}"] = value
substitutions["$(" + key + ")"] = value
output = ctx.outputs.out
ctx.actions.expand_template(
... |
class Circle:
pi = 3.14
def __init__(self, diameter):
print("Creating circle with diameter {d}".format(d=diameter))
# Add assignment for self.radius here:
self.radius = diameter / 2
def circumference(self):
return 2 * self.pi * self.radius
medium_pizza = Circle(12)
teaching_table = Circle(36... |
# coding = utf-8
"""
create on : 2019/04/06
project name : AtCoder
file name : 01_ABC086A
problem : https://atcoder.jp/contests/abs/tasks/abc086_a
"""
def main():
a, b = [int(x) for x in input().split(" ")]
ab = a * b
ans = "Odd" if ab % 2 else "Even"
print(ans)
if __name__ == "__main__":
main... |
# -*- coding: utf-8 -*-
def comp_periodicity(self, p=None):
"""Compute the periodicity factor of the lamination
Parameters
----------
self : LamSlotMulti
A LamSlotMulti object
Returns
-------
per_a : int
Number of spatial periodicities of the lamination
is_antiper_a :... |
# anagram_palindrome
#
# Write a function which accepts an input word and returns true or false
# if there exists an anagram of that input word that is a palindrome.
# We are going to try solve this question with a time complexcity of:
# O(n) => linear
# palindrome : is a string that read the same from front to back... |
def to_bool(value):
value = str(value)
if value == "True" or value == "TRUE" or value == "true":
return True
else:
return False
|
# -*- coding: UTF-8 -*-
strings = {
u"フライング・スヌーピー" : u"The Flying Snoopy",
u"スヌーピーのグレートレース™" : u"Snoopy's Great Race",
u"ハローキティのカップケーキ・ドリーム" : u"Hello Kitty's Cupcake Dream",
u"ジュラシック・パーク・ザ・ライド®\n※ご利用には整理券が必要です" : u"Jurassic Park: The Ride",
u"バック・トゥ・ザ・フューチャー®・ザ・ライド" : u"Back to the Future: The Ride... |
"""Exceptions"""
class ModelException(Exception):
pass
|
nota_trabalhos = float(input())
nota_prova = float(input())
media = (nota_trabalhos + nota_prova) / 2
if media >= 6:
print('aprovado')
elif nota_trabalhos >= 2:
print('talvez com a sub')
else:
print('reprovado') |
# 계속 나아가면서 하나 더하고 하나 빼는 형식으로도 풀어봤지만, 시간초과가 났다.
def to_timestamp(timeformat):
hour, minute, second = timeformat.split(":")
return int(hour) * 3600 + int(minute) * 60 + int(second)
def to_timeformat(timestamp):
hour, minute, second = timestamp // 3600, timestamp % 3600 // 60, timestamp % 60
return "%02d... |
def KthLSB(n, k):
return (n>>(k-1))&1
if __name__ == '__main__':
n = 10
k = 4
print(KthLSB(n, k)) |
#
# PySNMP MIB module ERI-DNX-STM1-OC3-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ERI-DNX-STM1-OC3-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:51:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
class User:
user = []
'''
this class creates new instance of user data
'''
def __init__(self, username, password):
'''
init method to define objects
Args:
username: to ask user a username
password: to either generate or ask user for a password
... |
def gcd(a,b):
if a==0:
return b
else:
return gcd(b%a,a)
c = gcd(100,35) # c = 5
print(c)
|
def debug(ctx,n):
print("######### BEGIN DEBUG"+n+"################")
print(ctx.getText())
print("######### END DEBUG ################")
class ASTException(Exception):
pass
|
class QuadTree:
"""A class implementing a quadtree."""
def __init__(self, boundary, max_points=4, depth=0):
"""Initialize this node of the quadtree.
boundary is a Rect object defining the region from which points are
placed into this node; max_points is the maximum number of points the... |
defines = {
'base00': '#F7B3DA',
'base01': '#f55050',
'base02': '#488214',
'base03': '#EEB422',
'base04': '#468dd4',
'base05': '#551a8b',
'base06': '#1b9e9e',
'base07': '#75616b',
'base08': '#9e8b95',
'base09': '#e06a26',
'base0A': '#f0dde6',
'base0B': '#b5a3ac',
'bas... |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 13 11:40:13 2021
@author: Mayur
"""
"""
Product class has all functinality related to adding/removing/displaying products
"""
class Product:
name = ""
price = 0
def __init__(self):
self.all_products = []
def reset(self):
self.all_... |
#Daniel Ferreira
def absoluto(n:int) -> int:
"""Essa função verifica primeiramente se o número é positivo. Caso não seja, converte ele para positivo e o retorna. Se a pessoa não escrever um núemro, aparecerá um TypeError e um ValueError, informando o erro."""
try:
if n < 0:
n * -1
... |
"""
ScriptList object (and friends).
"""
__all__ = ["ScriptList", "ScriptRecord", "ScriptCount", "LangSysRecord", "LangSysCount"]
class ScriptList(object):
__slots__ = ["ScriptCount", "ScriptRecord"]
def __init__(self):
self.ScriptCount = 0
self.ScriptRecord = None
def loadFromFontTools... |
class Solution(object):
def destCity(self, paths):
"""
:type paths: List[List[str]]
:rtype: str
"""
record = {}
all_cities = []
for cities in paths:
record[cities[0]] = cities[1]
for city in record.values():
if city not... |
#MenuTitle: Show Glyphs with this Anchor
# -*- coding: utf-8 -*-
__doc__="""
New Tab with all Glyphs that have the selected anchor.
"""
thisFont = Glyphs.font # frontmost font
selectedLayer = thisFont.selectedLayers[0]
selection = selectedLayer.selection
editString = ""
for i, anchor in enumerate(selection):
if i >... |
"""715. Range Module
https://leetcode.com/problems/range-module/
A Range Module is a module that tracks ranges of numbers. Your task is to
design and implement the following interfaces in an efficient manner.
addRange(int left, int right) Adds the half-open interval [left, right),
tracking every real number in that ... |
a,b = input("Enter A(x1, y1): ").split()
c,d = input("Enter B(x2, y2): ").split()
distance = pow((pow((int(c)-int(a)),2) + pow((int(d)-int(b)),2)), 0.5)
print("Distance between points A and B: ",distance)
|
class FileReader:
def __init__(self):
pass
def read_text_file(self, path):
file = open(path, 'r')
return file.read() |
'''
如果从第n个数字到最后都是递减的并且第n-1个数字小于第n个,说明从第n个数字开始的这段序列是字典序组合的最后一个,
在下一个组合中他们要倒序变为字典序第一个,然后从这段序列中找出第一个大于第n-1个数字的数和第n-1个数字交换就可以了。
举个栗子,当前组合为12431,可以看出431是递减的,同时4>2,这样我们把431倒序,组合就变为12134,
然后从134中找出第一个大于2的数字和2交换,这样就得到了下一个组合13124。对于完全递减的组合例如4321在倒序之后就可以结束了。
'''
class Solution:
def nextPermutation(self, nums):
righ... |
# -*- coding:utf-8 -*-
BIND_HOST='0.0.0.0'
BIND_PORT=9999
USER_HOME = '%s/var/users' %BASE_DIR
USER_ACCOUNT={
'alex':{'password':'123456',
'quotation':1000000,#1GB
'expire':'2017-01-22'
}
} |
# Created by MechAviv
# Map ID :: 620100029
# Spaceship : In Front of the Shuttle
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setStandAloneMode(True)
sm.forcedInput(0)
OBJECT_1 = sm.sendNpcController(9270083, 2415, -134)
sm.showNpcSpecialActionByObjectId(O... |
#
# PySNMP MIB module WIRELESS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WIRELESS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:29:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... |
class DisjointSet:
def __init__(self, *args):
"""Initializes the disjoint set
:param args: any number of integers
"""
# the value implies the index of the root node of the index
# e.g.: [0, 0, 1]; nodes 0 and 1 are in the same set with root = node 0
# {{0, 1}, 2}
... |
def partida():
print(" ")
# Solicita ao usuário os valores de n e m:
n = int(input("Quantas peças? "))
m = int(input("Limite de peças por jogada?"))
# Define uma variável para controlar a vez do computador:
is_computer_turn = True
# Decide quem iniciará o jogo:
if n % (m+1) == 0: is... |
class Semester:
def __init__(self, season:str, year:int, brother_id:int, amount:float):
self.season = season
self.year = year
self.brother_id = brother_id
self.amount = amount |
# -*- coding: utf-8 -*-
def test_dataset_sizes(test_file):
ds = test_file.dataset
assert ds.sizes == {"ch": 2, "pixel": 1024, "Time": 50}
def test_dataset_variables(test_file):
ds = test_file.dataset
for var in ["Count", "FilteredCount", "Rough_wavelength"]:
assert var in ds
def test_config(... |
def append_node_to_dict(node1, node2, dict_connections):
if not node1 in dict_connections:
dict_connections[node1] = [node2]
else:
node_connections = dict_connections[node1]
if not node2 in node_connections:
node_connections.append(node2)
dict_connections[node1] =... |
#!/usr/bin/env python3.8
"""
given a string return list of all the possible permutations of the string and count of possible permutations
"""
count = 0
list = []
def permutation(string,prefix):
global count
if len(string)==0:
count += 1
list.append(prefix)
else:
for i in range(len(string)):
permutation(s... |
"""
Events, the fundamental message.
"""
class SpaceEvent(object):
def __init__(self, data):
self.data = data
def __str__(self):
return '<%s>: %s' % (self.__class__.__name__, self.data)
class KernelEvent(SpaceEvent):
"""A special event."""
pass
|
class TrieNode:
def __init__(self):
self.children: Dict[str, TrieNode] = defaultdict(TrieNode)
self.deleted = False
class Solution:
def deleteDuplicateFolder(self, paths: List[List[str]]) -> List[List[str]]:
ans = []
root = TrieNode()
subtreeToNodes: Dict[str, List[TrieNode]] = defaultdict(lis... |
num_1 = int(input('Insira um número: '))
num_2 = int(input('Insira mais um número: '))
num_3 = int(input('Insira outro número: '))
num_4 = int(input('Insira mais outro número: '))
tupla_numeros = (num_1, num_2, num_3, num_4)
indice_3 = 0
if 3 in tupla_numeros:
indice_3 = tupla_numeros.index(3) + 1
print(f'A tup... |
# -*- coding: utf-8 -*-
# TODO: doc
"""feelsbook
"""
__version__ = (0, 0, 0)
|
class Type1:
def f1_1():
pass
def test(t1):
t1.f1_1()
t2 = t1
|
total = 0
quantidade = 0
barato = ''
valor = 0
while True:
produto = input('Qual o nome do produto? ')
valor_anterior = valor
valor = float(input('Qual o preço do produto? '))
total += valor
if valor > 1000:
quantidade += 1
if valor < valor_anterior:
barato = produto
c = inpu... |
# coding:utf-8
# File Name: strip_test
# Author : yifengyou
# Date : 2021/07/18
s = " this is a puppy "
print(s)
print(s.lstrip())
print(s.rstrip())
print(s.strip())
print(s)
print(s.lstrip(" this"))
print("=========")
print(s.startswith(" "))
print(s.find("puppy"))
print(s.replace("puppy", "dog"))
pr... |
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.36
工具: python == 3.7.3
"""
"""
思路:
先用set将两个数组分别去重
然后合并后的列表中如果某元素数目大于1,说明其来自不同的数组
利用字典保存结果并且判断
结果:
执行用时 : 44 ms, 在所有 Python3 提交中击败了97.64%的用户
内存消耗 : 13.1 MB, 在所有 Python3 提交中击败了81.55%的用户
"""
class Solution:
... |
TABLE8 = [0] * 2 ** 8
for index in range(len(TABLE8)):
TABLE8[index] = (index & 1) + TABLE8[index >> 1]
class Solution:
def hammingWeight(self, n: int) -> int:
return TABLE8[n & 0xff] + TABLE8[(n >> 8) & 0xff] + TABLE8[(n >> 16) & 0xff] + TABLE8[n >> 24]
|
class SensorReadError(Exception):
pass
class CommunicationErrorException(Exception):
pass |
# @time: 2022/1/10 5:31 PM
# Author: pan
# @File: study.py
# @Software: PyCharm
print("study py")
name = "pan"
age = 10
def study():
print("good good study, day day up!") |
class Response(object):
def __init__(self, request=None):
self.intent_name = request.intent_name if request else ''
self.lang = request.lang if request else ''
self.data = request.data if request else ''
self._speech = ''
self._text = ''
@property
def text(self):
... |
'''
math > ad-hoc
difficulty: easy
date: 09/Jun/2020
problem: how many bishops can be placed on a n x n chessboard without threatening each other?
by: @brpapa
'''
while (1):
try:
n = int(input())
ans = n + (n-2 if n > 2 else 0)
print(ans)
except EOFError:
break
|
ENCRYPTED_MESSAGE = 'MORA EVOCU ECCLESIA TUTIS AUT TIBI NISI OLIM OCIUS NOVEM'
DECRYPTED_MESSAGE = 'MEETATNOON'
CIPHER_OPTIONS = ['null','caesar','atbash']
cipher_used_in_this_example = CIPHER_OPTIONS[0] # replace with the index of the cipher used in this encryption
|
x1, x2, y1, y2 = 150, 193, -86, -136
def passes_through(vx, vy):
nx, ny = 0, 0
points = []
while nx <= x2 and ny >= y2:
nx, ny = nx + vx, ny + vy
points += [[nx, ny]]
if vx > 0:
vx = vx - 1
vy = vy - 1
if x1 <= nx and nx <= x2 and y2 <= ny and ny <= y1:... |
money = float(input('o quanto de dinheiro que a pessoa tem: '))
print('o dolar vale 3.27, quanto dolar ele podrá comprar?')
s = money / 3.27
print('{:.2f} / 3.27 = {:.2f}'.format(money, s))
print('mais ou menos {:.2f} dólares'.format(s))
#acrescentando para ponto flutuante( ":.2f" ) |
#João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar
# o rendimento diário de seu trabalho. Toda vez que ele traz um peso de peixes maior
# que o estabelecido pelo regulamento de pesca do estado de São Paulo (50 quilos)
# deve pagar uma multa de R$ 4,00 por quilo excedente. João precisa qu... |
#Practical proof of fact, that numbers 2^x are almost perfect number
#END = 30
END = int(input("End of loop"))
for i in range(2,END):
s = set([1])
n = 2**i
for j in range(int(n/2+1),1,-1):
if(n % j==0):
s.add(j)
print(n,end=" - ")
print(sum(s)+1==n)
#OUTPUT
"""
4 - True
8 - Tr... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def buildTree(self, inorder: 'List[int]', postorder: 'List[int]') -> 'TreeNode':
if not inorder or not postorder:
ret... |
expected_output = {
"tag": {
"1": {
"topo_type": "unicast",
"topo_name": "base",
"tid": 0,
"topo_id": "0x0",
"flex_algo": {
"None": {
"prefix": {
"4.4.4.4": {
"... |
"""/**
* @author [Jai Miles]
* @email [jaimiles23@gmail.com]
* @create date 2020-05-05 13:56:45
* @modify date 2020-05-05 13:56:45
* @desc [
Data module for the fallback handler.
]
*/
"""
##########
# Standard Fallback
##########
MS_FALLBACK = "I can't help you with that right now."
##########
# Did no... |
# MIT License
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP.
#
# netFlow : ECOS Netflow configuration
def get_net_flow_configuration(
self,
ne_id: str,
cached: bool,
) -> dict:
"""Get netflow configurations from Edge Connect appliance
.. list-table::
:header-rows: 1
... |
#!/usr/bin/env python
class Section:
def has_item(self, item):
return hasattr(self, item)
def __getitem__(self, item):
return self.__dict__[item]
class ConfigReader(object):
"""
ConfgiReader - An improved config parser.
"""
def __init__(self):
self.sections = []
d... |
class AccidentData:
"""Clase base que tiene por objetivo darle contexto a los datos de accidentes"""
def __init__(self):
self.client = 0
self.client_name = ""
self.client_contact = ""
self.client_phone = ""
self.data_origin = ""
|
{
"targets": [
{
"target_name": "baseJump",
"sources": [
"cc/baseJump.cc",
"cc/BigInteger.cc",
"cc/BigIntegerAlgorithms.cc",
"cc/BigIntegerUtils.cc",
"cc/BigUnsigned.cc",
"cc/BigUnsignedInABase.cc"
],
"include_dirs": [
"<!(node -e \"require('nan')\")"
],
"cflags!": [ "-f... |
# 48. Rotate Image
# ttungl@gmail.com
# You are given an n x n 2D matrix representing an image.
# Rotate the image by 90 degrees (clockwise).
# Note:
# You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
# Example... |
i = 0
while i < 3:
print("i: ", i)
j = 0
while j < 3:
print("j: ", j)
j += 1
i += 1
|
#!/usr/bin/env python3
#
# Author: Vishwas K Singh
# Email: vishwasks32@gmail.com
#
# Script to Program to find Sum, Diff, Prod, Avg, Div
num1 = input("Enter the first Number: ")
num2 = input("Enter the second Number: ")
# Check if the user has entered the number itself
try:
# Convert the numbers to double always... |
class Bands:
all_bands = []
def __init__(self, band_name, members):
self.band_name = 'band_name'
self.members = members
self.__class__.all_bands.append(self)
def to_list(self):
return self.all_bands
def __str__(self):
return f'the band name is {se... |
# Author: btjanaka (Bryon Tjanaka)
# Problem: (Leetcode) 1
# Title: Two Sum
# Link: https://leetcode.com/problems/two-sum/
# Idea: The easy solution is to check every pair of elements, but this is
# O(n^2). To achieve O(n), the basic idea is to use a set that keeps track of
# which elements we have seen so far while it... |
a = list(map(lambda i: ord(i) - 97, list(input())))
idx_array = [-1 for _ in range(26)]
for i in range(len(a)):
if idx_array[a[i]] == -1:
idx_array[a[i]] = i
for idx in idx_array:
print(idx, end=' ') |
# https://leetcode.com/problems/kth-smallest-element-in-a-bst/
#
# algorithms
# Medium (49.79%)
# Total Accepted: 199,308
# Total Submissions: 400,327
# beats 100.0% of python submissions
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# sel... |
# Complete the compareTriplets function below.
def compareTriplets(a, b):
al =0
bo=0
for i in range(3):
if(a[i]>b[i]):
al+=1
elif(b[i]>a[i]):
bo+=1
return(al,bo)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
a = list(map(int, in... |
def partition(top, end, array):
pivot_index = top
pivot = array[pivot_index]
while top < end:
while top < len(array) and array[top] <= pivot:
top += 1
while array[end] > pivot:
end -= 1
if(top < end):
array[top], array[end] = array[end], array[top]
ar... |
def find_coordinates(x, y):
# Get coordinates of mouse click
return (x- x%10, y - y%10)
def get_all_neighbours(cell):
# get neighbours along with current cell
(x,y) = cell
return [(x-i,y-j) for i in range(-10,20,10) for j in range(-10,20,10)]
def get_next_generation(cells):
# Get next generati... |
#
# PySNMP MIB module BIANCA-BRICK-PPP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BIANCA-BRICK-PPP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:37:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
def gcd(a,b):
res = 1
for i in range(1, min(a,b)+1):
if a % i == 0 and b % i == 0: res = i
return res
def solution(w,h):
return w * h - (w + h - gcd(w,h)) |
def markov_tweet():
#Created a nested dictionary with the 1st Key = a word second key = possible words that come after and value = counter
words_dic = {}
with open("prunedLyrics.txt", 'r', encoding="utf-8") as f:
for line in f:
line = line.replace("\n"," \n")
words_list = line.split(" ")
for index, word i... |
class Person:
@property
def full_name(self):
return f"{self.first_name} {self.last_name}"
|
"""
Setting for project
"""
logfile = "demo_project.log"
|
chassis_900 = '192.168.65.36'
chassis_910 = '192.168.65.21'
linux_900 = '192.168.65.34:443'
linux_910 = '192.168.65.23:443'
windows_900 = 'localhost:11009'
windows_910 = 'localhost:11009'
cm_900 = '172.40.0.204:443'
server_properties = {'linux_900': {'server': linux_900,
'locatio... |
n=int(input())
arr=list(map(int,input().split()))
a=0
p=0
for k in range(0,n):
a=a+arr[k]
for j in range(0,n):
d=(arr[j] - (a/n))**2
p=p+d
sigma=float ((p/n)**(1/2))
print(sigma)
|
class Port:
def __init__(self, path, vendor_id, product_id, serial_number):
self.path = path
self.vendor_id = vendor_id
self.product_id = product_id
self.serial_number = serial_number
def __repr__(self):
return f'<Port ' \
f'path={self.path} ' \
... |
def less_or_equal(value):
if value : # Change this line
return "25 or less"
elif value : # Change this line
return "75 or less"
else:
return "More than 75"
# Change the value 1 below to experiment with different values
print(less_or_equal(1))
|
#
# @lc app=leetcode id=2 lang=python3
#
# [2] Add Two Numbers
#
# https://leetcode.com/problems/add-two-numbers/description/
#
# algorithms
# Medium (30.66%)
# Likes: 5024
# Dislikes: 1280
# Total Accepted: 848.6K
# Total Submissions: 2.7M
# Testcase Example: '[2,4,3]\n[5,6,4]'
#
# You are given ... |
n = float(input('Digite o valor do produto: ' ))
print('digite 1 para > À vista dinheiro/cheque 10 % de desconto: ')
print()
print('digite 2 para > À vista no cartão - 5 % de desconto : ' )
print()
print('digite 3 para > Em até 2x nos cartão Preço normal : ' )
print()
print('digite 4 para > 3x ou mai... |
"""
Tickle.
The word "tickle" jitters when the cursor hovers over.
Sometimes, it can be tickled off the screen.
"""
message = "tickle"
# X and Y coordinates of text
x = 0
y = 0
# horizontal and vertical radius of the text
hr = 0
vr = 0
def setup():
global x, y, hr, vr
size(640, 360)
# Create the font
... |
# coding=utf-8
"""
Package to manage Sentry for ESST
"""
|
class Solution(object):
def partitionDisjoint(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
now_min= 10^6
nearly_max= nums[0]
last_time_max_value = nums[0]
last_time_max= -1
record_list = []
for i, v in enumerate(nums):
... |
"""
Given a non-empty list of words, return the k most frequent elements.
Your answer should be sorted by frequency from highest to lowest. If two words
have the same frequency, then the word with the lower alphabetical order comes
first.
Example 1:
Input: ["i", "love", "leetcode", "i", "love", "coding"], k = 2
... |
class ValueBlend:
def _init_corners(self, **kwargs):
# Corners is list of tuples:
# [bottomleft, bottomright, topleft, topright]
if 'corners' in kwargs:
self.corners = kwargs['corners']
if len(self.corners) != 4 or \
any(len(v) != 2 for v in self.cor... |
class Solution(object):
def bulbSwitch(self, n):
"""
:type n: int
:rtype: int
"""
num_of_facs = [1 for i in range(n)]
for j in range(2, n + 1):
for k in range(1, n / j + 1):
num_of_facs[j * k - 1] += 1
res = 0
for num in nu... |
str_1 = input()
str_2 = input()
str_3 = input()
print([str_1, [str_2], [[str_3]]])
|
class Dataset(object):
def __init__(self, name=None):
self.name = name
def __str__(self):
return self.name
def get_instance_name(self, filepath, id):
raise NotImplementedError("Abstract class")
def import_model(self, filepath):
raise NotImplementedError("Abstra... |
def isValid(s: str) -> bool:
open_to_close = {
'(': ')',
'{': '}',
'[': ']'
}
close_to_open = {v: k for k, v in open_to_close.items()}
stack = []
for i in s:
if i in open_to_close:
stack.append(i)
elif i in close_to_open:
... |
Numero = int(input('Insira um número: '))
Unidade = Numero//1%10
Dezena = Numero//10%10
Centena = Numero//100%10
Milhar = Numero//1000%10
print(f'Analisando o número {Numero}...')
print(f'Unidade: {Unidade}')
print(f'Dezena: {Dezena}')
print(f'Centena: {Centena}')
print(f'Milhar: {Milhar}') |
client_id = 'Ch8pNOBOAYzASwSmKClKZJKts8VnKDsj' # your bot's client ID
token = 'Mzc3MDU4MTc2MzUwMDI3Nzc3.DQ8csA.YRTHtBKENVulI8bk17-6gzGnScU' # your bot's token
carbon_key = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiIyMjA5NTkxNzg3NzkyNjI5ODYiLCJyYW5kIjozOTksImlhdCI6MTUxMjkzNTQ5NH0.1Al7nXx5HmvA7Lyc_ddc6V_czVxv... |
"""Device module handling /device/ API calls."""
class Device(object):
"""Device class with /device/ API calls."""
def __init__(self, opensprinkler):
"""Device class initializer."""
self._opensprinkler = opensprinkler
def _getOption(self, option):
"""Retrieve option"""
(r... |
def generate_concept_HTML(concept_title, concept_description):
html_text_1 = '''
<div class="concept">
<div class="concept-title">
''' + concept_title
html_text_2 = '''
</div>
<div class="concept-description">
''' + concept_description
html_text_3 = '''
</div>
</di... |
nop = b'\x00\x00'
brk = b'\x00\xA0'
ld1 = b'\x63\x25' # Load 0x25 into register V3
ld2 = b'\x64\x26' # Load 0x26 into register V4
sne = b'\x93\x40' # Skip next instruction if V3 != V4
with open("snevxvytest.bin", 'wb') as f:
f.write(ld1) # 0x0200 <-- Load the byte 0x25 into register V3
f.write(ld2) # 0x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.