content stringlengths 7 1.05M |
|---|
# coding: utf-8
# In[1]:
#num01_SwethaMJ.py
sum_ = 0
for i in range(1,1000):
if i%3==0 or i%5==0:
sum_ += i
print(sum_)
|
# M6 #2
str = 'inet addr:127.0.0.1 Mask:255.0.0.0'
index = str.find(':')
if index > 0:
# clip off the front
str1 = str[index+1:]
i = str1.find(' ')
addr = str1[:i].rstrip()
# addr is the inet address
print('Address: ', addr)
|
# o desconto e o total a pagar (total a pagar = total - desconto), sabendo-se que:
# - Se quantidade <= 5 o desconto será de 2%
# - Se quantidade > 5 e quantidade <=10 o desconto será de 3%
# - Se quantidade > 10 o desconto será de 5%
print('====================DESCRIÇÃO DE UM PRODUTO====================')
nome_do_prod... |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
... |
A = ['polegar esticado vertical: afastado do indicador', 'indicador dobrado: proximo ao medio', 'medio dobrado: proximo ao anelar', 'anelar dobrado: proximo ao minimo', 'minimo dobrado: proximo ao anelar']
B = ['polegar dobrado: afastado do indicador', 'indicador esticado vertical: proximo ao medio', 'medio esticado v... |
#set
a=set()
#a={}でも初期化可能
x=1
a.add(x)
if x in a:
print(x)
a.remove(x) |
class Solution:
def romanToInt(self, s: str) -> int:
dic = {"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000}
res = 0
while s:
letter = s[0]
if len(s)==1:
res+=dic[letter]
return res
if dic[letter]>=d... |
class blank (object):
def __init__ (self):
object.__init__ (self)
deployment_settings = blank ()
# Web2py Settings
deployment_settings.web2py = blank ()
deployment_settings.web2py.port = 8000
# Database settings
deployment_settings.database = blank ()
deployment_settings.database.db_type = "sqlite"
deplo... |
def insertion_sort(to_sort):
i=0
while i <= len(to_sort)-1:
hole = i;
item = to_sort[i]
while hole > 0 and to_sort[hole-1] > item:
to_sort[hole] = to_sort[hole-1]
hole-=1
to_sort[hole] = item
i+=1
return to_sort
|
load_modules = {
'hw_USBtin': {'port':'auto', 'speed':500}, # IO hardware module # Module for sniff and replay
'mod_stat': {"bus":'mod_stat','debug':2},'mod_stat~2': {"bus":'mod_stat'},
'mod_firewall': {}, 'mod_fuzz1':{'debug':2},
'gen_replay': {'debug': 1}# Stats
}... |
def dragon_lives_for(sequence):
dragon_size = 50
sheep = 0
squeezed_for = 0
days = 0
while True:
sheep += sequence.pop(0)
if dragon_size <= sheep:
sheep -= dragon_size
dragon_size += 1
squeezed_for = 0
else:
sheep = 0
... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------
# Copyright (C) 2009 StatPro Italia s.r.l.
#
# StatPro Italia
# Via G. B. Vico 4
# I-20123 Milano
# ITALY
#
# phone: +39 02 96875 1
# fax: +39 02 96875 605
#
# email: info@riskmap.net
#
# This program is distributed in the ... |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
AUTO_VALUE_VERSION = "1.7.4"
maven_jar(
name = "auto-value",
artifact = "com.google.auto.value:auto-value:" + AUTO_VALUE_VERSION,
sha1 = "6b126cb218af768339e4d6e95a9b0ae41f74e73d",
)
maven_jar(
... |
# -*- coding: utf-8 -*-
class AzureShellCache:
__inst = None
__cache = {}
@staticmethod
def Instance():
if AzureShellCache.__inst == None:
AzureShellCache()
return AzureShellCache.__inst
def __init__(self):
if AzureShellCache.__inst != None:
raise ... |
solutions = []
maxAllowed = 10**1000
value = 1
base = 1
while value * value <= maxAllowed:
while value < base * 10:
solutions.append(value)
value += base
base = value
solutions.append(value)
while True:
num = int(input())
if num == 0:
break
# Binary search
... |
# template_parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'template_validateALL ARROW ARROWPARENS ARROW_PRE ASSIGN ASSIGNBAND ASSIGNBOR ASSIGNBXOR ASSIGNDIVIDE ASSIGNLLSHIFT ASSIGNLSHIFT ASSIGNMINUS ASSIGNMOD ASSIGNPLU... |
def f():
print('f executed from module 1')
if __name__ == '__main__':
print('We are in module 1')
|
class ParserError(Exception):
"""
Base parser exception class.
Throws when any error occurs.
"""
pass
|
n=int(input("Enter a number : "))
r=int(input("Enter range of table : "))
print("Multiplication Table of",n,"is")
for i in range(0,r):
i=i+1
print(n,"X",i,"=",n*i)
print("Loop completed") |
PRACTICE = False
N_DAYS = 80
with open("test.txt" if PRACTICE else "input.txt", "r") as f:
content = f.read().strip()
state = list(map(int, content.split(",")))
def next_day(state):
new_state = []
num_new = 0
for fish in state:
if fish == 0:
new_state.append(6)
num_new... |
# This program says hello
print("Hello World!")
# Ask the user to input their name and assign it to the name variable
print("What is your name? ")
myName = input()
# Print out greet followed by name
print("It is good to meet you, " + myName)
# Print out the length of the name
print("The length of your name " + str(le... |
N = int(input())
x, y = 0, 0
for _ in range(N):
T, S = input().split()
T = int(T)
x += min(int(12 * T / 1000), len(S))
y += max(len(S) - int(12 * T / 1000), 0)
print(x, y)
|
# -*- coding: utf-8 -*-
# tomolab
# Michele Scipioni
# Harvard University, Martinos Center for Biomedical Imaging
# University of Pisa
LIGHT_BLUE = "rgb(200,228,246)"
BLUE = "rgb(47,128,246)"
LIGHT_RED = "rgb(246,228,200)"
RED = "rgb(246,128,47)"
LIGHT_GRAY = "rgb(246,246,246)"
GRAY = "rgb(200,200,200)"
GREEN = "rgb(0... |
__all__ = [
'manager', \
'node', \
'feature', \
'python_utils'
]
|
TEST_LAT=-12
TEST_LONG=60
TEST_LOCATION_HIERARCHY_FOR_GEO_CODE=['madagascar']
class DummyLocationTree(object):
def get_location_hierarchy_for_geocode(self, lat, long ):
return TEST_LOCATION_HIERARCHY_FOR_GEO_CODE
def get_centroid(self, location_name, level):
if location_name=="jalgaon" and lev... |
#Escreva um programa que leia dois números inteiros e compare-os. mostrando na tela uma mensagem:
while True:
try:
n1 = int(input('Primeiro número: '))
n2 = int(input('Segundo número: '))
except:
print('Entrada inválida, digite apenas números inteiros! Tente novamente...')
else:
... |
#
# PySNMP MIB module HUAWEI-PGI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-PGI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:35:58 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... |
class Solution:
def frequencySort(self, s: str) -> str:
freq = {}
for ch in s:
if(ch in freq):
freq[ch] += 1
else:
freq[ch] = 1
out = ""
for k,v in sorted(freq.items(), key=lambda x: x[1], reverse=True):
ou... |
psys_game_rain = 0
psys_game_snow = 1
psys_game_blood = 2
psys_game_blood_2 = 3
psys_game_hoof_dust = 4
psys_game_hoof_dust_mud = 5
psys_game_water_splash_1 = 6
psys_game_water_splash_2 = 7
psys_game_water_splash_3 = 8
psys_torch_fire = 9
psys_fire_glow_1 = 10
psys_fire_glow_fixed = 11
psys_torch_smoke = 12
psys_flue_s... |
# config:utf-8
"""
production settings file.
"""
|
def isEven(num):
num1 = num / 2
num2 = num // 2
if num1 == num2:
return True
else:
return False
# pi = (4/1) - (4/3) + (4/5) - (4/7) + (4/9) - (4/11) + (4/13) - (4/15)
pi = 0.0
for index, i in enumerate(range(1, 100), start=1):
thing = (4/((2 * index) - 1))
if isEven(index):
... |
DOMAIN = {
'20191016_1571241600': {'datasource': {'source': '20191016_1571241600'}},
'20191210_1575997200': {'datasource': {'source': '20191210_1575997200'}},
'20190724_1563969600': {'datasource': {'source': '20190724_1563969600'}},
'20191128_1574982000': {'datasource': {'source': '20191128_... |
# pylint: skip-file
class Hostgroup(object):
''' hostgroup methods'''
@staticmethod
def get_host_group_id_by_name(zapi, hg_name):
'''Get hostgroup id by name'''
content = zapi.get_content('hostgroup',
'get',
{'filter': {'... |
# Python - Object Oriented Programming
# Raise can be different for different employees or instances.
# But total number of employees will not be different for any instance.
# so lets create a class variable names num_of employees.
class Employee:
num_of_emps = 0
raise_amt = 1.04
def __init__(self, firstN... |
# Escrever um programa em Python em que dada uma lista com números inteiros,
# retorna uma nova lista com os números ímpares (ou pares) contidos nesta lista.
sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89, 88]
sampleList_even = []
sampleList_odd = []
i = 0
resto = 0
while i < len(sampleList):
if sampleList[i] %... |
# Split string at line boundaries
file_split = file.splitlines()
# Print file_split
print(file_split)
# Complete for-loop to split by commas
for substring in file_split:
substring_split = substring.split(",")
print(substring_split)
|
#!/usr/bin/env python
# coding: utf-8
def check(guess, tries):
if guess == word:
print("Good Job! You are one with the Source.")
exit(0)
elif guess == "lol":
print("You wasted a guess =P")
elif len(guess) < 5:
print("0, 1, 2, 3, 4 that’s how we count to five!")
elif guess... |
#!/usr/bin/python
# coding=utf-8
class Project(object):
__allowed_properties = [
'name',
'git_url',
'absolute_path'
]
def __new__(cls, project_settings):
# Check if project settings are a go for setting attributes
if not sorted(project_settings.keys()) == sorted(c... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 23 20:07:08 2018
@author: Shen Zhen-Xiong
"""
BasisDict = {'LDAmin': {'H': 'H_lda_5.0au_50Ry_2s1p',
'Li': 'Li_lda_8.0au_50Ry_2s2p1d',
'Be': 'Be_lda_8.0au_50Ry_2s2p1d',
'B': 'B_lda_7.0au_50Ry_... |
"""
Unit test module
How to debug test:
$ pytest -s # disable all capturing
"""
|
class Building:
def __init__(s,x,y,a,b,h=10): s.x,s.y,s.a,s.b,s.h=x,y,a,b,h
__repr__ = lambda s: "Building({}, {}, {}, {}, {})".format(s.x,s.y,s.a,s.b,s.h)
area,volume = lambda s: s.a*s.b,lambda s: s.a*s.b*s.h
corners = lambda s: {"south-west":(s.x,s.y),"north-east":(s.x+s.b,s.y+s.a),
... |
##for i in range(0,5):
## for j in range(5,i,-1):
##
## print(j,end='')
##
##
## print()
for i in range(5,0,-1):
for j in range(1,i+1):
print(i,end='')
print()
|
class User:
def __init__(self, user_name, email=None):
self.name = user_name
self.email = email
self.expense_dict = {}
def add_entry(self, user, amount):
print(f"Now updating Entry {user.name} for {self.name}'s dict.")
if self.expense_dict.get(user, None) is not None:
print(f"Previous entry was {self.ex... |
# 問題URL: https://atcoder.jp/contests/abc128/tasks/abc128_d
# 解答URL: https://atcoder.jp/contests/abc128/submissions/14707279
n, k = map(int, input().split())
v = [int(i) for i in input().split()]
ans = 0
for a in range(min(n, k) + 1):
pa, va = v[:a], v[a:]
for b in range(min(n, k) - a + 1):
pb = pa + va... |
_base_ = [
'../_base_/models/oscar/oscar_nlvr2_config.py',
'../_base_/datasets/oscar/oscar_nlvr2_dataset.py',
'../_base_/default_runtime.py',
]
# cover the parrmeter in above files
model = dict(params=dict(model_name_or_path='/home/datasets/mix_data/model/vinvl/vqa/large/checkpoint-2000000', ))
lr_config... |
class Required(object):
"""
A class holding a dictionary of required fields
for variety of transaction supported by pypesa
"""
re_customer_to_bussiness = {
"input_Amount",
"input_Country",
"input_Currency",
"input_CustomerMSISDN",
"input_ServiceProvide... |
mcl = [[-5.592134638754766e-05, 1e6],
[-6.441295571105171e-05, 1e6],
[-2.7292256647813406e-05, 1e6],
[-5.738494934280777e-05, 1e6],
[-3.920474118683737e-05, 1e6]]
accval, accruns = 0, 0
for mcrun in mcl:
accval += mcrun[0]*mcrun[1]
accruns += mcrun[1]
print(accruns, ': ', accva... |
greet=' hello bob '
greet.strip()
print(greet)
#right strip
greet=' hello bob '
greet.rstrip()
print(greet)
#left strip
greet=' hello bob '
greet.lstrip()
print(greet)
|
#
# PySNMP MIB module CPQSANAPP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CPQSANAPP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:12:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
class Factorial:
def __init__(self):
self.fact = [1]
def __call__(self,n):
if n < len(self.fact):
return 1
else:
fact_number = n * self(n-1)
self.fact.append(fact_number)
return self.fact[n]
factorial_of_n = Factorial()
n = int(input("n = "))
print(factorial_of_n(n))
|
def permutation(text, anchor, p):
if anchor == len(text):
p.add("".join(text))
return
for i in range(anchor, len(text)):
text[anchor], text[i] = text[i], text[anchor]
permutation(text, anchor + 1, p)
text[anchor], text[i] = text[i], text[anchor]
if __name__ == "__main__":
text = "abc"
p = ... |
_config = {
"class": "class"
}
def config():
return _config
|
fixthis = """
YOUR STORY GOES HERE
"""
|
######################## GLOBAL VARIABLES #########################
BINANCE = True # Variable to indicate which exchange to use: True for BINANCE, False for FTX
SHITCOIN = 'ftm'
MULTI_TF = True
TF_LIST = ['4h','1h','15m','5m','1m']
TF = '1h'
LEVELS_PER_TF = 3 # Number of levels per Time Frame to include in the list of ... |
# enable_pin 메소드는 아직 코딩되지 않았습니다.
# 코드가 오류없이 실행되도록 더미 메소드를 만들었습니다.
# 여러분이 이 장의 코드를 이해하지 못한다고 해서 놀라지 마세요.
# 별도의 챕터에서 메소드를 다룰 것입니다.
def enable_pin(user, pin):
print('pin enabled')
# current_user 와 pin에 테스트값을 넣었습니다.
current_user = 'TEST123'
pin = '123456'
# enable_pin에 인자를 넣어 pin을 활성화시켜보세요.
enable_pin(current_user, ... |
# def sumar_numeros(numero1 = 1, numero2 = 1) -> int: # Esto es una pista de lo que debe retornar la funcion
# return numero1 + numero2
# print('Llamado a función con valores por default', sumar_numeros())
# print('Llamado a función suma con valores asignados', sumar_numeros(2,10))
# #Cuando no se conoce el numer... |
# https://codeforces.com/problemset/problem/266/A
n = int(input())
s = input()
ans = 0
for i in range(n - 1):
if s[i] == s[i + 1]:
ans += 1
print(ans) |
def generate_list():
output_list = [x ** 2 for x in list(range(1, 21))]
print(output_list)
generate_list()
|
class DynamoDataAttribute(object):
def __init__(self, datatype, value=None, initialized=True):
"""initialize the DynamoDataAttribute
This class stores the current value of the attribute on
the model and some extra metadata about the attribute itself
datatype - the Datatype of the co... |
def assert_modal_view_shown(running_app, klass=None):
assert running_app.root_window.children
if klass:
klass_found = False
children = running_app.root_window.children
for child in children:
klass_found |= isinstance(child, klass)
assert klass_found, "%s modal view no... |
#!/usr/bin/env python3
def check_kwarg(kwargs, name, default=None, arg_type=None, required=False, pop=False):
""" Simple function for checking a kwarg. Useful if you don't want to
create a new object to check a kwarg or two. Pop=True will remove the
kwarg entry from kwargs if found. """
if required:
... |
# Alexa skill
APPLICATION_ID: str = "amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0"
RESPONSE_VERSION: str = "1.0"
# Bible API
BIBLE_TRANSLATION = "GNBDC" # Can't use NIV - it's still in copyright
BIBLE_API_URL = f"https://bibles.org/v2/eng-{BIBLE_TRANSLATION}/passages.js"
# Bible Passages
BIBLE_PASSAGES_CSV_U... |
def sum_array(arr):
if arr == None:
return 0
if len(arr) == 0 or 1:
return 0
else:
x = max(arr)
y = min(arr)
arr.remove(x)
arr.remove(y)
return(sum(arr))
print(sum_array([1,2,3,4,4])) |
# ------------------------------------------------------------------------------
# Access to the CodeHawk Binary Analyzer Analysis Results
# Author: Henny Sipma
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2020 Kestrel Technology LLC
#
#... |
class TemplateBindingExtension(MarkupExtension):
"""
Implements a markup extension that supports the binding between the value of a property in a template and the value of some other exposed property on the templated control.
TemplateBindingExtension()
TemplateBindingExtension(property: DependencyProperty... |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
"""
a = int(input("Ingrese un número: "))
b = int(input("Ingrese un número: "))
if a % b == 0:
print(f"El número {a} es divisible de {b}")
else:
print(f"El número {a} no es divisible de {b}") |
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 26 11:20:30 2021
@author: qizhe
"""
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 26 10:45:37 2021
@author: qizhe
"""
class Solution:
def maxProfit(self, prices) -> int:
"""
这个参考答案了,要求最多2次交易,用动态规划来做
共5种状态
效果很好,但是没太懂其实,为什么可以... |
s = 'Aracati, Fortim, Cedro, Fortim'
busca = str(input("Digite o nome de uma cidade: "))
resultado = busca.lower() in s.lower()
if resultado:
print("A cidade está na lista")
else:
print("A cidade não está na lista") |
def print_bigger_number(first, second):
if first > second:
print(first)
else:
print(second)
|
def palindrome(number):
return number == number[::-1]
if __name__ == '__main__':
init = int(input())
number = init + 1
while not palindrome(str(number)):
number += 1
print(number - init) |
"""
Logforce request settings file
"""
USERNAME = ''
PASSWORD = ''
CLIENT_VERSION = '4.3.0.0'
URLS = {
'development':'',
'test':'',
'production':''
} |
# bad practice: I/O inside the function
def say_hello():
name = input('enter a name: ')
print('hello ' + name)
# say_hello()
# best practice: No I/O in the function
def say_hello2(name):
msg = 'hello ' + name
msg += '\nPleased to meet you'
return msg
print(say_hello2('Ahmed'))
name1 = input('e... |
# All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA.
# Write a function to find all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule.
# E... |
def main():
# Declare nucleotide variables [Adenine, Cytosine, Guanine, Thymine]
A = 0;
C = 0;
G = 0;
T = 0;
# Manage input file
input = open(r"C:\Users\lawht\Desktop\Github\ROSALIND\Bioinformatics Stronghold\(1) Counting DNA Nucleotides\Counting DNA Nucleotides\rosalind_dna.txt","r");
... |
def get_template_filter():
return example_filter2
def example_filter2(string):
return "Example2: " + string
|
### Migratory Birds - Solution
def migratoryBirds(type_nums):
count = [0] * len(type_nums)
for i in type_nums:
count[i] += 1
min_id = count.index(max(count))
print(min_id)
birds = int(input())
type_nums = tuple(map(int, input().split()[:birds]))
migratoryBirds(type_nums) |
def transpose(matrix):
return map(list, zip(*matrix))
M = [[1,2,3], [4,5,6]]
print(transpose(M))
|
class Node:
def __init__(self, data, parent):
self.data = data
self.parent = parent
self.right_node = None
self.left_node = None
class BinarySearchTree:
def __init__(self):
self.root = None
def remove(self, data):
if self.root:
... |
# -*- coding: utf-8 -*-
"""
Created on 19-1-24 上午11:32
IDE PyCharm
@author: Meng Dong
""" |
"""
Functions for easily setting up Tkinter window settings
Author: Marco P. L. Ribeiro
Date: June 2019
MIT License
Copyright (c) 2019 Marco P. L. Ribeiro
"""
def configure_window(master, title="Python Application", width=600, height=600, resizable=True, centred=True, bg=None):
'''Configure Tkinter GUI window
... |
# Copyright (c) 2016 Google Inc. (under http://www.apache.org/licenses/LICENSE-2.0)
# Test trailing comma after last arg
def h1(a:a1,) -> r1:
pass
def h2(a:a2,b:b2,) -> r2:
pass
def h3(a:a3) -> r3:
pass
def h4(a:a4) -> r4:
pass
|
"""Helper structure to set default config""" # pylint: disable=line-too-long
default_config = [
{
"arg": "--cooldown",
"type": int,
"default": 1440, # A day
"dest": "minutes_between_trades",
"help": "It determine the amount of minutes that the trader should wait between t... |
# Space: O(n)
# Time: O(n)
class Solution:
def coinChange(self, coins, amount):
dp = [amount + 1] * (amount + 1)
dp[0] = 0
for i in coins:
for j in range(len(dp)):
if j - i >= 0:
dp[j] = min(dp[j], dp[j - i] + 1)
return dp[amount] if... |
class coordinate:
def __init__(self, x, y):
self.x = x
self.y = y
def distance(self, other_coordinate):
x_diff = (self.x - other_coordinate.x)**2
y_diff = (self.y - other_coordinate.y)**2
return (x_diff + y_diff)**0.5
if __name__ == "__main__":
... |
# Time: O(n); Space: O(n)
def fib(n):
memo = {}
if n == 0 or n == 1:
return n
if n not in memo:
memo[n] = fib(n - 1) + fib(n - 2)
return memo[n]
# Test cases:
print(fib(4))
|
def get_size(nbytes, suffix="B"):
factor = 1024
for unit in ["", "K", "M", "G", "T", "P"]:
if nbytes < factor:
return f"{nbytes:.2f}{unit}{suffix}"
nbytes /= factor
# This shouldn't happen on real systems, but you can never be sure (2020, btw)
return f"{nbytes:.2f}{unit}{suff... |
class Enricher:
def __init__(self, connection=None):
self._connection = connection
async def enrich(self, post_ids):
return await self._connection.find_many(post_ids)
|
def cycle(sequence):
dict={}
for i,j in enumerate(sequence):
if dict.get(j, -1)<0:
dict[j]=i
else:
return [dict[j], i] if not dict[j] else [dict[j], i-1]
return [] |
BANG_DICT = {
"!allegro": "Allegro",
"!cakebook": "CakePHP Cookbook",
"!animeka": "Animeka",
"!webcams": "webcams.travel",
"!ipernity": "Ipernity",
"!trademe": "TradeMe",
"!anidb": "aniDB",
"!nuget": "nuget gallery",
"!pgp": "MIT PGP Public Key Server Lookup",
"!endthelie": "End ... |
A = int(input())
n = 1
while n ** 3 < A:
n += 1
print('YES' if n ** 3 == A else 'NO')
|
"""
Push O(1) :Push Element To Top
Pop O(1) : POP Element From Top
get_max O(1) : Returns max Element from the stack
Peek O(1): Returns Top Element
Size O(1) : Returns Size of the stack
"""
class Stack:
def __init__(self):
self.items = []
self.itemmax=[]
self.top=0
def isEmpty(self):
... |
tupla =(
'APRENDER', 'PROGRAMAR', 'LINGUAGEM', 'PYTHON', 'CURSO', 'GRATIS', 'ESTUDAR',
'PRATICAR', 'TRABALHAR', 'MERCADO', 'PROGRAMADOR', 'FUTURO'
)
for palavra in tupla:
print('Na palavra {} temos'.format(palavra), end=' ')
for letra in palavra:
if letra in 'AEIOU':
print('{}'.form... |
def Decorator(f):
def wrapper(arg):
print ('befor')
f(arg)
print ('after')
return wrapper
@Decorator # либо: Function = Decorator(Function)
def Function(x):
print ('function', + x)
Function(23) # декорированая функция |
# Implement a macro folly_library() that the BUILD file can load.
load("@rules_cc//cc:defs.bzl", "cc_library")
# Ref: https://github.com/google/glog/blob/v0.5.0/bazel/glog.bzl
def expand_template_impl(ctx):
ctx.actions.expand_template(
template = ctx.file.template,
output = ctx.outputs.out,
... |
# Created by MechAviv
# Chinese Text Damage Skin (30 Day) | (2436741)
if sm.addDamageSkin(2436741):
sm.chat("'Chinese Text Damage Skin (30 Day)' Damage Skin has been added to your account's damage skin collection.")
sm.consumeItem() |
def rumble(rate, intensity, duration):
__end_regular_rumble()
_["viewport"].rumble(rate, intensity, duration)
def regular_rumble(rate, intensity, duration, interval):
__end_regular_rumble()
def _rumble():
_["viewport"].rumble(rate, intensity, duration)
_["regular_rumble"] = _rumble
D... |
def fuc() -> None:
return None
def fua() -> bool:
return True
def fub() -> bool:
return False
def fud() -> int:
return -1
def fue() -> str:
return ""
|
del_items(0x80121A34)
SetType(0x80121A34, "void PreGameOnlyTestRoutine__Fv()")
del_items(0x80123AF8)
SetType(0x80123AF8, "void DRLG_PlaceDoor__Fii(int x, int y)")
del_items(0x80123FCC)
SetType(0x80123FCC, "void DRLG_L1Shadows__Fv()")
del_items(0x801243E4)
SetType(0x801243E4, "int DRLG_PlaceMiniSet__FPCUciiiiiii(unsigne... |
# _*_ coding: utf-8 _*_
#
# Package: base
__all__ = ["firebase"]
|
class Solution(object):
def mincostTickets(self, days, costs):
"""
:type days: List[int]
:type costs: List[int]
:rtype: int
"""
dp = []
dp.append((costs[0], days[0],))
dp.append((costs[1], days[0] + 6,))
dp.append((costs[2], days[0] + 29,))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.