content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def make_pizza(*toppings):
print(toppings)
# for item in toppings:
# print("Add " + item)
| def make_pizza(*toppings):
print(toppings) |
class Solution:
def numSplits(self, s: str) -> int:
answer=0
left=[0]*26
right=[0]*26
for x in s:
right[ord(x)-ord('a')]+=1
leftNum=0
rightNum=sum(x > 0 for x in right)
for x in s:
index=ord(x)-ord('a')
if left[in... | class Solution:
def num_splits(self, s: str) -> int:
answer = 0
left = [0] * 26
right = [0] * 26
for x in s:
right[ord(x) - ord('a')] += 1
left_num = 0
right_num = sum((x > 0 for x in right))
for x in s:
index = ord(x) - ord('a')
... |
#!/usr/bin/python3
# -*- mode: python; coding: utf-8 -*-
VERSION=1
TEMPLATE_KEY_PREFIX = 'jflow.template'
SEPARATOR_KEY = '.'
KEY_VERSION = 'version'
KEY_FORK = 'fork'
KEY_UPSTREAM = 'upstream'
KEY_PUBLIC = 'public'
KEY_DEBUG = 'debug'
KEY_REMOTE = 'remote'
KEY_MERGE_TO = 'merge-to'
KEY_EXTRA = 'extra'
# Template... | version = 1
template_key_prefix = 'jflow.template'
separator_key = '.'
key_version = 'version'
key_fork = 'fork'
key_upstream = 'upstream'
key_public = 'public'
key_debug = 'debug'
key_remote = 'remote'
key_merge_to = 'merge-to'
key_extra = 'extra'
key_public_prefix = 'public-prefix'
key_public_suffix = 'public-suffix'... |
while True:
print('Who are you?')
name=input()
if name!='Joe':
continue
print('Hello,Joe.What is the password?(it is a fish)')
password=input()
if password=='swordfish':
break
print('Access granted')
| while True:
print('Who are you?')
name = input()
if name != 'Joe':
continue
print('Hello,Joe.What is the password?(it is a fish)')
password = input()
if password == 'swordfish':
break
print('Access granted') |
def GenerateConfig(context):
resources = []
haEnabled = context.properties['num_instances'] > 1
# Enabling services
services = {
'name': 'enable_services',
'type': 'enable_services.py',
'properties': {
'services': context.properties['services']
}
}
# N... | def generate_config(context):
resources = []
ha_enabled = context.properties['num_instances'] > 1
services = {'name': 'enable_services', 'type': 'enable_services.py', 'properties': {'services': context.properties['services']}}
networking = {'name': 'networking', 'type': 'networking.py', 'properties': {'... |
def is_equivalent(str_a, str_b):
if len(str_a) % 2 != 0 or len(str_b) % 2 != 0:
if str_a == str_b:
return True
return False
elif str_a == str_b:
return True
else:
len_a = len(str_a)
len_b = len(str_b)
a1_i, a1_j = 0, (len_a // 2)
a2_i, a2_... | def is_equivalent(str_a, str_b):
if len(str_a) % 2 != 0 or len(str_b) % 2 != 0:
if str_a == str_b:
return True
return False
elif str_a == str_b:
return True
else:
len_a = len(str_a)
len_b = len(str_b)
(a1_i, a1_j) = (0, len_a // 2)
(a2_i, a... |
def main():
# Store the total sum of multiples of 3 and 5
sum_multiples = 0
# Loop through every number less than 1000
for num in range(1,1000):
# Check if number is divisible by 3 or 5, i.e. a multiple
if num % 3 == 0 or num % 5 == 0:
sum_multiples += num
p... | def main():
sum_multiples = 0
for num in range(1, 1000):
if num % 3 == 0 or num % 5 == 0:
sum_multiples += num
print(sum_multiples)
if __name__ == '__main__':
main() |
# 177
# 10
# print(divmod(177, 10))
user = int(input())
user2 = int(input())
a = divmod(user, user2)
print(a[0])
print(a[1])
# for i in a:
# print(''.join(a[i]))
print(divmod(user,user2))
# print(divmod(user)) | user = int(input())
user2 = int(input())
a = divmod(user, user2)
print(a[0])
print(a[1])
print(divmod(user, user2)) |
{
"targets": [{
"target_name": "node_hge",
"sources": [
"src/entry.cpp"
],
"include_dirs": [
"src/hge181/include",
"<!(node -e \"require('nan')\")"
],
"libraries": [
"../src/hge181/lib/vc/hge.lib",
"../src/hge181/lib/vc/hgehelp.lib"
],
"libra... | {'targets': [{'target_name': 'node_hge', 'sources': ['src/entry.cpp'], 'include_dirs': ['src/hge181/include', '<!(node -e "require(\'nan\')")'], 'libraries': ['../src/hge181/lib/vc/hge.lib', '../src/hge181/lib/vc/hgehelp.lib'], 'libraries!': ['libc.lib'], 'defines': ['WIN32_LEAN_AND_MEAN'], 'VCLinkerTool': {'IgnoreSpec... |
question_replaceable_special_characters = {',', "'", '"', ';', '?', ':', '-', '(', ')', '[', ']', '{', '}'}
special_characters = ['*', '$']
punctuations = set()
pickled_questions_dir = "bin/data/questions"
pickle_files_extension = ".pickle"
questions_per_segment = 100
debug_print_len = 25 | question_replaceable_special_characters = {',', "'", '"', ';', '?', ':', '-', '(', ')', '[', ']', '{', '}'}
special_characters = ['*', '$']
punctuations = set()
pickled_questions_dir = 'bin/data/questions'
pickle_files_extension = '.pickle'
questions_per_segment = 100
debug_print_len = 25 |
class LoopiaError(Exception):
_exceptions = {}
code = None
message = None
def __init__(self, response=None):
super(LoopiaError, self).__init__(self.message)
self.response = response
@classmethod
def register(cls, exception):
if exception.code in cls._exceptions:
... | class Loopiaerror(Exception):
_exceptions = {}
code = None
message = None
def __init__(self, response=None):
super(LoopiaError, self).__init__(self.message)
self.response = response
@classmethod
def register(cls, exception):
if exception.code in cls._exceptions:
... |
def paperwork(n, m):
if n < 0 or m < 0 : return 0
else: return n * m
print(paperwork(5,0)) | def paperwork(n, m):
if n < 0 or m < 0:
return 0
else:
return n * m
print(paperwork(5, 0)) |
def clocks(x, y, a, b, x2, y2):
a = a - x
b = b - y
if b < 0:
b = 60 + b
a = a - 1
if a < 0:
a = 24 + a
a2 = x2 + a
b2 = y2 + b
if b2 >= 60:
b2 = b2 - 60
a2 = a2 + 1
if a2 >= 24:
a2 = a2 - 24
print(a2, b2)
clocks(int(input()), int(input... | def clocks(x, y, a, b, x2, y2):
a = a - x
b = b - y
if b < 0:
b = 60 + b
a = a - 1
if a < 0:
a = 24 + a
a2 = x2 + a
b2 = y2 + b
if b2 >= 60:
b2 = b2 - 60
a2 = a2 + 1
if a2 >= 24:
a2 = a2 - 24
print(a2, b2)
clocks(int(input()), int(input... |
n=6
a,b=0,0
arr=[1,2,4,4,5,6]
for i in range(int(n-1)):
if arr[i-1]>=arr[i]<=arr[i+1]:
a=a+1
if arr[i-1]<=arr[i]>=arr[i+1]:
b=b+1
print(b if a>b else a)
def howMany(sentence):
i = 0
ans = 0
n = len(sentence)
while (i < n):
c = 0
c2 = 0
c3 = 0
... | n = 6
(a, b) = (0, 0)
arr = [1, 2, 4, 4, 5, 6]
for i in range(int(n - 1)):
if arr[i - 1] >= arr[i] <= arr[i + 1]:
a = a + 1
if arr[i - 1] <= arr[i] >= arr[i + 1]:
b = b + 1
print(b if a > b else a)
def how_many(sentence):
i = 0
ans = 0
n = len(sentence)
while i < n:
c = ... |
# Parameters for compute_reference.py
# mpmath maximum precision when computing hypergeometric function values.
MAXPREC = 100000
# Range of a and b. PTS should be an odd number, since
# a = 0 and b = 0 are included in addition to positive and negative values.
UPPER = 2.3
PTS = 401
# Range of the logarithm of z valu... | maxprec = 100000
upper = 2.3
pts = 401
lower_z = -2
upper_z = 3
pts_z = 31 |
'''
09 - Dictionary of lists
Some more data just came in! This time, you'll use the dictionary of lists method,
parsing the data column by column.
|date | small_sold | large_sold |
|-------------+---------------+------------|
|"2019-11-17" | 10859987 | 7674135 |
|"2019-12-01" | 9291631 | 6238096 ... | """
09 - Dictionary of lists
Some more data just came in! This time, you'll use the dictionary of lists method,
parsing the data column by column.
|date | small_sold | large_sold |
|-------------+---------------+------------|
|"2019-11-17" | 10859987 | 7674135 |
|"2019-12-01" | 9291631 | 6238096 ... |
n = int(input())
friends = list(input().split())
sum = 0
for i in friends:
sum += int(i)
ways = 0
for i in range(1,6):
if (sum+i)%(n+1) != 1:
ways += 1
print(ways)
| n = int(input())
friends = list(input().split())
sum = 0
for i in friends:
sum += int(i)
ways = 0
for i in range(1, 6):
if (sum + i) % (n + 1) != 1:
ways += 1
print(ways) |
tanya_list = [
'kenapa',
'bila',
'siapa',
'mengapa',
'apa',
'bagaimana',
'berapa',
'mana']
perintah_list = [
'jangan',
'sila',
'tolong',
'harap',
'usah',
'jemput',
'minta']
pangkal_list = [
'maka',
'alkisah',
'arakian',
'syahdah',
'adapun',... | tanya_list = ['kenapa', 'bila', 'siapa', 'mengapa', 'apa', 'bagaimana', 'berapa', 'mana']
perintah_list = ['jangan', 'sila', 'tolong', 'harap', 'usah', 'jemput', 'minta']
pangkal_list = ['maka', 'alkisah', 'arakian', 'syahdah', 'adapun', 'bermula', 'kalakian']
bantu_list = ['akan', 'telah', 'boleh', 'mesti', 'belum', '... |
N = int(input())
result = 0
for i in range(1, N + 1):
if i % 3 == 0 or i % 5 == 0:
continue
result += i
print(result)
| n = int(input())
result = 0
for i in range(1, N + 1):
if i % 3 == 0 or i % 5 == 0:
continue
result += i
print(result) |
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education
# {"feature": "Education", "instances": 127, "metric_value": 0.987, "depth": 1}
if obj[1]<=2:
# {"feature": "Coupon", "instances": 91, "metric_value": 0.9355, "depth": 2}
if obj[0]>1:
return 'True'
elif obj[0]<=1:
return 'True'
else: return 'True... | def find_decision(obj):
if obj[1] <= 2:
if obj[0] > 1:
return 'True'
elif obj[0] <= 1:
return 'True'
else:
return 'True'
elif obj[1] > 2:
if obj[0] <= 3:
return 'False'
elif obj[0] > 3:
return 'False'
els... |
class Solution:
def minimumTotal(self, triangle: List[List[int]]) -> int:
n = len(triangle)
if n == 1: return min(triangle[0])
row_curr = triangle[n-1]
for row in range(n-2, -1, -1):
row_up = triangle[row]
for ind in range(len(row_up)):
... | class Solution:
def minimum_total(self, triangle: List[List[int]]) -> int:
n = len(triangle)
if n == 1:
return min(triangle[0])
row_curr = triangle[n - 1]
for row in range(n - 2, -1, -1):
row_up = triangle[row]
for ind in range(len(row_up)):
... |
#Accessing specific elemnts from a dictionary
Breakfast={
"Name":"dosa",
"cost": 45,
"Proteins": 4,
"Fat":2
}
#Finding the cost of Breakfast
p=Breakfast.get("cost")
print(p)
| breakfast = {'Name': 'dosa', 'cost': 45, 'Proteins': 4, 'Fat': 2}
p = Breakfast.get('cost')
print(p) |
NPKT = 100000
# def getselfaddr():
# return socket.getaddrinfo(None, PORT, socket.AF_INET6, socket.SOCK_DGRAM,socket.IPPROTO_IP)[0]
| npkt = 100000 |
deliver_states = {
'DEFAULT': ['1', 'PENDING_ORDERS', 'ACCEPT_PENDING_JOLLOF', 'ACCEPT_PENDING_DELICACY', 'TO_PICKUP', 'PICKED_UP_JOLLOF', 'PICKED_UP_DELICACY', 'TO_DROPOFF', 'DROPPED_OFF_JOLLOF', 'DROPPED_OFF_DELICACY'],
'CANCELLED': ['DEFAULT'],
'FLASH_LOCATION': ['FLASH_LOCATION', 'CANCELLED'],
'REQ... | deliver_states = {'DEFAULT': ['1', 'PENDING_ORDERS', 'ACCEPT_PENDING_JOLLOF', 'ACCEPT_PENDING_DELICACY', 'TO_PICKUP', 'PICKED_UP_JOLLOF', 'PICKED_UP_DELICACY', 'TO_DROPOFF', 'DROPPED_OFF_JOLLOF', 'DROPPED_OFF_DELICACY'], 'CANCELLED': ['DEFAULT'], 'FLASH_LOCATION': ['FLASH_LOCATION', 'CANCELLED'], 'REQUEST_PHONE': ['REQ... |
class Synonym:
def __init__(self,
taxon_id,
name_id,
id='',
name_phrase='',
according_to_id='',
status='synonym',
reference_id='',
page_reference_id='',
link='',... | class Synonym:
def __init__(self, taxon_id, name_id, id='', name_phrase='', according_to_id='', status='synonym', reference_id='', page_reference_id='', link='', remarks='', needs_review=''):
self.id = id
self.taxon_id = taxon_id
self.name_id = name_id
self.name_phrase = name_phrase... |
# ----------------------------------------------------------------------
# CISCO-VPDN-MGMT-MIB
# Compiled MIB
# Do not modify this file directly
# Run ./noc mib make-cmib instead
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
... | name = 'CISCO-VPDN-MGMT-MIB'
last_updated = '2009-06-16'
compiled = '2020-01-19'
mib = {'CISCO-VPDN-MGMT-MIB::ciscoVpdnMgmtMIB': '1.3.6.1.4.1.9.10.24', 'CISCO-VPDN-MGMT-MIB::ciscoVpdnMgmtMIBNotifs': '1.3.6.1.4.1.9.10.24.0', 'CISCO-VPDN-MGMT-MIB::cvpdnNotifSessionID': '1.3.6.1.4.1.9.10.24.0.1', 'CISCO-VPDN-MGMT-MIB::cvp... |
N = int(input())
positions = []
for x in range(N):
input_line = input().split()
positions.append([int(input_line[0]), int(input_line[1])])
sorted_positions = sorted(positions)
minRadius = 1000000
for x in range(len(sorted_positions)-1):
if sorted_positions[x][1] == 0 and sorted_positions[x-1... | n = int(input())
positions = []
for x in range(N):
input_line = input().split()
positions.append([int(input_line[0]), int(input_line[1])])
sorted_positions = sorted(positions)
min_radius = 1000000
for x in range(len(sorted_positions) - 1):
if sorted_positions[x][1] == 0 and sorted_positions[x - 1][1] == 1:
... |
# Payable-related constants
PAYABLE_FIRST_ROW = 20
PAYABLE_FIRST_COL = 2
PAYABLE_LAST_COL = 25
PAYABLE_SORT_BY = 3
PAYABLE_PAYPAL_ID_COL = 18
PAYABLE_FIELDS = [
'timestamp',
'requester',
'department',
'item',
'detail',
'event_date',
'payment_type',
'use_of_funds',
'notes',
... | payable_first_row = 20
payable_first_col = 2
payable_last_col = 25
payable_sort_by = 3
payable_paypal_id_col = 18
payable_fields = ['timestamp', 'requester', 'department', 'item', 'detail', 'event_date', 'payment_type', 'use_of_funds', 'notes', 'type', 'name', 'paypal', 'address', 'amount', 'driving_reimbursement']
pay... |
operadores = ('+', '-', '*', '/', '%', '=', '>', '<', '>=', '<=', '!', '!=', '==', '&', '|', '++', '--', '+=', '-=',
'/=', '*=')
comentario = '//'
comentario_inicio = '/*'
comentario_fim = '*/'
aspas = '"'
aspasSimples = "'"
delimitadores = (';', '{', '}', '(', ')', '[', ']', comentario, comentario_inic... | operadores = ('+', '-', '*', '/', '%', '=', '>', '<', '>=', '<=', '!', '!=', '==', '&', '|', '++', '--', '+=', '-=', '/=', '*=')
comentario = '//'
comentario_inicio = '/*'
comentario_fim = '*/'
aspas = '"'
aspas_simples = "'"
delimitadores = (';', '{', '}', '(', ')', '[', ']', comentario, comentario_inicio, comentario_... |
class pycacheNotFoundError(Exception):
def __init__(self, msg):
self.msg = msg
super().__init__(self.msg)
class installModulesFailedError(Exception):
def __init__(self):
self.msg = "The modules could not be installed! Some error occurred!"
super().__init__(self.msg)
| class Pycachenotfounderror(Exception):
def __init__(self, msg):
self.msg = msg
super().__init__(self.msg)
class Installmodulesfailederror(Exception):
def __init__(self):
self.msg = 'The modules could not be installed! Some error occurred!'
super().__init__(self.msg) |
# Auto-generated pytest file
class TestInit:
def test___init__(self):
fail()
class TestEnter:
def test___enter__(self):
fail()
class TestExit:
def test___exit__(self):
fail()
class TestGetSearchResultCount:
def test_get_search_result_count(self):
fail()
class Tes... | class Testinit:
def test___init__(self):
fail()
class Testenter:
def test___enter__(self):
fail()
class Testexit:
def test___exit__(self):
fail()
class Testgetsearchresultcount:
def test_get_search_result_count(self):
fail()
class Testgetsearchresultlinks:
de... |
# https://baike.baidu.com/item/%E5%BF%AB%E9%80%9F%E5%B9%82
# 11 = 2^0 + 2^! + 2^3
# a^11 = a^(2^0) + a^(2^1) + a^(2^3)
class Solution:
def myPow(self, x: float, n: int) -> float:
N = n
if N < 0:
x = 1/x
N = -N
ans = 1
current_product = x
while N > 0:
... | class Solution:
def my_pow(self, x: float, n: int) -> float:
n = n
if N < 0:
x = 1 / x
n = -N
ans = 1
current_product = x
while N > 0:
if N % 2 == 1:
ans = ans * current_product
current_product = current_product... |
# time Complexity: O(n^2)
# space Complexity: O(1)
def bubble_sort(arr):
current = 0
next = 1
last_index = len(arr)
while last_index >= next:
if arr[current] > arr[next]:
arr[current], arr[next] = arr[next], arr[current]
current += 1
next += 1
if next == ... | def bubble_sort(arr):
current = 0
next = 1
last_index = len(arr)
while last_index >= next:
if arr[current] > arr[next]:
(arr[current], arr[next]) = (arr[next], arr[current])
current += 1
next += 1
if next == last_index:
current = 0
next... |
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
# Copy / paste from the "fastest" solution.
# It's sort of beautiful in its simplicity, if wildly esoteric.
# Basically the same thing as the hacky failsafe in my first solution;
# compare the number of unique characters... | class Solution:
def is_isomorphic(self, s: str, t: str) -> bool:
return len(set(zip(s, t))) == len(set(s)) == len(set(t)) |
#
# PySNMP MIB module APDNSALG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APDNSALG-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:23:12 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,... | (acmepacket_mgmt,) = mibBuilder.importSymbols('ACMEPACKET-SMI', 'acmepacketMgmt')
(ap_transport_type, ap_hardware_module_family, ap_redundancy_state) = mibBuilder.importSymbols('ACMEPACKET-TC', 'ApTransportType', 'ApHardwareModuleFamily', 'ApRedundancyState')
(sys_mgmt_percentage,) = mibBuilder.importSymbols('APSYSMGMT... |
'''
/******************************************************************
*
* Copyright 2018 Samsung Electronics 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
*
* htt... | """
/******************************************************************
*
* Copyright 2018 Samsung Electronics 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
*
* htt... |
hpp = 'AL-Import' # Specify the name of the hpp to print the graph
graph_title='EM- Total Impact of the energy maximization scenario on '+ hpp
df_em2 = df_em1.groupby(['scenario'])['value'].sum().round(2).reset_index()
fig5c = px.bar(df_em2, x='scenario', y='value', text= 'value', color='scenario',barmode='group',
... | hpp = 'AL-Import'
graph_title = 'EM- Total Impact of the energy maximization scenario on ' + hpp
df_em2 = df_em1.groupby(['scenario'])['value'].sum().round(2).reset_index()
fig5c = px.bar(df_em2, x='scenario', y='value', text='value', color='scenario', barmode='group', labels={'value': 'GWh', 'tech': 'HPP'}, title=grap... |
class MessageTypeNotSupported(Exception):
pass
class MessageDoesNotExist(Exception):
pass
| class Messagetypenotsupported(Exception):
pass
class Messagedoesnotexist(Exception):
pass |
# https://www.codechef.com/problems/RAINBOWA
for T in range(int(input())):
n,l=int(input()),list(map(int,input().split()))
print("no") if(set(l)!=set(list(range(1,8))) or l[0]!=1 or l[-1]!=1 or l!=l[::-1]) else print("yes") | for t in range(int(input())):
(n, l) = (int(input()), list(map(int, input().split())))
print('no') if set(l) != set(list(range(1, 8))) or l[0] != 1 or l[-1] != 1 or (l != l[::-1]) else print('yes') |
# -*- encoding:utf-8 -*-
__version__ = (1, 2, 11)
__version_str__ = ".".join(map(str, __version__))
__version_core__ = (3, 0, 4)
| __version__ = (1, 2, 11)
__version_str__ = '.'.join(map(str, __version__))
__version_core__ = (3, 0, 4) |
def to_camel_case(s):
return ('' if not s else s[0] + ''.join(c.upper() if s[::-1][i + 1] in '-_'
else '' if c in '-_'
else c for i, c in
enumerate(s[::-1][:-1]))[::-1])
| def to_camel_case(s):
return '' if not s else s[0] + ''.join((c.upper() if s[::-1][i + 1] in '-_' else '' if c in '-_' else c for (i, c) in enumerate(s[::-1][:-1])))[::-1] |
##NIM, Umur, Tinggi = (211080200045, 18, 170)
##print(NIM, Umur, Tinggi)
angka_positif = 1,2,3,4,5,6,7,8,9
print(angka_positif)
| angka_positif = (1, 2, 3, 4, 5, 6, 7, 8, 9)
print(angka_positif) |
GOLD = ["7374", "7857", "7990", "8065", "8250"]
ANNOTATORS = ["01", "02", "03", "04", "05", "06"]
DOC_HEADER = ["order", "doc_id", "assigned", "nr_sens_calculated", "nr_sens", "annotator_1", "annotator_2",
"assigned_2"]
CYCLE_FILE = "../input/batch_cycles.csv"
CYCLE_COL = "cycle"
ASSIGNMENT_TXT = "assig... | gold = ['7374', '7857', '7990', '8065', '8250']
annotators = ['01', '02', '03', '04', '05', '06']
doc_header = ['order', 'doc_id', 'assigned', 'nr_sens_calculated', 'nr_sens', 'annotator_1', 'annotator_2', 'assigned_2']
cycle_file = '../input/batch_cycles.csv'
cycle_col = 'cycle'
assignment_txt = 'assignment.txt'
assig... |
class IntegerField:
def __str__(self):
return "integer"
| class Integerfield:
def __str__(self):
return 'integer' |
class AdministrativeDivision:
def __init__(self, level):
self.level = level
pass
class Province(AdministrativeDivision):
type = 'Province'
area = 0
center = ''
def __init__(self, name):
self.name = name
self.level = 1
def __str__(self):
return f"{self.name} {self.type}"
pas... | class Administrativedivision:
def __init__(self, level):
self.level = level
pass
class Province(AdministrativeDivision):
type = 'Province'
area = 0
center = ''
def __init__(self, name):
self.name = name
self.level = 1
def __str__(self):
return f'{self.name... |
# Binary Tree implemented using python list
class BinaryTree:
def __init__(self,size) -> None:
self.cl=size*[None]
self.lastUsedIndex=0
self.maxSize=size
def insertNode(self,value):
if self.lastUsedIndex+1==self.maxSize:
return "BT is full"
self.cl[self.last... | class Binarytree:
def __init__(self, size) -> None:
self.cl = size * [None]
self.lastUsedIndex = 0
self.maxSize = size
def insert_node(self, value):
if self.lastUsedIndex + 1 == self.maxSize:
return 'BT is full'
self.cl[self.lastUsedIndex + 1] = value
... |
num1 = int(input())
count1 = 0
while 1 <= num1 <= 5:
if num1 == 5:
count1 += 1
num1 = int(input())
print(count1)
| num1 = int(input())
count1 = 0
while 1 <= num1 <= 5:
if num1 == 5:
count1 += 1
num1 = int(input())
print(count1) |
class Label(object):
def __eq__(self, other):
assert(isinstance(other, Label))
return type(self) == type(other)
def __ne__(self, other):
assert(isinstance(other, Label))
return type(self) != type(other)
def __hash__(self):
return hash(self.to_class_str())
def ... | class Label(object):
def __eq__(self, other):
assert isinstance(other, Label)
return type(self) == type(other)
def __ne__(self, other):
assert isinstance(other, Label)
return type(self) != type(other)
def __hash__(self):
return hash(self.to_class_str())
def to... |
#Function to insert a string in the middle of a string
def string_in():
string=str(input("Enter a string :"))
mid=len(string)//2
word=str(input("Enter a word to insert in middle :"))
new_string=string[:mid]+word+string[mid:]
print(new_string)
string_in()
| def string_in():
string = str(input('Enter a string :'))
mid = len(string) // 2
word = str(input('Enter a word to insert in middle :'))
new_string = string[:mid] + word + string[mid:]
print(new_string)
string_in() |
#
# This file contains "references" to unreferenced code that should be kept and not considered dead code
#
not_used_but_whitelisted
| not_used_but_whitelisted |
# Copyright 2018 TNG Technology Consulting GmbH, Unterfoehring, Germany
# Licensed under the Apache License, Version 2.0 - see LICENSE.md in project root directory
# TODO IT-1: give this function some great functionality
def great_function():
pass
# TODO: give this function some greater functionality
def greate... | def great_function():
pass
def greater_function():
pass |
n = 0
for i in range(999, 100, -1):
for j in range(i, 100, -1):
x = i * j
if x > n:
s = str(i * j)
if s == s[::-1]:
n = i * j
print(n)
| n = 0
for i in range(999, 100, -1):
for j in range(i, 100, -1):
x = i * j
if x > n:
s = str(i * j)
if s == s[::-1]:
n = i * j
print(n) |
class DictSerializable:
@classmethod
def from_dict(cls, data: dict) -> 'DictSerializable':
return cls(**data)
def to_dict(self) -> dict:
return vars(self) | class Dictserializable:
@classmethod
def from_dict(cls, data: dict) -> 'DictSerializable':
return cls(**data)
def to_dict(self) -> dict:
return vars(self) |
known = {}
def ack(m, n):
if m == 0:
return n + 1
if m > 0 and n == 0:
return ack(m-1, 1)
if m > 0 and n > 0:
if (m,n) in known:
print('Cache hit')
return known[(m, n)]
else:
known[(m, n)] = ack(m - 1, ack(m , n - 1))
retu... | known = {}
def ack(m, n):
if m == 0:
return n + 1
if m > 0 and n == 0:
return ack(m - 1, 1)
if m > 0 and n > 0:
if (m, n) in known:
print('Cache hit')
return known[m, n]
else:
known[m, n] = ack(m - 1, ack(m, n - 1))
return know... |
#
# @lc app=leetcode id=450 lang=python3
#
# [450] Delete Node in a BST
#
# @lc code=start
# 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 deleteNode(s... | class Solution:
def delete_node(self, root: TreeNode, key: int) -> TreeNode:
if not root:
return None
if root.val == key:
if not root.right:
left = root.left
return left
right = root.right
while root.left:
... |
__title__ = 'pairing-functions'
__description__ = 'A collection of pairing functions'
__url__ = 'https://github.com/ConvertGroupLabs/pairing-functions'
__version__ = '0.2.1'
__author__ = 'Convert Group Labs'
__author_email__ = 'tools@convertgroup.com'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2020 Convert ... | __title__ = 'pairing-functions'
__description__ = 'A collection of pairing functions'
__url__ = 'https://github.com/ConvertGroupLabs/pairing-functions'
__version__ = '0.2.1'
__author__ = 'Convert Group Labs'
__author_email__ = 'tools@convertgroup.com'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2020 Convert ... |
def deleteMid(head):
# check if the list contains 1 or more nodes
if head is None or head.next is None:
return None
#assign pointers to their respective positions
prev, i, j = None, head, head
while j and j.next:
j = j.next.next;# j pointer moves 2 nodes ahead
... | def delete_mid(head):
if head is None or head.next is None:
return None
(prev, i, j) = (None, head, head)
while j and j.next:
j = j.next.next
prev = i
i = i.next
prev.next = i.next
return head
class Node:
def __init__(self, data):
self.data = data
... |
N = int(input())
a = N % 1000
if a == 0:
print(0)
else:
print(1000 - a)
| n = int(input())
a = N % 1000
if a == 0:
print(0)
else:
print(1000 - a) |
# -*- coding: utf-8 -*-
f = open("dico.txt", "r")
contrasenia = "hola"
contador = 0
linea = f.readline()
while linea:
contador += 1
if linea.strip() == contrasenia.strip():
print('Contrasenia encontrada: ' + linea)
print('en ' + str(contador) + ' intentos')
break
linea = f.readline(... | f = open('dico.txt', 'r')
contrasenia = 'hola'
contador = 0
linea = f.readline()
while linea:
contador += 1
if linea.strip() == contrasenia.strip():
print('Contrasenia encontrada: ' + linea)
print('en ' + str(contador) + ' intentos')
break
linea = f.readline()
f.close() |
first = "Murat"
last = "Aksoy"
name = f"Welcome to pyhton '{last}', {first}"
print(name) | first = 'Murat'
last = 'Aksoy'
name = f"Welcome to pyhton '{last}', {first}"
print(name) |
AUTHOR="Zawadi Done"
DESCRIPTION="This module wil install/update MassDNS"
INSTALL_TYPE="GIT"
REPOSITORY_LOCATION="https://github.com/blechschmidt/massdns"
INSTALL_LOCATION="massdns"
DEBIAN=""
AFTER_COMMANDS="cd {INSTALL_LOCATION},make,cp bin/massdns /usr/local/bin/"
LAUNCHER="massdns"
| author = 'Zawadi Done'
description = 'This module wil install/update MassDNS'
install_type = 'GIT'
repository_location = 'https://github.com/blechschmidt/massdns'
install_location = 'massdns'
debian = ''
after_commands = 'cd {INSTALL_LOCATION},make,cp bin/massdns /usr/local/bin/'
launcher = 'massdns' |
'''
This module declares constants needed for this solution. This is to remove
magic numbers
'''
CRATER_CHANGE_WHEN_SUNNY = 0.9
CRATER_CHANGE_WHEN_RAINY = 1.2
CRATER_CHANGE_WHEN_WINDY = 0.0
ORBIT1_ORBIT_DISTANCE = 18
ORBIT1_CRATERS_COUNT = 20
ORBIT2_ORBIT_DISTANCE = 20
ORBIT2_CRATERS_COUNT = 10
| """
This module declares constants needed for this solution. This is to remove
magic numbers
"""
crater_change_when_sunny = 0.9
crater_change_when_rainy = 1.2
crater_change_when_windy = 0.0
orbit1_orbit_distance = 18
orbit1_craters_count = 20
orbit2_orbit_distance = 20
orbit2_craters_count = 10 |
class Solution:
def singleNumber(self, nums: List[int]) -> int:
ret = 0
for n in nums:
ret ^= n
return ret | class Solution:
def single_number(self, nums: List[int]) -> int:
ret = 0
for n in nums:
ret ^= n
return ret |
#!/usr/bin/env python3
# https://www.urionlinejudge.com.br/judge/en/problems/view/1020
def decompose(total, value):
decomposed = total // value
return total - decomposed * value, decomposed
def main():
DAYS = int(input())
DAYS, YEARS = decompose(DAYS, 365)
DAYS, MONTHS = decompose(DAYS, 30)... | def decompose(total, value):
decomposed = total // value
return (total - decomposed * value, decomposed)
def main():
days = int(input())
(days, years) = decompose(DAYS, 365)
(days, months) = decompose(DAYS, 30)
print(YEARS, 'ano(s)')
print(MONTHS, 'mes(es)')
print(DAYS, 'dia(s)')
if __n... |
'''
Creating a very basic module in Python
'''
languages = {'Basic', 'QBasic', 'Cobol', 'Pascal', 'Assembly', 'C/C++', 'Java', 'Python', 'Ruby'}
values = 10, 50, 60, 11, 98, 75, 65, 32
def add(*args: float) -> float:
sum = 0.0
for value in args:
sum += value
return sum
def multiply(*args: float) -> flo... | """
Creating a very basic module in Python
"""
languages = {'Basic', 'QBasic', 'Cobol', 'Pascal', 'Assembly', 'C/C++', 'Java', 'Python', 'Ruby'}
values = (10, 50, 60, 11, 98, 75, 65, 32)
def add(*args: float) -> float:
sum = 0.0
for value in args:
sum += value
return sum
def multiply(*args: fl... |
#Config, Reference, and configure provided in globals
cards = Config(
hd_audio=Config(
match=dict(),
name='Auto-%(id)s-%(label)s',
restart=-1,
input=dict(
label="input",
subdevice='0',
channels=2,
buffer_size=512,
buffer_count=4,
sample_rate=48000,
quality=4
),
output=dict(... | cards = config(hd_audio=config(match=dict(), name='Auto-%(id)s-%(label)s', restart=-1, input=dict(label='input', subdevice='0', channels=2, buffer_size=512, buffer_count=4, sample_rate=48000, quality=4), output=dict(label='output', subdevice='0', channels=2, buffer_size=512, buffer_count=4, sample_rate=48000, quality=4... |
#!/usr/bin/env python3
# Copyright 2018, Rackspace US, Inc.
#
# 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 applicabl... | tripleo_mapping_group = {'hosts': ['undercloud', 'overcloud', 'Undercloud', 'Overcloud'], 'all': ['hosts'], 'shared-infra_hosts': ['Controller', 'controller'], 'rabbitmq_all': ['Controller', 'controller'], 'memcached_all': ['Controller', 'controller'], 'galera_all': ['Controller', 'controller'], 'galera': ['Controller'... |
def make_bio_dict(tags, start_idx=0):
d = dict()
i = start_idx
for tag in tags:
for pre_tag in ['B-', 'I-']:
d[pre_tag + tag] = i
i += 1
d['O'] = i
return d | def make_bio_dict(tags, start_idx=0):
d = dict()
i = start_idx
for tag in tags:
for pre_tag in ['B-', 'I-']:
d[pre_tag + tag] = i
i += 1
d['O'] = i
return d |
# -*- coding: utf-8 -*-
__author__ = "Sergey Aganezov"
__email__ = "aganezov(at)cs.jhu.edu"
__status__ = "production"
version = "1.10"
__all__ = ["grimm",
"breakpoint_graph",
"graphviz",
"utils",
"edge",
"genome",
"kbreak",
"multicolor",
... | __author__ = 'Sergey Aganezov'
__email__ = 'aganezov(at)cs.jhu.edu'
__status__ = 'production'
version = '1.10'
__all__ = ['grimm', 'breakpoint_graph', 'graphviz', 'utils', 'edge', 'genome', 'kbreak', 'multicolor', 'tree', 'vertices', 'utils', 'distances'] |
size(200, 200)
stroke(0)
strokeWidth(10)
fill(1, 0.3, 0)
polygon((40, 40), (40, 160))
polygon((60, 40), (60, 160), (130, 160))
polygon((100, 40), (160, 160), (160, 40), close=False)
| size(200, 200)
stroke(0)
stroke_width(10)
fill(1, 0.3, 0)
polygon((40, 40), (40, 160))
polygon((60, 40), (60, 160), (130, 160))
polygon((100, 40), (160, 160), (160, 40), close=False) |
# flake8: noqa
_base_ = [
'./coco.py'
]
data = dict(
samples_per_gpu=2,
workers_per_gpu=2,
train=dict(classes=('person',)),
val=dict(classes=('person',)),
test=dict(classes=('person',))
)
| _base_ = ['./coco.py']
data = dict(samples_per_gpu=2, workers_per_gpu=2, train=dict(classes=('person',)), val=dict(classes=('person',)), test=dict(classes=('person',))) |
x = int(input())
n = int(input())
pool = x
for _ in range(n):
pool += x - int(input())
print(pool)
| x = int(input())
n = int(input())
pool = x
for _ in range(n):
pool += x - int(input())
print(pool) |
def reject_outliers(data, m = 2.):
d = np.abs(data - np.median(data))
mdev = np.median(d)
s = d/mdev if mdev else 0.
return (s < m)
def mean_dup(x_):
global reject_outliers
if 1==len(np.unique(x_.values)):
return x_.values[0]
else:
x = x_.... | def reject_outliers(data, m=2.0):
d = np.abs(data - np.median(data))
mdev = np.median(d)
s = d / mdev if mdev else 0.0
return s < m
def mean_dup(x_):
global reject_outliers
if 1 == len(np.unique(x_.values)):
return x_.values[0]
else:
x = x_.values[reject_outliers(x_.values.c... |
class MyList:
class _Node:
__slots__ = ('value', 'next')
def __init__(self, value, next=None):
self.value = value
self.next = next
class _NodeIterator:
def __init__(self, first):
self._next_node = first
def __iter__(self):
retur... | class Mylist:
class _Node:
__slots__ = ('value', 'next')
def __init__(self, value, next=None):
self.value = value
self.next = next
class _Nodeiterator:
def __init__(self, first):
self._next_node = first
def __iter__(self):
retu... |
number = 10
array = '64630 11735 14216 99233 14470 4978 73429 38120 51135 67060'
array = list(map(int, array.split()))
def find_mean(a):
return round(sum(a)/number, 1)
def find_median(a):
a = sorted(a)
if len(a) % 2 == 0:
return round((a[number//2 - 1] + a[number//2])/2, 1)
else:
ret... | number = 10
array = '64630 11735 14216 99233 14470 4978 73429 38120 51135 67060'
array = list(map(int, array.split()))
def find_mean(a):
return round(sum(a) / number, 1)
def find_median(a):
a = sorted(a)
if len(a) % 2 == 0:
return round((a[number // 2 - 1] + a[number // 2]) / 2, 1)
else:
... |
class IAMPolicies():
def __init__(self, iam):
self.client = iam
def _marker_handler(self, marker=None, scope='All'):
if marker:
response = self.client.list_policies(
Scope=scope,
OnlyAttached=True,
PolicyUsageFilter='PermissionsPolicy... | class Iampolicies:
def __init__(self, iam):
self.client = iam
def _marker_handler(self, marker=None, scope='All'):
if marker:
response = self.client.list_policies(Scope=scope, OnlyAttached=True, PolicyUsageFilter='PermissionsPolicy', Marker=marker)
else:
respons... |
runtime_project='core'
editor_project='core-Editor'
runtime_project_file='Assembly-CSharp'
editor_project_file='Assembly-CSharp-Editor'
define='ANDROID'
MONO="/Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/Current/bin/mono"
MDTOOL="/Applications/Unity/MonoDevelop.app/Contents/MacOS/lib... | runtime_project = 'core'
editor_project = 'core-Editor'
runtime_project_file = 'Assembly-CSharp'
editor_project_file = 'Assembly-CSharp-Editor'
define = 'ANDROID'
mono = '/Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/Current/bin/mono'
mdtool = '/Applications/Unity/MonoDevelop.app/Conte... |
L = 0
heatmap = []
while True:
try:
line = [int(x) for x in input()]
# Pad heatmap with 9s
heat = [9] + line + [9]
L = len(heat)
heatmap.extend(heat)
except EOFError:
break
index = 0
# Pad 9s in top and bottom
heatmap = heatmap + (L*[9])
bigmap = (L*[9]) + ... | l = 0
heatmap = []
while True:
try:
line = [int(x) for x in input()]
heat = [9] + line + [9]
l = len(heat)
heatmap.extend(heat)
except EOFError:
break
index = 0
heatmap = heatmap + L * [9]
bigmap = L * [9] + heatmap + L * [9]
total = []
for (index, value) in enumerate(hea... |
# Enter your code for "Hello with attitude" here.
name = input("What is your name? ")
print("So you call yourself '" + name + "' huh?")
| name = input('What is your name? ')
print("So you call yourself '" + name + "' huh?") |
# https://www.codewars.com/kata/59e49b2afc3c494d5d00002a/train/python
def sort_vowels(s):
if isinstance(s, int) or s == None:
return ''
vovels = ['a', 'e', 'u', 'i', 'o']
output = []
for letter in s:
if vovels.count(letter.lower()) > 0:
output.append(f'|{let... | def sort_vowels(s):
if isinstance(s, int) or s == None:
return ''
vovels = ['a', 'e', 'u', 'i', 'o']
output = []
for letter in s:
if vovels.count(letter.lower()) > 0:
output.append(f'|{letter}')
else:
output.append(f'{letter}|')
return '\n'.join(output... |
#!/usr/bin/python3
# The MDPs consists of a range of integers 0..stateMax which represent
# the states of the MDP, a set of actions. The rewards and transition
# probabilities are accessed with some of the functions below defined
# for the Python classes that represent MDPs.
#
# - The __init__ constructor builds the ... | class Gridmdp:
def __init__(self, xs, ys, cells, teleport=False):
self.xSize = xs
self.ySize = ys
self.stateMax = xs * ys - 1
self.grid = cells
self.teleport = teleport
north = 1
south = 2
west = 3
east = 4
actions = [NORTH, SOUTH, WEST, EAST]
def tu... |
W = int(input())
N, K = map(int, input().split())
dp = [{} for _ in range(K + 1)]
dp[0][0] = 0
for _ in range(N):
A, B = map(int, input().split())
for i in range(K - 1, -1, -1):
for j in dp[i]:
if j + A <= W:
dp[i + 1].setdefault(j + A, 0)
dp[i + 1][j + A] = ... | w = int(input())
(n, k) = map(int, input().split())
dp = [{} for _ in range(K + 1)]
dp[0][0] = 0
for _ in range(N):
(a, b) = map(int, input().split())
for i in range(K - 1, -1, -1):
for j in dp[i]:
if j + A <= W:
dp[i + 1].setdefault(j + A, 0)
dp[i + 1][j + A]... |
class RenderInterface(object):
def render(self):
raise NotImplementedError("Class %s doesn't implement render()" % (self.__class__.__name__))
class ViewportInterface(object):
def to_dict(self):
raise NotImplementedError("Class %s doesn't implement to_dict()" % (self.__class__.__name__))
d... | class Renderinterface(object):
def render(self):
raise not_implemented_error("Class %s doesn't implement render()" % self.__class__.__name__)
class Viewportinterface(object):
def to_dict(self):
raise not_implemented_error("Class %s doesn't implement to_dict()" % self.__class__.__name__)
... |
num1 = int(input('digite um valor'))
num2 = int(input('digite um valor'))
s = num1 + num2
print('A soma entre {} e {} vale {}'.format(num1, num2, s))
| num1 = int(input('digite um valor'))
num2 = int(input('digite um valor'))
s = num1 + num2
print('A soma entre {} e {} vale {}'.format(num1, num2, s)) |
def modify_phoneme_script_to_create_grapheme_script(original_dataset_path, grapheme_dataset_path):
with open(original_dataset_path, 'r', encoding='utf-8-sig') as f:
lines = f.readlines()
new_lines = []
for line in lines:
split_result = line.split('|')
wav_path = split_result[0]
... | def modify_phoneme_script_to_create_grapheme_script(original_dataset_path, grapheme_dataset_path):
with open(original_dataset_path, 'r', encoding='utf-8-sig') as f:
lines = f.readlines()
new_lines = []
for line in lines:
split_result = line.split('|')
wav_path = split_result[0]
... |
# Solution
def add_one(arr):
output = 1;
for i in range(len(arr), 0, -1):
output = output + arr[i - 1]
borrow = output//10
if borrow == 0:
arr[i - 1] = output
break
else:
arr[i - 1] = output % 10
output = borrow
arr = [borrow] ... | def add_one(arr):
output = 1
for i in range(len(arr), 0, -1):
output = output + arr[i - 1]
borrow = output // 10
if borrow == 0:
arr[i - 1] = output
break
else:
arr[i - 1] = output % 10
output = borrow
arr = [borrow] + arr
i... |
def interpolation_search(arr, key):
low = 0
high = len(arr) - 1
while arr[high] != arr[low] and key >= arr[low] and key <= arr[high]:
mid = int(low + ((key - arr[low]) * (high - low) / (arr[high] - arr[low])))
if arr[mid] == key:
return mid
elif arr[mid] < key:
... | def interpolation_search(arr, key):
low = 0
high = len(arr) - 1
while arr[high] != arr[low] and key >= arr[low] and (key <= arr[high]):
mid = int(low + (key - arr[low]) * (high - low) / (arr[high] - arr[low]))
if arr[mid] == key:
return mid
elif arr[mid] < key:
... |
try:
with open('../../.password/google-maps/api', 'r') as fp:
key = fp.readlines()
key = ''.join(key)
except:
# Insert your API key here
key = 'AIzaSyDxydKN7Yt54JNmVw9opg9EcibCghjetgw'
| try:
with open('../../.password/google-maps/api', 'r') as fp:
key = fp.readlines()
key = ''.join(key)
except:
key = 'AIzaSyDxydKN7Yt54JNmVw9opg9EcibCghjetgw' |
#SOLUTION FOR P20
'''P20 (*) Remove the K'th element from a list.
Example:
* (remove-at '(a b c d) 2)
(A C D)'''
my_list = ['a','b','c','d','e']
pos= int(input('Element to remove = '))
if pos <= len(my_list): #CHECK IF INPUT IS IN RANGE
my_list.pop(pos-1) #REMOVE THE ELEMENT AT GIVEN INDE... | """P20 (*) Remove the K'th element from a list.
Example:
* (remove-at '(a b c d) 2)
(A C D)"""
my_list = ['a', 'b', 'c', 'd', 'e']
pos = int(input('Element to remove = '))
if pos <= len(my_list):
my_list.pop(pos - 1)
print(my_list)
else:
print('Invalid input ') |
class PairSet(object):
__slots__ = '_data',
def __init__(self):
self._data = set()
def __contains__(self, item):
return item in self._data
def has(self, a, b):
return (a, b) in self._data
def add(self, a, b):
self._data.add((a, b))
self._data.add((b, a))
... | class Pairset(object):
__slots__ = ('_data',)
def __init__(self):
self._data = set()
def __contains__(self, item):
return item in self._data
def has(self, a, b):
return (a, b) in self._data
def add(self, a, b):
self._data.add((a, b))
self._data.add((b, a))... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def count_unival_subtrees(self, root: TreeNode) -> int:
self.count = 0
self.is_unival(root)
return self.count
def is_unival(self, root: TreeNode) -> bool... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def count_unival_subtrees(self, root: TreeNode) -> int:
self.count = 0
self.is_unival(root)
return self.count
def is_unival(self, root: TreeNode) -> bool... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def push(self, new_data):
new_node = Node(new_data)
new_node.next = self.head
self.head = new_node
def getNth(self, ll... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def push(self, new_data):
new_node = node(new_data)
new_node.next = self.head
self.head = new_node
def get_nth(self, llist, ... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | project = 'elasticsearch-objects-operator'
copyright = '2020, 90poe & elasticsearch-objects-operator development tean'
author = 'elasticsearch-objects-operator development team'
extensions = ['recommonmark', 'sphinx_markdown_tables']
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'... |
def draw_line(tick_length, tick_label=""):
line = "-" * tick_length
if tick_label:
line += " " + tick_label
print(line)
def draw_interval(center_length):
if center_length > 0:
draw_interval(center_length - 1)
draw_line(center_length)
draw_interval(center_length - 1)
d... | def draw_line(tick_length, tick_label=''):
line = '-' * tick_length
if tick_label:
line += ' ' + tick_label
print(line)
def draw_interval(center_length):
if center_length > 0:
draw_interval(center_length - 1)
draw_line(center_length)
draw_interval(center_length - 1)
def... |
class TrainConfig(typing.NamedTuple):
T: int
train_size: int
batch_size: int
loss_func: typing.Callable
class TrainData(typing.NamedTuple):
feats: np.ndarray
targs: np.ndarray
DaRnnNet = collections.namedtuple("DaRnnNet", ["encoder", "decoder", "enc_opt", "dec_opt"]) | class Trainconfig(typing.NamedTuple):
t: int
train_size: int
batch_size: int
loss_func: typing.Callable
class Traindata(typing.NamedTuple):
feats: np.ndarray
targs: np.ndarray
da_rnn_net = collections.namedtuple('DaRnnNet', ['encoder', 'decoder', 'enc_opt', 'dec_opt']) |
__author__ = 'matti'
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:testipassu@localhost/gachimuchio'
class DebugConfig(Config):
DEBUG = True | __author__ = 'matti'
class Config(object):
debug = False
testing = False
sqlalchemy_database_uri = 'postgresql://postgres:testipassu@localhost/gachimuchio'
class Debugconfig(Config):
debug = True |
phrase = "Awana Academy"
print("Awana\nAcademy")
print("Awana\"Academy")
print("Awana\Academy")
print(phrase + " is cool")
print(phrase.capitalize())
print(phrase.lower())
print(phrase.upper())
print(phrase.isupper())
print(phrase.upper().isupper())
print(len(phrase))
print(phrase[0])
print(phrase.index("A"... | phrase = 'Awana Academy'
print('Awana\nAcademy')
print('Awana"Academy')
print('Awana\\Academy')
print(phrase + ' is cool')
print(phrase.capitalize())
print(phrase.lower())
print(phrase.upper())
print(phrase.isupper())
print(phrase.upper().isupper())
print(len(phrase))
print(phrase[0])
print(phrase.index('A'))
print(phr... |
#!/usr/bin/env python3
with open('AUTHORS', 'r') as authors_file:
authors = list(sorted([x.strip() for x in authors_file]))
with open('Qiskit.bib', 'w') as fd:
fd.write("@misc{ Qiskit,\n")
fd.write(' author = {%s},\n' % ' and '.join(authors))
fd.write(' title = {Qiskit: the Quantum Informa... | with open('AUTHORS', 'r') as authors_file:
authors = list(sorted([x.strip() for x in authors_file]))
with open('Qiskit.bib', 'w') as fd:
fd.write('@misc{ Qiskit,\n')
fd.write(' author = {%s},\n' % ' and '.join(authors))
fd.write(' title = {Qiskit: the Quantum Information Science Kit},\n')
... |
#while loop
temp = 0
while(temp < 20):
temp+=1
if(temp>10):
print(temp,"> 10")
print(temp)
# for loops
colors = ['yellow','white','blue','magenta','red']
for color in colors:
print(color)
print(range(10))
for index in range(10):
print(index) | temp = 0
while temp < 20:
temp += 1
if temp > 10:
print(temp, '> 10')
print(temp)
colors = ['yellow', 'white', 'blue', 'magenta', 'red']
for color in colors:
print(color)
print(range(10))
for index in range(10):
print(index) |
# alias to Bazel module `toolchains/cc`
load("@rules_nixpkgs_cc//:foreign_cc.bzl", _nixpkgs_foreign_cc_configure = "nixpkgs_foreign_cc_configure")
nixpkgs_foreign_cc_configure = _nixpkgs_foreign_cc_configure
| load('@rules_nixpkgs_cc//:foreign_cc.bzl', _nixpkgs_foreign_cc_configure='nixpkgs_foreign_cc_configure')
nixpkgs_foreign_cc_configure = _nixpkgs_foreign_cc_configure |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.