content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Language:
def hello(self, name):
return "Hello from {0}".format(name)
class Python35(Language):
def hello(self):
return super(Python35, self).hello("Python 3.5")
print(Python35().hello())
| class Language:
def hello(self, name):
return 'Hello from {0}'.format(name)
class Python35(Language):
def hello(self):
return super(Python35, self).hello('Python 3.5')
print(python35().hello()) |
# Some constants
NULL_BABELNET_ID = "NULL_BID"
NULL_TYPE = "NULL_T"
CUSTOM_TYPE = "CUSTOM_TYPE"
# XML tags
DISAMBIGUATED_ARTICLE_TAG = "disambiguatedArticle"
TEXT_TAG = "text"
ANNOTATIONS_TAG= "annotations"
ANNOTATION_TAG= "annotation"
BABELNET_ID_TAG = "babelNetID"
MENTION_TAG = "mention"
ANCHOR_START_TAG= "anchorSt... | null_babelnet_id = 'NULL_BID'
null_type = 'NULL_T'
custom_type = 'CUSTOM_TYPE'
disambiguated_article_tag = 'disambiguatedArticle'
text_tag = 'text'
annotations_tag = 'annotations'
annotation_tag = 'annotation'
babelnet_id_tag = 'babelNetID'
mention_tag = 'mention'
anchor_start_tag = 'anchorStart'
anchor_end_tag = 'anch... |
#coding:utf-8
'''
filename:moduleexample.py
The module of Python.
'''
__all__ = [
'Book',
'GLOBALVAR',
]
GLOBALVAR = 'test string'
class Book:
lang = 'python'
def __init__(self,auther):
self.auther = auther
def get_name(self):
return self.auther
def foo(x... | """
filename:moduleexample.py
The module of Python.
"""
__all__ = ['Book', 'GLOBALVAR']
globalvar = 'test string'
class Book:
lang = 'python'
def __init__(self, auther):
self.auther = auther
def get_name(self):
return self.auther
def foo(x):
return x * 2
python_var = book('la... |
def generate_rule_based_replacement_stats(stats_raw):
poisoned_nums = []
for i in stats_raw:
poisoned_nums.append(i['poisoned_num'])
print("poisoned_nums: ", poisoned_nums)
print("avg: ", sum(poisoned_nums)/len(poisoned_nums)) | def generate_rule_based_replacement_stats(stats_raw):
poisoned_nums = []
for i in stats_raw:
poisoned_nums.append(i['poisoned_num'])
print('poisoned_nums: ', poisoned_nums)
print('avg: ', sum(poisoned_nums) / len(poisoned_nums)) |
def get_len(_int):
'''Find the number of digits of an int
if not mathematical integer (1.0 allowed)
(e.g. 1.1), return -1
Given an integer, finds the number of
digits in that integer in base 10
'''
power = 0
if _int % 1 != 0:
return -1
while True:
if _int < 10**pow... | def get_len(_int):
"""Find the number of digits of an int
if not mathematical integer (1.0 allowed)
(e.g. 1.1), return -1
Given an integer, finds the number of
digits in that integer in base 10
"""
power = 0
if _int % 1 != 0:
return -1
while True:
if _int < 10 ** pow... |
my_f = np.arange(0, 10, 1)
print(my_f)
'''
Output:
[0 1 2 3 4 5 6 7 8 9]
''' | my_f = np.arange(0, 10, 1)
print(my_f)
'\nOutput:\n[0 1 2 3 4 5 6 7 8 9]\n' |
# https://mantine.dev/theming/extend-theme/#default-colors
DEFAULT_COLORS = {
"dark": [
"#C1C2C5",
"#A6A7AB",
"#909296",
"#5c5f66",
"#373A40",
"#2C2E33",
"#25262b",
"#1A1B1E",
"#141517",
"#101113",
],
"gray": [
"#f8f9fa"... | default_colors = {'dark': ['#C1C2C5', '#A6A7AB', '#909296', '#5c5f66', '#373A40', '#2C2E33', '#25262b', '#1A1B1E', '#141517', '#101113'], 'gray': ['#f8f9fa', '#f1f3f5', '#e9ecef', '#dee2e6', '#ced4da', '#adb5bd', '#868e96', '#495057', '#343a40', '#212529'], 'red': ['#fff5f5', '#ffe3e3', '#ffc9c9', '#ffa8a8', '#ff8787',... |
#Run the following program:
'''
#Open for reading. The 'r' stands for reading. We could alternatively use 'w' for writing, but let's save that for later.
file_handle = open('data.txt', 'r')
#Read the first line
line = file_handle.readline()
print(line)
'''
#What's different if we call readline() again?
'''
#Open for ... | """
#Open for reading. The 'r' stands for reading. We could alternatively use 'w' for writing, but let's save that for later.
file_handle = open('data.txt', 'r')
#Read the first line
line = file_handle.readline()
print(line)
"""
"\n#Open for reading. The 'r' stands for reading. We could alternatively use 'w' for writin... |
SIMDEM_VERSION = "0.8.2-dev"
SIMDEM_TEMP_DIR = "~/.simdem/tmp"
# When in demo mode we insert a small random delay between characters.
# TYPING DELAY is the upper bound of this delay.
TYPING_DELAY = 0.2
# Prompt to use in the console
console_prompt = "$ "
# Port for web server when running with '--webui true' optios
... | simdem_version = '0.8.2-dev'
simdem_temp_dir = '~/.simdem/tmp'
typing_delay = 0.2
console_prompt = '$ '
port = 8080
is_debug = False
modes = ['tutorial', 'demo', 'learn', 'test', 'script', 'prep'] |
message = input()
command_data = input()
while command_data != 'Reveal':
command_data = command_data.split(':|:')
command = command_data[0]
if command == 'InsertSpace':
index = int(command_data[1])
message = message[:index] + ' ' + message[index:]
print(message)
elif command =... | message = input()
command_data = input()
while command_data != 'Reveal':
command_data = command_data.split(':|:')
command = command_data[0]
if command == 'InsertSpace':
index = int(command_data[1])
message = message[:index] + ' ' + message[index:]
print(message)
elif command == '... |
variable = 9
if variable == 10:
print('variable equal 10')
elif variable < 10:
print('variable less then 10')
else:
print('variable great then 10')
list_to_test = [1, 2, 3]
if list_to_test:
print("List is not empty")
if len(list_to_test) != 0:
print("List is not empty")
# in op... | variable = 9
if variable == 10:
print('variable equal 10')
elif variable < 10:
print('variable less then 10')
else:
print('variable great then 10')
list_to_test = [1, 2, 3]
if list_to_test:
print('List is not empty')
if len(list_to_test) != 0:
print('List is not empty')
if 10 in [20, 30, 20, 10]:
... |
data = (
((0.769301, -0.233610), (0.748311, -0.288301)),
((0.748311, -0.288301), (0.696783, -0.342991)),
((0.696783, -0.342991), (0.669761, -0.338019)),
((0.669761, -0.338019), (0.769301, -0.233610)),
((0.053355, -0.233610), (0.033364, -0.338019)),
((0.033364, -0.338019), (0.139936, -0.342991)),
((0.139936, -0.342991),... | data = (((0.769301, -0.23361), (0.748311, -0.288301)), ((0.748311, -0.288301), (0.696783, -0.342991)), ((0.696783, -0.342991), (0.669761, -0.338019)), ((0.669761, -0.338019), (0.769301, -0.23361)), ((0.053355, -0.23361), (0.033364, -0.338019)), ((0.033364, -0.338019), (0.139936, -0.342991)), ((0.139936, -0.342991), (0.... |
x = 0
valores = list()
for c in range(0, 5):
x = int(input("Informe um numero: "))
# Primeiro valor
if c == 0:
valores.append(x)
# Novo maior valor
elif x > max(valores):
valores.append(x)
# Novo menor valor
elif x < min(valores):
valores.insert(0, x)
elif x > val... | x = 0
valores = list()
for c in range(0, 5):
x = int(input('Informe um numero: '))
if c == 0:
valores.append(x)
elif x > max(valores):
valores.append(x)
elif x < min(valores):
valores.insert(0, x)
elif x > valores[0]:
valores.insert(1, x)
elif x < valores[4]:
... |
class Solution(object):
def rob(self, nums):
if nums == []:
return 0
if len(nums) == 1 :
return nums[0]
best = [nums[0], max(nums[0], nums[1])]
for i, num in enumerate(nums[2:]):
best.append(max(best[-2]+num, best[-1]))
print(best... | class Solution(object):
def rob(self, nums):
if nums == []:
return 0
if len(nums) == 1:
return nums[0]
best = [nums[0], max(nums[0], nums[1])]
for (i, num) in enumerate(nums[2:]):
best.append(max(best[-2] + num, best[-1]))
print(best)
... |
class Junction(object):
# TODO priority
# TODO controller
def __init__(self):
self._id = None
self._name = None
self._connections = []
@property
def id(self):
return self._id
@id.setter
def id(self, value):
self._id = int(value)
@property
... | class Junction(object):
def __init__(self):
self._id = None
self._name = None
self._connections = []
@property
def id(self):
return self._id
@id.setter
def id(self, value):
self._id = int(value)
@property
def name(self):
return self._name
... |
file = open("day 03/Toon - Python/input", "r")
values = [[x == '1' for x in list(line)[:-1]] for line in file.readlines()]
def list_to_int(bools):
return int(''.join(map(str, map(int, bools))), 2)
gamma_list = [[value[i] for value in values] for i in range(len(values[0]))]
gamma_binary = [1 if sum(row) > len(row)/2... | file = open('day 03/Toon - Python/input', 'r')
values = [[x == '1' for x in list(line)[:-1]] for line in file.readlines()]
def list_to_int(bools):
return int(''.join(map(str, map(int, bools))), 2)
gamma_list = [[value[i] for value in values] for i in range(len(values[0]))]
gamma_binary = [1 if sum(row) > len(row) ... |
#
# PySNMP MIB module PROXDBEXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PROXDBEXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:33:33 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... | (prox_db_ext,) = mibBuilder.importSymbols('APENT-MIB', 'proxDbExt')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, value_r... |
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="UShareSoft"
VERSION="0.1"
HTTP_TIMEOUT=10
| __author__ = 'UShareSoft'
version = '0.1'
http_timeout = 10 |
pkgname = "swig"
pkgver = "4.0.2"
pkgrel = 0
build_style = "gnu_configure"
hostmakedepends = ["byacc"]
makedepends = ["zlib-devel", "pcre-devel"]
pkgdesc = "Simplified Wrapper and Interface Generator"
maintainer = "q66 <q66@chimera-linux.org>"
license = "GPL-3.0-or-later"
url = "http://www.swig.org"
source = f"$(SOURCE... | pkgname = 'swig'
pkgver = '4.0.2'
pkgrel = 0
build_style = 'gnu_configure'
hostmakedepends = ['byacc']
makedepends = ['zlib-devel', 'pcre-devel']
pkgdesc = 'Simplified Wrapper and Interface Generator'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'GPL-3.0-or-later'
url = 'http://www.swig.org'
source = f'$(SOURCE... |
print('Hello! This is my first python script! \\(-_- )/')
print('What is your name?')
name = input()
print('Hah! Very well done, ' + name)
# print(len(name))
#print(name * 3)
print('Now tell me your age, please')
age = input()
print('So you will be ' + str(int(age) + 1) + ' in a year! |(-.-)|')
| print('Hello! This is my first python script! \\(-_- )/')
print('What is your name?')
name = input()
print('Hah! Very well done, ' + name)
print('Now tell me your age, please')
age = input()
print('So you will be ' + str(int(age) + 1) + ' in a year! |(-.-)|') |
class student:
def __init__(self):
self.name = None
self.surname = None
self.patronymic = None
self.age = None
self.address = None
self.mail = None
self.phone_number = None
self.group_number = None
class teacher:
def __init__(self):
self.n... | class Student:
def __init__(self):
self.name = None
self.surname = None
self.patronymic = None
self.age = None
self.address = None
self.mail = None
self.phone_number = None
self.group_number = None
class Teacher:
def __init__(self):
self... |
print("\n Dispalys a new line")
print("\t Dispalys a tab space")
print("\\ Dispalys a backslash")
print("\" displays a double quote")
print("\'displays a single quoute") | print('\n Dispalys a new line')
print('\t Dispalys a tab space')
print('\\ Dispalys a backslash')
print('" displays a double quote')
print("'displays a single quoute") |
class Solution:
def hIndex(self, citations: List[int]) -> int:
if not citations:
return 0
citations.sort(reverse=True)
if citations[-1] >= len(citations):
return len(citations)
if citations[0] == 0:
return 0
lo, hi = 0, len(citations) - 1
... | class Solution:
def h_index(self, citations: List[int]) -> int:
if not citations:
return 0
citations.sort(reverse=True)
if citations[-1] >= len(citations):
return len(citations)
if citations[0] == 0:
return 0
(lo, hi) = (0, len(citations) ... |
# CS1010S AY18/19 Sem 2 Finals
a = [1, 2]
a += [a]
print(a)
b = a.copy() # shallow copy vs deep copy?
a[2] = 0
print(a)
print(b) | a = [1, 2]
a += [a]
print(a)
b = a.copy()
a[2] = 0
print(a)
print(b) |
def printer_error(s):
lower_case = s.lower()
errors = 0
total_count = 0
for i in range(len(lower_case)):
ch = ord(lower_case[i])
if ch < 97 or ch > 109:
errors += 1
total_count += 1
return f'{errors}/{total_count}' | def printer_error(s):
lower_case = s.lower()
errors = 0
total_count = 0
for i in range(len(lower_case)):
ch = ord(lower_case[i])
if ch < 97 or ch > 109:
errors += 1
total_count += 1
return f'{errors}/{total_count}' |
class GitObject(object):
repo = None
def __init__(self, repo, data=None):
self.repo = repo
if data != None:
self.deserialize(data)
def serialize(self):
# this function must be implemented by the subclasses
raise Exception("Unimplemented!")
def deserialize(... | class Gitobject(object):
repo = None
def __init__(self, repo, data=None):
self.repo = repo
if data != None:
self.deserialize(data)
def serialize(self):
raise exception('Unimplemented!')
def deserialize(self, data):
raise exception('Unimplemented.') |
class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
class LinkedList:
def __init__(self, items=None, head=None):
self.head = head
if items is not None:
for item in items:
self.AddNode(item)
def __str__(self):... | class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
class Linkedlist:
def __init__(self, items=None, head=None):
self.head = head
if items is not None:
for item in items:
self.AddNode(item)
def __str__(self):
... |
# i cloned it from remote server to my machine
# Code starts here
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 G... | 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': 65, 'English... |
part=input()
f=open(part)
n=i=0
for line in f:
summ=0
if n>0:
start1=line.find(" ")
stop1=line.find(" ",start1+1)
summ+=int(line[start1+1:stop1+1])
start2=line.find(" ",stop1)
stop2=line.find(" ",start2+1)
summ+=int(line[start2... | part = input()
f = open(part)
n = i = 0
for line in f:
summ = 0
if n > 0:
start1 = line.find(' ')
stop1 = line.find(' ', start1 + 1)
summ += int(line[start1 + 1:stop1 + 1])
start2 = line.find(' ', stop1)
stop2 = line.find(' ', start2 + 1)
summ += int(line[start2 +... |
class PlayerInterface():
# Returns your player name, as to be displayed during the game
def getPlayerName(self):
return "Not Defined"
# Returns your move. The move must be a couple of two integers,
# Which are the coordinates of where you want to put your piece
# on the board. Coordinates ... | class Playerinterface:
def get_player_name(self):
return 'Not Defined'
def get_player_move(self):
return (-1, -1)
def play_opponent_move(self, x, y):
pass
def new_game(self, color):
pass
def end_game(self, color):
pass |
query = '''with tasks as (
SELECT ListAgg(parent_tid,';') within group(order by Level desc) as revPath FROM t_production_task
START WITH taskid = %i CONNECT BY NOCYCLE PRIOR parent_tid = taskid
),
current_task as (
select CASE WHEN ( INSTR(revPath,';') > 0 ) THEN substr(revPath,0,instr(revPath,';',1,1) - 1)
... | query = 'with tasks as (\n\tSELECT ListAgg(parent_tid,\';\') within group(order by Level desc) as revPath FROM t_production_task\n\tSTART WITH taskid = %i CONNECT BY NOCYCLE PRIOR parent_tid = taskid\n\t),\n current_task as (\n\t\tselect CASE WHEN ( INSTR(revPath,\';\') > 0 ) THEN substr(revPath,0,instr(revPath,\';\... |
# In Initialize:
self.AddUniverse(self.CoarseSelectionFunction)
def CoarseSelectionFunction(self, coarse):
'''Take the top 50 by dollar volume using coarse'''
# sort descending by daily dollar volume
sortedByDollarVolume = sorted(coarse, \
key=lambda x: x.DollarVolume, reverse=True)
# we need... | self.AddUniverse(self.CoarseSelectionFunction)
def coarse_selection_function(self, coarse):
"""Take the top 50 by dollar volume using coarse"""
sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
return [x.Symbol for x in sortedByDollarVolume[:50]] |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
hash = set()
for e in A:
hash.add(abs(e))
return len(hash)
| def solution(A):
hash = set()
for e in A:
hash.add(abs(e))
return len(hash) |
class Solution:
def threeSum(self, nums: list[int]) -> list[list[int]]:
nums.sort()
res = []
for x in range(len(nums)):
# if previous value is same as current value
if x > 0 and nums[x] == nums[x-1]:
continue
i, j = x + 1, len(nums)-1
... | class Solution:
def three_sum(self, nums: list[int]) -> list[list[int]]:
nums.sort()
res = []
for x in range(len(nums)):
if x > 0 and nums[x] == nums[x - 1]:
continue
(i, j) = (x + 1, len(nums) - 1)
while i < j:
if nums[x] ... |
VIEW = 'view'
CREATE = 'create',
UPDATE = 'update',
DELETE = 'delete'
permission_map = {
VIEW: '%(app_label)s.view_%(model_name)s',
CREATE: '%(app_label)s.add_%(model_name)s',
UPDATE: '%(app_label)s.change_%(model_name)s',
DELETE: '%(app_label)s.delete_%(model_name)s',
}
def get_model_permission(mode... | view = 'view'
create = ('create',)
update = ('update',)
delete = 'delete'
permission_map = {VIEW: '%(app_label)s.view_%(model_name)s', CREATE: '%(app_label)s.add_%(model_name)s', UPDATE: '%(app_label)s.change_%(model_name)s', DELETE: '%(app_label)s.delete_%(model_name)s'}
def get_model_permission(model, type):
kwa... |
# Objects used on UCTP algorithm
#==============================================================================================================
# Keep the data of a professor
class Prof:
def __init__(self, name, period, charge, quadriSabbath, prefCampus, prefSubjQ1List, prefSubjQ2List, prefSu... | class Prof:
def __init__(self, name, period, charge, quadriSabbath, prefCampus, prefSubjQ1List, prefSubjQ2List, prefSubjQ3List, prefSubjLimList):
self.name = name
self.period = period
self.charge = charge
self.quadriSabbath = quadriSabbath
self.prefCampus = prefCampus
... |
def parse_contract_items(api_result):
rowset = api_result.find('rowset')
results = []
for row in rowset.findall('row'):
a = row.attrib
item = {
'id': int(a['recordID']),
'type_id': int(a['typeID']),
'quantity': int(a['quantity']),
'singleton': ... | def parse_contract_items(api_result):
rowset = api_result.find('rowset')
results = []
for row in rowset.findall('row'):
a = row.attrib
item = {'id': int(a['recordID']), 'type_id': int(a['typeID']), 'quantity': int(a['quantity']), 'singleton': a['singleton'] == '1', 'action': 'offered' if a['... |
# Copyright https://www.globaletraining.com/
# List comprehensions provide a concise way to create lists.
def main():
my_numbers = [18, 32, 74, 34, 69, 2, 4, 52, 61, 32, 11, 5, 17, 95, 96, 18, 38, 35, 49, 89, 54, 44, 99, 29]
my_numbers_double = []
for n in my_numbers:
my_numbers_double.append(n*2)... | def main():
my_numbers = [18, 32, 74, 34, 69, 2, 4, 52, 61, 32, 11, 5, 17, 95, 96, 18, 38, 35, 49, 89, 54, 44, 99, 29]
my_numbers_double = []
for n in my_numbers:
my_numbers_double.append(n * 2)
print(my_numbers_double)
my_numbers_double_comp1 = [n * 2 for n in my_numbers]
print(my_numbe... |
( MibScalarInstance, ) = mibBuilder.importSymbols(
'SNMPv2-SMI',
'MibScalarInstance'
)
( snmpUnknownSecurityModels,
snmpInvalidMsgs,
snmpUnknownPDUHandlers ) = mibBuilder.importSymbols(
'SNMP-MPD-MIB',
'snmpUnknownSecurityModels',
'snmpInvalidMsgs',
'snmpUnknownPDUHandlers',
)
__snm... | (mib_scalar_instance,) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalarInstance')
(snmp_unknown_security_models, snmp_invalid_msgs, snmp_unknown_pdu_handlers) = mibBuilder.importSymbols('SNMP-MPD-MIB', 'snmpUnknownSecurityModels', 'snmpInvalidMsgs', 'snmpUnknownPDUHandlers')
__snmp_unknown_security_models = mib_scal... |
# both arrays are the same size? => true
# is A and B is equal, is A a rotation of B? => false
# is both array is empty, one is a rotation of another? => true
# [1, 2, 3, 4, 5, 6, 7]
# [4, 5, 6, 7, 1, 2, 3]
# True
# [1, 2, 3, 4, 5, 6, 7]
# [4, 3, 6, 7, 1, 2, 3]
# False
# []
# []
# True
def is_rotation(a, b):
if... | def is_rotation(a, b):
if a == b:
return True
if len(a) != len(b):
return False
for index in range(1, len(b)):
if b[index:len(b)] + b[0:index] == a:
return True
return False
a = [1, 2, 3, 4, 5, 6, 7]
b = [4, 5, 6, 7, 1, 2, 3]
print(is_rotation(a, b))
a = [1, 2, 3, 4, ... |
def nama_fungsi():
# isi fungsi
print("ini isi function")
def hello():
print("Hello World")
def cetak_nama(nama, kota="Sukabumi"):
print("Nama saya " + nama + ". Saya tinggal di kota " + kota)
#hello()
cetak_nama("Nadia", "Bandung")
#cetak_nama("Nadia")
| def nama_fungsi():
print('ini isi function')
def hello():
print('Hello World')
def cetak_nama(nama, kota='Sukabumi'):
print('Nama saya ' + nama + '. Saya tinggal di kota ' + kota)
cetak_nama('Nadia', 'Bandung') |
def check(board):
#straight combination
for i in range(6):
for j in range(3):
if(board[i][j]=="R" and board[i][j+1]=="R" and board[i][j+2]=="R" and board[i][j+3]=="R"):
return True
if(board[i][j]=="Y" and board[i][j+1]=="Y" and board[i][j+2]=="Y" and board[i][j... | def check(board):
for i in range(6):
for j in range(3):
if board[i][j] == 'R' and board[i][j + 1] == 'R' and (board[i][j + 2] == 'R') and (board[i][j + 3] == 'R'):
return True
if board[i][j] == 'Y' and board[i][j + 1] == 'Y' and (board[i][j + 2] == 'Y') and (board[i][... |
#ADD MANY 50DC 150DC 250DC 350DC
headerfile = "taz,parkingType,pricingModel,chargingPointType,numStalls,feeInCents,reservedFor"
with open('gemini_taz_unlimited_parking_plugs_power.csv', mode='w') as csv_writer:
csv_writer.write(headerfile+"\n")
for x in range(1, 1455):
csv_writer.write(f"{x},Residenti... | headerfile = 'taz,parkingType,pricingModel,chargingPointType,numStalls,feeInCents,reservedFor'
with open('gemini_taz_unlimited_parking_plugs_power.csv', mode='w') as csv_writer:
csv_writer.write(headerfile + '\n')
for x in range(1, 1455):
csv_writer.write(f'{x},Residential,Block,NoCharger,9999999,0,Any'... |
n = int(input())
a = n
for x in range(1,n):
a *= (n-x)
print(a)
| n = int(input())
a = n
for x in range(1, n):
a *= n - x
print(a) |
def main():
# input
N, M = map(int, input().split())
ABs = []
for _ in range(M):
ABs.append(list(map(int, input().split())))
K = int(input())
CDs = []
for _ in range(K):
CDs.append(list(map(int, input().split())))
# compute
ans = 0
for i in range(2**K):
d... | def main():
(n, m) = map(int, input().split())
a_bs = []
for _ in range(M):
ABs.append(list(map(int, input().split())))
k = int(input())
c_ds = []
for _ in range(K):
CDs.append(list(map(int, input().split())))
ans = 0
for i in range(2 ** K):
dishes = [0 for _ in r... |
class Lecture:
def __init__(self, startTime, endTime, module, slot_type, location):
self.startTime = startTime
self.endTime = endTime
self.module = module
self.slot_type = slot_type
self.location = location
| class Lecture:
def __init__(self, startTime, endTime, module, slot_type, location):
self.startTime = startTime
self.endTime = endTime
self.module = module
self.slot_type = slot_type
self.location = location |
def insertionSort(lista):
for i in range(1, len(lista)):
daVez = lista[i]
k = i
while k > 0 and int(daVez['dificuldade']) > int(lista[k-1]['dificuldade']):
lista[k] = lista[k - 1]
k = k - 1
lista[k] = daVez
return lista
num_problemas = int(in... | def insertion_sort(lista):
for i in range(1, len(lista)):
da_vez = lista[i]
k = i
while k > 0 and int(daVez['dificuldade']) > int(lista[k - 1]['dificuldade']):
lista[k] = lista[k - 1]
k = k - 1
lista[k] = daVez
return lista
num_problemas = int(input())... |
#add function
def add(num1, num2):
return num1 + num2
#Minus function
def minus(num1, num2):
return num1 - num2
#multiply function
def multiply(num1, num2):
return num1 * num2
#devide function
def divide(num1, num2):
return num1 / num2
#area function
def area(num1):
return 3.14 * num1 * num1
def main():
oper... | def add(num1, num2):
return num1 + num2
def minus(num1, num2):
return num1 - num2
def multiply(num1, num2):
return num1 * num2
def divide(num1, num2):
return num1 / num2
def area(num1):
return 3.14 * num1 * num1
def main():
operation = raw_input('what do you want to do(+,-,*,/,area):')
... |
'''
Created on Aug 1, 2014
@author: tangliuxiang
'''
class andprop(object):
def __init__(self, prop):
self.mProp = prop
self.mParsed = False
self.mPropDict = {}
self.__parsed__()
def __parsed__(self):
if self.mParsed is False:
propfile = file(self.mProp... | """
Created on Aug 1, 2014
@author: tangliuxiang
"""
class Andprop(object):
def __init__(self, prop):
self.mProp = prop
self.mParsed = False
self.mPropDict = {}
self.__parsed__()
def __parsed__(self):
if self.mParsed is False:
propfile = file(self.mProp)
... |
#Player 1 input:
text_to_guess = input("Player 1, please input the text to guess! ")
guessed_so_far = ""
for i in text_to_guess:
if i != " ":
# guessed_so_far = guessed_so_far + "*"
guessed_so_far += "*"
else:
guessed_so_far += " "
print(f"Text to guess: {guessed_so_far}") #
done = False... | text_to_guess = input('Player 1, please input the text to guess! ')
guessed_so_far = ''
for i in text_to_guess:
if i != ' ':
guessed_so_far += '*'
else:
guessed_so_far += ' '
print(f'Text to guess: {guessed_so_far}')
done = False
while not done:
if text_to_guess == guessed_so_far:
do... |
def last_three_nums(m, n):
if n == 1:
return m
else:
tmp = n // 2
return ((last_three_nums(m, tmp) % 1000) *
(last_three_nums(m, n - tmp) % 1000)) % 1000
if __name__ == '__main__':
with open('input.txt', 'r+') as f:
for line in f.readlines():
pa... | def last_three_nums(m, n):
if n == 1:
return m
else:
tmp = n // 2
return last_three_nums(m, tmp) % 1000 * (last_three_nums(m, n - tmp) % 1000) % 1000
if __name__ == '__main__':
with open('input.txt', 'r+') as f:
for line in f.readlines():
para = line.split(' ')
... |
class BbuHealthStatus(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_bbu_health_status(idx_name)
class BbuHealthStatusColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_bbus()
| class Bbuhealthstatus(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_bbu_health_status(idx_name)
class Bbuhealthstatuscolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_bbus() |
studies_folder = 'studies/'
experiment_folder = 'experimentation/'
models_folder = 'modeling/'
models_results_folder = 'results/'
models_results_plots_folder = 'results/plots/'
models_results_figures_folder = 'figures/'
models_results_weights_folder = 'results/weights/'
models_scripts_folder = 'scripts/'
experiment_fil... | studies_folder = 'studies/'
experiment_folder = 'experimentation/'
models_folder = 'modeling/'
models_results_folder = 'results/'
models_results_plots_folder = 'results/plots/'
models_results_figures_folder = 'figures/'
models_results_weights_folder = 'results/weights/'
models_scripts_folder = 'scripts/'
experiment_fil... |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: lib.coginvasion.cog.Variant
NORMAL, SKELETON, WAITER, MINIGAME, ZOMBIE = range(5)
def getVariantById(index):
variants = [
NORM... | (normal, skeleton, waiter, minigame, zombie) = range(5)
def get_variant_by_id(index):
variants = [NORMAL, SKELETON, WAITER, MINIGAME, ZOMBIE]
return variants[index] |
a,b,c=list(map(int,input().split()))
M=0
for i in range(0,c+1):
M=max(M,min(a+i,b+(c-i)))
print(M*2) | (a, b, c) = list(map(int, input().split()))
m = 0
for i in range(0, c + 1):
m = max(M, min(a + i, b + (c - i)))
print(M * 2) |
numero = 0
numero = int(input('de onde vc quer q comece o decrecimento \n'))
while numero > -1:
print(numero)
numero -= 1
| numero = 0
numero = int(input('de onde vc quer q comece o decrecimento \n'))
while numero > -1:
print(numero)
numero -= 1 |
__title__ = 'requests-raw'
__description__ = 'Use requests to talk HTTP via a Raw sockets (To Test RFC Compliance)'
__url__ = 'https://github.com/realgam3/requests-raw'
__version__ = '1.0.0'
__build__ = 0x010000
__author__ = 'Tomer Zait (realgam3)'
__author_email__ = 'realgam3@gmail.com'
__license__ = 'Apache 2.0'
__co... | __title__ = 'requests-raw'
__description__ = 'Use requests to talk HTTP via a Raw sockets (To Test RFC Compliance)'
__url__ = 'https://github.com/realgam3/requests-raw'
__version__ = '1.0.0'
__build__ = 65536
__author__ = 'Tomer Zait (realgam3)'
__author_email__ = 'realgam3@gmail.com'
__license__ = 'Apache 2.0'
__copyr... |
## Backreference
re.sub(r'\[(\d+)\]', r'\1', '[52] apples and [31] mangoes')
re.sub(r'(_)?_', r'\1', '_foo_ __123__ _baz_')
re.sub(r'(\w+),(\w+)', r'\2,\1', 'good,bad 42,24')
re.sub(r'\[(\d+)\]', r'(\15)', '[52] apples and [31] mangoes')
re.sub(r'\[(\d+)\]', r'(\g<1>5)', '[52] apples and [31] mangoes')
re.sub(r'\... | re.sub('\\[(\\d+)\\]', '\\1', '[52] apples and [31] mangoes')
re.sub('(_)?_', '\\1', '_foo_ __123__ _baz_')
re.sub('(\\w+),(\\w+)', '\\2,\\1', 'good,bad 42,24')
re.sub('\\[(\\d+)\\]', '(\\15)', '[52] apples and [31] mangoes')
re.sub('\\[(\\d+)\\]', '(\\g<1>5)', '[52] apples and [31] mangoes')
re.sub('\\[(\\d+)\\]', '(\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
token = '407803845:AAFHG-8KH0PPWGfE-2YuBT1LVFJ2TGopQk0'
| token = '407803845:AAFHG-8KH0PPWGfE-2YuBT1LVFJ2TGopQk0' |
# 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.
{
'target_defaults': {
'msvs_cygwin_dirs': ['../../../../../<(DEPTH)/third_party/cygwin'],
},
'targets': [
{
'target_name': 'test_batch',
... | {'target_defaults': {'msvs_cygwin_dirs': ['../../../../../<(DEPTH)/third_party/cygwin']}, 'targets': [{'target_name': 'test_batch', 'type': 'none', 'rules': [{'rule_name': 'build_with_batch', 'msvs_cygwin_shell': 0, 'extension': 'S', 'outputs': ['output.obj'], 'action': ['call go.bat', '<(RULE_INPUT_PATH)', 'output.obj... |
# MIT License
# Copyright (c) 2016 Alexis Bekhdadi (midoriiro) <contact@smartsoftwa.re>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the... | class Attributedict(dict):
def __getattr__(self, key):
return self[key]
def __setattr__(self, key, value):
self[key] = value
def __delattr__(self, key):
del self[key]
class Partialdictcomparer(dict):
def __init__(self, obj):
super().__init__()
self._obj = obj... |
class Solution:
def findUnsortedSubarray(self, nums: List[int]) -> int:
sorted_list = sorted(nums)
left = 0
right = len(nums) -1
while left <= right and sorted_list[left] == nums[left]:
left += 1
while right >= left and sorted_li... | class Solution:
def find_unsorted_subarray(self, nums: List[int]) -> int:
sorted_list = sorted(nums)
left = 0
right = len(nums) - 1
while left <= right and sorted_list[left] == nums[left]:
left += 1
while right >= left and sorted_list[right] == nums[right]:
... |
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to ... | get_method = 'get'
post_method = 'post'
put_method = 'put'
delete_method = 'delete'
resources_path = '/resources'
portal_resources_path = '/portalresources'
slices_create_path = '/slices/create'
slices_delete_path = '/slices/delete'
slices_get_path = '/slices'
slices_get_slice_id_path = '/slices/{sliceID}'
slices_renew... |
class Solution:
def isPerfectSquare(self, num: int) -> bool:
l, r = 1, num // 2
while l < r:
mid = (l + r) // 2
if mid * mid < num:
l = mid + 1
elif mid * mid > num:
r = mid - 1
else:
l = r = mid
... | class Solution:
def is_perfect_square(self, num: int) -> bool:
(l, r) = (1, num // 2)
while l < r:
mid = (l + r) // 2
if mid * mid < num:
l = mid + 1
elif mid * mid > num:
r = mid - 1
else:
l = r = mid
... |
[day_survive, food_death, food_hunger], food_retrieve, food_has, day_hunger = [int(a) for a in input().split()], [int(b) for b in input().split()], 0, 0
food_hunger -= food_death
for each_day in range(day_survive):
food_has += food_retrieve[each_day] - food_death
if (food_has < 0):
day_hunger = -1
... | ([day_survive, food_death, food_hunger], food_retrieve, food_has, day_hunger) = ([int(a) for a in input().split()], [int(b) for b in input().split()], 0, 0)
food_hunger -= food_death
for each_day in range(day_survive):
food_has += food_retrieve[each_day] - food_death
if food_has < 0:
day_hunger = -1
... |
class Pod:
def __init__(self, name: str, status: str):
self.name = name
self.status = status
@classmethod
def from_api(cls, api_pod):
return cls(api_pod.metadata.name, api_pod.status.phase)
| class Pod:
def __init__(self, name: str, status: str):
self.name = name
self.status = status
@classmethod
def from_api(cls, api_pod):
return cls(api_pod.metadata.name, api_pod.status.phase) |
def f(a):
if float(a) == 0:
return '0.'
if float(a) > 0:
return a.lstrip('0')
if float(a) < 0:
return a.replace('-0', '-')
print(f('-0.0'))
print(f('0.0'))
print(f('100230.00234'))
print(f('0.43204'))
print(f('-23.5908'))
print(f('-2901.406'))
print(f('-0.32305'))
| def f(a):
if float(a) == 0:
return '0.'
if float(a) > 0:
return a.lstrip('0')
if float(a) < 0:
return a.replace('-0', '-')
print(f('-0.0'))
print(f('0.0'))
print(f('100230.00234'))
print(f('0.43204'))
print(f('-23.5908'))
print(f('-2901.406'))
print(f('-0.32305')) |
src = Split('''
guider.c
''')
component = aos_component('libguider', src)
include_tmp = Split('''
.
../iotx-system
../LITE-utils
../LITE-log
../misc
../digest
../sdk-impl
../../security/tfs
''')
for i in include_tmp:
component.add_global_includes(i)
component.add_comp_dep... | src = split('\n guider.c\n')
component = aos_component('libguider', src)
include_tmp = split('\n .\n ../iotx-system \n ../LITE-utils \n ../LITE-log \n ../misc \n ../digest \n ../sdk-impl \n ../../security/tfs\n')
for i in include_tmp:
component.add_global_includes(i)
component.add_comp_de... |
SAFE = '.'
TRAP = '^'
initial = '^..^^.^^^..^^.^...^^^^^....^.^..^^^.^.^.^^...^.^.^.^.^^.....^.^^.^.^.^.^.^.^^..^^^^^...^.....^....^.'
num_rows = 39
prev = initial
next = ''
safe_tiles = initial.count(SAFE)
for i in range(0, num_rows):
for j in range(0, len(initial)):
left = prev[j-1] if j-1 >= 0 else SAFE
... | safe = '.'
trap = '^'
initial = '^..^^.^^^..^^.^...^^^^^....^.^..^^^.^.^.^^...^.^.^.^.^^.....^.^^.^.^.^.^.^.^^..^^^^^...^.....^....^.'
num_rows = 39
prev = initial
next = ''
safe_tiles = initial.count(SAFE)
for i in range(0, num_rows):
for j in range(0, len(initial)):
left = prev[j - 1] if j - 1 >= 0 else S... |
one_to_ten = range(1, 11)
for i in one_to_ten:
for j in one_to_ten:
print("%d * %d = %d" % (i, j, i * j))
| one_to_ten = range(1, 11)
for i in one_to_ten:
for j in one_to_ten:
print('%d * %d = %d' % (i, j, i * j)) |
class readin:
#read in string
teBeChecked = input("Input string to be checked please: ")
#strip string of whitespace
teBeChecked = teBeChecked.replace(" ", "")
#copy a reverse of the sting
tempString = teBeChecked[::-1]
#check if the strings are the same, print result
if teBeChecked == tempString:
... | class Readin:
te_be_checked = input('Input string to be checked please: ')
te_be_checked = teBeChecked.replace(' ', '')
temp_string = teBeChecked[::-1]
if teBeChecked == tempString:
print('True')
else:
print('False') |
#1 - Crear una clase que represente un numero complejo. Tenga 4 metodos que permita las operaciones matematicas basicas (+,-,*,/).
class imaginario:
def __init__(self, r, j):
self.r=r
self.j=j
def __str__(self):
if self.j > 0:
return str(self.r)+" + j"+str(self.j)
el... | class Imaginario:
def __init__(self, r, j):
self.r = r
self.j = j
def __str__(self):
if self.j > 0:
return str(self.r) + ' + j' + str(self.j)
else:
return str(self.r) + ' - j' + str(abs(self.j))
def sumar(a, b):
ar = a.r
aj = a.j
... |
description = 'Vacuum readout devices using Leybold Center 3'
group = 'lowlevel'
devices = dict(
vacuum_CB = device('nicos.devices.generic.ManualMove',
description = 'Pressure in Chopper chamber',
default = 3.5e-6,
abslimits = (0, 1000),
unit = 'mbar',
fmtstr = '%.1g',
... | description = 'Vacuum readout devices using Leybold Center 3'
group = 'lowlevel'
devices = dict(vacuum_CB=device('nicos.devices.generic.ManualMove', description='Pressure in Chopper chamber', default=3.5e-06, abslimits=(0, 1000), unit='mbar', fmtstr='%.1g'), vacuum_SFK=device('nicos.devices.generic.ManualMove', descrip... |
#
# PySNMP MIB module LIEBERT-GP-SYSTEM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LIEBERT-GP-SYSTEM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:06:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection) ... |
#
# PySNMP MIB module HPN-ICF-NPV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-NPV-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:40:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ... |
def div_by_3(x, y):
# print(f"({x}), ({y})")
s1 = 0
for i in str(x):
# print(i)
s1 = s1 + int(i)
s2 = 0
for i in str(y):
# print(i)
s2 = s2 + int(i)
if (s1 % 3 == 0) and (s2 % 3 == 0):
return True
else:
return False
def weird_checker(func, ... | def div_by_3(x, y):
s1 = 0
for i in str(x):
s1 = s1 + int(i)
s2 = 0
for i in str(y):
s2 = s2 + int(i)
if s1 % 3 == 0 and s2 % 3 == 0:
return True
else:
return False
def weird_checker(func, input_list):
out = []
for (k, v) in enumerate(input_list):
... |
right = set()
wrong = {}
cnt, total = 0,0
while True:
a = input()
if a == "-1":
break
t,p,result = a.split()
if p in right:
continue
if result == "right":
right.add(p)
cnt+=1
total += int(t)
else:
try:
wrong[p]+=1
except:
... | right = set()
wrong = {}
(cnt, total) = (0, 0)
while True:
a = input()
if a == '-1':
break
(t, p, result) = a.split()
if p in right:
continue
if result == 'right':
right.add(p)
cnt += 1
total += int(t)
else:
try:
wrong[p] += 1
e... |
# -*- coding: utf-8 -*-
def myfunction():
grains = {}
grains['a_custom'] = {'k2': 'v2'}
return grains
| def myfunction():
grains = {}
grains['a_custom'] = {'k2': 'v2'}
return grains |
def hey(phrase):
phrase = phrase.replace("\t", "")
phrase = phrase.replace(" ", "")
phrase = phrase.replace("\n", "")
phrase = phrase.replace("\r", "")
if len(phrase) == 0:
return("Fine. Be that way!")
elif phrase.isupper():
return("Whoa, chill out!")
elif phrase[len(phrase)... | def hey(phrase):
phrase = phrase.replace('\t', '')
phrase = phrase.replace(' ', '')
phrase = phrase.replace('\n', '')
phrase = phrase.replace('\r', '')
if len(phrase) == 0:
return 'Fine. Be that way!'
elif phrase.isupper():
return 'Whoa, chill out!'
elif phrase[len(phrase) - ... |
# In functional programming, the function is the active agent:
# Hey print_time! Here's an object to print
#
# In OOP, the objects are the active agents.
# Hey obj start! Please print yourself
class Time:
def set(self, seconds):
time = Time()
minutes, time.seconds = divmod(seconds, 60)
... | class Time:
def set(self, seconds):
time = time()
(minutes, time.seconds) = divmod(seconds, 60)
(hour, time.minutes) = divmod(minutes, 60)
time.hour = hour
return time
def print(self):
print('%.2d:%.2d:%.2d' % (self.hour, self.minutes, self.seconds))
time = time... |
# -*- coding: utf-8 -*-
def single_word_check(segments):
'''
Function for checking to see if there are any single
repeating words in the English text. Common examples include
'the the' and 'is is'.
'''
for segment in segments:
# Only proceed if there is target text.
if segmen... | def single_word_check(segments):
"""
Function for checking to see if there are any single
repeating words in the English text. Common examples include
'the the' and 'is is'.
"""
for segment in segments:
if segment.target_text:
if not segment.target_text.isspace():
... |
h,d=0,0
for l in open("2"):
a,b=l.split(" ")
b=int(b)
if a[0]=='f':h+=b
elif a[0]=='d':d+=b
else:d-=b
print(h*d)
| (h, d) = (0, 0)
for l in open('2'):
(a, b) = l.split(' ')
b = int(b)
if a[0] == 'f':
h += b
elif a[0] == 'd':
d += b
else:
d -= b
print(h * d) |
DISCOUNT = 15
def apply_discount(price, discount):
return price * (100 - discount) / 100
# def discount_product(price):
# pass
basket = [5985.58, 4789.6, 14593.5, 4751.3]
basket_sum = sum(basket)
print(basket_sum)
basket_sum_discounted = 0
discount_1 = 7
for product in basket:
# print(product, apply_... | discount = 15
def apply_discount(price, discount):
return price * (100 - discount) / 100
basket = [5985.58, 4789.6, 14593.5, 4751.3]
basket_sum = sum(basket)
print(basket_sum)
basket_sum_discounted = 0
discount_1 = 7
for product in basket:
basket_sum_discounted += apply_discount(product, discount_1)
print(bask... |
class CommonPartitionKeys:
VERSION = "version"
EXTRAS = "extras"
class CollectionKeys(CommonPartitionKeys):
CONTENTS = "contents"
class TileSetKeys(CommonPartitionKeys):
DIMENSIONS = "dimensions"
SHAPE = "shape"
DEFAULT_TILE_SHAPE = "default_tile_shape"
DEFAULT_TILE_FORMAT = "default_til... | class Commonpartitionkeys:
version = 'version'
extras = 'extras'
class Collectionkeys(CommonPartitionKeys):
contents = 'contents'
class Tilesetkeys(CommonPartitionKeys):
dimensions = 'dimensions'
shape = 'shape'
default_tile_shape = 'default_tile_shape'
default_tile_format = 'default_tile_... |
with open('./p5js.txt', 'r') as f:
line = f.read()
print()
| with open('./p5js.txt', 'r') as f:
line = f.read()
print() |
def test_notional_initial(position):
mid_price = 100000000000000000000 # 100
notional = 10000000000000000000 # 10
debt = 2000000000000000000 # 2
liquidated = False
# NOTE: mid_ratio tests in test_entry_price.py
oi = int((notional / mid_price) * 1000000000000000000) # 0.1
fraction = 1000... | def test_notional_initial(position):
mid_price = 100000000000000000000
notional = 10000000000000000000
debt = 2000000000000000000
liquidated = False
oi = int(notional / mid_price * 1000000000000000000)
fraction = 1000000000000000000
is_long = True
entry_price = 101000000000000000000
... |
config = {
"s3_bucket": 'hp-wukong',
"ghe_token_file": 'ghe-token.txt',
"ghe_url": 'https://github.azc.ext.hp.com',
}
| config = {'s3_bucket': 'hp-wukong', 'ghe_token_file': 'ghe-token.txt', 'ghe_url': 'https://github.azc.ext.hp.com'} |
# Check if its positive
# Check if its prime
# Ask again if negative
x = True
while x:
num = int(input("Input Positive Value: "))
for i in range(2, int(num / 2) + 1):
if (num % i) == 0:
print(num, "Is Prime!")
x = False
break
else:
print(num, "N... | x = True
while x:
num = int(input('Input Positive Value: '))
for i in range(2, int(num / 2) + 1):
if num % i == 0:
print(num, 'Is Prime!')
x = False
break
else:
print(num, 'Not Prime')
x = False
break |
class Solution:
@staticmethod
def naive(grid):
visited = set()
rows = len(grid)
cols = len(grid[0])
def dfs(i,j):
if i>cols-1 or j>rows-1 \
or i<0 or j<0 \
or str(i)+','+str(j) in visited:
return
visited.add... | class Solution:
@staticmethod
def naive(grid):
visited = set()
rows = len(grid)
cols = len(grid[0])
def dfs(i, j):
if i > cols - 1 or j > rows - 1 or i < 0 or (j < 0) or (str(i) + ',' + str(j) in visited):
return
visited.add(str(i) + ',' ... |
# required function
def saveThePrisoner(n,m,s):
if ((s+m-1)%n):
return ((s+m-1)%n)
else:
return n
def main():
# number of test cases
t = int(input())
while t:
# n = number of prisoners
# m = number of sweets
# s = starting seat number
n,m,s = map(int,... | def save_the_prisoner(n, m, s):
if (s + m - 1) % n:
return (s + m - 1) % n
else:
return n
def main():
t = int(input())
while t:
(n, m, s) = map(int, input().split(' '))
print(save_the_prisoner(n, m, s))
t -= 1
if __name__ == '__main__':
main() |
df12.merge(df13)
# A B C D sum_C sum_D
# --- ----- ---------- ----------- ---------- -----------
# foo one -0.710095 0.253189 -0.0752683 1.51216
# bar one -0.165891 -0.433233 -0.165891 -0.433233
# foo two -1.51996 1.12321 -2.13829 ... | df12.merge(df13) |
salario = int(input('Salario '))
imposto = 27.
while imposto > 0.:
imposto = input('Imposto ou (0) para sair: ')
if not imposto:
imposto = 27.
else:
imposto = float(imposto)
print("Valor real: {0}".format(salario - (salario * (imposto * 0.01)))) | salario = int(input('Salario '))
imposto = 27.0
while imposto > 0.0:
imposto = input('Imposto ou (0) para sair: ')
if not imposto:
imposto = 27.0
else:
imposto = float(imposto)
print('Valor real: {0}'.format(salario - salario * (imposto * 0.01))) |
# https://www.geeksforgeeks.org/maximum-sum-hour-glass-matrix/
def hourglassSum(arr):
size = len(arr)
options = []
for i in range(size):
for j in range(size):
points = list()
points.append([i, j])
points.append([i, j + 1])
points.append([i, j + 2])
... | def hourglass_sum(arr):
size = len(arr)
options = []
for i in range(size):
for j in range(size):
points = list()
points.append([i, j])
points.append([i, j + 1])
points.append([i, j + 2])
points.append([i + 1, j + 1])
points.appe... |
'''
XXXX-XXXX-XXXX-XXXX
valid[0,1,2,3]%2 == 0
valid[4,5,6,7] = 0003
valid[8,9,10,11] = 0004
valid[] = 71,75,83,75
'''
key = "0000-0003-0004-GKSK"
global getFlag
check_1 = 0
check_2 = 0
check_3 = 0
check_4 = 0
valid = key.split("-")
for i in valid[0]:
if int(i)%2 == 0:
check_1 += 1
if int(va... | """
XXXX-XXXX-XXXX-XXXX
valid[0,1,2,3]%2 == 0
valid[4,5,6,7] = 0003
valid[8,9,10,11] = 0004
valid[] = 71,75,83,75
"""
key = '0000-0003-0004-GKSK'
global getFlag
check_1 = 0
check_2 = 0
check_3 = 0
check_4 = 0
valid = key.split('-')
for i in valid[0]:
if int(i) % 2 == 0:
check_1 += 1
if int(valid[1]) > 1:
... |
data = {
'S_0x': 0,
'S_1x': 2,
'S_2x': 25,
'S_3x': 27,
'S_4x': 19,
'S_5x': 28,
'S_6x': 76,
'S_7x': 95,
'S_8x': 27,
'S_9x': 2,
'p_flu_0x': 0.000050,
'p_flu_1x': 0.000063,
'p_flu_2x': 0.000206,
'p_flu_3x': 0.000206,
'p_flu_4x': 0.000206,
'p_flu_5x': 0.000... | data = {'S_0x': 0, 'S_1x': 2, 'S_2x': 25, 'S_3x': 27, 'S_4x': 19, 'S_5x': 28, 'S_6x': 76, 'S_7x': 95, 'S_8x': 27, 'S_9x': 2, 'p_flu_0x': 5e-05, 'p_flu_1x': 6.3e-05, 'p_flu_2x': 0.000206, 'p_flu_3x': 0.000206, 'p_flu_4x': 0.000206, 'p_flu_5x': 0.000614, 'p_flu_6x': 0.004465, 'p_flu_6x': 0.008315, 'p_flu_7x': 0.008315, '... |
def doubler_generator():
number = 2
while True:
yield number
number *= number
doubler = doubler_generator()
print (next(doubler))
#2
print (next(doubler))
#4
print (next(doubler))
#16
print (type(doubler))
#<class 'generator'> | def doubler_generator():
number = 2
while True:
yield number
number *= number
doubler = doubler_generator()
print(next(doubler))
print(next(doubler))
print(next(doubler))
print(type(doubler)) |
obj1 = lv.obj(lv.scr_act(),None)
obj1.set_size(100,50)
obj1.align(None,lv.ALIGN.CENTER, -60, -30)
# Copy the previous object and enable drag
obj2 = lv.obj(lv.scr_act(),obj1)
#obj2.set_size(100,50)
obj2.align(None,lv.ALIGN.CENTER, 0, 0)
obj2.set_drag(True)
# create style
style_shadow = lv.style_t()
style_shadow.init()... | obj1 = lv.obj(lv.scr_act(), None)
obj1.set_size(100, 50)
obj1.align(None, lv.ALIGN.CENTER, -60, -30)
obj2 = lv.obj(lv.scr_act(), obj1)
obj2.align(None, lv.ALIGN.CENTER, 0, 0)
obj2.set_drag(True)
style_shadow = lv.style_t()
style_shadow.init()
style_shadow.set_shadow_width(lv.STATE.DEFAULT, 10)
style_shadow.set_shadow_s... |
class item():
def __init__ (self,code=0,name=0,price=0,qty=0):
self.items=[]
self.code=code
self.name=name
self.price=price
self.qty=qty
def get(self):
self.code=input("Enter Item Code :- ")
self.name=input("Enter Item Name :- ")
... | class Item:
def __init__(self, code=0, name=0, price=0, qty=0):
self.items = []
self.code = code
self.name = name
self.price = price
self.qty = qty
def get(self):
self.code = input('Enter Item Code :- ')
self.name = input('Enter Item Name :- ')
s... |
{
'target_defaults': {
'variables': {
'deps': [
'libchrome-<(libbase_ver)',
],
},
},
'targets' : [
{
'target_name': 'libcros_config',
'type': 'shared_library',
'sources': [
'libcros_config/cros_config.cc',
'libcros_config/fake_cros_config.cc',
... | {'target_defaults': {'variables': {'deps': ['libchrome-<(libbase_ver)']}}, 'targets': [{'target_name': 'libcros_config', 'type': 'shared_library', 'sources': ['libcros_config/cros_config.cc', 'libcros_config/fake_cros_config.cc'], 'link_settings': {'libraries': ['-lfdt']}}], 'conditions': [['USE_test == 1', {'targets':... |
min_turn_penalty = 0.9
min_uncertainty_penalty = 0.7
def neighbours(i):
return [j for j in range(5) if abs(i - j) <= 1]
neighbours_dict = dict()
for i in range(5):
neighbours_dict[i] = neighbours(i)
foreigners_dict = dict()
for i in range(5):
foreigners_dict[i] = [j for j in range(5) if j not in neighb... | min_turn_penalty = 0.9
min_uncertainty_penalty = 0.7
def neighbours(i):
return [j for j in range(5) if abs(i - j) <= 1]
neighbours_dict = dict()
for i in range(5):
neighbours_dict[i] = neighbours(i)
foreigners_dict = dict()
for i in range(5):
foreigners_dict[i] = [j for j in range(5) if j not in neighbours... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.