content stringlengths 7 1.05M |
|---|
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
BEFORE = """
<!-- Bootstrap v3.0.3 -->
<link href="https://s3.amazonaws.com/mturk-public/bs30/css/bootstrap.min.css" rel="stylesheet" />
<section class="container" id="Other" style="margin-bottom:15px; padding: 10px 10px;
font-family: Verdana, Geneva, sans-seri... |
class Logger(object):
"""
La classe modellizza un logger, per generare un file di testo di output
"""
def __init__(self, fp):
self.fp = open(fp, 'w')
def log(self, msg):
self.fp.write(msg + '\n')
def close(self):
self.fp.close() |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# cython: language_level=2, boundscheck=False
class NoValidVersion(Exception):
pass
class VersionZero(Exception):
pass
class ExceededPaddingVersion(Exception):
pass
class NoVersionNumber(Exception):
pass
|
"""
Various container utilities
"""
def get_from_dict(d, path):
"""
Extract a value pointed by ``path`` from a nested dict.
Example:
>>> d = {
... "path": {
... "to": {
... "item": "value"
... }
... }
... }
>>> get_from_dict(d, "/path/to... |
name = input("[>] Enter name: ")
email = input("[>] Enter email: ")
if "@" not in name and "@" in email:
print("[+] OK")
elif "@" not in name and "@" not in email:
print("[-] Incorrect email")
elif "@" in name and "@" in email:
print("[-] Incorrect login")
elif "@" in name and "@" not in email:
print("... |
#
# PySNMP MIB module CISCO-ROUTE-POLICIES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ROUTE-POLICIES-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:54:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... |
# Copyright 2018-2020 Stanislav Pidhorskyi
#
# 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 i... |
class GPIOBus(object):
""" This is a helper class for when your pins don't line up with ports. """
def __init__(self, pins):
self.pins = pins
self.width = len(pins)
self.max = pow(2, len(pins)) - 1
def write(self, value):
if value > self.max:
raise AttributeErro... |
#!/usr/bin/env python3
'''
homework/data_structure/1_17_k_fib.py
count the $(m)th $(k)-Fibonacci number
with time complexity of O(n)
'''
class FibCache:
'''
Acts like heap?
Make sure you DON'T re-use the instance!
'''
def __init__(self, k):
''' initialize FibCache instance... |
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for number in numbers:
# Lewatkan loop untuk angka yang dapat di bagi 3
if number % 3 == 0:
continue
print(number) |
# Conner Skoumal
# Matchmaker Lite
print("")
print("Matchmaker 2021")
print("")
print("[[Your instruction here.]]")
print("")
userResponse1 = int(input("Ironclad Robotics rocks!"))
desiredResponse1 = 5
compatibility1 = 5 - abs(userResponse1 - desiredResponse1)
print("Question 1 Compatibility: " + str(compatibility1))... |
def main():
print("Please enter a sentence: ")
user_sentence = input()
str_for_checking = prepare_str_for_palindrome_checking(user_sentence)
res = is_palindrome(str_for_checking)
if(res == True):
print("Your sentence is a palindrome")
else:
print(("Your sentence is not a palindro... |
#kpbochenek@gmail.com
def swap_sort(array):
array = list(array[:])
result = []
for i in range(1, len(array)):
j = i-1
k = i
while j >= 0 and array[j] > array[k]:
array[k], array[j] = array[j], array[k]
result.append("%d%d" % (j, k))
j -= 1
... |
name = "Fahad Hafeez"
print(len(name))
if len(name) < 3:
print("Name must be at least 3 characters long")
elif len(name) > 50:
print("Name must be a maximum of 50 characters long")
else:
print("Name looks good") |
#!/usr/bin/env python3
def MakeCaseAgnostic(choices):
def find_choice(choice):
for key, item in enumerate(choice.lower() for choice in choices):
if choice.lower() == item:
return choices[key]
return choice
return find_choice |
# Author:周健伟
# 每个用户登录三次,登录成功
#则显示欢迎登录,三次登录失败则
#将该用户锁定。将登录用户从文件中读出,
#锁起来的用户也保存在文件中
def login(filename):
userName = []
passWord = []
try:
data = open(filename)
for each_line in data:
(username,password)=each_line.strip().split(",")
userName.append(username)
... |
class Config(object):
def __init__(self):
# model params
self.model = "AR"
self.nsteps = 10 # equivalent to x_len
self.msteps = 7
self.nbins = 4
self.attention_size = 16
self.num_filters = 32
self.kernel_sizes = [3]
self.l2_lambda = 1e-3... |
# General info
COMPANY_NAME = "Shore East"
SITENAME = "Cloudy Memory"
EMAIL_PREFIX = "[ %s ] " % SITENAME
APPNAME = "cloudmemory-app"
BASE = "http://%s.appspot.com" % APPNAME
API_AUTH = "waywayb4ck"
PLAY_STORE_LINK = ""
DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
# Branding... |
#
# PySNMP MIB module HUAWEI-MUSA-MA5100-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-MUSA-MA5100-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:32:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
class Solution:
def countPairs(self, deliciousness: List[int]) -> int:
"""
A good meal is a meal that contains exactly two different food items with a sum of deliciousness equal to a power of two.
You can pick any two different foods to make a good meal.
Given an array of integers delicio... |
class WeightRegularizerMixin:
def __init__(self, regularizer=None, reg_weight=1, **kwargs):
super().__init__(**kwargs)
self.regularizer = regularizer
self.reg_weight = reg_weight
def regularization_loss(self, weights):
if self.regularizer is None:
return 0
... |
def whatday(num):
if num == 1:
return "Sunday"
elif num == 2:
return "Monday"
elif num == 3:
return "Tuesday"
elif num == 4:
return "Wednesday"
elif num == 5:
return "Thursday"
elif num == 6:
return "Friday"
elif num == 7:
return "Saturday"
else:
return "W... |
# rects using framebuf
display.fill(0)
for i in range(0, 15):
j = 6 * i
display.framebuf.fill_rect(j, j, 12, 12, i)
display.framebuf.rect(90 - (j), j, 12, 12, i)
display.show()
|
wildcards = dict()
## experiments x params x
wildcards['/lustre/projects/project-broaddus/denoise_experiments/flower/e01/n2v2/'] = "mask_{n}_{m}/table.csv"
wildcards['/lustre/projects/project-broaddus/denoise_experiments/flower/e01/n2gt/'] = "d{a}/table.csv"
wildcards['/lustre/projects/project-broaddus/denoise_experi... |
class AlmaException(Exception):
class_message = "An exception occurred."
def __init__(self, message=None, **kwargs):
if message:
self._message = message % kwargs
else:
self._message = self.class_message % kwargs
def __repr__(self):
return self._message
... |
def test_get_wallet_not_authenticated(api_client):
rsp = api_client.get("/api/wallet/")
assert rsp.status_code == 401
def test_get_wallet_success(api_client, wallet):
api_client.force_authenticate(wallet.user)
rsp = api_client.get("/api/wallet/")
assert rsp.status_code == 200
print(rsp.cont... |
STARTING_CHAR_FOR_SHAPE_NAME = "@"
class Shape(object):
def __init__(self, name, class_uri, statements):
self._name = name
self._class_uri = class_uri
self._statements = statements
@property
def name(self):
return self._name
@property
def class_uri(self):
... |
#
# PySNMP MIB module CXLlcFrConv-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXLlcFrConv-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:33:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
number = int(input("Input an int: "))
oddNum = 1
for x in range(number):
print(oddNum)
oddNum += 2 |
"""
Tema: Listas, mutabilidad y clonacion.
Curso: Pensamiento computacional.
Plataforma: Platzi.
Profesor: David Aroesti.
Alumno: @edinsonrequena.
"""
a = [1, 2, 3]
b = a
print(b)
print(id(a)) # Aca podemos ver como a y b estan en el mismo lugar de
print(id(b)) # memoria, lo que quiere decir que son la misma lista.... |
"""Top-level package for webml."""
__author__ = """BlueML AI"""
__email__ = 'james.liang.cje@gmail.com'
__version__ = '0.1.0'
|
'''
Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.
'''
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, val=0, left=None, right=None... |
class IridaConnectionError(Exception):
"""
This error is thrown when the api cannot connect to the IRIDA api
Either the server is unreachable or the credentials are invalid
All calls to the api should expect this error
"""
pass
|
set1 = set()
set1.add(1)
set1.add(3)
set1.add(1)
set1.add(2)
print(set1)
set2 = set([1, 3, 5, 7, 9])
print(set2)
# union
print(set1 | set2)
# intersection
print(set1 & set2)
# difference
print(set1 - set2)
set3 = {"a", "b"}
print(set3)
# immutable set
set4 = frozenset([9, 10])
|
"""Setting file for the Cloud SQL guestbook"""
CLOUDSQL_INSTANCE = 'ReplaceWithYourInstanceName'
DATABASE_NAME = 'guestbook'
USER_NAME = 'ReplaceWithYourDatabaseUserName'
PASSWORD = 'ReplaceWithYourDatabasePassword'
|
# --------------
class_1=['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2=['Hilary Mason','Carla Gentry', 'Corinna Cortes']
new_class=class_1+class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
courses={'Math'... |
def combo(ls, c):
if c == 0:
return [[]]
l =[]
for i in range(0, len(ls)):
m = ls[i]
remLst = ls[i + 1:]
for p in combo(remLst, c-1):
l.append([m]+p)
return l
a =str("input")
n =int(input("combo :"))
list_1 =... |
"""
Sample module docstring
"""
def world():
"""
Sample function docstring
"""
print('world')
|
# https://www.hackerrank.com/challenges/strange-code/problem
def strangeCounter(t):
k = 3
while t > k:
t -= k
k *= 2
return k - t + 1
if __name__ == '__main__':
t0 = 6
assert strangeCounter(t0) == 4
|
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'django_mercadopago',
'tests',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'djang... |
def print_name(firstName, lastName, reverse=False):
"""
:param firstName: String first name
:param lastName: String last name
:param reverse: boolean
:return: None
"""
if reverse:
print(lastName, ',', firstName)
else:
print(firstName, lastName)
print_name("Eric", "Gr... |
class PrivateMessage:
def __init__(self, type, author, body, filename=None, waID=None, tgID=None):
self.type = type
self.author = author
self.body = body
self.waID = waID
self.tgID = tgID
self.filename = filename
class GroupMessage:
def __init__(self, type, auth... |
num01 = int(input('Digite um valor: '))
num02 = int(input('Digite outro valor: '))
soma = num01 + num02
print('A soma entre {} e {} é igual a {}!'.format(num01, num02, soma))
|
# Create phone number
def create_phone_number(n):
full_str = ''.join([str(numb) for numb in x])
return f'({full_str[0:3]})' + ' ' + f'{full_str[3:6]}' + '-' + f'{full_str[6:10]}'
def create_phone_number_2(x):
phone_number = "({}{}{}) {}{}{}-{}{}{}{}".format(*x)
return phone_... |
# -*- coding: utf-8 -*-
def shape(src_str, prefix_str, suffix_str):
prefix_pos = src_str.find(prefix_str);
if prefix_pos == -1:
return None;
#endif
prefix_pos = prefix_pos + len(prefix_str);
temp_str = src_str[prefix_pos:];
suffix_pos = temp_str.find(suffix_str);
if suffix_pos == -1:
return None;
#e... |
fileout = open("makeshingles.sh", "w")
for i in range(1,57):
if i >= 10:
s = "0" + str(i)
else:
s = "00" + str(i)
fileout.write("./a.out TEMPF/OUT-" + s + ".txt TEMPK/KEYWORDS-" + s + ".txt\n")
fileout.close() |
# O código a seguir determina se a pessoa tem idade ou não para votar
# Este código é de minha autoria, portanto, difere do que é apresentado no livro (mais simples)
ano = 2021
limite = 16
x = 0
y = 0
validos = []
nao_validos = []
while True:
eleitor = input('Digite o nome do eleitor: \nOu digite S para encerrar... |
"""
n & (n - 1) == 0
"""
class Solution(object):
def isPowerOfTwo(self, n):
if n == 0:
return False
return n & (n - 1) == 0
"""
n&(-n) == n
"""
class Solution(object):
def isPowerOfTwo(self, n):
if n == 0:
return False
return n & (-n) == n
"""
log N... |
# 0: 1: 2: 3: 4:
# aaaa .... aaaa aaaa ....
# b c . c . c . c b c
# b c . c . c . c b c
# .... .... dddd dddd dddd
# e f . f e . . f . f
# e f . f e . . f . f
# gggg .... gggg gggg ..... |
class Error (Exception):
pass
class NotEnoughPlayersError (Error):
""" when too many cards have been drawn
"""
def __init__(self, message):
self.message = "must have more than one player!"
class BetTooSmallError (Error):
""" too little has been bet
"""
def __init__(self, messag... |
def subset(array,n,ans):
subs = [None]*n
helper(n,array,subs,0,ans)
return ans
def helper(n,array,subs,i,ans):
if i==n:
lis=[]
if any(subs):
for j in range(len(subs)):
if subs[j]!=None:
lis.append(subs[j])
ans.append(lis)
... |
'''
Source : https://oj.leetcode.com/problems/maximum-subarray/
Author : Yuan Wang
Date : 2018-05-28
/**********************************************************************************
*
* Find the contiguous subarray within an array (containing at least one number)
* which has the largest sum.
*
* For example, ... |
while True:
username = input("Enter username: ")
if username == 'pypy':
break
else:
continue |
lados = [float(x) for x in input().split()]
lados.sort()
lados = lados[::-1]
a, b, c = list(lados)
if a >= b + c:
print('NAO FORMA TRIANGULO')
else:
if a ** 2 == b ** 2 + c ** 2:
print('TRIANGULO RETANGULO')
if a ** 2 > b ** 2 + c ** 2:
print('TRIANGULO OBTUSANGULO')
if a ** 2 < b ** 2 ... |
char = []
string = "ppphhpphhppppphhhhhhhpphhpppphhpphpp"
for i in range(len(string)):
if string[i] == 'p' or string[i] == 'P':
char.append('P')
else:
char.append('H')
print(char) |
def pal(p): # str.isalpha is function form of the method .isalpha()
np = list(filter(str.isalpha, p.lower())) # remove non-letters
return np == np[::-1] and len(np) > 0 # check if palindrome
# py.test exercise_10_26_16.py --cov=exercise_10_26_16.py --cov-report=html
def test_pal():
assert pal('mom')
... |
class Student(object):
def __init__(self,name,age,china,math,english):
self.__name=name
self.__age=age
self.__c=china
self.__m=math
self.__e=english
if self.__c<0 or self.__c>100 or self.__m<0 or self.__m>100 or self.__e<0 or self.__e>100:
raise ValueError("数字不在有效内")
def get_name(self):
return str(... |
# Desafio 1
n1 = float(input('Digite um número!! '))
n2 = float(input('Agora outro!!! '))
s = int( n1 / n2 )
print('A divisão entre {} e {} é {}'.format(n1, n2, s)) |
class ParkingSystem:
# # Instance Variables (Accepted), O(1) time, O(1) space wrt addCar
# def __init__(self, big: int, medium: int, small: int):
# self.big = big
# self.medium = medium
# self.small = small
# def addCar(self, carType: int) -> bool:
# if carType == 1:
# ... |
numero = int(input("Introduzca el numero= "))
if numero >= 10:
numero *= 3
print(numero)
else:
numero *=4
print(numero)
|
#Week1
#Exercise 1: Use input to ask name, age, and hometown.
#Print Hello, my name is {}. I am {} years old and I live in {}
name=input("Enter your name: ")
age=input("Enter your age: ")
hometown=input("Enter your hometown: ")
print("Hello, my name is {}. I am {} years old and I live in {}".format(name, age, hometown)... |
class Solution:
def binaryGap(self, N):
"""
:type N: int
:rtype: int
"""
dis = 0
last = 0
now = 1
while N > 0:
bit = N & 0x01
if bit == 1 and last == 0:
last = now
elif bit == 1:
dis... |
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = '\x126h\x8d\xec\x81\xa9\x13 O\x084\xd7\xbc\xd3\x17'
_lr_action_items = {'RPAREN':([1,2,4,8,11,12,13,14,15,],[-1,-7,-6,13,-5,-4,-8,-2,-3,]),'DIVIDE':([1,2,4,11,12,13,14,15,],[6,-7,-6,-5,-4,-... |
# https://leetcode.com/problems/license-key-formatting/
class Solution:
def licenseKeyFormatting(self, S, K):
"""
:type S: str
:type K: int
:rtype: str
"""
S = ''.join(s.upper() for s in S if s.isalnum())
first_group = len(S) % K
out = []
is... |
#
# PySNMP MIB module PDN-SYSLOG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-SYSLOG-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:30:50 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... |
BASE_NAME = "GTR Tool Rack Stereo"
BUFFER_SIZE = 255
def main():
log('\n')
# Get the track name
proj_index = 0
track_index = 0
track = RPR_GetTrack(proj_index, track_index)
response = RPR_GetSetMediaTrackInfo_String(track, 'P_NAME', '', False)
(succeeded, track, param_name, track_name, set_... |
"""
notation_instances.py
"""
population = [{
'Name': 'Shlaer-Mellor',
'About': 'Source of Executable UML / xUML modeling semantics',
'Why use it': 'Designed for fast easy hand drawing.Great for whiteboards and notes!'
}, {
'Name': 'Starr',
'About': 'Stealth mode! Mimimal drawing clutter to put the... |
def isPrime(n):
# 1 is not a prime number by definition
if n < 2:
return False
return sum(d for d in xrange(2, n) if n % d == 0) == 0
def UnitTests():
assert isPrime(1) == False
assert isPrime(2) == True
assert isPrime(3) == True
assert isPrime(4) == False
assert isPrime(13) == True
assert isPrime(23) == ... |
"""
딕셔너리 구현하기
"""
class Dict:
def __init__(self):
self.items = [None] * 8
def put(self, key, value):
idx = hash(key) % len(self.items)
self.items[idx] = value
def get(self, key):
idx = hash(key) % len(self.items)
return self.items[idx]
my_dict = Dict()
my_dict.p... |
# pylint: disable=missing-module-docstring
__all__ = [
'conftest',
'standard',
'test_main_layout',
'test_root_index',
'utils',
]
|
# Check input files to see if 200 sample id's match
def main():
file_a = "1kg-200samples.tsv"
file_b = "1000genomes.low_coverage.GRCh38DH.alignment.index"
sample_ids_a = []
sample_ids_b = []
fh_a = open(file_a, "r")
fh_a.readline()
for line in fh_a:
sample_id = line.strip().split(... |
def solution(X, A):
leaves = set(range(1, X+1))
for second, leaf in enumerate(A):
if leaf in leaves:
leaves.remove(leaf)
if not leaves:
return second
return -1
def test_solution():
assert solution(5, [1, 3, 1, 4, 2, 3, 5, 4]) == 6
|
def frequency(lst, search_term):
"""Return frequency of term in lst.
>>> frequency([1, 4, 3, 4, 4], 4)
3
>>> frequency([1, 4, 3], 7)
0
"""
d = {}
for x in lst:
if x in d:
d[x] = d[x] + 1
else:
d[x] = 1
if search_term in d:
... |
# -------------------- PATH ---------------------
#ROOT_PATH = "/local/data2/pxu4/TypeClassification"
ROOT_PATH = "."
DATA_PATH = "%s/data" % ROOT_PATH
ONTONOTES_DATA_PATH = "%s/OntoNotes" % DATA_PATH
BBN_DATA_PATH="%s/BBN" % DATA_PATH
LOG_DIR = "%s/log" % ROOT_PATH
CHECKPOINT_DIR = "%s/checkpoint" % ROOT_PATH
OUTPUT_... |
shift = 3
def magic(method, text):
processed_text = ""
for c in text:
if c.isupper():
# find the position in 0-25
c_index = ord(c) - ord("A")
# perform the shift
if method == "Verschlusseln":
new_index = (c_index + shift) % 26
if method == "Entschlüsseln":
new_ind... |
"""
Reservoir sampling. Sample from stream of unknown length
usage:
from statistics import median
res = initialize_res_samples(fields)
num_samples = 50
random_generator = random.Random()
random_generator.seed(42)
for row_index, row in enumerate(stream):
for field in fields:
value = row[field]
upda... |
s = 0
for i in range(5):
a = int(input())
if a < 40:
a = 40
s += a
print(int(s / 5))
|
def fill_nan(df):
# fill NaN in df sets and categorize columns datatype
# adding missing column for the missing imputed values
for column in df.columns:
if column in numerical_feature_names:
df[column+'_missing'] = df[column].isnull()
mean = np.nanmean(df[column].values)
... |
metric_dimension = {
"post_all_days": {
"metric": [
"post_impressions_unique",
"post_engaged_users",
"post_impressions_paid_unique"
],
"period": [
"lifetime",
],
"date_window": "lifetime",
"dimension": [
"pos... |
class Observable:
def __init__(self):
self.result = None
def callback(self, result):
self.result = result
def format_response(self):
results = []
for d in self.result.search.docs:
for idx, match in enumerate(d.matches):
score = match.score.value
... |
# Copyright 2014 Doug Latornell and The University of British Columbia
# 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 ap... |
# -*- coding: UTF-8 -*-
logger.info("Loading 1 objects to table notes_eventtype...")
# fields: id, name, remark, body
loader.save(create_notes_eventtype(1,['System note', 'System note', 'System note'],u'',['', '', '']))
loader.flush_deferred_objects()
|
expected_output = {
"bridge_domain": {
3051: {
"number_of_ports_in_all": 2,
"state": "UP",
"member_ports": [
"vfi VPLS-3051 neighbor 192.168.36.220 3051",
"GigabitEthernet0/0/3 service instance 3051",
],
"mac_table":... |
# -*- coding: utf-8 -*-
"""
overholt
~~~~~~~~
overholt application package
"""
|
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'duplicate_names',
'type': 'shared_library',
'dependencies': [
'one/sub.gyp:one',
... |
class FinnHubAPI:
TOKEN="yourTokenHere"
# Get a FinHubb API from
# https://finnhub.io/ |
"""
Config for Reddit Giveaway
I need some configuration, so that the script itself is more reusable.
"""
SUBMISSION = '40idxl'
MATCH_TEXT = 'I would build'
|
WHITE_KING_MOVED = False
BLACK_KING_MOVED = False
BLACK_LEFT_ROOK_MOVED = False
BLACK_RIGHT_ROOK_MOVED = False
WHITE_LEFT_ROOK_MOVED = False
WHITE_RIGHT_ROOK_MOVED = False
"""
all the above values are for determining whether these pieces moved or not in order to know if castling can be performed"""
WHITE_DOWN = True # ... |
"""
Abaixo de 200 minutos = R$0.20 por minuto
Entre 200 e 400 minutos = R$0.18 por minuto
Acima de 400 minutos = R$0.15 por minuto
"""
minutos = int(input('Quantos minutos você utilizou este mês: '))
if minutos < 200:
preco = 0.20
else:
if minutos < 400:
preco = 0.18
else:
preco = 0.15
print... |
B = BLOCK_SIZE = 30
SURFACE_WIDTH = 300
SURFACE_HEIGHT = 600
S = [['.....',
'.....',
'..00.',
'.00..',
'.....'],
['.....',
'..0..',
'..00.',
'...0.',
'.....' ]]
Z = [['.....',
'.....',
'.00..',
'..00.',
'.....'],
['.....',
... |
lista = ('Lapis', 1.5, 'caneta', 2.5, 'caderno', 16.90, 'mochila', 67.99, 'livro', 37.89)
print('-'*40)
print(f'{"LISTA ESCOLAR":^40}')
print('-'*40)
for c in range(0, len(lista)):
if c % 2 == 0:
print(f'{lista[c]:.<30}', end=' ')
else:
print(f'R$ {lista[c]:.2f}')
print('-'*40)
|
class WindowDatas():
def __init__(self):
self.previousWindow = None
self.nextWindow = None
self.finalWindow = None
self.accountDATA = None
self.actions= None
self.show= True
self.database = None |
# Flask Config Variables to be Auto-Loaded
config = {
'flask': {
'SECRET_KEY': b'!T3DxK;L1jJGYf$', # Please change. See Flask for requirements.
'TESTING': True,
'TEMPLATES_AUTO_RELOAD': True,
'SERVER_NAME': 'flask.mvc'
},
'templati... |
class FVTADD :
def __init__(self):
self.default = ''
def runTest(self,self) :
return TemplateTest.runTest(self)
def tearDown(self,self) :
return TemplateTest.tearDown(self)
def setUp(self,self) :
return TemplateTest.setUp(self)
def chkSetUpCondition(self,self,fv,... |
class ITopBanner(Interface):
"""marker interface for Front Page"""
class IThemeSpecific(Interface):
"""marker interface for theme layer""" |
#Your task is to complete this function
# function should strictly return a string else answer wont be printed
def multiplyStrings(str1, str2):
return str(int(str1) * int(str2))
|
#!/usr/bin/env python
#
# Copyright (c) 2015 Pavel Lazar pavel.lazar (at) gmail.com
#
# The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED.
#####################################################################
class EngineClientError(Exception):
"""
An exception in the EE client.
"""
pas... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# Prefixes
CONSOLE_LOG_PREFIX = "LanguageWorkerConsoleLog"
# Capabilities
RAW_HTTP_BODY_BYTES = "RawHttpBodyBytes"
TYPED_DATA_COLLECTION = "TypedDataCollection"
RPC_HTTP_BODY_ONLY = "RpcHttpBodyOnly"
RPC_HTTP_TRIGGER_METADAT... |
n = int(input())
res = 0
for i in range(n):
res += int((input().strip())[:25])
print(str(res)[:10])
|
#Crie um programa que simule o funcionamento de um caixa eletrônico
#no inicio pergunte ao usuário qual será o valor a se rsacado (valor inteiro)
#o programa vai informar quantas cédulas de cada valor serão entregues
#obs considere; R$ 20, R$50, R$ 10, R$ 1
valor = int(input('Que valor você quer sacar? R$ '))
total = v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.