content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# kano00
# https://adventofcode.com/2021/day/10
def calc1(chunk_list):
left_brankets = ["(", "[", "{", "<"]
right_brankets = [")", "]", "}", ">"]
scores = [3,57,1197,25137]
res = 0
def calc_points(chunk):
stack = []
for c in chunk:
for i in range(4):
if ... | def calc1(chunk_list):
left_brankets = ['(', '[', '{', '<']
right_brankets = [')', ']', '}', '>']
scores = [3, 57, 1197, 25137]
res = 0
def calc_points(chunk):
stack = []
for c in chunk:
for i in range(4):
if c == left_brankets[i]:
sta... |
def show_magicians(magician_names, great_magicians):
"""Transfer the lis of magician in the great list"""
while magician_names:
magician = magician_names.pop()
great_magicians.append(magician)
def make_great(great_magicians):
"""Print the new list of magicians"""
for great_magician in g... | def show_magicians(magician_names, great_magicians):
"""Transfer the lis of magician in the great list"""
while magician_names:
magician = magician_names.pop()
great_magicians.append(magician)
def make_great(great_magicians):
"""Print the new list of magicians"""
for great_magician in g... |
#!/usr/bin/python
li = [1, 2, 3, 1, 4, 5]
# wrong 1
for v in li:
if v == 1 or v == 2:
li.remove(v)
# wrong 2
for idx, v in enumerate(li):
if v == 1 or v == 2:
del li[idx]
# wrong 3
for idx, v in enumerate(li[:]):
if v == 1 or v == 2:
del li[idx]
# not recommend
for v in li[:]:
... | li = [1, 2, 3, 1, 4, 5]
for v in li:
if v == 1 or v == 2:
li.remove(v)
for (idx, v) in enumerate(li):
if v == 1 or v == 2:
del li[idx]
for (idx, v) in enumerate(li[:]):
if v == 1 or v == 2:
del li[idx]
for v in li[:]:
if v == 1 or v == 2:
li.remove(v)
li = list(filter(lam... |
def candidate_selection(wn,
token,
target_lemma,
pos=None,
gold_lexkeys=set(),
debug=False):
"""
return candidate synsets of a token
:param str token: the token
:param str targe_lemm... | def candidate_selection(wn, token, target_lemma, pos=None, gold_lexkeys=set(), debug=False):
"""
return candidate synsets of a token
:param str token: the token
:param str targe_lemma: a lemma
:param str pos: supported: n, v, r, a. If None, candidate selection is limited by one pos
:param str g... |
"""
Write a Python function to map two lists into a dictionary.
list1 contains the keys, list2 contains the values.
Input lists:
list1 = [1,2,3,4,5]
list2 = [6,7,8,9,10]
Expected output: {1: 6, 2: 7, 3: 8, 4: 9, 5: 10}
"""
#Solution is:
def map_lists(list1,list2):
return (dict(zip(list1,list2)))
| """
Write a Python function to map two lists into a dictionary.
list1 contains the keys, list2 contains the values.
Input lists:
list1 = [1,2,3,4,5]
list2 = [6,7,8,9,10]
Expected output: {1: 6, 2: 7, 3: 8, 4: 9, 5: 10}
"""
def map_lists(list1, list2):
return dict(zip(list1, list2)) |
largest = None
smallest = None
numbers = list()
while True:
num = input('Enter a number: ')
if num == "done":
if numbers == []:
max = '(no input)'
min = '(no input)'
else:
max = max(numbers)
min = min(numbers)
break
try:
num ... | largest = None
smallest = None
numbers = list()
while True:
num = input('Enter a number: ')
if num == 'done':
if numbers == []:
max = '(no input)'
min = '(no input)'
else:
max = max(numbers)
min = min(numbers)
break
try:
num = i... |
# Iterable Data
# - String
# - List
# - Set
# - Dictionary
for x in [3,5,2]:
print(x)
for x in "abc":
print(x)
for x in {"x":"123", "a":"456"}:
print(x)
##########
# max(iterable data)
# sorted (iterable data)
result=max([30, 20, 50, 10])
print(result)
result2=sorted([30, 20, 50, 10])
print(result2) | for x in [3, 5, 2]:
print(x)
for x in 'abc':
print(x)
for x in {'x': '123', 'a': '456'}:
print(x)
result = max([30, 20, 50, 10])
print(result)
result2 = sorted([30, 20, 50, 10])
print(result2) |
print(population/area)
# De indices worden gebruitk om te achterhalen welke elementen bij elkaar horen.
# Strings kun je gewoon optellen!
df1 = make_df(list('AB'), range(2))
# print(df1)
df2 = make_df(list('ACB'), range(3))
# print(df2)
print(df1+df2) # Alleen overeenkomstige kolommen zijn gebruikt, en de volgorde va... | print(population / area)
df1 = make_df(list('AB'), range(2))
df2 = make_df(list('ACB'), range(3))
print(df1 + df2)
print()
df1 = make_df('AB', [1, 2])
df2 = make_df('AB', [3, 4])
print(pd.concat([df1, df2]))
print()
print(pd.concat([df1, df2], axis=1))
print()
df3 = make_df('AB', [1, 3])
print(pd.concat([df1, df3]))
pr... |
class Solution(object):
def XXX(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root:
return 0
return max (self.XXX(root.left)+1 , self.XXX(root.right)+1)
| class Solution(object):
def xxx(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root:
return 0
return max(self.XXX(root.left) + 1, self.XXX(root.right) + 1) |
n = int(input())
dot = (2 ** n) + 1
result = dot * dot
print(result)
| n = int(input())
dot = 2 ** n + 1
result = dot * dot
print(result) |
var1 = "Hello "
var2 = "World"
# + Operator is used to combine strings
var3 = var1 + var2
print(var3)
| var1 = 'Hello '
var2 = 'World'
var3 = var1 + var2
print(var3) |
#x = 3
#x = x*x
#print(x)
#y = input('enter a number:')
#print(y)
#x = int(input('Enter an integer'))
#if x%2 == 0:
# print('Even')
#else:
# print('Odd')
# if x%3 != 0:
# print('And not divisible by 3')
#Find the cube root of a perfect cube
#x = int(input('Enter an integer'))
#ans = 0
#while ans*ans*an... | for i in range(1, 101):
s = str(i)
if i % 3 == 0 or i % 5 == 0:
s = ''
if i % 3 == 0:
s = s + 'Fizz'
if i % 5 == 0:
s = s + 'Buzz'
print(s) |
class Order:
def __init__(self, orderInfo):
self.order_id = orderInfo[0]
self.customer_id =int(orderInfo[1])
self.order_date = orderInfo[2]
self.status = orderInfo[3]
self.total_price = float(orderInfo[4])
self.comment = orderInfo[5]
| class Order:
def __init__(self, orderInfo):
self.order_id = orderInfo[0]
self.customer_id = int(orderInfo[1])
self.order_date = orderInfo[2]
self.status = orderInfo[3]
self.total_price = float(orderInfo[4])
self.comment = orderInfo[5] |
#
# PySNMP MIB module Unisphere-Data-Registry (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-Registry
# Produced by pysmi-0.3.4 at Wed May 1 15:31:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, single_value_constraint, constraints_union, value_range_constraint) ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 6 19:14:57 2019
@author: athreya
"""
#Python Programming
#Print function: Prints the given text within single/double quotes
print('Hi wecome to Python!')
#Hi wecome to Python!
print("Hello World")
#Hello World
#Strings: Text in Python is consid... | """
Created on Mon May 6 19:14:57 2019
@author: athreya
"""
print('Hi wecome to Python!')
print('Hello World')
print('Hello World this is Manoj')
print('Here is the place where you can learn python')
print('Hello' + 'Python')
pond = 'The old pond,\nA frog jumps in:\nPlop!'
todays_date = 'May 06, 2019'
print(todays_da... |
RULE_TO_REMOVE = \
"""
{
"data-source-definition-name": "__RuleToRemove",
"model-id": "__RuleToRemove",
"model-description": "System DSD for marking rules to be removed.",
"can-reflect-on-web": false,
"fields": [
{
"field-name": "rule_name",
"type": "STRING",
... | rule_to_remove = '\n{\n "data-source-definition-name": "__RuleToRemove",\n "model-id": "__RuleToRemove",\n "model-description": "System DSD for marking rules to be removed.",\n "can-reflect-on-web": false,\n "fields": [\n {\n "field-name": "rule_name",\n "type": "STRING",\n ... |
# el binary searc solo sirve con una lista ordenada
def run():
sequence = [1,2,3,4,5,6,7,8,9,10,11]
print(binary_search(sequence,-5))
def binary_search(list,goal,start=None,end=None):
if start is None:
start = 0
if end is None:
end = len(list)-1
midpoint = (start + end)... | def run():
sequence = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
print(binary_search(sequence, -5))
def binary_search(list, goal, start=None, end=None):
if start is None:
start = 0
if end is None:
end = len(list) - 1
midpoint = (start + end) // 2
if end < start:
return -1
e... |
# Func11.py
def calc(n,m):
return [n+m, n-m, n*m, n/m]
print(calc(20, 10))
a,b,c,d = calc(20,10)
print(a,b,c,d) # + - * /
def swap(n,m):
return m, n
x= 200
y= 100
x,y = swap(x,y)
print(x,y) # 100, 200
| def calc(n, m):
return [n + m, n - m, n * m, n / m]
print(calc(20, 10))
(a, b, c, d) = calc(20, 10)
print(a, b, c, d)
def swap(n, m):
return (m, n)
x = 200
y = 100
(x, y) = swap(x, y)
print(x, y) |
"""
DeskUnity
"""
class Event:
TEST = "TEST"
CONNECTION_TEST = "CONNECTION_TEST"
MOVE_MOUSE = "MOVE_MOUSE"
MOUSE_LEFT_DOWN = "MOUSE_LEFT_DOWN"
MOUSE_LEFT_UP = "MOUSE_LEFT_UP"
MOUSE_RIGHT_DOWN = "MOUSE_RIGHT_DOWN"
MOUSE_RIGHT_UP = "MOUSE_RIGHT_UP"
MOUSE_WHEEL = "MOUSE_WHEEL"
KEY... | """
DeskUnity
"""
class Event:
test = 'TEST'
connection_test = 'CONNECTION_TEST'
move_mouse = 'MOVE_MOUSE'
mouse_left_down = 'MOUSE_LEFT_DOWN'
mouse_left_up = 'MOUSE_LEFT_UP'
mouse_right_down = 'MOUSE_RIGHT_DOWN'
mouse_right_up = 'MOUSE_RIGHT_UP'
mouse_wheel = 'MOUSE_WHEEL'
key_... |
class Source:
def __init__(self,id,name):
self.id = id
self.name = name
class Articles:
def __init__(self, publishedAt, urlToImage,title,content,author,url):
self.publishedAt = publishedAt
self.urlToImage= urlToImage
self.title = title
self.content =content
self.author... | class Source:
def __init__(self, id, name):
self.id = id
self.name = name
class Articles:
def __init__(self, publishedAt, urlToImage, title, content, author, url):
self.publishedAt = publishedAt
self.urlToImage = urlToImage
self.title = title
self.content = con... |
# from 1.0.0
data1 = {
'fs': {
'nn::fssrv::sf::IFileSystemProxyForLoader': {
0: {"inbytes": 0, "outbytes": 0, "buffers": [25], "outinterfaces": ['nn::fssrv::sf::IFileSystem']},
1: {"inbytes": 8, "outbytes": 1},
},
'nn::fssrv::sf::IEventNotifier': {
0: {"inbytes": ... | data1 = {'fs': {'nn::fssrv::sf::IFileSystemProxyForLoader': {0: {'inbytes': 0, 'outbytes': 0, 'buffers': [25], 'outinterfaces': ['nn::fssrv::sf::IFileSystem']}, 1: {'inbytes': 8, 'outbytes': 1}}, 'nn::fssrv::sf::IEventNotifier': {0: {'inbytes': 0, 'outbytes': 0, 'outhandles': [1]}}, 'nn::fssrv::sf::IFileSystemProxy': {... |
def median(list):
center_value = len(list) // 2
return list[center_value]
def sort_list(list_to_order):
while True:
changed = False
for index, value in enumerate(list_to_order):
if not(index + 1 == len(list_to_order)):
if value > list_to_order[index + 1]:
... | def median(list):
center_value = len(list) // 2
return list[center_value]
def sort_list(list_to_order):
while True:
changed = False
for (index, value) in enumerate(list_to_order):
if not index + 1 == len(list_to_order):
if value > list_to_order[index + 1]:
... |
def soma(var1, var2):
var = var1 +var2
return var
def subtracao(var1, var2):
var =var1 - var2
return var
def multiplicacao(var1, var2):
var =var1 * var2
return var
def divisao(var1, var2):
var =var1/var2
return var
| def soma(var1, var2):
var = var1 + var2
return var
def subtracao(var1, var2):
var = var1 - var2
return var
def multiplicacao(var1, var2):
var = var1 * var2
return var
def divisao(var1, var2):
var = var1 / var2
return var |
class Settings:
def __init__(self):
pass
# default settings
master_title = 'Mr.'
master_name = 'John'
master_surname = 'Doe'
master_gender = 'female'
master_formal_address = 'sir'
master_email_username = None
master_email_password = None
jarvis_name = 'jarvis'
ja... | class Settings:
def __init__(self):
pass
master_title = 'Mr.'
master_name = 'John'
master_surname = 'Doe'
master_gender = 'female'
master_formal_address = 'sir'
master_email_username = None
master_email_password = None
jarvis_name = 'jarvis'
jarvis_gender = 'female'
... |
# Created by MechAviv
# NPC ID :: 9131007
# Takeda Shingen
if sm.getFieldID() == 807100000:
sm.setSpeakerID(9131007)
sm.sendNext("Get to the Honnou-ji Outer Wall and open the Eastern Door.")
elif sm.getFieldID() == 807100001: # Honnou-ji Eastern Grounds
sm.startQuest(57101)
# Unhandled Field Effect [O... | if sm.getFieldID() == 807100000:
sm.setSpeakerID(9131007)
sm.sendNext('Get to the Honnou-ji Outer Wall and open the Eastern Door.')
elif sm.getFieldID() == 807100001:
sm.startQuest(57101)
sm.setIntroBoxChat(9131007)
sm.sendNext("You did all right, samurai. I'll let you join my side for now.")
sm... |
a,b,c=map(int,input().split())
e=180
d=a+b+c
if(e==d):
print("yes")
else:
print("no")
| (a, b, c) = map(int, input().split())
e = 180
d = a + b + c
if e == d:
print('yes')
else:
print('no') |
# https://www.hackerrank.com/challenges/encryption/problem
def encryption(s):
n = len(s)
r, c = math.floor(math.sqrt(n)), math.ceil(math.sqrt(n))
if r*c<n:
r+=1
res =[]
for i in range(c):
temp = []
j = 0
while i+j<n:
temp.append(s[i+j])
j... | def encryption(s):
n = len(s)
(r, c) = (math.floor(math.sqrt(n)), math.ceil(math.sqrt(n)))
if r * c < n:
r += 1
res = []
for i in range(c):
temp = []
j = 0
while i + j < n:
temp.append(s[i + j])
j += c
res.append(''.join(temp))
prin... |
"""Workspace rules for importing Haskell packages."""
load("@ai_formation_hazel//tools:mangling.bzl", "hazel_workspace")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def new_cabal_package(package, sha256, url = None, strip_prefix = None):
url = url or "https://hackage.haskell.org/package/%... | """Workspace rules for importing Haskell packages."""
load('@ai_formation_hazel//tools:mangling.bzl', 'hazel_workspace')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def new_cabal_package(package, sha256, url=None, strip_prefix=None):
url = url or 'https://hackage.haskell.org/package/%s/%s.... |
#!/user/bin/env python
'''rFree.py:
This filter returns true if the rFree value for this structure is within the
specified range
References
----------
- `rFree <http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/r-value-and-r-free>`_
'''
__author__ = "Mars (Shih-Cheng) Huang"
__maintainer__ = "Mars (Shih-C... | """rFree.py:
This filter returns true if the rFree value for this structure is within the
specified range
References
----------
- `rFree <http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/r-value-and-r-free>`_
"""
__author__ = 'Mars (Shih-Cheng) Huang'
__maintainer__ = 'Mars (Shih-Cheng) Huang'
__email__ ... |
# Declare some constants and variables
WIDTH, HEIGHT = (600, 400)
FPS = 60
BLACK = "#000000"
DARKGRAY = "#404040"
GRAY = "#808080"
LIGHTGRAY = "#d3d3d3"
WHITE = "#FFFFFF"
ORANGE = "#FF6600"
RED = "#FF1F00"
PURPLE = "#800080"
DARKPURPLE = "#301934"
| (width, height) = (600, 400)
fps = 60
black = '#000000'
darkgray = '#404040'
gray = '#808080'
lightgray = '#d3d3d3'
white = '#FFFFFF'
orange = '#FF6600'
red = '#FF1F00'
purple = '#800080'
darkpurple = '#301934' |
def generate_log(logs):
logs.create('test', '123', '0.0.0.0', 'os', '1.0.0', 'browser', '1.0.0', 'continent',
'country', 'country_emoji', 'region', 'city')
def test_logs(logs):
test_logs_log(logs)
test_reset(logs)
test_clean(logs)
def test_logs_log(logs):
generate_l... | def generate_log(logs):
logs.create('test', '123', '0.0.0.0', 'os', '1.0.0', 'browser', '1.0.0', 'continent', 'country', 'country_emoji', 'region', 'city')
def test_logs(logs):
test_logs_log(logs)
test_reset(logs)
test_clean(logs)
def test_logs_log(logs):
generate_log(logs)
assert len(logs.get... |
first_number = int(input("Enter the first number: "))
second_number = int(input("Enter the second number: "))
operation = input("Choose operation(+, -, *, /, %): ")
result = 0
if operation == "+" or operation == "-" or operation == "*":
if operation == "+":
result = first_number + second_number
elif op... | first_number = int(input('Enter the first number: '))
second_number = int(input('Enter the second number: '))
operation = input('Choose operation(+, -, *, /, %): ')
result = 0
if operation == '+' or operation == '-' or operation == '*':
if operation == '+':
result = first_number + second_number
elif ope... |
# -*- coding: utf-8 -*-
class PfigAttributeError(Exception):
"""
Exception raised when a attribute is wrong or missing
"""
pass
class PfigTransactionError(Exception):
"""
Exception raised when a transaction is failed.
"""
pass
| class Pfigattributeerror(Exception):
"""
Exception raised when a attribute is wrong or missing
"""
pass
class Pfigtransactionerror(Exception):
"""
Exception raised when a transaction is failed.
"""
pass |
WORD_VEC_SIZE = 256 # Suggest: 300
MAX_LENGTH = 8
ENDING_MARK = "<e>"
LSTM_UNIT = 64 # Suggest: 512
ATTENTION_UNIT = 1 # Suggest: 128???
EPOCHS = 400 | word_vec_size = 256
max_length = 8
ending_mark = '<e>'
lstm_unit = 64
attention_unit = 1
epochs = 400 |
class Card(object):
"""docstring for Card"""
def __init__(self, rank, suit):
self.rank = rank
self.suit = suit
def is_same_suit(self, card):
return self.suit == card.suit
def is_same_rank(self, card):
return self.rank == card.rank
def __str__(self):
return str(self.rank) + " of " + str(... | class Card(object):
"""docstring for Card"""
def __init__(self, rank, suit):
self.rank = rank
self.suit = suit
def is_same_suit(self, card):
return self.suit == card.suit
def is_same_rank(self, card):
return self.rank == card.rank
def __str__(self):
return... |
lines = open("../in/input02.txt").read().splitlines()
count = 0
for line in lines:
line = line.replace('-',' ').replace(':','').split(' ')
# print(line)
# print(line[3].count(line[2]))
if int(line[0]) <= line[3].count(line[2]) <= int(line[1]):
count = count + 1
print('part 1: ',count... | lines = open('../in/input02.txt').read().splitlines()
count = 0
for line in lines:
line = line.replace('-', ' ').replace(':', '').split(' ')
if int(line[0]) <= line[3].count(line[2]) <= int(line[1]):
count = count + 1
print('part 1: ', count)
lines = open('../in/input02.txt').read().splitlines()
count =... |
"""
Should emit:
B020 - on lines 8, 21, and 36
"""
items = [1, 2, 3]
for items in items:
print(items)
items = [1, 2, 3]
for item in items:
print(item)
values = {"secret": 123}
for key, value in values.items():
print(f"{key}, {value}")
for key, values in values.items():
print(f"{key}, {values}")
... | """
Should emit:
B020 - on lines 8, 21, and 36
"""
items = [1, 2, 3]
for items in items:
print(items)
items = [1, 2, 3]
for item in items:
print(item)
values = {'secret': 123}
for (key, value) in values.items():
print(f'{key}, {value}')
for (key, values) in values.items():
print(f'{key}, {values}')
for ... |
'''
This file will control the keyboard mapping to flying commands.
The init routine will setup the default values, however, the api supports the ability to update
the value for any of the flying commands.
'''
LAND1 = "LAND1"
FORWARD = "FORWARD"
BACKWARD = "BACKWARD"
LEFT = "LEFT"
RIGHT = "RIGHT"
CLOCKWISE = "CLOCKWI... | """
This file will control the keyboard mapping to flying commands.
The init routine will setup the default values, however, the api supports the ability to update
the value for any of the flying commands.
"""
land1 = 'LAND1'
forward = 'FORWARD'
backward = 'BACKWARD'
left = 'LEFT'
right = 'RIGHT'
clockwise = 'CLOCKWIS... |
class Moon:
position = [None, None, None]
velocity = [None, None, None]
def __init__(self, position):
self.position = list(position)
self.velocity = [0] * len(position)
def ApplyGravity(self, moons):
for moon in moons:
for coord in range(len(moon.position)):
... | class Moon:
position = [None, None, None]
velocity = [None, None, None]
def __init__(self, position):
self.position = list(position)
self.velocity = [0] * len(position)
def apply_gravity(self, moons):
for moon in moons:
for coord in range(len(moon.position)):
... |
def default_cmp(x, y):
""" Default comparison function """
if x < y:
return -1
elif x > y:
return +1
else:
return 0
def order(seq, cmp = default_cmp, reverse = False):
""" Return the order in which to take the items to obtained
a sorted sequence."""
o = range(len(s... | def default_cmp(x, y):
""" Default comparison function """
if x < y:
return -1
elif x > y:
return +1
else:
return 0
def order(seq, cmp=default_cmp, reverse=False):
""" Return the order in which to take the items to obtained
a sorted sequence."""
o = range(len(seq))
... |
# -*- coding: utf-8 -*-
"""Top-level package for {{ cookiecutter.project_name }}."""
VERSION = tuple('{{cookiecutter.version}}'.split('.'))
__author__ = '{{ cookiecutter.full_name }}'
__email__ = '{{ cookiecutter.email }}'
# string created from tuple to avoid inconsistency
__version__ = ".".join([str(x) for x in VERS... | """Top-level package for {{ cookiecutter.project_name }}."""
version = tuple('{{cookiecutter.version}}'.split('.'))
__author__ = '{{ cookiecutter.full_name }}'
__email__ = '{{ cookiecutter.email }}'
__version__ = '.'.join([str(x) for x in VERSION]) |
def compute(original_input):
# copy of input
input = [x for x in original_input]
pointer = 0
while(input[pointer] != 99):
if input[pointer] == 1:
input[input[pointer+3]] = input[input[pointer+1]] + input[input[pointer+2]]
elif input[pointer] == 2:
input[input[poi... | def compute(original_input):
input = [x for x in original_input]
pointer = 0
while input[pointer] != 99:
if input[pointer] == 1:
input[input[pointer + 3]] = input[input[pointer + 1]] + input[input[pointer + 2]]
elif input[pointer] == 2:
input[input[pointer + 3]] = inp... |
def wheat_from_chaff(values):
last=len(values)-1
for i, j in enumerate(values):
if j<0:
continue
rec=last
while values[last]>=0:
last-=1
if i>=last:
break
values[last], values[i]=values[i], values[last]
if rec==last:
... | def wheat_from_chaff(values):
last = len(values) - 1
for (i, j) in enumerate(values):
if j < 0:
continue
rec = last
while values[last] >= 0:
last -= 1
if i >= last:
break
(values[last], values[i]) = (values[i], values[last])
if ... |
# https://programmers.co.kr/learn/courses/30/lessons/60058?language=python3
def solution(p):
answer = ''
def is_balanced(p):
return p.count("(") == p.count(")")
def is_correct(p):
count = 0
if is_balanced(p):
for x in p:
if x =='(': count += 1
... | def solution(p):
answer = ''
def is_balanced(p):
return p.count('(') == p.count(')')
def is_correct(p):
count = 0
if is_balanced(p):
for x in p:
if x == '(':
count += 1
else:
count -= 1
... |
def rotLeft(a, d):
# shift d times to the left (d is in the range of 1 - n)
n = len(a)
temp = [None for _ in range(n)]
for i in range(n):
temp[i-d] = a[i]
return temp
# driver code
print(rotLeft([1,2,3,4,5], 4)) | def rot_left(a, d):
n = len(a)
temp = [None for _ in range(n)]
for i in range(n):
temp[i - d] = a[i]
return temp
print(rot_left([1, 2, 3, 4, 5], 4)) |
A, B = [int(a) for a in input().split()]
outlet = 1
ans = 0
while outlet < B:
outlet += A-1
ans += 1
print(ans)
| (a, b) = [int(a) for a in input().split()]
outlet = 1
ans = 0
while outlet < B:
outlet += A - 1
ans += 1
print(ans) |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... | def load_arguments(self, _):
with self.argument_context('datamigration get-assessment') as c:
c.argument('connection_string', nargs='+', help='Sql Server Connection Strings')
c.argument('output_folder', type=str, help='Output folder to store assessment report')
c.argument('config_file_path',... |
boot_capacity = float(input())
entries = 0
capacity = 0
suitcases_inside = 0
command = input()
while command != "End":
suitcases = float(command)
entries += 1
suitcases_inside += 1
command = input()
if entries % 3 == 0:
capacity += suitcases + suitcases * 10 / 100
if capacity > b... | boot_capacity = float(input())
entries = 0
capacity = 0
suitcases_inside = 0
command = input()
while command != 'End':
suitcases = float(command)
entries += 1
suitcases_inside += 1
command = input()
if entries % 3 == 0:
capacity += suitcases + suitcases * 10 / 100
if capacity > boot_... |
class LargerStrKey(str):
def __lt__(x: str, y: str) -> bool:
return x + y > y + x
class Solution:
def largestNumber(self, nums: List[int]) -> str:
return ''.join(sorted(map(str, nums), key=LargerStrKey)).lstrip('0') or '0'
| class Largerstrkey(str):
def __lt__(x: str, y: str) -> bool:
return x + y > y + x
class Solution:
def largest_number(self, nums: List[int]) -> str:
return ''.join(sorted(map(str, nums), key=LargerStrKey)).lstrip('0') or '0' |
"""
Created on Sat Apr 18 10:45:11 2020
@author: Pieter Cawood
"""
class Location(object):
def __init__(self, col, row):
self.col = col
self.row = row
def __eq__(self, other):
return self.col == other.col and self.row == other.row
def __hash__(self):
re... | """
Created on Sat Apr 18 10:45:11 2020
@author: Pieter Cawood
"""
class Location(object):
def __init__(self, col, row):
self.col = col
self.row = row
def __eq__(self, other):
return self.col == other.col and self.row == other.row
def __hash__(self):
return hash(str(sel... |
"\n"
"\nfoo"
"bar\n"
"foo\nbar"
| """
"""
'\nfoo'
'bar\n'
'foo\nbar' |
{
"targets": [
{
"target_name": "module",
"sources": [ "cc/module.cc", "cc/functions.cc", "cc/satgraph.cc" ]
}
]
}
| {'targets': [{'target_name': 'module', 'sources': ['cc/module.cc', 'cc/functions.cc', 'cc/satgraph.cc']}]} |
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""PYPOWER solves power flow and Optimal Power Flow (OPF) problems.
"""
| """PYPOWER solves power flow and Optimal Power Flow (OPF) problems.
""" |
#
# PySNMP MIB module NSCHippiSonet-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NSCHippiSonet-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:15:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ... |
#
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# 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 ... | """ARM7 (ARM 32-bit) C/C++ toolchain."""
load('@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl', 'action_config', 'feature', 'flag_group', 'flag_set', 'tool', 'tool_path', 'with_feature_set')
load('@bazel_tools//tools/build_defs/cc:action_names.bzl', 'ACTION_NAMES')
def _impl(ctx):
toolchain_identifier = 'arme... |
class Solution:
def maxProfit(self, prices, fee):
"""
:type prices: List[int]
:type fee: int
:rtype: int
"""
# two states: one is hold, one is free
hold = -prices[0]
free = 0
for price in prices[1:]:
hold, free = max(hold, free - pr... | class Solution:
def max_profit(self, prices, fee):
"""
:type prices: List[int]
:type fee: int
:rtype: int
"""
hold = -prices[0]
free = 0
for price in prices[1:]:
(hold, free) = (max(hold, free - price), max(free, hold + price - fee))
... |
class DataCheckAction:
"""Base class for all DataCheckActions."""
def __init__(self, action_code, details=None):
"""
A recommended action returned by a DataCheck.
Arguments:
action_code (DataCheckActionCode): Action code associated with the action.
details (dict... | class Datacheckaction:
"""Base class for all DataCheckActions."""
def __init__(self, action_code, details=None):
"""
A recommended action returned by a DataCheck.
Arguments:
action_code (DataCheckActionCode): Action code associated with the action.
details (dict... |
def test_python_is_installed(host):
assert host.run('python --version').rc == 0
def test_sudo_is_installed(host):
assert host.run('sudo --version').rc == 0
| def test_python_is_installed(host):
assert host.run('python --version').rc == 0
def test_sudo_is_installed(host):
assert host.run('sudo --version').rc == 0 |
"""Errors for messaging_service_scripts."""
class EndToEnd:
"""Errors for end-to-end benchmark code."""
class ReceivedUnexpectedObjectError(Exception):
"""Got an unexpected object from another process."""
class SubprocessTimeoutError(Exception):
"""Subprocess output timed out."""
class SubprocessFa... | """Errors for messaging_service_scripts."""
class Endtoend:
"""Errors for end-to-end benchmark code."""
class Receivedunexpectedobjecterror(Exception):
"""Got an unexpected object from another process."""
class Subprocesstimeouterror(Exception):
"""Subprocess output timed out."""
cla... |
### we prepend t_ to tablenames and f_ to fieldnames for disambiguity
########################################
db.define_table('t_queue',
Field('f_name', type='string',
label=T('Name')),
auth.signature,
format='%(f_name)s',
migrate=settings.migrate)
db.define_table('t_queue_archive',db.t_qu... | db.define_table('t_queue', field('f_name', type='string', label=t('Name')), auth.signature, format='%(f_name)s', migrate=settings.migrate)
db.define_table('t_queue_archive', db.t_queue, field('current_record', 'reference t_queue', readable=False, writable=False)) |
# -*- coding: utf-8 -*-
# @author: Longxing Tan, tanlongxing888@163.com
# @date: 2020-09
class GBDTRegressor(object):
# This model can predict multiple steps time series prediction by GBDT model, and the main 3 mode can be all included
def __init__(self, use_model, each_model_per_prediction, extend_prediction... | class Gbdtregressor(object):
def __init__(self, use_model, each_model_per_prediction, extend_prediction_to_train, extend_weights=None):
pass
def train(self, x_train, y_train, x_valid=None, y_valid=None, categorical_features=None, fit_params={}):
pass
def predict(self):
pass
d... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def maximumAverageSubtree(self, root: TreeNode) -> float:
maxScore = 0
def dfs(curr):
... | class Solution:
def maximum_average_subtree(self, root: TreeNode) -> float:
max_score = 0
def dfs(curr):
nonlocal maxScore
if not curr:
return (0, 0)
(left_sum, left_count) = dfs(curr.left)
(right_sum, right_count) = dfs(curr.right)
... |
#shift cracker
global iora;
iora = ""
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def crack(text):
for integer in range(0,len(text)):
v = text[integer]
vv = text[integer+1]
... | global iora
iora = ''
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def crack(text):
for integer in range(0, len(text)):
v = text[integer]
vv = text[integer + 1]
vvv = text[integer + 2]
if v... |
class Singleton(type):
instance = None
def __call__(cls, *args, **kw):
if not cls.instance:
cls.instance = super(Singleton, cls).__call__(*args, **kw)
return cls.instance
class SingletonObject(object):
__metaclass__ = Singleton
a = SingletonObject()
b = SingletonObject()
pr... | class Singleton(type):
instance = None
def __call__(cls, *args, **kw):
if not cls.instance:
cls.instance = super(Singleton, cls).__call__(*args, **kw)
return cls.instance
class Singletonobject(object):
__metaclass__ = Singleton
a = singleton_object()
b = singleton_object()
prin... |
# Django settings for example project.
###########################################################################
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'example',
###############... | installed_apps = ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'example', 'ajax_select')
ajax_lookup_channels = {'label': {'model': 'example.label', 'search_field': 'name'}, 'person': ('example.lookups', 'PersonLookup'), 'group': ('exam... |
def load_wmap(filename):
wmap = dict()
with open(filename, 'rb') as fp:
for line in fp:
entry = line.strip().split('\t')
if len(entry) != 2:
continue
try:
wmap[entry[1].decode('utf-8')] = int(entry[0])
except ValueError... | def load_wmap(filename):
wmap = dict()
with open(filename, 'rb') as fp:
for line in fp:
entry = line.strip().split('\t')
if len(entry) != 2:
continue
try:
wmap[entry[1].decode('utf-8')] = int(entry[0])
except ValueError:
... |
class Event:
def __init__(self, _src, _target, _type, _time):
self.src = _src
self.target = _target
self.type = _type
self.time = _time
def __eq__(self, other):
return self.__dict__ == other.__dict__
| class Event:
def __init__(self, _src, _target, _type, _time):
self.src = _src
self.target = _target
self.type = _type
self.time = _time
def __eq__(self, other):
return self.__dict__ == other.__dict__ |
__author__ = 'Viswanath Chidambaram'
__email__ = 'viswanc@thoughtworks.com'
__version__ = '0.0.1'
| __author__ = 'Viswanath Chidambaram'
__email__ = 'viswanc@thoughtworks.com'
__version__ = '0.0.1' |
def test_str(project_client):
project = project_client
assert project.__str__() == project._domain.__str__()
def test_get_repository(rubicon_client):
rubicon = rubicon_client
assert rubicon.repository == rubicon.config.repository
| def test_str(project_client):
project = project_client
assert project.__str__() == project._domain.__str__()
def test_get_repository(rubicon_client):
rubicon = rubicon_client
assert rubicon.repository == rubicon.config.repository |
def to_d3_graph(g):
"""convert networkx format graph to d3 format
node/edge attributes are copied
"""
data = {'nodes': [], 'edges': []}
for n in g.nodes_iter():
node = g.node[n]
# print('node', node)
for f in ('topics', 'bow', 'hashtag_bow'):
if f in node:
... | def to_d3_graph(g):
"""convert networkx format graph to d3 format
node/edge attributes are copied
"""
data = {'nodes': [], 'edges': []}
for n in g.nodes_iter():
node = g.node[n]
for f in ('topics', 'bow', 'hashtag_bow'):
if f in node:
del node[f]
n... |
# EXAMPLE PATH: define the actual path on your system
gpkg_path = "C:/Users/joker/OneDrive/Mantsa 6. vuosi/Work/PYQGIS-dev/data/practical_data.gpkg" # windows
gpkg_layer = QgsVectorLayer(gpkg_path, "whole_gpkg", "ogr")
# returns a list of strings describing the sublayers
# !!::!! separetes the values
# EXAMPLE: 1!!::!!... | gpkg_path = 'C:/Users/joker/OneDrive/Mantsa 6. vuosi/Work/PYQGIS-dev/data/practical_data.gpkg'
gpkg_layer = qgs_vector_layer(gpkg_path, 'whole_gpkg', 'ogr')
sub_strings = gpkg_layer.dataProvider().subLayers()
for sub_string in sub_strings:
layer_name = sub_string.split(gpkg_layer.dataProvider().sublayerSeparator())... |
class HttpError(Exception):
def __init__(self, res, data):
self.res = res
self.status = res.status_code
self.reason = res.reason_phrase
self.method = res.method
if isinstance(data, dict):
self.message = data.get('statusMessage', '')
else:
self.... | class Httperror(Exception):
def __init__(self, res, data):
self.res = res
self.status = res.status_code
self.reason = res.reason_phrase
self.method = res.method
if isinstance(data, dict):
self.message = data.get('statusMessage', '')
else:
self... |
# -*- python -*-
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of con... | {'variables': {'conditions': [['OS=="linux"', {'syscall_handler': ['linux/nacl_syscall_impl.c']}], ['OS=="mac"', {'syscall_handler': ['linux/nacl_syscall_impl.c']}], ['OS=="win"', {'syscall_handler': ['win/nacl_syscall_impl.c'], 'msvs_cygwin_shell': 0}]]}, 'includes': ['../../../build/common.gypi'], 'target_defaults': ... |
'''
1. Write a Python program to find the single element appears once in a list where every element appears four times except for one.
Input : [1, 1, 1, 2, 2, 2, 3]
Output : 3
2. Write a Python program to find two elements appear twice in a list where all the other elements appear exactly twice in the list.
Input : ... | """
1. Write a Python program to find the single element appears once in a list where every element appears four times except for one.
Input : [1, 1, 1, 2, 2, 2, 3]
Output : 3
2. Write a Python program to find two elements appear twice in a list where all the other elements appear exactly twice in the list.
Input : ... |
# Implementation of Doubly Linked List.
"""In computer science, a doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. ...
The beginning and ending nodes' previous and next links,
respectively, point to some kind of terminator, typically a sentinel node or ... | """In computer science, a doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. ...
The beginning and ending nodes' previous and next links,
respectively, point to some kind of terminator, typically a sentinel node or null, to facilitate traversal of the list"... |
class RuleChecker:
def __init__(self):
pass
'''
data: a list of data that has the format {'price': 0.5}, sorted by time descending
'''
def check(self, rule, data):
return getattr(self, rule)(data)
def oldest_newest_single_larger_than_5per(self, tickerData):
data = ticke... | class Rulechecker:
def __init__(self):
pass
"\n data: a list of data that has the format {'price': 0.5}, sorted by time descending\n "
def check(self, rule, data):
return getattr(self, rule)(data)
def oldest_newest_single_larger_than_5per(self, tickerData):
data = ticker... |
# import yaml
# print(yaml.safe_load("""---
# version: 1
# disable_existing_loggers: False
# formatters:
# simple:
# format: '[%(levelname)s] [%(asctime)s:%(name)s] %(message)s'
# handlers:
# console:
# class: logging.StreamHandler
# level: WARNING
# formatter: simple
# stream: ext://sys.stdou... | config = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'simple': {'format': '[%(levelname)s] [%(asctime)s:%(name)s] %(message)s'}}, 'handlers': {'console': {'class': 'logging.StreamHandler', 'level': 'INFO', 'formatter': 'simple', 'stream': 'ext://sys.stdout'}}, 'loggers': {'autosklearn.metalearning'... |
'Constant strings for scripts in the repo'
UPLOAD_CONTAINER = 'results'
UPLOAD_TOKEN_VAR = 'PERFLAB_UPLOAD_TOKEN'
UPLOAD_STORAGE_URI = 'https://pvscmdupload.{}.core.windows.net'
UPLOAD_QUEUE = 'resultsqueue'
| """Constant strings for scripts in the repo"""
upload_container = 'results'
upload_token_var = 'PERFLAB_UPLOAD_TOKEN'
upload_storage_uri = 'https://pvscmdupload.{}.core.windows.net'
upload_queue = 'resultsqueue' |
for _ in range(int(input())):
n,m=map(int,input().split())
l=[]
for i in range(n):
l1=list(map(int,input().split()))
l.append(l1)
for i in range(n):
for j in range(m):
if i%2==1:
if j%2==1:
if l[i][j]%2==0:
l... | for _ in range(int(input())):
(n, m) = map(int, input().split())
l = []
for i in range(n):
l1 = list(map(int, input().split()))
l.append(l1)
for i in range(n):
for j in range(m):
if i % 2 == 1:
if j % 2 == 1:
if l[i][j] % 2 == 0:
... |
"""
Jobs service.
This Django app manages API endpoints related to managing 'pg_cron'-based
scheduling around data lifecycles, particularly around refreshing materialized
views.
This scheduling service is colocated with the database in order to keep the
scheduling logic defined within the same runtime as the data man... | """
Jobs service.
This Django app manages API endpoints related to managing 'pg_cron'-based
scheduling around data lifecycles, particularly around refreshing materialized
views.
This scheduling service is colocated with the database in order to keep the
scheduling logic defined within the same runtime as the data man... |
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
def binarySearch (arr, l, r, x):
if r >= l:
mid = l + (r - l) // 2
if arr[mid] == x:
... | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
def binary_search(arr, l, r, x):
if r >= l:
mid = l + (r - l) // 2
if arr[mid] == x:
r... |
src = Split('''
api/api_readholdingregisters.c
pdu/readholdingregisters.c
adu/rtu/rtu.c
adu/rtu/mbcrc.c
physical/serial.c
auxiliary/log.c
auxiliary/other.c
api/mbm.c
''')
component = aos_component('mbmaster', src)
component.add_global_includes('includ... | src = split('\n api/api_readholdingregisters.c\n pdu/readholdingregisters.c\n adu/rtu/rtu.c\n adu/rtu/mbcrc.c\n physical/serial.c\n auxiliary/log.c\n auxiliary/other.c\n api/mbm.c\n')
component = aos_component('mbmaster', src)
component.add_global_includes('includ... |
class Simulator:
# the maximum number of steps the agent should take before we interrupt him to break infinite cycles
max_steps = 500
# the recommended number of random game walkthroughs for vocabulary initialization
# should ideally cover all possible states and used words
initialization_iteratio... | class Simulator:
max_steps = 500
initialization_iterations = 1024
reward_scale = 1
game = None
def __init__(self):
raise not_implemented_error('Simulator is an abstract class.')
def restart(self):
raise not_implemented_error('Simulator is an abstract class.')
def startup_a... |
# Element der Fibonacci-Folge berechnen:
def fib(n):
if n == 0: # f(0) = 0
return 0
elif n == 1: # f(1) = 1
return 1
else: # f(n) = f(n-1) + f(n-2)
return fib (n-1) + fib (n-2)
# Ackermann-Funktion berechnen:
def ack(m,n):
if m == 0: # A(0,n) = n+1
return n+1
elif n == 0: # A(... | def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
def ack(m, n):
if m == 0:
return n + 1
elif n == 0:
return ack(m - 1, 1)
else:
return ack(m - 1, ack(m, n - 1))
def hailstone(n):
print(n)
if n != ... |
class To_int_ask:
def __init__(self):
pass
def func_(self):
try:
self.a = int(input('> '))
return self.a
except ValueError:
print('''Maybe you entered some str symbol's, try with out it''')
ret = self.func_()
retur... | class To_Int_Ask:
def __init__(self):
pass
def func_(self):
try:
self.a = int(input('> '))
return self.a
except ValueError:
print("Maybe you entered some str symbol's, try with out it")
ret = self.func_()
return ret |
"""
443. Two Sum - Greater than target
https://www.lintcode.com/problem/two-sum-greater-than-target/description
"""
class Solution:
"""
@param nums: an array of integer
@param target: An integer
@return: an integer
"""
def twoSum2(self, nums, target):
# write your code here
num... | """
443. Two Sum - Greater than target
https://www.lintcode.com/problem/two-sum-greater-than-target/description
"""
class Solution:
"""
@param nums: an array of integer
@param target: An integer
@return: an integer
"""
def two_sum2(self, nums, target):
nums = sorted(nums)
n = ... |
n,k=map(int, input().split())
s = input()
nums = []
sums = []
cnt = 1
for i in range(1, n):
if s[i - 1] != s[i]:
nums.append(int(s[i - 1]))
sums.append(cnt)
cnt = 1
else:
cnt += 1
candi = 0
ansli = []
if s[0] == "0":
if s[-1] == "0":
k = min(k, len(sums)//2 + 1)
... | (n, k) = map(int, input().split())
s = input()
nums = []
sums = []
cnt = 1
for i in range(1, n):
if s[i - 1] != s[i]:
nums.append(int(s[i - 1]))
sums.append(cnt)
cnt = 1
else:
cnt += 1
candi = 0
ansli = []
if s[0] == '0':
if s[-1] == '0':
k = min(k, len(sums) // 2 + 1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
add(1, 2) + "!"
result =add(1, 2) + "!"
result= add(1, 2) + "!"
result = add(1, 2) + "!"
x= add(1, 2) + "!"
def add(x: int, y: int) -> int:
add(1, 2) + "!"
result =add(1, 2) + "!"
result= add(1, 2) + "!"
result = add(1, 2) + "!"
x= add(1, 2) + "!"
def xadd(x: int,... | add(1, 2) + '!'
result = add(1, 2) + '!'
result = add(1, 2) + '!'
result = add(1, 2) + '!'
x = add(1, 2) + '!'
def add(x: int, y: int) -> int:
add(1, 2) + '!'
result = add(1, 2) + '!'
result = add(1, 2) + '!'
result = add(1, 2) + '!'
x = add(1, 2) + '!'
def xadd(x: int, y: int) -> int:
... |
#-- powertools.vendorize
''' script to vendorize dependencies for a module
'''
#-------------------------------------------------------------------------------------------------#
#-------------------------------------------------------------------------------------------------#
| """ script to vendorize dependencies for a module
""" |
# -*- coding: utf-8 -*-
#auth table for developer and others
#search bar(using keywords)
#public,private projects
#group accesses for many groups
#this for the main categories..
db.define_table('category',
Field('name',requires=(IS_SLUG(),IS_LOWER(),IS_NOT_IN_DB(db,'category.name'))))
##this is for sub_category
d... | db.define_table('category', field('name', requires=(is_slug(), is_lower(), is_not_in_db(db, 'category.name'))))
db.define_table('subcategory', field('category', 'reference category', requires=is_in_db(db, 'category.id', '%(name)s')), field('title', requires=(is_slug(), is_lower(), is_not_in_db(db, 'subcategory.title'),... |
num = 1
num = 2
num2 = 3
| num = 1
num = 2
num2 = 3 |
"""
Helper variables, lists, dictionaries, used for a clean display in the template.
"""
# Advanced Search Template Helpers -----------------------------------
SORT_OPTIONS_ORDER = ['Router Name', 'Fingerprint', 'Country Code',
'Bandwidth', 'Uptime', 'Last Descriptor Published',
... | """
Helper variables, lists, dictionaries, used for a clean display in the template.
"""
sort_options_order = ['Router Name', 'Fingerprint', 'Country Code', 'Bandwidth', 'Uptime', 'Last Descriptor Published', 'Hostname', 'IP Address', 'ORPort', 'DirPort', 'Platform', 'Contact', 'Authority', 'Bad Directory', 'Bad Exit',... |
PROJECT_URL = "https://github.com/sebiweise/Home-Assistant-Parcello/"
ISSUE_URL = "{}issues".format(PROJECT_URL)
DOMAIN = "parcello"
VERSION = "0.0.1"
ISSUE_URL = "https://github.com/sebiweise/Home-Assistant-Parcello/issues"
PLATFORM = "sensor"
API_BASEURL = "https://api-v4.parcello.org/v1/app"
# Configuration Proper... | project_url = 'https://github.com/sebiweise/Home-Assistant-Parcello/'
issue_url = '{}issues'.format(PROJECT_URL)
domain = 'parcello'
version = '0.0.1'
issue_url = 'https://github.com/sebiweise/Home-Assistant-Parcello/issues'
platform = 'sensor'
api_baseurl = 'https://api-v4.parcello.org/v1/app'
conf_scan_interval = 'sc... |
class DatabaseManipulator:
def __init__(self, conexao):
self.__conexao = conexao
self.__cursor = self.__conexao.cursor()
def getConexao(self):
return self.__conexao
def setConexao(self, conexao):
self.__conexao = conexao
def getCursor(self):
return self.__curso... | class Databasemanipulator:
def __init__(self, conexao):
self.__conexao = conexao
self.__cursor = self.__conexao.cursor()
def get_conexao(self):
return self.__conexao
def set_conexao(self, conexao):
self.__conexao = conexao
def get_cursor(self):
return self.__c... |
#
# Copyright 2017 Google Inc. All Rights Reserved.
#
# 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... | {'includes': ['../common.gypi'], 'variables': {'target_app_location_param': '<(PRODUCT_DIR)/demos'}, 'targets': [{'target_name': 'iondemohud_assets', 'type': 'static_library', 'includes': ['../dev/zipasset_generator.gypi'], 'dependencies': ['<(ion_dir)/port/port.gyp:ionport'], 'sources': ['res/iondemohud.iad']}, {'targ... |
"""
Two-Fer module.
"""
def two_fer(name="you"):
"""
:param name:str name of the person
:return str message.
"""
return f"One for {name}, one for me."
| """
Two-Fer module.
"""
def two_fer(name='you'):
"""
:param name:str name of the person
:return str message.
"""
return f'One for {name}, one for me.' |
N = int(input())
def get_impact(s: str):
strength = 1
impact = 0
for c in s:
if c == 'S':
impact += strength
else:
strength *= 2
return impact
for i in range(N):
d, p = input().split()
d = int(d)
sol = 0
if p.count('S') > d:
sol = ... | n = int(input())
def get_impact(s: str):
strength = 1
impact = 0
for c in s:
if c == 'S':
impact += strength
else:
strength *= 2
return impact
for i in range(N):
(d, p) = input().split()
d = int(d)
sol = 0
if p.count('S') > d:
sol = 'IMPOS... |
# -*- coding: utf-8 -*-
"""Top-level package for Movie Recommender."""
__author__ = """SPICED"""
__email__ = 'kristian@spiced-academy.com'
__version__ = '0.1.0'
| """Top-level package for Movie Recommender."""
__author__ = 'SPICED'
__email__ = 'kristian@spiced-academy.com'
__version__ = '0.1.0' |
#!/usr/bin/env python
"""
Copyright 2014 Denys Sobchyshak
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 a... | """
Copyright 2014 Denys Sobchyshak
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 agree... |
n = int(input())
if 0 <= n <= 100:
if n == 0:
print('E')
elif 1 <= n <= 35:
print('D')
elif 36 <= n <= 60:
print('C')
elif 61 <= n <= 85:
print('B')
elif 86 <= n <= 100:
print('A') | n = int(input())
if 0 <= n <= 100:
if n == 0:
print('E')
elif 1 <= n <= 35:
print('D')
elif 36 <= n <= 60:
print('C')
elif 61 <= n <= 85:
print('B')
elif 86 <= n <= 100:
print('A') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.