content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class MigrationBase:
initial = False
depends = []
actions = []
| class Migrationbase:
initial = False
depends = []
actions = [] |
'''Find the sum of all the multiples of 3 or 5 below N. '''
def sumaDeDivisores(n, divisor):
'''
:param n:
:param divisor:
:return: Suma todos los numeros menores a n que son divisibles por "divisor"
'''
#Formula de la sumatoria de los elemntos de una serie x*(x+1)//2
return (n//divisor)*(... | """Find the sum of all the multiples of 3 or 5 below N. """
def suma_de_divisores(n, divisor):
"""
:param n:
:param divisor:
:return: Suma todos los numeros menores a n que son divisibles por "divisor"
"""
return n // divisor * (divisor * (1 + n // divisor)) // 2
for _ in range(int(input())):
... |
def get_board():
list_board = [{'name': 'go',
'type': 'go'},
{'name': 'old kent road',
'type': 'road'},
{'name': 'community chest',
'type': 'community chest'},
{'name': 'whitechapel road',
... | def get_board():
list_board = [{'name': 'go', 'type': 'go'}, {'name': 'old kent road', 'type': 'road'}, {'name': 'community chest', 'type': 'community chest'}, {'name': 'whitechapel road', 'type': 'road'}, {'name': 'income tax', 'type': 'tax'}, {'name': 'kings cross station', 'type': 'station'}, {'name': 'the angel... |
expected_output = {
"next_reload_boot_variable": "harddisk:/c1100-universalk9.BLD_POLARIS_DEV_LATEST_20200517_102119.SSA.bin,12;harddisk:/genie-iedge-asr-uut,12;",
"active": {
"boot_variable": "harddisk:/c1100-universalk9.BLD_POLARIS_DEV_LATEST_20200517_102119.SSA.bin,12;harddisk:/genie-iedge-asr-uut,12... | expected_output = {'next_reload_boot_variable': 'harddisk:/c1100-universalk9.BLD_POLARIS_DEV_LATEST_20200517_102119.SSA.bin,12;harddisk:/genie-iedge-asr-uut,12;', 'active': {'boot_variable': 'harddisk:/c1100-universalk9.BLD_POLARIS_DEV_LATEST_20200517_102119.SSA.bin,12;harddisk:/genie-iedge-asr-uut,12;', 'configuration... |
# -*- coding: utf-8 -*-
def main():
n = int(input())
a = list(map(int, input().split()))
diff = float('inf')
ans = 0
ave = sum(a) / n
for i, ai in enumerate(a):
if abs(ai - ave) < diff:
diff = abs(ai - ave)
ans = i
print(ans)
if __name_... | def main():
n = int(input())
a = list(map(int, input().split()))
diff = float('inf')
ans = 0
ave = sum(a) / n
for (i, ai) in enumerate(a):
if abs(ai - ave) < diff:
diff = abs(ai - ave)
ans = i
print(ans)
if __name__ == '__main__':
main() |
# A point class is created to allow storing points as variables.
class Point2D:
def __init__(self, x: float, y: float):
self.x = x
self.y = y
| class Point2D:
def __init__(self, x: float, y: float):
self.x = x
self.y = y |
'''
For 50 points, modify your function from part 3. Your new
function should take as arguments:
an image,
an x, y, width, and height
and number of rows and number of columns
The function then uses two nested for loops to cut out both rows and
columns from the given image and returns them all in a list.
... | """
For 50 points, modify your function from part 3. Your new
function should take as arguments:
an image,
an x, y, width, and height
and number of rows and number of columns
The function then uses two nested for loops to cut out both rows and
columns from the given image and returns them all in a list.
... |
# ***************************************************************************************
# Title: LabAdvComp/parcel
# Author: Joshua S. Miller
# Date: May 26, 2016
# Code version: 0.1.13
# Availability: https://github.com/LabAdvComp/parcel
# *****************************************************************************... | gb = 1024 * 1024 * 1024
mb = 1024 * 1024
http_chunk_size = 1 * MB
save_interval = 1 * GB |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {}
modules = ["model.py"]
doc_url = "https://NuuttiSten.github.io/ml_project_template_test_nuutti/"
git_url = "https://github.com/NuuttiSten/ml_project_template_test_nuutti/tree/master/"
def custom_doc_lin... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {}
modules = ['model.py']
doc_url = 'https://NuuttiSten.github.io/ml_project_template_test_nuutti/'
git_url = 'https://github.com/NuuttiSten/ml_project_template_test_nuutti/tree/master/'
def custom_doc_links(name):
return None |
# Write your solution for 1.2 here!
i = 0
sum = 0
for i in range(101):
if(i%2==0):
sum = sum + i
print(sum) | i = 0
sum = 0
for i in range(101):
if i % 2 == 0:
sum = sum + i
print(sum) |
# -*- python -*-
load("@drake//tools/workspace:which.bzl", "which_repository")
def sphinx_repository(name):
which_repository(
name = name,
command = "sphinx-build",
additional_search_paths = [
"/usr/share/sphinx/scripts/python3",
],
allow_missing = True,
... | load('@drake//tools/workspace:which.bzl', 'which_repository')
def sphinx_repository(name):
which_repository(name=name, command='sphinx-build', additional_search_paths=['/usr/share/sphinx/scripts/python3'], allow_missing=True, build_epilog='print("DRAKE DEPRECATED: The @sphinx repository is being removed from Drake... |
#!/usr/bin/env python3
# Author: Emmanuel Odeke <odeke@ualberta.ca>
def reverseLenMap(wList):
# Return a map of length as keys and content as buckets
# where the buckets are hashmaps of word to a common sentinel
lenToWordBucketMap = dict()
for w in wList:
if isinstance(w, str):
wLe... | def reverse_len_map(wList):
len_to_word_bucket_map = dict()
for w in wList:
if isinstance(w, str):
w_len = len(w)
bucket = lenToWordBucketMap.get(wLen, None)
if bucket is None:
bucket = dict()
lenToWordBucketMap[wLen] = bucket
... |
COLORS = {
'background': (220, 21, 16),
'black': (220, 16, 23),
'red': (7, 77, 69),
'green': (85, 47, 62),
'yellow': (40, 93, 73),
'blue': (200, 93, 70),
'magenta': (260, 86, 85),
'cyan': (160, 57, 72),
'white': (0, 0, 78),
}
NAME = 'Ayu Mirage'
| colors = {'background': (220, 21, 16), 'black': (220, 16, 23), 'red': (7, 77, 69), 'green': (85, 47, 62), 'yellow': (40, 93, 73), 'blue': (200, 93, 70), 'magenta': (260, 86, 85), 'cyan': (160, 57, 72), 'white': (0, 0, 78)}
name = 'Ayu Mirage' |
def get_dic():
return [
u"password",
u"123456",
u"12345678",
u"1234",
u"qwerty",
u"12345",
u"dragon",
u"pussy",
u"baseball",
u"football",
u"letmein",
u"monkey",
u"696969",
u"abc123",
u"mustang",
... | def get_dic():
return [u'password', u'123456', u'12345678', u'1234', u'qwerty', u'12345', u'dragon', u'pussy', u'baseball', u'football', u'letmein', u'monkey', u'696969', u'abc123', u'mustang', u'michael', u'shadow', u'master', u'jennifer', u'111111', u'2000', u'jordan', u'superman', u'harley', u'1234567', u'fuckme... |
'''
Kattis - honey
Hm, the CP way to solve this is just to make a few terms and then throw it into OEIS and get the
first 14 terms. This is what I did. How it really works?... im not too sure
Maybe ill get back to it someday (or maybe not)
Time: O(1), Space: O(1)
'''
a = [1, 0, 6, 12, 90, 360, 2040, 10080, 54810, 2906... | """
Kattis - honey
Hm, the CP way to solve this is just to make a few terms and then throw it into OEIS and get the
first 14 terms. This is what I did. How it really works?... im not too sure
Maybe ill get back to it someday (or maybe not)
Time: O(1), Space: O(1)
"""
a = [1, 0, 6, 12, 90, 360, 2040, 10080, 54810, 2906... |
server = dict(
address="localhost",
port=5006
)
| server = dict(address='localhost', port=5006) |
class Pessoa:
olhos = 2
def __init__(self, *filhos, nome = None, idade = 19):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Ola {id(self)}'
@staticmethod
def metodo_estatico():
return 42
@classmethod
... | class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=19):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Ola {id(self)}'
@staticmethod
def metodo_estatico():
return 42
@classmethod
de... |
n = int(input('Type a number: '))
if n%2==0:
print('Even')
else:
print('Odd') | n = int(input('Type a number: '))
if n % 2 == 0:
print('Even')
else:
print('Odd') |
# coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
SNAKE_TO_CAMEL_CASE_TABLE = {
"annotation_selector": "annotationSelector",
"api_version": "apiVersion",
"excluded_paths": "excludedPaths",
"identity_... | snake_to_camel_case_table = {'annotation_selector': 'annotationSelector', 'api_version': 'apiVersion', 'excluded_paths': 'excludedPaths', 'identity_extra_field_selector': 'identityExtraFieldSelector', 'label_selector': 'labelSelector', 'last_transition_time': 'lastTransitionTime', 'locked_resource_statuses': 'lockedRes... |
def binary_search(a, x):
mid = tempmid = len(a)//2
while len(a) > 1:
if a[mid] > x:
a = a[:mid]
mid = len(a)//2
tempmid -= (len(a) - mid)
elif a[mid] < x:
a = a[mid + 1:]
mid = len(a)//2
tempmid += (mid + 1)
else:
... | def binary_search(a, x):
mid = tempmid = len(a) // 2
while len(a) > 1:
if a[mid] > x:
a = a[:mid]
mid = len(a) // 2
tempmid -= len(a) - mid
elif a[mid] < x:
a = a[mid + 1:]
mid = len(a) // 2
tempmid += mid + 1
else:
... |
class DecentralizedVariable:
def __init__(self, variable, base_class, is_training=False):
self.variable = variable
self.merger = base_class(variable.value, is_training=is_training)
def send(self):
self.merger.set(self.variable.value)
return self.merger.send()
def get(self):... | class Decentralizedvariable:
def __init__(self, variable, base_class, is_training=False):
self.variable = variable
self.merger = base_class(variable.value, is_training=is_training)
def send(self):
self.merger.set(self.variable.value)
return self.merger.send()
def get(self)... |
class NORTH:
@staticmethod
def advance(self, x, y):
return (x, y + 1)
@staticmethod
def turn_right(self):
return EAST
@staticmethod
def turn_left(self):
return WEST
class EAST:
@staticmethod
def advance(self, x, y):
return (x + 1, y)
@staticmethod... | class North:
@staticmethod
def advance(self, x, y):
return (x, y + 1)
@staticmethod
def turn_right(self):
return EAST
@staticmethod
def turn_left(self):
return WEST
class East:
@staticmethod
def advance(self, x, y):
return (x + 1, y)
@staticmetho... |
NORMAL = 'n'
SUMMER = 's'
ORI = 0
PH1 = 1
PH2 = 2
HOME = 0
BUSSINESS = 1
h_origin = {NORMAL: [(110, 2.1), (220, 2.68), (170, 3.27), (200, 3.55), (9999999, 3.97)],
SUMMER: [(110, 2.1), (220, 3.02), (170, 4.05), (200, 4.51), (9999999, 5.10)],}
h_phase1 = {NORMAL: [(120, 2.1), (210, 2.68), (170, 3.61), (2... | normal = 'n'
summer = 's'
ori = 0
ph1 = 1
ph2 = 2
home = 0
bussiness = 1
h_origin = {NORMAL: [(110, 2.1), (220, 2.68), (170, 3.27), (200, 3.55), (9999999, 3.97)], SUMMER: [(110, 2.1), (220, 3.02), (170, 4.05), (200, 4.51), (9999999, 5.1)]}
h_phase1 = {NORMAL: [(120, 2.1), (210, 2.68), (170, 3.61), (200, 4.01), (9999999... |
def row2dict(row) -> dict:
res = {}
for column in row.__table__.columns:
res[column.name] = str(getattr(row, column.name))
del(res['id'])
return res
def tuple2list(row) -> list:
res = [i for (i,) in row]
return res
| def row2dict(row) -> dict:
res = {}
for column in row.__table__.columns:
res[column.name] = str(getattr(row, column.name))
del res['id']
return res
def tuple2list(row) -> list:
res = [i for (i,) in row]
return res |
class Solution:
def maximalRectangle(self, matrix: List[List[str]]) -> int:
m = len(matrix)
if m == 0:
return 0
n = len(matrix[0])
if n == 0:
return 0
heights = [0] * (n + 1)
maxArea = 0
for i in range(m):
St = []
... | class Solution:
def maximal_rectangle(self, matrix: List[List[str]]) -> int:
m = len(matrix)
if m == 0:
return 0
n = len(matrix[0])
if n == 0:
return 0
heights = [0] * (n + 1)
max_area = 0
for i in range(m):
st = []
... |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
dct = {}
for i, n in enumerate(nums):
if n not in dct:
dct[target - n] = i
else:
return [dct[n], i] | class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
dct = {}
for (i, n) in enumerate(nums):
if n not in dct:
dct[target - n] = i
else:
return [dct[n], i] |
# encoding: utf-8
class cachedProperty(object):
def __init__(self, func):
self.func = func
def __get__(self, instance, type):
res = instance.__dict__[self.func.__name__] = self.func(instance)
return res
| class Cachedproperty(object):
def __init__(self, func):
self.func = func
def __get__(self, instance, type):
res = instance.__dict__[self.func.__name__] = self.func(instance)
return res |
# Python - 2.7.6
Test.describe('Basic tests')
Test.assert_equals(how_many_dalmatians(26), 'More than a handful!')
Test.assert_equals(how_many_dalmatians(8), 'Hardly any')
Test.assert_equals(how_many_dalmatians(14), 'More than a handful!')
Test.assert_equals(how_many_dalmatians(80), "Woah that's a lot of dogs!")
Test.a... | Test.describe('Basic tests')
Test.assert_equals(how_many_dalmatians(26), 'More than a handful!')
Test.assert_equals(how_many_dalmatians(8), 'Hardly any')
Test.assert_equals(how_many_dalmatians(14), 'More than a handful!')
Test.assert_equals(how_many_dalmatians(80), "Woah that's a lot of dogs!")
Test.assert_equals(how_m... |
print ('hello world')
print ("hello world")
print ("jhon")
print ("jhon kennedy")
print ("hi,I am python.")
print (25)
print (2*2)
print (2+5+9)
print ("20","+","2","=","22")
| print('hello world')
print('hello world')
print('jhon')
print('jhon kennedy')
print('hi,I am python.')
print(25)
print(2 * 2)
print(2 + 5 + 9)
print('20', '+', '2', '=', '22') |
foods = ['apples', 'bread', 'cheese', 'milk', 'banans', 'graves']
# print(foods[0])
# print(foods[1])
# print(foods[2])
# print(foods[3])
for food in foods:
if food == "cheese":
continue #break
print(food)
for number in range(1, 8):
print(number)
for letter in "Hello":
p... | foods = ['apples', 'bread', 'cheese', 'milk', 'banans', 'graves']
for food in foods:
if food == 'cheese':
continue
print(food)
for number in range(1, 8):
print(number)
for letter in 'Hello':
print(letter)
while count <= 10:
print(count)
count = count + 1 |
class Solution:
# @param n: an integer
# @return: a boolean which equals to True if the first player will win
def firstWillWin(self, n):
# write your code here
dp = [False] * 3
cur = 0
for i in xrange(n):
dp[-1] = not (dp[0] and dp[1])
dp[cur] = dp[-1... | class Solution:
def first_will_win(self, n):
dp = [False] * 3
cur = 0
for i in xrange(n):
dp[-1] = not (dp[0] and dp[1])
dp[cur] = dp[-1]
cur = (cur + 1) % 2
return dp[-1] |
load(":import_external.bzl", import_external = "import_external")
def dependencies():
import_external(
name = "org_portable_scala_portable_scala_reflect_2_12",
artifact = "org.portable-scala:portable-scala-reflect_2.12:1.1.1",
artifact_sha256 = "2eb8ee9df8ff1ecb3612552d2f6dbdbc17c149ad78dbe... | load(':import_external.bzl', import_external='import_external')
def dependencies():
import_external(name='org_portable_scala_portable_scala_reflect_2_12', artifact='org.portable-scala:portable-scala-reflect_2.12:1.1.1', artifact_sha256='2eb8ee9df8ff1ecb3612552d2f6dbdbc17c149ad78dbeef5ca56bc6ba964a956', srcjar_sha2... |
ROW_SIZE = 25
IMAGE_SIZE = 150
image = "2202212222221021222222222202222222212220102222222222222211022222222222222222210222222221222022222122222222222022222222202220022022222021222222222222222212212222221120222222222222222222202220222222222222222200022222222222222222220222222222222022222022222222222222222222212220022... | row_size = 25
image_size = 150
image = '2202212222221021222222222202222222212220102222222222222211022222222222222222210222222221222022222122222222222022222222202220022022222021222222222222222212212222221120222222222222222222202220222222222222222200022222222222222222220222222222222022222022222222222222222222212220022222... |
'''
Created on Jun 18, 2014
@author: lwoydziak
'''
class Inventory(object):
def __init__(self, provider):
self.__onProvider = provider
def __filter(self, nodes, byFilter, varible):
nodesOfInterest = [aNode for aNode in nodes if byFilter in getattr(aNode, varible)]
return nodesOfIntere... | """
Created on Jun 18, 2014
@author: lwoydziak
"""
class Inventory(object):
def __init__(self, provider):
self.__onProvider = provider
def __filter(self, nodes, byFilter, varible):
nodes_of_interest = [aNode for a_node in nodes if byFilter in getattr(aNode, varible)]
return nodesOfIn... |
'''Module holding adding functions.'''
def add_one(x):
return x + 1
def add_five(x):
return x + 5
| """Module holding adding functions."""
def add_one(x):
return x + 1
def add_five(x):
return x + 5 |
broker_url = 'amqp://rabbitmq_user:password@rabbitmq:5672/my_vhost'
enable_utc = True
accept_content = ['json']
accept_content = ['application/json']
# task 'send_async_email' will be delivered to queue 'email'
task_routes = {
'email.send_async_email': {'queue': 'email'}
}
result_backend = 'rpc://'
# messages wil... | broker_url = 'amqp://rabbitmq_user:password@rabbitmq:5672/my_vhost'
enable_utc = True
accept_content = ['json']
accept_content = ['application/json']
task_routes = {'email.send_async_email': {'queue': 'email'}}
result_backend = 'rpc://'
result_persistent = False |
tempPrecompFilePath = 'c:/users/paulm/appdata/local/temp/tmpii9wxy.precomp'
| temp_precomp_file_path = 'c:/users/paulm/appdata/local/temp/tmpii9wxy.precomp' |
# Program to count the pattern in a string :)
def count(string, patterns):
x = string.count(patterns) # Counting the patterns
return x
st = input("Enter the string :")
k = int(input("Enter the no of patterns :"))
sol = [] # Empty list to store answers
for i in range(k):
... | def count(string, patterns):
x = string.count(patterns)
return x
st = input('Enter the string :')
k = int(input('Enter the no of patterns :'))
sol = []
for i in range(k):
pattern = input('enter the pattern :')
sol.append(count(st, pattern))
for i in sol:
print(i) |
#factors
def factors():
a = int(input("Type num"))
factors = [1]
i = 2
while(i <= a):
if(a%i == 0):
factors.append(i)
i += 1
print(factors)
factors()
| def factors():
a = int(input('Type num'))
factors = [1]
i = 2
while i <= a:
if a % i == 0:
factors.append(i)
i += 1
print(factors)
factors() |
def setup():
global dots
size(800, 600)
dots = []
for _ in range(50):
# dots.append([random(width), random(height), random(-5, 5), random(-5, 5)])
dots.append({
"x": random(width),
"y": random(height),
"vx": random(-5, 5),
... | def setup():
global dots
size(800, 600)
dots = []
for _ in range(50):
dots.append({'x': random(width), 'y': random(height), 'vx': random(-5, 5), 'vy': random(-5, 5)})
def draw():
background(200)
closest = None
closest_d = 0
for pos in dots:
stroke_weight(8)
point... |
#!/usr/bin/env python3
# This would be a good place for utility functions.
def utility():
pass
| def utility():
pass |
def cap_first(s):
return s[0].upper() + s[1:]
def get_cleaned_token(string_value):
output = ' '.join(partial.strip() for partial in string_value.split('\n'))
output = ' '.join(partial.strip() for partial in output.split('\t'))
output = ' '.join(partial.strip() for partial in output.split('\r'))
ou... | def cap_first(s):
return s[0].upper() + s[1:]
def get_cleaned_token(string_value):
output = ' '.join((partial.strip() for partial in string_value.split('\n')))
output = ' '.join((partial.strip() for partial in output.split('\t')))
output = ' '.join((partial.strip() for partial in output.split('\r')))
... |
class Packet(object):
def __init__(self, message_id: int, packet_id: int, total_packets: int,
information: str):
self.message_id = message_id
self.packet_id = packet_id
self.total = total_packets
self.information = information
def __lt__(self, other):
re... | class Packet(object):
def __init__(self, message_id: int, packet_id: int, total_packets: int, information: str):
self.message_id = message_id
self.packet_id = packet_id
self.total = total_packets
self.information = information
def __lt__(self, other):
return self.packet... |
# Object oriented programming example
class Dog:
def __init__(self, name, age):
self.name = name
self.age = age
def get_name(self):
return self.name
def get_age(self):
return self.age
def change_name(self, name):
self.name = name
def set_age(self, age):
self.age = age
def bark(self):
print("b... | class Dog:
def __init__(self, name, age):
self.name = name
self.age = age
def get_name(self):
return self.name
def get_age(self):
return self.age
def change_name(self, name):
self.name = name
def set_age(self, age):
self.age = age
def bark(se... |
class Record(object):
def __init__(self, line):
timestamp, uf_time, serial, state = line[:-1].split(',')
self.timestamp = int(timestamp)
self.uf_time = uf_time
self.serial = serial
self.state = int(state)
input_file = open('question.in')
input_data = input_file.readlines()
... | class Record(object):
def __init__(self, line):
(timestamp, uf_time, serial, state) = line[:-1].split(',')
self.timestamp = int(timestamp)
self.uf_time = uf_time
self.serial = serial
self.state = int(state)
input_file = open('question.in')
input_data = input_file.readlines()... |
VOCAB = {} #key = word, value = number of documents word appears in
VECTOR = [] #list of vocab words to model the bag-of-words after
PATHS = {'TRAIN':'datasets/train/{}/',
'VALID':'datasets/valid/{}/'}
TOTALS = {'TRAIN':5659,
'VALID':611}
LABELS = {0:'A',1:'B',2:'C',3:'D',4:'E',5:'F',6:'G',7:'H',... | vocab = {}
vector = []
paths = {'TRAIN': 'datasets/train/{}/', 'VALID': 'datasets/valid/{}/'}
totals = {'TRAIN': 5659, 'VALID': 611}
labels = {0: 'A', 1: 'B', 2: 'C', 3: 'D', 4: 'E', 5: 'F', 6: 'G', 7: 'H', 8: 'I'}
ignored_files = ['.DS_Store'] |
class Piece():
def __init__(self):
self.avatar = None
self.direction = None
self.boardRow = self.boardColumn = None
self.x = self.y = 0
self.isKing = False
def move(self,):
pass | class Piece:
def __init__(self):
self.avatar = None
self.direction = None
self.boardRow = self.boardColumn = None
self.x = self.y = 0
self.isKing = False
def move(self):
pass |
#l for lion not 1(one)
l = []
print(l)
print(type(l))
l = [1, 2, 3]
print(l)
l = list()
print(l)
l = list([1, 2, 3])
print(l)
# the length function gives the length
print("length is ", len(l))
# list is an ordered collection. and indexing starts at 0
print("0: ", l[0], " 1: ", l[1], " 2: ", l[2])
# We can also use... | l = []
print(l)
print(type(l))
l = [1, 2, 3]
print(l)
l = list()
print(l)
l = list([1, 2, 3])
print(l)
print('length is ', len(l))
print('0: ', l[0], ' 1: ', l[1], ' 2: ', l[2])
print('-1: ', l[-1], ' -2: ', l[-2], ' -3: ', l[-3])
n = len(1) |
arq = open("hdi.csv","r")
texto = arq.readlines()
arq.close()
cont = 3
for indice in range(1,len(texto)):
if " " in texto[indice][0:cont]:
texto[indice] = texto[indice][cont:]
if indice > 9 and indice < 99:
cont = 4
if indice > 99 and indice < 999:
cont = 5
if indice > 999 and in... | arq = open('hdi.csv', 'r')
texto = arq.readlines()
arq.close()
cont = 3
for indice in range(1, len(texto)):
if ' ' in texto[indice][0:cont]:
texto[indice] = texto[indice][cont:]
if indice > 9 and indice < 99:
cont = 4
if indice > 99 and indice < 999:
cont = 5
if indice > 999 and ... |
fileconnection = open("olympics.txt", "r")
lines = fileconnection.readlines()
header = lines[0]
field_names = header.strip().split(',')
for row in lines[1:] :
vals = row.strip().split(',')
if vals[5] != "NA" :
print("{}: {}; {}".format(vals[0],vals[4],vals[5]))
fileconnection.close()
| fileconnection = open('olympics.txt', 'r')
lines = fileconnection.readlines()
header = lines[0]
field_names = header.strip().split(',')
for row in lines[1:]:
vals = row.strip().split(',')
if vals[5] != 'NA':
print('{}: {}; {}'.format(vals[0], vals[4], vals[5]))
fileconnection.close() |
class Solution:
def calculate(self, s: str) -> int:
stack=[]
operand=0
res=0
sign=1
for i in s:
if i.isdigit():
operand=operand*10+int(i)
continue
if i =="+":
res=res+operand*sign
... | class Solution:
def calculate(self, s: str) -> int:
stack = []
operand = 0
res = 0
sign = 1
for i in s:
if i.isdigit():
operand = operand * 10 + int(i)
continue
if i == '+':
res = res + operand * sign
... |
# Copyright (c) 2010 ActiveState Software Inc. All rights reserved.
__version_info__ = ('1', '2')
__version__ = '.'.join(__version_info__) + '.dev'
| __version_info__ = ('1', '2')
__version__ = '.'.join(__version_info__) + '.dev' |
#
# PySNMP MIB module ERICSSON-ROUTER-SMI (http://pysnmp.sf.net)
# ASN.1 source file://\usr\share\snmp\ERICSSON-ROUTER-SMI.my
# Produced by pysmi-0.0.6 at Tue Aug 02 15:20:36 2016
# On host ? platform ? version ? by user ?
# Using Python version 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (I... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2014-10-26 16:54:01
# @Author : yml_bright@163.com
API_URL = 'http://127.0.0.1/webserv2/'
CONNECT_TIME_OUT = 7
TERM = '14-15-2'
| api_url = 'http://127.0.0.1/webserv2/'
connect_time_out = 7
term = '14-15-2' |
# Think about how to improved based on this basis
def mincoin(coins, target):
coins.sort()
cnt = target
for coin in coins:
if target - coin >= 0:
tmp = 1 + mincoin(coins, target - coin)
if cnt > tmp:
cnt = tmp
else:
break
return cnt
... | def mincoin(coins, target):
coins.sort()
cnt = target
for coin in coins:
if target - coin >= 0:
tmp = 1 + mincoin(coins, target - coin)
if cnt > tmp:
cnt = tmp
else:
break
return cnt
print
mincoin([1, 2], 3) |
class TimeSimulator:
def __init__(self, start_time):
self.timestamp = start_time
self.date = start_time.date()
self.first = True
# maybe skip day if time tick is not in data
def time_tick(self, interval):
self.timestamp += interval
if self.timestamp.date()... | class Timesimulator:
def __init__(self, start_time):
self.timestamp = start_time
self.date = start_time.date()
self.first = True
def time_tick(self, interval):
self.timestamp += interval
if self.timestamp.date() != self.date:
self.first = True
se... |
class Registros():
def __init__(self, clave, registro):
self.clave = clave
self.registro = registro
def getClave(self):
return self.clave
def getRegistro(self):
return self.registro
| class Registros:
def __init__(self, clave, registro):
self.clave = clave
self.registro = registro
def get_clave(self):
return self.clave
def get_registro(self):
return self.registro |
def setup():
size(400, 400)
def draw():
fill(200, 200, 0)
circle(width/2, width/2, 200)
| def setup():
size(400, 400)
def draw():
fill(200, 200, 0)
circle(width / 2, width / 2, 200) |
def billboard(name, price=30):
accu = 0
for _ in name:
accu += price
return accu | def billboard(name, price=30):
accu = 0
for _ in name:
accu += price
return accu |
courses= ("Python Programming" , "RDBMS" ,"Web Technology","Software Engineering")
electives = ("Business Intelligence","Big Data Analytics")
# number of courses opted
print("Number of courses opted =",len(courses))
#List all the courses
print("Courses opted are=",courses)
print("Updated tuple with elective courses=... | courses = ('Python Programming', 'RDBMS', 'Web Technology', 'Software Engineering')
electives = ('Business Intelligence', 'Big Data Analytics')
print('Number of courses opted =', len(courses))
print('Courses opted are=', courses)
print('Updated tuple with elective courses=', courses + electives) |
__author__ = 'elias'
class ArrayList(object):
def __init__(self):
self.size = 0
self.capacity = 0
self.array = []
def getSize(self):
return self.size
def getCapacity(self):
return self.capacity
def setCapacity(self, newCapacity):
temp = []
for... | __author__ = 'elias'
class Arraylist(object):
def __init__(self):
self.size = 0
self.capacity = 0
self.array = []
def get_size(self):
return self.size
def get_capacity(self):
return self.capacity
def set_capacity(self, newCapacity):
temp = []
... |
with open('data/arch-spec') as f:
specs = f.read()
CODES = {}
for line in specs.splitlines()[35::2]:
name, spec = line.split(': ')
code, *args = spec.split()
CODES[int(code)] = name, len(args)
if __name__ == '__main__':
for code, (name, n_args) in sorted(CODES.items()):
print(f'Opcode {co... | with open('data/arch-spec') as f:
specs = f.read()
codes = {}
for line in specs.splitlines()[35::2]:
(name, spec) = line.split(': ')
(code, *args) = spec.split()
CODES[int(code)] = (name, len(args))
if __name__ == '__main__':
for (code, (name, n_args)) in sorted(CODES.items()):
print(f'Opcod... |
a1= 1
va= "hola mundo" #string
num= 2.5 #punto flotante
com =2+3j
#operaciones
#suma,resta,multiplicacion y division
a3= 1//3
print (a3)
tnum = num//3.4
print (tnum)
#otros operadores
#< >
#<= >= == !=
| a1 = 1
va = 'hola mundo'
num = 2.5
com = 2 + 3j
a3 = 1 // 3
print(a3)
tnum = num // 3.4
print(tnum) |
# Support code
class Event:
def __init__(self, time, is_start):
self.time = time
self.is_start = is_start
def __lt__(self, other):
if self.time == other.time:
return not self.is_start
return self.time < other.time
# Problem code
def minMeetingRooms(intervals):
... | class Event:
def __init__(self, time, is_start):
self.time = time
self.is_start = is_start
def __lt__(self, other):
if self.time == other.time:
return not self.is_start
return self.time < other.time
def min_meeting_rooms(intervals):
events = []
for interval... |
DATA_PATH = '../input/data.txt'
MODEL_PATH = '../models/'
EMBEDDING_DIM = 100
PAD_TYPE = 'pre'
# BATCH_SIZE = 64
LEARNING_RATE = 1e-3
NUM_EPOCHS = 100
GENERATE_WORDS = 100
| data_path = '../input/data.txt'
model_path = '../models/'
embedding_dim = 100
pad_type = 'pre'
learning_rate = 0.001
num_epochs = 100
generate_words = 100 |
cmds_t = {
969:"Quick Open File",
800:"Open File",
801:"Open DVD/BD",
802:"Open Device",
976:"Reopen File",
24044:"Move to Recycle Bin",
805:"Save a Copy",
806:"Save Image",
807:"Save Image (auto)",
808:"Save thumbnails",
809:"Load Subtitle",
810:"Save Subtitle",
804:"Close",
814:"Properties... | cmds_t = {969: 'Quick Open File', 800: 'Open File', 801: 'Open DVD/BD', 802: 'Open Device', 976: 'Reopen File', 24044: 'Move to Recycle Bin', 805: 'Save a Copy', 806: 'Save Image', 807: 'Save Image (auto)', 808: 'Save thumbnails', 809: 'Load Subtitle', 810: 'Save Subtitle', 804: 'Close', 814: 'Properties', 816: 'Exit',... |
word1, word2 = input("Enter the two words: ").split()
if word1 == word2:
print("All of the characters from these words are the same!")
exit(0)
else:
k = 0
for i in range(len(word1)):
if word1[i] in word2[i]:
k += 1
else:
break
print(f"There are {k} of the same fir... | (word1, word2) = input('Enter the two words: ').split()
if word1 == word2:
print('All of the characters from these words are the same!')
exit(0)
else:
k = 0
for i in range(len(word1)):
if word1[i] in word2[i]:
k += 1
else:
break
print(f'There are {k} of the same f... |
#Bubble Sort
def bubbleSort(array):
#the outer loop will traverse through all the element starting from the 0th index to n-1
for i in range(0, len(array)-1):
#the inner loop will traverse through all elements except the last element as it is sorted and is in a fixed position
for j in range(0, le... | def bubble_sort(array):
for i in range(0, len(array) - 1):
for j in range(0, len(array) - 1 - i):
if array[j] > array[j + 1]:
(array[j], array[j + 1]) = (array[j + 1], array[j])
inp = input('Enter a list of numbers separated by commas: ').split(',')
array = [int(num) for num in i... |
# ttaset
class GroupHelper:
def __init__(self, app):
self.app = app
def open_group_page(self):
wd = self.app.wd
# open group page
if not wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new")) > 0:
wd.find_element_by_link_text("groups").click(... | class Grouphelper:
def __init__(self, app):
self.app = app
def open_group_page(self):
wd = self.app.wd
if not wd.current_url.endswith('/group.php') and len(wd.find_elements_by_name('new')) > 0:
wd.find_element_by_link_text('groups').click()
def select_first_group(self)... |
{
"targets": [{
"target_name": "utp_native",
'dependencies': [
'deps/libutp.gyp:libutp',
],
"include_dirs": [
"<!(node -e \"require('napi-macros')\")",
"deps/libutp",
],
"sources": [
"./binding.cc",
],
'xcode_settings': {
'OTHER_CFLAGS': [
'-O3',
... | {'targets': [{'target_name': 'utp_native', 'dependencies': ['deps/libutp.gyp:libutp'], 'include_dirs': ['<!(node -e "require(\'napi-macros\')")', 'deps/libutp'], 'sources': ['./binding.cc'], 'xcode_settings': {'OTHER_CFLAGS': ['-O3']}, 'cflags': ['-O3'], 'conditions': [['OS=="android"', {'cflags': ['-fPIC'], 'ldflags':... |
SCREEN_W = 800
SCREEN_H = 600
CODER_W = 20
CODER_H = 20
CURSOR_W = 8
CURSOR_H = 12
BUG_W = 30
BUG_H = 30
BUG_FIELD_Y = 50
BUG_FIELD_X = 50
SNIPPET_SPEED = 0.2
EXCEPTIE_H = 30
EXCEPTIE_W = 30
EXCEPTIE_SPEED = .1
# Points / Level
LEVEL_1_POINTS = 15
LEVEL_2_POINTS = 100
LEVEL_3_POINTS = 750... | screen_w = 800
screen_h = 600
coder_w = 20
coder_h = 20
cursor_w = 8
cursor_h = 12
bug_w = 30
bug_h = 30
bug_field_y = 50
bug_field_x = 50
snippet_speed = 0.2
exceptie_h = 30
exceptie_w = 30
exceptie_speed = 0.1
level_1_points = 15
level_2_points = 100
level_3_points = 750
level_4_points = 3500
level_5_points = 10000
m... |
# A collection of functions to create displays of different MSG RGB products
# These are standard SEVIRI RGBs designed to work with data from
# the MSG series (Meteosat-8 through Meteosat-11) and were provided
# by EUMETSAT (HansPeter Roesli). These functions were last revised
# by EUMETSAT on 12/15/2011 and were ori... | def msg_airmass_rgb(b5T, b6T, b8T, b9T):
red = rescale(b5T - b6T, -25, 0, 0, 255)
grn = rescale(b8T - b9T, -40, 5, 0, 255)
blu = rescale(b5T, 243, 208, 0, 255)
return combine_rgb(red, grn, blu)
def msg24_hr_microphysics_rgb(b9T, b7T, b10T):
red = rescale(b10T - b9T, -4, 2, 0, 255)
grn = 255 * r... |
def all_even():
n=0
while True:
yield n
n += 2
my_gen = all_even();
for i in range(5):
print(next(my_gen))
for i in range(2):
print(next(my_gen)) | def all_even():
n = 0
while True:
yield n
n += 2
my_gen = all_even()
for i in range(5):
print(next(my_gen))
for i in range(2):
print(next(my_gen)) |
class AXLClientSettings(object):
def __init__(self, host, user, passwd, path, version,
schema_path=None, suds_config=None, proxy=dict(),
transport_debugger=False):
self.host = host
self.user = user
self.passwd = passwd
self.path = path
self... | class Axlclientsettings(object):
def __init__(self, host, user, passwd, path, version, schema_path=None, suds_config=None, proxy=dict(), transport_debugger=False):
self.host = host
self.user = user
self.passwd = passwd
self.path = path
self.schema_path = schema_path
... |
class isotopomer_netRxns():
def __init__(self):
self.isotopomer_rxns_net = {};
self.isotopomer_rxns_net = self.define_netRxns();
def define_netRxns(self):
isotopomer_rxns_net = {};
isotopomer_rxns_net.update(self.define_netRxns_iDM2014_reversible());
#isotopomer_rxns_net... | class Isotopomer_Netrxns:
def __init__(self):
self.isotopomer_rxns_net = {}
self.isotopomer_rxns_net = self.define_netRxns()
def define_net_rxns(self):
isotopomer_rxns_net = {}
isotopomer_rxns_net.update(self.define_netRxns_iDM2014_reversible())
return isotopomer_rxns_n... |
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
l = []
for i in range(m):
x = int(input())
l.append(x)
cnt = 0
count = [True]*(10**6)
suffix = [0] * n
for i in range(n-1, -1, -1):
if count[a[i]] == True:
cnt += 1
suffix[i] = cnt
count[a[i]] = False
else:... | (n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
l = []
for i in range(m):
x = int(input())
l.append(x)
cnt = 0
count = [True] * 10 ** 6
suffix = [0] * n
for i in range(n - 1, -1, -1):
if count[a[i]] == True:
cnt += 1
suffix[i] = cnt
count[a[i]] = False
el... |
def compact(seq):
for i, val in enumerate(seq):
if i == 0 or val != last:
yield val
last = val
| def compact(seq):
for (i, val) in enumerate(seq):
if i == 0 or val != last:
yield val
last = val |
SK = ['0x1800',
'0x1811',
'0x1815',
'0x180F',
'0x183B',
'0x1810',
'0x181B',
'0x181E',
'0x181F',
'0x1805',
'0x1818',
'0x1816',
'0x180A',
'0x183C',
'0x181A',
'0x1826',
'0x1801',
'0x1808',
'0x1809',
'0x180D'... | sk = ['0x1800', '0x1811', '0x1815', '0x180F', '0x183B', '0x1810', '0x181B', '0x181E', '0x181F', '0x1805', '0x1818', '0x1816', '0x180A', '0x183C', '0x181A', '0x1826', '0x1801', '0x1808', '0x1809', '0x180D', '0x1823', '0x1812', '0x1802', '0x1821', '0x183A', '0x1820', '0x1803', '0x1819', '0x1827', '0x1828', '0x1807', '0x1... |
class Graduate_Student:
number_of_graduate_students = 0
def __init__(self, name, credits):
self.name = name
self.credits = credits
def __str__(self):
s = "Department: "+self.name+", Course Credits: "+str(self.credits)
return s
# Write your codes here.
class MSc_Student(Gr... | class Graduate_Student:
number_of_graduate_students = 0
def __init__(self, name, credits):
self.name = name
self.credits = credits
def __str__(self):
s = 'Department: ' + self.name + ', Course Credits: ' + str(self.credits)
return s
class Msc_Student(Graduate_Student):
... |
RWS_DEFAULT_OPTIONS = {
'workflow_lock_required': False,
'release_workflow_lock_on_completion': True,
'release_workflow_lock_on_init': False,
'resource_lock_required': False,
'release_resource_lock_on_completion': True,
'release_resource_lock_on_init': False,
}
| rws_default_options = {'workflow_lock_required': False, 'release_workflow_lock_on_completion': True, 'release_workflow_lock_on_init': False, 'resource_lock_required': False, 'release_resource_lock_on_completion': True, 'release_resource_lock_on_init': False} |
class Currency:
def __init__(self, acronym, name):
self.acronym = acronym
self.name = name
def _currency_list_to_dict(currencies):
return {
currency.acronym: currency
for currency in currencies
}
_default_currencies = _currency_list_to_dict([
Currency('AUD', 'Austral... | class Currency:
def __init__(self, acronym, name):
self.acronym = acronym
self.name = name
def _currency_list_to_dict(currencies):
return {currency.acronym: currency for currency in currencies}
_default_currencies = _currency_list_to_dict([currency('AUD', 'Australia Dollar'), currency('GBP', '... |
'''
A message containing letters from A-Z can be encoded into numbers using the following mapping:
'A' -> "1"
'B' -> "2"
...
'Z' -> "26"
To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For example, "11106" c... | """
A message containing letters from A-Z can be encoded into numbers using the following mapping:
'A' -> "1"
'B' -> "2"
...
'Z' -> "26"
To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For example, "11106" c... |
def is_correct(s):
lst = list()
for i in s:
if i == '(':
lst.append(i)
elif i ==')':
if not lst:
return False
lst.pop()
if not lst:
return True
else:
return False
while True:
try:
exp = input()
flag = is_correct(ex... | def is_correct(s):
lst = list()
for i in s:
if i == '(':
lst.append(i)
elif i == ')':
if not lst:
return False
lst.pop()
if not lst:
return True
else:
return False
while True:
try:
exp = input()
flag ... |
n = int(input())
a = sorted(map(int, input().split(' ')))
ans = [0]*n
for i in range(n):
ans[i] = a[i//2] if i%2 == 0 else a[(i+n)//2]
print(' '.join(map(str, ans)))
| n = int(input())
a = sorted(map(int, input().split(' ')))
ans = [0] * n
for i in range(n):
ans[i] = a[i // 2] if i % 2 == 0 else a[(i + n) // 2]
print(' '.join(map(str, ans))) |
def nwd(a, b):
while b:
a, b = b, a % b
return a
number_of_cases = input()
for x in range(int(number_of_cases)):
line = input()
numbers = list(line.split(" "))
num1 = int(numbers[0])
num2 = int(numbers[1])
print(int((num1 * num2) / nwd(num1, num2)))
| def nwd(a, b):
while b:
(a, b) = (b, a % b)
return a
number_of_cases = input()
for x in range(int(number_of_cases)):
line = input()
numbers = list(line.split(' '))
num1 = int(numbers[0])
num2 = int(numbers[1])
print(int(num1 * num2 / nwd(num1, num2))) |
display = DecisionBoundaryDisplay.from_estimator(
tree, X_train, cmap=plt.cm.RdBu_r, alpha=0.5,
)
_ = data_train.plot.scatter(
x="Feature #0",
y="Feature #1",
c="Classes",
s=50,
cmap=plt.cm.RdBu_r,
ax=display.ax_
)
| display = DecisionBoundaryDisplay.from_estimator(tree, X_train, cmap=plt.cm.RdBu_r, alpha=0.5)
_ = data_train.plot.scatter(x='Feature #0', y='Feature #1', c='Classes', s=50, cmap=plt.cm.RdBu_r, ax=display.ax_) |
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non... | class Changecontextrequest(object):
def __init__(self):
self.action = None
self.contextName = None
def get_action(self):
return self.action
def set_action(self, action):
self.action = action
def get_context_name(self):
return self.contextName
def set_cont... |
# Simple function which returns message as pong in json
def ping_pong(event, context):
response = {
"statusCode": 200,
"body": {"message": "pong"}
}
return response
| def ping_pong(event, context):
response = {'statusCode': 200, 'body': {'message': 'pong'}}
return response |
print("sumayresta")
| print('sumayresta') |
#
# PySNMP MIB module DEVICE (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DEVICE
# Produced by pysmi-0.3.4 at Wed May 1 12:41:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ... |
# ---------------- User Configuration Settings for speed-cam.py ---------------------------------
# Ver 5.00 search-speed.py Variable Configuration Settings
# ======================================
# speed-search.py variable settings
# ======================================
# Display and Log settings... | search_verbose = True
search_log_to_file = False
search_logfile_path = 'speed-search.log'
search_gui_on = False
search_match_value = 0.97
search_source_images_path = 'media/images'
search_copy_on = True
search_dest_path = 'media/search'
search_using_csv = True
search_csv_path = 'speed-cam.csv'
search_data_on_image = Tr... |
def expand_x_1(n):
# This version uses a generator and thus less computations
c =1
for i in range(n/2+1):
c = c*(n-i)/(i+1)
yield c
def aks(p):
if p==2:
return True
for i in expand_x_1(p):
if i % p:
# we stop without computing all possible solutions
retur... | def expand_x_1(n):
c = 1
for i in range(n / 2 + 1):
c = c * (n - i) / (i + 1)
yield c
def aks(p):
if p == 2:
return True
for i in expand_x_1(p):
if i % p:
return False
return True
def expand_x_1(p):
ex = [1]
for i in range(p):
ex.append(e... |
#!/usr/bin/env python3
### IMPORTS ###
### GLOBALS ###
### FUNCTIONS ###
### CLASSES ###
class LicenseHandlerBase:
def import_license(self, license_data):
# Used to import a license from an external transport mechanism, such as a file.
raise NotImplementedError
def export_license(self, iden... | class Licensehandlerbase:
def import_license(self, license_data):
raise NotImplementedError
def export_license(self, identifier):
raise NotImplementedError
def generate_license(self):
raise NotImplementedError
def validate_license(self, identifier):
raise NotImplement... |
triangle = []
with open("trianglebig.txt") as f:
content = f.readlines()
for line in content:
nums = line.split(" ");
numsInt = []
for num in nums:
numsInt.append(int(num))
triangle.append(numsInt)
triangle = triangle[::-1]
for row in range(1, len(triangle)):
for index in range(0, len(tri... | triangle = []
with open('trianglebig.txt') as f:
content = f.readlines()
for line in content:
nums = line.split(' ')
nums_int = []
for num in nums:
numsInt.append(int(num))
triangle.append(numsInt)
triangle = triangle[::-1]
for row in range(1, len(triangle)):
for ... |
class CBWCve(object):
def __init__(self,
content="",
created_at="",
cve_code="",
cve_score="",
last_modified="",
published="",
updated_at=""):
self.content = content
self.created_at... | class Cbwcve(object):
def __init__(self, content='', created_at='', cve_code='', cve_score='', last_modified='', published='', updated_at=''):
self.content = content
self.created_at = created_at
self.cve_code = cve_code
self.cve_score = cve_score
self.last_modified = last_mo... |
pre = 0
for x in range(int(input())):
da = int(input())
if(da%2==0):
print(int(da/2))
else:
print(pre)
x = 0
f = 0
if (da < 0):
f = 1
da = da * -1
if(pre == 0):
x= int(da/2)
pre = 1
else:
x = int(da+1)/2
pre = 0
if(f == 1):
print(int(x*-1))
else:
print(int(x))
| pre = 0
for x in range(int(input())):
da = int(input())
if da % 2 == 0:
print(int(da / 2))
else:
print(pre)
x = 0
f = 0
if da < 0:
f = 1
da = da * -1
if pre == 0:
x = int(da / 2)
pre = 1
else:
... |
k = int(input())
n = k
while n >= 5:
if k%n == 0 and k//n >= 5:
break
n-=1
if n < 5:
print(-1)
else:
for i in range(n):
for j in range(k//n):
print('aeiou'[(i+j)%5], end = '') | k = int(input())
n = k
while n >= 5:
if k % n == 0 and k // n >= 5:
break
n -= 1
if n < 5:
print(-1)
else:
for i in range(n):
for j in range(k // n):
print('aeiou'[(i + j) % 5], end='') |
# Two pointer approach. Initiate i, j = 0, 1. Keep i on even terms, j on odd. Increment by 2 if correct, else swap.
class Solution:
def sortArrayByParityII(self, A: List[int]) -> List[int]:
i, j = 0, 1
while i<len(A) and j<len(A):
# is is for even and j is for odd
... | class Solution:
def sort_array_by_parity_ii(self, A: List[int]) -> List[int]:
(i, j) = (0, 1)
while i < len(A) and j < len(A):
if A[i] % 2 == 0:
i += 2
continue
if A[j] % 2 != 0:
j += 2
continue
(A[i... |
# Python - 3.6.0
test.assert_equals(openOrSenior([[45, 12], [55, 21], [19, -2], [104, 20]]), ['Open', 'Senior', 'Open', 'Senior'])
test.assert_equals(openOrSenior([[16, 23], [73, 1], [56, 20], [1, -1]]), ['Open', 'Open', 'Senior', 'Open'])
| test.assert_equals(open_or_senior([[45, 12], [55, 21], [19, -2], [104, 20]]), ['Open', 'Senior', 'Open', 'Senior'])
test.assert_equals(open_or_senior([[16, 23], [73, 1], [56, 20], [1, -1]]), ['Open', 'Open', 'Senior', 'Open']) |
class OrgAuthFactor:
types = {
'id': str,
'factorType': str,
'provider': str,
'status': str
}
def __init__(self):
self.id = None # str
self.factorType = None # str
self.provider = None # str
self.status = None # str
self.link... | class Orgauthfactor:
types = {'id': str, 'factorType': str, 'provider': str, 'status': str}
def __init__(self):
self.id = None
self.factorType = None
self.provider = None
self.status = None
self.links = None
self.embedded = None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.