content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
expected_output = {
"system_auth_control": False,
"version": 3,
"interfaces": {
"Ethernet1/2": {
"interface": "Ethernet1/2",
"pae": "authenticator",
"port_control": "not auto",
"host_mode": "double host",
"re_authentication": False,
... | expected_output = {'system_auth_control': False, 'version': 3, 'interfaces': {'Ethernet1/2': {'interface': 'Ethernet1/2', 'pae': 'authenticator', 'port_control': 'not auto', 'host_mode': 'double host', 're_authentication': False, 'timeout': {'quiet_period': 59, 'server_timeout': 29, 'supp_timeout': 29, 'tx_period': 29,... |
# -*- coding: utf-8 -*-
# From http://www.w3.org/WAI/ER/IG/ert/iso639.htm
# ISO 639: 2-letter codes
languages = {
'aa': 'afar',
'ab': 'abkhazian',
'af': 'afrikaans',
'am': 'amharic',
'ar': 'arabic',
'as': 'assamese',
'ay': 'aymara',
'az': 'azerbaijani',
'ba': 'bashkir',
'be': 'byelorussian',
'bg': 'bulgarian',
'bh': '... | languages = {'aa': 'afar', 'ab': 'abkhazian', 'af': 'afrikaans', 'am': 'amharic', 'ar': 'arabic', 'as': 'assamese', 'ay': 'aymara', 'az': 'azerbaijani', 'ba': 'bashkir', 'be': 'byelorussian', 'bg': 'bulgarian', 'bh': 'bihari', 'bi': 'bislama', 'bn': 'bengali', 'bo': 'tibetan', 'br': 'breton', 'ca': 'catalan', 'co': 'co... |
#FileExample2.py ----Writing data to file
#opening file in write mode
fp = open("info.dat",'w')
#Writing data to file
fp.write("Hello Suprit this is Python")
#Check message
print("Data Inserted to file Successfully!\nPlease Verify.")
| fp = open('info.dat', 'w')
fp.write('Hello Suprit this is Python')
print('Data Inserted to file Successfully!\nPlease Verify.') |
class EnvVariableFile(object):
T_WORK = '/ade/kgurupra_dte8028/oracle/work/build_run_robot1/../'
VIEW_ROOT = '/ade/kgurupra_dte8028'
BROWSERTYPE = 'firefox' ########################For OID info################################################
OID_HOST = 'slc06xgk.us.oracle.com'
OID_PORT = '15635'
OID_SSL_PORT =... | class Envvariablefile(object):
t_work = '/ade/kgurupra_dte8028/oracle/work/build_run_robot1/../'
view_root = '/ade/kgurupra_dte8028'
browsertype = 'firefox'
oid_host = 'slc06xgk.us.oracle.com'
oid_port = '15635'
oid_ssl_port = '22718'
oid_admin = 'cn=orcladmin'
oid_admin_password = 'welc... |
List_of_numbers = [5,10,15,20,25]
for numbers in List_of_numbers:
print (numbers **10)
Values_list=[]
Values_list.append(numbers **10)
print(Values_list)
| list_of_numbers = [5, 10, 15, 20, 25]
for numbers in List_of_numbers:
print(numbers ** 10)
values_list = []
Values_list.append(numbers ** 10)
print(Values_list) |
q = 'a'
while(q != 'q'):
print("estou em looping")
q = input("Insira algo> ")
else:
print("fim") | q = 'a'
while q != 'q':
print('estou em looping')
q = input('Insira algo> ')
else:
print('fim') |
# cnt = int(input())
# for i in range(cnt):
# rep = int(input())
# arr = list(str(input()))
# for j in range(len(arr)):
# prt = arr[j]
# for _ in range(rep):
# print(prt,end="")
# print()
cnt = int(input())
for i in range(cnt):
(rep,arr) = map(str,inpu... | cnt = int(input())
for i in range(cnt):
(rep, arr) = map(str, input().split())
arr = list(str(arr))
for j in range(len(arr)):
prt = arr[j]
for _ in range(int(rep)):
print(prt, end='')
print() |
class SwapUser:
def __init__(self, exposure, collateral_perc, fee_perc):
self.exposure = exposure
self.collateral = collateral_perc
self.collateral_value = collateral_perc * exposure
self.fee = fee_perc * exposure
self.is_active = True
self.is_liquidated = ... | class Swapuser:
def __init__(self, exposure, collateral_perc, fee_perc):
self.exposure = exposure
self.collateral = collateral_perc
self.collateral_value = collateral_perc * exposure
self.fee = fee_perc * exposure
self.is_active = True
self.is_liquidated = False
... |
class SquareGrid:
def __init__(self, width, height):
self.width = width
self.height = height
self.walls = []
def in_bounds(self, node_id):
(x, y) = node_id
return 0 <= x < self.width and 0 <= y < self.height
def passable(self, node_id):
return node_id not in... | class Squaregrid:
def __init__(self, width, height):
self.width = width
self.height = height
self.walls = []
def in_bounds(self, node_id):
(x, y) = node_id
return 0 <= x < self.width and 0 <= y < self.height
def passable(self, node_id):
return node_id not i... |
#
# PySNMP MIB module NETSCREEN-OSPF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-OSPF-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:10:23 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ... |
test_dic = {
"SERVICETYPE": {
"SC": {
"SITEVERSION": {"T33L": "1"}
},
"EC": {
"SITEVERSION": {
"T33L": "1",
"T31L": {
"BROWSERVERSION": {
"9.1": "1",
"59.0": "1"
... | test_dic = {'SERVICETYPE': {'SC': {'SITEVERSION': {'T33L': '1'}}, 'EC': {'SITEVERSION': {'T33L': '1', 'T31L': {'BROWSERVERSION': {'9.1': '1', '59.0': '1'}}, 'T32L': '1'}}, 'TC': {'OSVERSION': {'10.13': '1', 'Other': {'BROWSERVERSION': {'52.0': '1'}}}}}} |
#
# @lc app=leetcode id=977 lang=python3
#
# [977] Squares of a Sorted Array
#
# @lc code=start
class Solution:
def sortedSquares(self, A: List[int]) -> List[int]:
newls = [item * item for item in A]
return sorted(newls)
# @lc code=end
| class Solution:
def sorted_squares(self, A: List[int]) -> List[int]:
newls = [item * item for item in A]
return sorted(newls) |
def get_firts_two_characters(string):
# 6.1.A
return string[:2]
def get_last_three_characters(string):
# 6.1.B
return string[-3:]
def print_every_two(string):
# 6.1.C
return string[::2]
def reverse(string):
# 6.1.D
return string[::-1]
def reverse_and_concact(string):
# 6.1.D
... | def get_firts_two_characters(string):
return string[:2]
def get_last_three_characters(string):
return string[-3:]
def print_every_two(string):
return string[::2]
def reverse(string):
return string[::-1]
def reverse_and_concact(string):
return string + reverse(string)
def str_insert_character(st... |
#!/usr/bin/env python3
def stalinsort(x=[]):
if x == []:
return x
for i in range(len(x)-1):
if x[i] < x[i+1]:
continue
else:
x.pop(i+1)
return x
| def stalinsort(x=[]):
if x == []:
return x
for i in range(len(x) - 1):
if x[i] < x[i + 1]:
continue
else:
x.pop(i + 1)
return x |
# Author: thisHermit
ASCENDING = 1
DESCENDING = 0
N = 5
def main():
input_array = [5, 4, 3, 2, 5]
a = input_array.copy()
# sort the array
sort(a, N)
# test and show
assert a, sorted(input_array)
show(a, N)
def exchange(i, j, a, n):
a[i], a[j] = a[j], a[i]
def compare(i... | ascending = 1
descending = 0
n = 5
def main():
input_array = [5, 4, 3, 2, 5]
a = input_array.copy()
sort(a, N)
assert a, sorted(input_array)
show(a, N)
def exchange(i, j, a, n):
(a[i], a[j]) = (a[j], a[i])
def compare(i, j, dirr, a, n):
if dirr == (a[i] > a[j]):
exchange(i, j, a, ... |
input_data = raw_input(">")
upper_case_letters = []
lower_case_letter = []
for x in input_data:
if str(x).isalpha() and str(x).isupper():
upper_case_letters.append(str(x))
elif str(x).isalpha() and str(x).islower():
lower_case_letter.append(str(x))
print("Upper case: " + str(len(upper_case_le... | input_data = raw_input('>')
upper_case_letters = []
lower_case_letter = []
for x in input_data:
if str(x).isalpha() and str(x).isupper():
upper_case_letters.append(str(x))
elif str(x).isalpha() and str(x).islower():
lower_case_letter.append(str(x))
print('Upper case: ' + str(len(upper_case_lette... |
'''
While loop - it keeps looping while a given condition is valid
'''
name = "Kevin"
age = 24
letter_index = 0
while letter_index < len(name):
print(name[letter_index])
letter_index = letter_index + 1
else:
print("Finished with the while loop")
'''
line 4 - we define the name with a string "Kevin"
line 5 -... | """
While loop - it keeps looping while a given condition is valid
"""
name = 'Kevin'
age = 24
letter_index = 0
while letter_index < len(name):
print(name[letter_index])
letter_index = letter_index + 1
else:
print('Finished with the while loop')
'\nline 4 - we define the name with a string "Kevin"\nline 5 -... |
# List
transports = ["airplane", "car", "ferry"]
modes = ["air", "ground", "water"]
# Lists contain simple data (index based item) and can be edited after being assigned.
# E.g. as transport types are not as limited as in this list, it can be updated by adding or removing.
# Let's create a couple of functions for add... | transports = ['airplane', 'car', 'ferry']
modes = ['air', 'ground', 'water']
print('\nLIST DATA TYPE')
print('--------------\n')
def add_transport():
global transports
global modes
message = input('Do you want to ADD a new transport? [Type yes/no]: ').lower().strip()
if message == 'yes':
name =... |
class WordDictionary:
def __init__(self):
self.list=set()
def add_word(self, word):
self.list.add(word)
def search(self, s):
if s in self.list:
return True
for i in self.list:
if len(i)!=len(s):
continue
flag=True
... | class Worddictionary:
def __init__(self):
self.list = set()
def add_word(self, word):
self.list.add(word)
def search(self, s):
if s in self.list:
return True
for i in self.list:
if len(i) != len(s):
continue
flag = True
... |
# Coastline harmonization with a landmask
def coastlineHarmonize(maskFile, ds, outmaskFile, outDEM, minimum, waterVal=0):
'''
This function is designed to take a coastline mask and harmonize elevation
values to it, such that no elevation values that are masked as water cells
will have elevation >0, ... | def coastline_harmonize(maskFile, ds, outmaskFile, outDEM, minimum, waterVal=0):
"""
This function is designed to take a coastline mask and harmonize elevation
values to it, such that no elevation values that are masked as water cells
will have elevation >0, and no land cells will have an elevation < mi... |
# This program gets a numberic test score from the
# user and displays the corresponding letter grade.
# Named constants to represent the grade thresholds
A_SCORE = 90
B_SCORE = 80
C_SCORE = 70
D_SCORE = 60
# Get a test score from the user.
score = int(input('Enter your test score: '))
# Determine th... | a_score = 90
b_score = 80
c_score = 70
d_score = 60
score = int(input('Enter your test score: '))
if score >= A_SCORE:
print('Your grade is A.')
elif score >= B_SCORE:
print('Your grade is B.')
elif score >= C_SCORE:
print('Your grade is C.')
elif score >= D_SCORE:
print('Your grade is D.')
else:
pr... |
{
'target_defaults': {
'variables': {
'deps': [
'libbrillo-<(libbase_ver)',
'libchrome-<(libbase_ver)',
'libndp',
'libshill-client',
'protobuf-lite',
],
},
},
'targets': [
{
'target_name': 'protos',
'type': 'static_library',
'variab... | {'target_defaults': {'variables': {'deps': ['libbrillo-<(libbase_ver)', 'libchrome-<(libbase_ver)', 'libndp', 'libshill-client', 'protobuf-lite']}}, 'targets': [{'target_name': 'protos', 'type': 'static_library', 'variables': {'proto_in_dir': '.', 'proto_out_dir': 'include/arc-networkd'}, 'sources': ['<(proto_in_dir)/i... |
class ApplicationException(Exception):
def __init__(self, java_exception):
self.java_exception = java_exception
def message(self):
return self.java_exception.getMessage()
| class Applicationexception(Exception):
def __init__(self, java_exception):
self.java_exception = java_exception
def message(self):
return self.java_exception.getMessage() |
# def t1():
# l = []
# for i in range(10000):
# l = l + [i]
# def t2():
# l = []
# for i in range(10000):
# l.append(i)
# def t3():
# l = [i for i in range(10000)]
# def t4():
# l = list(range(10000))
#
# from timeit import Timer
#
# timer1 = Timer("t1()", "from __main__ import t1")
# prin... | i = []
for i in range(4):
I.append({'num': i})
print(I)
i = []
a = {'num': 0}
for i in range(4):
a['num'] = i
I.append(a)
print(I) |
#!/usr/bin/env python3
class ProjectNameException(Exception):
pass
class MissingEnv(ProjectNameException):
pass
class CreateDirectoryException(ProjectNameException):
pass
class ConfigError(ProjectNameException):
pass
| class Projectnameexception(Exception):
pass
class Missingenv(ProjectNameException):
pass
class Createdirectoryexception(ProjectNameException):
pass
class Configerror(ProjectNameException):
pass |
# Here go your api methods.
def get_prod_list():
prod_list = db(db.products).select(
db.products.id,
db.products.name,
db.products.description,
db.products.price,
orderby=~db.products.price
).as_list()
return response.json(dict(prod_list=prod_list))
def get_rev... | def get_prod_list():
prod_list = db(db.products).select(db.products.id, db.products.name, db.products.description, db.products.price, orderby=~db.products.price).as_list()
return response.json(dict(prod_list=prod_list))
def get_rev_list():
review_list = db(db.reviews).select(db.reviews.usr, db.reviews.prod... |
########
# BASE #
########
# Registration
NICK = 'NICK'
PASS = 'PASS'
QUIT = 'QUIT'
USER = 'USER' # Sent when registering a new user.
# Channel ops
INVITE = 'INVITE'
JOIN = 'JOIN'
KICK = 'KICK'
LIST = 'LIST'
MODE = 'MODE'
NAMES = 'NAMES'
PART = 'PART'
TOPIC = 'TOPIC'
# Server ops
ADMIN = 'ADMIN'
CONNECT = 'CONNECT'... | nick = 'NICK'
pass = 'PASS'
quit = 'QUIT'
user = 'USER'
invite = 'INVITE'
join = 'JOIN'
kick = 'KICK'
list = 'LIST'
mode = 'MODE'
names = 'NAMES'
part = 'PART'
topic = 'TOPIC'
admin = 'ADMIN'
connect = 'CONNECT'
info = 'INFO'
links = 'LINKS'
oper = 'OPER'
rehash = 'REHASH'
restart = 'RESTART'
server = 'SERVER'
squit = ... |
# -*- coding: utf-8 -*-
if __name__ == '__main__':
Plant = lambda x: x + 2
FFC = lambda x: 1.1 * x + 1.9
FBC = lambda y: 0.9*y - 1.8
x = 5
x_ = x
y = Plant(x)
for k in range(100):
ypre = FFC(x_)
x_ = FFC(ypre)
x_ = (x + x_) / 2
print(y, ypre)
| if __name__ == '__main__':
plant = lambda x: x + 2
ffc = lambda x: 1.1 * x + 1.9
fbc = lambda y: 0.9 * y - 1.8
x = 5
x_ = x
y = plant(x)
for k in range(100):
ypre = ffc(x_)
x_ = ffc(ypre)
x_ = (x + x_) / 2
print(y, ypre) |
def gcdIter(a, b):
'''
a, b: positive integers
returns: a positive integer, the greatest common divisor of a & b.
'''
# Your code here
gcd = 1
if a > b:
for i in range(b, 0, -1):
if a % i == 0 and b % i == 0:
gcd = i
break
else:
... | def gcd_iter(a, b):
"""
a, b: positive integers
returns: a positive integer, the greatest common divisor of a & b.
"""
gcd = 1
if a > b:
for i in range(b, 0, -1):
if a % i == 0 and b % i == 0:
gcd = i
break
else:
for i in range(a, ... |
#English alphabet to be used in
#decipher/encipher calculations.
Alpha=['a','b','c','d','e','f','g',
'h','i','j','k','l','m','n',
'o','p','q','r','s','t','u',
'v','w','x','y','z']
def v_cipher(mode, text):
if(mode == "encipher"):
plainTxt = text
cipher... | alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def v_cipher(mode, text):
if mode == 'encipher':
plain_txt = text
cipher = ''
key = input('Key:')
key = key.upper()
if len(key) > len(pl... |
class Match:
def __init__(self, first_team, second_team, first_team_score, second_team_score):
self.first_team = first_team
self.second_team = second_team
self.first_team_score = first_team_score
self.second_team_score = second_team_score
self.commentary = []
def __repr_... | class Match:
def __init__(self, first_team, second_team, first_team_score, second_team_score):
self.first_team = first_team
self.second_team = second_team
self.first_team_score = first_team_score
self.second_team_score = second_team_score
self.commentary = []
def __repr... |
def millis_interval(start, end):
diff = end - start
millis = diff.days * 24 * 60 * 60 * 1000
millis += diff.seconds * 1000
millis += diff.microseconds / 1000
return int(round(millis))
| def millis_interval(start, end):
diff = end - start
millis = diff.days * 24 * 60 * 60 * 1000
millis += diff.seconds * 1000
millis += diff.microseconds / 1000
return int(round(millis)) |
'''
module for calculating
factorials of large
numbers efficiently
'''
def factorial(n: int):
'''
Calculating factorial using
prime decomposition
'''
prime = [True] * (n + 1)
result = 1
for i in range (2, n + 1):
if (prime[i]):
j = 2 * i
while (j <= ... | """
module for calculating
factorials of large
numbers efficiently
"""
def factorial(n: int):
"""
Calculating factorial using
prime decomposition
"""
prime = [True] * (n + 1)
result = 1
for i in range(2, n + 1):
if prime[i]:
j = 2 * i
while j <= n:
... |
class Solution:
def frequencySort(self, s: str) -> str:
freq_dict = dict()
output = ""
for x in s:
if x in freq_dict:
freq_dict[x] += 1
else:
freq_dict[x] = 1
refined_freq = sorted(freq_dict.items(), key=operator.itemg... | class Solution:
def frequency_sort(self, s: str) -> str:
freq_dict = dict()
output = ''
for x in s:
if x in freq_dict:
freq_dict[x] += 1
else:
freq_dict[x] = 1
refined_freq = sorted(freq_dict.items(), key=operator.itemgetter(1)... |
class Solution:
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
time = []
for i in intervals:
time.append((i[0], 1))
time.append((i[1], 0))
time.sort()
count = maxCount = 0
for t in time:
if t[1] == 1:
count +=... | class Solution:
def min_meeting_rooms(self, intervals: List[List[int]]) -> int:
time = []
for i in intervals:
time.append((i[0], 1))
time.append((i[1], 0))
time.sort()
count = max_count = 0
for t in time:
if t[1] == 1:
coun... |
class Company(object):
def __init__(self, name, title, start_date):
self.name = name
self.title = title
self.start_date = start_date
def getName(self):
return self.name
def getTitle(self):
return self.title
def getStartDate(self):
return self.start_dat... | class Company(object):
def __init__(self, name, title, start_date):
self.name = name
self.title = title
self.start_date = start_date
def get_name(self):
return self.name
def get_title(self):
return self.title
def get_start_date(self):
return self.start... |
class FastSort2():
def __init__(self, elems = []):
self._elems = elems
def FS2(self, low, high):
if low >= high:
return
i = low
pivot = self._elems[low]
for m in range(low + 1, high + 1):
if self._elems[m] < pivot:
i += ... | class Fastsort2:
def __init__(self, elems=[]):
self._elems = elems
def fs2(self, low, high):
if low >= high:
return
i = low
pivot = self._elems[low]
for m in range(low + 1, high + 1):
if self._elems[m] < pivot:
i += 1
... |
descriptor = ' {:<30} {}'
message_help_required_tagname = descriptor.format('', 'required: provide a tag to scrape')
message_help_required_login_username = descriptor.format('', 'required: add a login username')
message_help_required_login_password = descriptor.format('', 'required: add a login password')
message_help... | descriptor = ' {:<30} {}'
message_help_required_tagname = descriptor.format('', 'required: provide a tag to scrape')
message_help_required_login_username = descriptor.format('', 'required: add a login username')
message_help_required_login_password = descriptor.format('', 'required: add a login password')
message_help... |
#
# PySNMP MIB module Juniper-TSM-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-TSM-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 19:53:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint, constraints_union) ... |
def ready_jobs_dict_to_key(ready_jobs_list_dict):
ready_jobs_list_key = (
"ready_jobs"
+ "_cpu_credits_"
+ str(ready_jobs_list_dict["cpu_credits"])
+ "_gpu_credits_"
+ str(ready_jobs_list_dict["gpu_credits"])
)
return ready_jobs_list_key
| def ready_jobs_dict_to_key(ready_jobs_list_dict):
ready_jobs_list_key = 'ready_jobs' + '_cpu_credits_' + str(ready_jobs_list_dict['cpu_credits']) + '_gpu_credits_' + str(ready_jobs_list_dict['gpu_credits'])
return ready_jobs_list_key |
{'application':{'type':'Application',
'name':'Template',
'backgrounds': [
{'type':'Background',
'name':'standaloneBuilder',
'title':u'PythonCard standaloneBuilder',
'size':(800, 610),
'statusBar':1,
'menubar': {'type':'MenuBar',
'menus': [
... | {'application': {'type': 'Application', 'name': 'Template', 'backgrounds': [{'type': 'Background', 'name': 'standaloneBuilder', 'title': u'PythonCard standaloneBuilder', 'size': (800, 610), 'statusBar': 1, 'menubar': {'type': 'MenuBar', 'menus': [{'type': 'Menu', 'name': 'menuFile', 'label': '&File', 'items': [{'type':... |
class Error(Exception):
def __init__(self, typ, start_pos, end_pos, details) -> None:
self.typ = typ
self.details = details
self.start_pos = start_pos
self.end_pos = end_pos
def __repr__(self) -> str:
return f"{self.typ} : {self.details} ({self.start_pos.idx}, {self.... | class Error(Exception):
def __init__(self, typ, start_pos, end_pos, details) -> None:
self.typ = typ
self.details = details
self.start_pos = start_pos
self.end_pos = end_pos
def __repr__(self) -> str:
return f'{self.typ} : {self.details} ({self.start_pos.idx}, {self.end... |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def insert(head, x):
new_node = ListNode(x)
if head is None:
head = new_node
return
last_node = head
while last_node.next:
last_node = last_node.next
last_node.next = new_node
d... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def insert(head, x):
new_node = list_node(x)
if head is None:
head = new_node
return
last_node = head
while last_node.next:
last_node = last_node.next
last_node.next = new_node
def pri... |
class Client():
def __init__(self, player):
#self.clientSocket
pass
def connect(self):
pass
def sending(self):
pass
def getting(self):
pass
def serverHandling(self):
pass | class Client:
def __init__(self, player):
pass
def connect(self):
pass
def sending(self):
pass
def getting(self):
pass
def server_handling(self):
pass |
# -*- coding: utf-8 -*-
# Scrapy settings for state_scrapper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://docs.scrapy.org/en/latest/topics/settings.html
# https://docs.scrapy.org/en/lat... | bot_name = 'state_scrapper'
spider_modules = ['state_scrapper.spiders']
newspider_module = 'state_scrapper.spiders'
user_agent = 'state_scrapper (+http://www.mobicrol.com)'
robotstxt_obey = True
download_delay = 3.0
concurrent_requests_per_domain = 16
item_pipelines = {'state_scrapper.pipelines.DuplicatesPipeline': 200... |
n = int(input())
a = sorted(list(map(int, input().split(" "))))
while len(a) > 0:
print(len(a))
a = sorted(list(filter(lambda x: x > 0, map(lambda x: x - a[0], a))))
| n = int(input())
a = sorted(list(map(int, input().split(' '))))
while len(a) > 0:
print(len(a))
a = sorted(list(filter(lambda x: x > 0, map(lambda x: x - a[0], a)))) |
config = dict(
agent=dict(),
algo=dict(),
env=dict(
game="pong",
num_img_obs=1,
),
model=dict(),
optim=dict(),
runner=dict(
n_steps=5e6,
# log_interval_steps=1e5,
),
sampler=dict(
batch_T=20,
batch_B=32,
max_decorrelation_steps=... | config = dict(agent=dict(), algo=dict(), env=dict(game='pong', num_img_obs=1), model=dict(), optim=dict(), runner=dict(n_steps=5000000.0), sampler=dict(batch_T=20, batch_B=32, max_decorrelation_steps=1000))
configs = dict(default=config) |
class Solution:
def findGoodStrings(self, n, s1, s2, evil):
M = 10 ** 9 + 7
m = len(evil)
memo = {}
# KMP
dfa = self.failure(evil)
def dfs(i, x, bound):
if x == m:
return 0
if i == n:
return 1
... | class Solution:
def find_good_strings(self, n, s1, s2, evil):
m = 10 ** 9 + 7
m = len(evil)
memo = {}
dfa = self.failure(evil)
def dfs(i, x, bound):
if x == m:
return 0
if i == n:
return 1
if (i, x, bound) ... |
#!/usr/bin/env python
xlist = [1, 3, 5, 7, 1]
ylist = [1, 1, 1, 1, 2]
totaltrees = 1
with open('input.txt', 'r', encoding='utf-8') as input:
all_lines = input.readlines()
for i in range(5):
x = xlist[i]
y = ylist[i]
trees = 0
posx = 0
posy = 0
iterations = 1
for line in all_lines:
... | xlist = [1, 3, 5, 7, 1]
ylist = [1, 1, 1, 1, 2]
totaltrees = 1
with open('input.txt', 'r', encoding='utf-8') as input:
all_lines = input.readlines()
for i in range(5):
x = xlist[i]
y = ylist[i]
trees = 0
posx = 0
posy = 0
iterations = 1
for line in all_lines:
if y == 2 and posy %... |
class PriorityQueue:
def __init__(self, arr: list = [], is_min=True):
self.arr = arr
self.minmax = min if is_min else max
self.heapify()
@staticmethod
def children(i):
return (2 * i + 1, 2 * i + 2)
@staticmethod
def parent(i):
return (i - 1) // 2
@stati... | class Priorityqueue:
def __init__(self, arr: list=[], is_min=True):
self.arr = arr
self.minmax = min if is_min else max
self.heapify()
@staticmethod
def children(i):
return (2 * i + 1, 2 * i + 2)
@staticmethod
def parent(i):
return (i - 1) // 2
@static... |
# Written by Pavel Jahoda
#This class is used for evaluating and processing the results of the simulations
class Evaluation: #TODO, implement evaluation class
def __init__(self):
pass
def processResults(self,n_of_blocked_calls, n_of_dropped_calls, n_of_calls, n_of_channels_reverved):
p... | class Evaluation:
def __init__(self):
pass
def process_results(self, n_of_blocked_calls, n_of_dropped_calls, n_of_calls, n_of_channels_reverved):
pass
def evaluate(self):
pass
class Generator:
def __init__(self):
self.dummy_return_value = 0
def generate_speed(se... |
def fetching_episode(episode_name, stream_page):
tag = "[ FETCHING ]"
print(tag, episode_name, stream_page)
def fetched_episode(episode_name, stream_url, success):
tag = "[ SUCCESS ] " if success else "[ FAILED ] "
print(tag, episode_name, stream_url, end="\n\n")
def fetching_list(anime_url):
pri... | def fetching_episode(episode_name, stream_page):
tag = '[ FETCHING ]'
print(tag, episode_name, stream_page)
def fetched_episode(episode_name, stream_url, success):
tag = '[ SUCCESS ] ' if success else '[ FAILED ] '
print(tag, episode_name, stream_url, end='\n\n')
def fetching_list(anime_url):
pri... |
# definition
class OriginalException(Exception):
pass
| class Originalexception(Exception):
pass |
menu = ['deathnote', 'netflix', 'teaching']
# for i in range(len(menu)):
# print(i + 1,'. ',menu[i],sep='')
for index, item in enumerate(menu):
print(index + 1,'. ',item,sep='')
# for item in menu:
# print(item)
| menu = ['deathnote', 'netflix', 'teaching']
for (index, item) in enumerate(menu):
print(index + 1, '. ', item, sep='') |
class landShift():
def __init__(self):
self.shiftList = []
self.unwarpPts = []
def addPos(self, shift):
self.shiftList.append(shift)
if len(self.shiftList)>10:
self.shiftList = self.shiftList[1:]
def getVelocity(self):
if len(self.shiftList):
... | class Landshift:
def __init__(self):
self.shiftList = []
self.unwarpPts = []
def add_pos(self, shift):
self.shiftList.append(shift)
if len(self.shiftList) > 10:
self.shiftList = self.shiftList[1:]
def get_velocity(self):
if len(self.shiftList):
... |
def swap_case(s):
returnString = ""
for character in s:
if character.islower():
returnString += character.upper()
else:
returnString += character.lower()
return returnString
| def swap_case(s):
return_string = ''
for character in s:
if character.islower():
return_string += character.upper()
else:
return_string += character.lower()
return returnString |
def no_teen_sum(a, b, c):
def fix_teen(n):
if n ==15 or n==16:
return n
if 13<=n<=19:
return 0
else:
return n
sum = fix_teen(a)+ fix_teen(b)+ fix_teen(c)
return sum
def round_sum(a, b, c):
def round10(num):
if num%10<5:
... | def no_teen_sum(a, b, c):
def fix_teen(n):
if n == 15 or n == 16:
return n
if 13 <= n <= 19:
return 0
else:
return n
sum = fix_teen(a) + fix_teen(b) + fix_teen(c)
return sum
def round_sum(a, b, c):
def round10(num):
if num % 10 < 5:
... |
'''
This code is written by bidongqinxian
'''
def quick_sort(lst):
if not lst:
return []
base = lst[0]
left = quick_sort([x for x in lst[1: ] if x < base])
right = quick_sort([x for x in lst[1: ] if x >= base])
return left + [base] + right
| """
This code is written by bidongqinxian
"""
def quick_sort(lst):
if not lst:
return []
base = lst[0]
left = quick_sort([x for x in lst[1:] if x < base])
right = quick_sort([x for x in lst[1:] if x >= base])
return left + [base] + right |
K, N, F = map(int, input().split())
A = list(map(int, input().split()))
t = K * N - sum(A)
if t < 0:
print(-1)
else:
print(t)
| (k, n, f) = map(int, input().split())
a = list(map(int, input().split()))
t = K * N - sum(A)
if t < 0:
print(-1)
else:
print(t) |
_base_ = [
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
# model settings
model = dict(
type='FCOS',
pretrained='open-mmlab://detectron/resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
... | _base_ = ['../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py']
model = dict(type='FCOS', pretrained='open-mmlab://detectron/resnet50_caffe', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', r... |
#!/usr/bin/python
print("How you doing man???")
| print('How you doing man???') |
# ========================
# Information
# ========================
# Direct Link: https://www.hackerrank.com/challenges/write-a-function/problem
# Difficulty: Medium
# Max Score: 10
# Language: Python
# ========================
# Solution
# ========================
def is_leap(YEAR):
'''Checking w... | def is_leap(YEAR):
"""Checking whether year is a leap year"""
return YEAR % 4 == 0 and (YEAR % 400 == 0 or YEAR % 100 != 0)
year = int(input())
print(is_leap(YEAR)) |
# Name: config.py
# Description: defines configurations for the various components of audio extraction and processing
class AudioConfig:
# The format to store audio in
AUDIO_FORMAT = 'mp3'
# Prefix to save audio features to
FEATURE_DESTINATION = '/features/'
# Checkpoint frequency in number of tra... | class Audioconfig:
audio_format = 'mp3'
feature_destination = '/features/'
checkpoint_frequency = 10
min_clip_length = 29
class Displayconfig:
cmap = 'Greys'
figsize_width = 10
figsize_height = 10
class Featureextractorconfig:
supported_features = ['chroma_stft', 'rms', 'spec_cent', 's... |
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
intervals.sort(key=lambda x: x[0])
res = []
for i in range(0, len(intervals)):
if not res or res[-1][1] < intervals[i][0]:
res.append(intervals[i])
else:
re... | class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
intervals.sort(key=lambda x: x[0])
res = []
for i in range(0, len(intervals)):
if not res or res[-1][1] < intervals[i][0]:
res.append(intervals[i])
else:
r... |
# -*- coding: utf-8 -*-
# Source: https://leetcode.com/problems/search-in-rotated-sorted-array/
def search(nums, left, right, target):
if left > right:
return -1
mid = int((left + right) / 2)
if nums[mid] == target:
return mid
# left --- target --- mid --- right
if nums[mid] <= nu... | def search(nums, left, right, target):
if left > right:
return -1
mid = int((left + right) / 2)
if nums[mid] == target:
return mid
if nums[mid] <= nums[right]:
if target < nums[mid] or target > nums[right]:
return search(nums, left, mid - 1, target)
else:
... |
'''Use an IF statement inside a FOR loop to select only positive numbers.'''
def printAllPositive(numberList):
'''Print only the positive numbers in numberList.'''
for num in numberList:
if num > 0:
print(num)
printAllPositive([3, -5, 2, -1, 0, 7])
| """Use an IF statement inside a FOR loop to select only positive numbers."""
def print_all_positive(numberList):
"""Print only the positive numbers in numberList."""
for num in numberList:
if num > 0:
print(num)
print_all_positive([3, -5, 2, -1, 0, 7]) |
# The tests rely on a lot of absolute paths so this file
# configures all of that
music_folder = u'/home/rudi/music'
o_path = u'/home/rudi/throwaway/ACDC_-_Back_In_Black-sample-64kbps.ogg'
watch_path = u'/home/rudi/throwaway/watch/',
real_path1 = u'/home/rudi/throwaway/watch/unknown/unknown/ACDC_-_Back_In_Black-sample... | music_folder = u'/home/rudi/music'
o_path = u'/home/rudi/throwaway/ACDC_-_Back_In_Black-sample-64kbps.ogg'
watch_path = (u'/home/rudi/throwaway/watch/',)
real_path1 = u'/home/rudi/throwaway/watch/unknown/unknown/ACDC_-_Back_In_Black-sample-64kbps-64kbps.ogg'
opath = u'/home/rudi/Airtime/python_apps/media-monitor2/tests... |
# python3
def max_ammount(W, weights):
values = [[0 for _ in weights + [0]] for _ in range(W + 1)]
for w in range(1, W + 1):
for i, wi in enumerate(weights):
values[w][i + 1] = max([
values[w][i],
values[w - wi][i] + wi if w - wi >= 0 else 0
])
... | def max_ammount(W, weights):
values = [[0 for _ in weights + [0]] for _ in range(W + 1)]
for w in range(1, W + 1):
for (i, wi) in enumerate(weights):
values[w][i + 1] = max([values[w][i], values[w - wi][i] + wi if w - wi >= 0 else 0])
return values[-1][-1]
if __name__ == '__main__':
... |
abcd = (1 + 2 + 3 + 4 +
5 + 6)
aaaa = (8188107138941 <=
90)
bbbb = (123 ** 456 &
780)
cccc = (123 ** 456
& 780
| 89 /
8)
| abcd = 1 + 2 + 3 + 4 + 5 + 6
aaaa = 8188107138941 <= 90
bbbb = 123 ** 456 & 780
cccc = 123 ** 456 & 780 | 89 / 8 |
def temperature_format(value):
return round(int(value) * 0.1, 1)
class OkofenDefinition:
def __init__(self, name=None):
self.domain = name
self.__datas = {}
def set(self, target, value):
self.__datas[target] = value
def get(self, target):
if target in self.__datas:
... | def temperature_format(value):
return round(int(value) * 0.1, 1)
class Okofendefinition:
def __init__(self, name=None):
self.domain = name
self.__datas = {}
def set(self, target, value):
self.__datas[target] = value
def get(self, target):
if target in self.__datas:
... |
def findMin(a, n):
su = 0
su = sum(a)
dp = [[0 for i in range(su + 1)]
for j in range(n + 1)]
for i in range(n + 1):
dp[i][0] = True
for j in range(1, su + 1):
dp[0][j] = False
for i in range(1, n + 1):
for j in range(1, su + 1):
dp[i][j] = dp[i ... | def find_min(a, n):
su = 0
su = sum(a)
dp = [[0 for i in range(su + 1)] for j in range(n + 1)]
for i in range(n + 1):
dp[i][0] = True
for j in range(1, su + 1):
dp[0][j] = False
for i in range(1, n + 1):
for j in range(1, su + 1):
dp[i][j] = dp[i - 1][j]
... |
class AboutDialog:
def __init__(self, builder):
self._win = builder.get_object('dialog_about', target=self, include_children=True)
def run(self):
result = self._win.run()
self._win.hide()
return result | class Aboutdialog:
def __init__(self, builder):
self._win = builder.get_object('dialog_about', target=self, include_children=True)
def run(self):
result = self._win.run()
self._win.hide()
return result |
def extractChichipephCom(item):
'''
Parser for 'chichipeph.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('the former wife', 'The Former Wife of Invisible Wealthy Man', ... | def extract_chichipeph_com(item):
"""
Parser for 'chichipeph.com'
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [('the former wife', 'The Former Wife of Invisible Wealthy Man',... |
#
# PySNMP MIB module PDN-IFEXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-IFEXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:30:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ... |
class BinarySearch:
def __init__(self):
pass
def search(self, array, item):
# return self.recursively_search(array, item, 0, len(array)-1)
return self.interactive_search(array, item, 0, len(array)-1)
def recursively_search(self, array, item, left, right):
if(left > right):
... | class Binarysearch:
def __init__(self):
pass
def search(self, array, item):
return self.interactive_search(array, item, 0, len(array) - 1)
def recursively_search(self, array, item, left, right):
if left > right:
return -1
mid = int((left + right) / 2)
i... |
class Solution:
def makeGood(self, s: str) -> str:
ans = []
for ch in s:
if ans and ans[-1].lower() == ch.lower() and ans[-1] != ch:
ans.pop()
else:
ans.append(ch)
return ''.join(ans)
| class Solution:
def make_good(self, s: str) -> str:
ans = []
for ch in s:
if ans and ans[-1].lower() == ch.lower() and (ans[-1] != ch):
ans.pop()
else:
ans.append(ch)
return ''.join(ans) |
#-----------------------------------------------------------------------------
# Runtime: 28ms
# Memory Usage:
# Link:
#-----------------------------------------------------------------------------
class Solution:
def spiralOrder(self, matrix: [[int]]) -> [int]:
row_length = len(matrix)
if row_le... | class Solution:
def spiral_order(self, matrix: [[int]]) -> [int]:
row_length = len(matrix)
if row_length <= 0:
return matrix
col_length = len(matrix[0])
matrix_length = col_length * row_length
result = []
level = 0
while True:
first_co... |
def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Reserved'},
{'abbr': 'surf',
'code': 1,
'title': 'Surface',
'units': 'of the Earth, which includes sea surface'},
{'abbr': 'bcld', 'code': 2, 'title': 'Cloud base level'},
{'abbr': 'tcld'... | def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Reserved'}, {'abbr': 'surf', 'code': 1, 'title': 'Surface', 'units': 'of the Earth, which includes sea surface'}, {'abbr': 'bcld', 'code': 2, 'title': 'Cloud base level'}, {'abbr': 'tcld', 'code': 3, 'title': 'Cloud top level'}, {'abbr': 'isot', 'code': 4, 'titl... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.preorder_i = 0
def build_tree(self, preorder, inorder) -> TreeNode:
return self.rec(preorder, inorder, 0, len(preorder) - 1)
def re... |
inpt1 = int(input('enter base: '))
inpt2 = int(input('enter height: '))
inpt3 = int(input('enter hypotenus: '))
def get_area(base, height):
return 0.5 * base * height
def get_per(base, height, hypo):
return base + height + hypo
print("area of the triangle is: ")
print(get_area(inpt1, inpt2))
print()
print('t... | inpt1 = int(input('enter base: '))
inpt2 = int(input('enter height: '))
inpt3 = int(input('enter hypotenus: '))
def get_area(base, height):
return 0.5 * base * height
def get_per(base, height, hypo):
return base + height + hypo
print('area of the triangle is: ')
print(get_area(inpt1, inpt2))
print()
print('th... |
def __getattr__():
pass
class C1:
def __str__(self):
return ''
def foo(self):
'''
>>> class Good():
... def __str__(self):
... return 1
'''
pass
class C2:
if True:
def __str__(self):
return ''
class C... | def __getattr__():
pass
class C1:
def __str__(self):
return ''
def foo(self):
"""
>>> class Good():
... def __str__(self):
... return 1
"""
pass
class C2:
if True:
def __str__(self):
return ''
class... |
class Config(object):
DEBUG = False
TESTING = False
SECRET_KEY = 'AAABBBBAAAA'
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db'
class ProductionConfig(Config):
DATABASE_URI = 'mysql://user@localhost/foo'
class DevelopmentConfig(Config):
DEBUG = True
class TestingConfig(Config):
TESTING... | class Config(object):
debug = False
testing = False
secret_key = 'AAABBBBAAAA'
sqlalchemy_database_uri = 'sqlite:////tmp/test.db'
class Productionconfig(Config):
database_uri = 'mysql://user@localhost/foo'
class Developmentconfig(Config):
debug = True
class Testingconfig(Config):
testing ... |
#!/usr/bin/python3
'''
Finds the coincidence index for the piece of text
Does not format the text so make sure to pass in a formatted one
'''
def findCoincidenceIndex(text: str, shift: int):
shiftedText = text[:-(shift)]
text = text[shift:]
shiftedLen = len(shiftedText)
similarCount = 0
for i in ra... | """
Finds the coincidence index for the piece of text
Does not format the text so make sure to pass in a formatted one
"""
def find_coincidence_index(text: str, shift: int):
shifted_text = text[:-shift]
text = text[shift:]
shifted_len = len(shiftedText)
similar_count = 0
for i in range(shiftedLen):... |
# Default
domainFile = "domains.txt"
assets = "./assets/"
targets = assets + "targets/"
subdomains = assets + "subdomains/"
domains = assets + "domains/"
takeover = assets + "takeover/"
dto = assets = "dto/"
# Target Information
targetFields = {
"Domain" : "",
"Analysis" : {
"Subdomain" : "",
"... | domain_file = 'domains.txt'
assets = './assets/'
targets = assets + 'targets/'
subdomains = assets + 'subdomains/'
domains = assets + 'domains/'
takeover = assets + 'takeover/'
dto = assets = 'dto/'
target_fields = {'Domain': '', 'Analysis': {'Subdomain': '', 'Ping': '', 'Dns': ''}} |
count = int(input())
matrix = []
for i in range(count):
matrix.append(list(map(int, input().split())))
# matrix = [list(map(int, input().split())) for i in range(n)]
roads = 0
for row in range(len(matrix)):
for col in range(row, len(matrix)):
roads += matrix[row][col]
print(roads)
| count = int(input())
matrix = []
for i in range(count):
matrix.append(list(map(int, input().split())))
roads = 0
for row in range(len(matrix)):
for col in range(row, len(matrix)):
roads += matrix[row][col]
print(roads) |
# BUILD FILE SYNTAX: SKYLARK
SE_VERSION = '3.9.1'
ASSEMBLY_VERSION = '3.9.1.0'
| se_version = '3.9.1'
assembly_version = '3.9.1.0' |
#
# PySNMP MIB module STN-SESSION-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-SESSION-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:11:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ... |
msg = "No Smoking here"
print(len(msg))
msg.count('o')
msg.count('s',3,5)
msg.count('n')
msg.count('N')
msg.count('O',7)
msg.count('o',7)
msg.count('o',1,7)
msg.count('o',7,15) | msg = 'No Smoking here'
print(len(msg))
msg.count('o')
msg.count('s', 3, 5)
msg.count('n')
msg.count('N')
msg.count('O', 7)
msg.count('o', 7)
msg.count('o', 1, 7)
msg.count('o', 7, 15) |
definition = [
{
"project_name" : "Project1",
"end_points": [
{
"local_development": "http://localhost:8066/",
"local_team_development": "http://192.168.5.217:8066/"
}
],
"api_end_point_partial_path": "api/"
}
]
| definition = [{'project_name': 'Project1', 'end_points': [{'local_development': 'http://localhost:8066/', 'local_team_development': 'http://192.168.5.217:8066/'}], 'api_end_point_partial_path': 'api/'}] |
print('----- range(3) -----')
print(range(3))
for x in range(3): print(x)
print('----- range(3, 10) -----')
print(range(3, 10))
for x in range(3, 10): print(x)
print('----- range(-3) -----')
print(range(-3))
for x in range(-3): print(x)
print('----- range(0,-3) -----')
print(range(0,-3))
for x in range(0,-3): print(x)
... | print('----- range(3) -----')
print(range(3))
for x in range(3):
print(x)
print('----- range(3, 10) -----')
print(range(3, 10))
for x in range(3, 10):
print(x)
print('----- range(-3) -----')
print(range(-3))
for x in range(-3):
print(x)
print('----- range(0,-3) -----')
print(range(0, -3))
for x in range(0, ... |
# leetcode
class Solution:
def reverse(self, x: int) -> int:
str_x = str(x)
if str_x[:1] == "-":
isNeg = True
str_x = str_x[1:]
else:
isNeg = False
str_x = str_x[::-1]
new_x = int(str_x)
if isNeg:
... | class Solution:
def reverse(self, x: int) -> int:
str_x = str(x)
if str_x[:1] == '-':
is_neg = True
str_x = str_x[1:]
else:
is_neg = False
str_x = str_x[::-1]
new_x = int(str_x)
if isNeg:
new_x *= -1
if new_x < ... |
n = input()
# Reading first list
list1 = list(map(int, input().split()))
# Reading second list then to set
set1 = set(list(map(int, input().split())))
set2 = set(list(map(int, input().split())))
count = 0
# Looping through elements in
for el in list1:
# checking the element existence Set
if el in set1:
... | n = input()
list1 = list(map(int, input().split()))
set1 = set(list(map(int, input().split())))
set2 = set(list(map(int, input().split())))
count = 0
for el in list1:
if el in set1:
count += 1
elif el in set2:
count -= 1
print(count) |
pairs = {1: "apple",
"orange": [2,3,5],
True:False,
None:"True",
}
print(pairs.get("orange"))
print(pairs.get(7))
print(pairs.get(12345, "not in dictionary")) | pairs = {1: 'apple', 'orange': [2, 3, 5], True: False, None: 'True'}
print(pairs.get('orange'))
print(pairs.get(7))
print(pairs.get(12345, 'not in dictionary')) |
main = [{'category': 'Transfer Limits',
'field': [{'name': 'tx_transfer_min',
'title': 'Minimum amount a user can transfer per transaction',
'note': 'Default is set to zero.'},
{'name': 'tx_transfer_max_day',
'title': 'Maximum total... | main = [{'category': 'Transfer Limits', 'field': [{'name': 'tx_transfer_min', 'title': 'Minimum amount a user can transfer per transaction', 'note': 'Default is set to zero.'}, {'name': 'tx_transfer_max_day', 'title': 'Maximum total amount a user can transfer per day', 'note': 'Default is set to unlimited.'}, {'name': ... |
# Author: Luke Hindman
# Date: Tue Oct 24 13:10:06 MDT 2017
# Description: In-class example for user input and lists
# Create an empty grocery list
groceryList = []
# Shopping list loop
done = False
while done == False:
# Prompt the user for an item to add to the list
item = input("Please enter an item or ... | grocery_list = []
done = False
while done == False:
item = input('Please enter an item or done when finished: ')
if item.lower() == 'done':
done = True
else:
groceryList.append(item)
for g in groceryList:
print("Don't forget the " + g + '!') |
space = [[1 for _ in range(21)] for _ in range(21)]
for x in range(1,21):
for y in range(1,21):
space[x][y] = space[x-1][y] + space[x][y-1]
print(space[20][20])
| space = [[1 for _ in range(21)] for _ in range(21)]
for x in range(1, 21):
for y in range(1, 21):
space[x][y] = space[x - 1][y] + space[x][y - 1]
print(space[20][20]) |
#4.6
def computepay(h,r):
# ( 40 hours * normal rate ) + (( overtime hours ) * time-and-a-half rate)
if(h>40):
p = ( 40 * r ) + (( h - 40 ) * 1.5 * r)
return p
else:
p = h * r
return p
hours = float(input("Enter Hours: "))
rate = float(input("Enter Rate per hour: "))
pay = ... | def computepay(h, r):
if h > 40:
p = 40 * r + (h - 40) * 1.5 * r
return p
else:
p = h * r
return p
hours = float(input('Enter Hours: '))
rate = float(input('Enter Rate per hour: '))
pay = computepay(hours, rate)
print('Pay', pay) |
class CellCountMissingCellsException(Exception):
pass
class UnknownAtlasValue(Exception):
pass
def atlas_value_to_structure_id(atlas_value, structures_reference_df):
line = structures_reference_df[
structures_reference_df["id"] == atlas_value
]
if len(line) == 0:
raise UnknownAtl... | class Cellcountmissingcellsexception(Exception):
pass
class Unknownatlasvalue(Exception):
pass
def atlas_value_to_structure_id(atlas_value, structures_reference_df):
line = structures_reference_df[structures_reference_df['id'] == atlas_value]
if len(line) == 0:
raise unknown_atlas_value(atlas_... |
x = 'abc'
x = "abc"
x = r'abc'
x = 'abc' \
'def'
x = ('abc'
'def')
x = 'ab"c'
x = "ab'c"
x = '''ab'c'''
| x = 'abc'
x = 'abc'
x = 'abc'
x = 'abcdef'
x = 'abcdef'
x = 'ab"c'
x = "ab'c"
x = "ab'c" |
class DefaultConfig (object) :
root_raw_train_data = 'path to be filled' # downloaded training data root
root_raw_eval_data = 'path to be filled' # downloaded evaluation/testing data root
root_dataset_file = './dataset/' # preprocessed dataset root
root_train_volume = './dataset/train/' # preprocessed... | class Defaultconfig(object):
root_raw_train_data = 'path to be filled'
root_raw_eval_data = 'path to be filled'
root_dataset_file = './dataset/'
root_train_volume = './dataset/train/'
root_eval_volume = './dataset/eval/'
root_exp_file = './exp/'
root_submit_file = './submit/'
root_pred_d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.