content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
########################################################################
# amara/writers/htmlentities.py
"""
This module defines the entities for HTML 3.2, HTML 4.0 and XHTML 1.0.
"""
__all__ = ['ENTITIES_HTML_32', 'ENTITIES_HTML_40', 'ENTITIES_XHTML_10']
# HTML 3.2 defined character entities
ENTITIES_HTML_32 = {
... | """
This module defines the entities for HTML 3.2, HTML 4.0 and XHTML 1.0.
"""
__all__ = ['ENTITIES_HTML_32', 'ENTITIES_HTML_40', 'ENTITIES_XHTML_10']
entities_html_32 = {u'\xa0': ' ', u'¡': '¡', u'¢': '¢', u'£': '£', u'¤': '¤', u'¥': '¥', u'¦': '¦', u'§': '§', u'¨': '¨'... |
# Write a program that reads numbers from the user until a blank line is entered.
# Your program should display the average of all of the values entered by the user.
# Then the program should display all of the below average values, followed by all of the average values (if any),
# followed by all of the above avera... | num_list = []
average = 0
total = 0
below_average = []
average_vals = []
above_average = []
def get_num():
user_num = input('Please enter a number: ')
if userNum == '':
return userNum
else:
user_num = int(userNum)
numList.append(userNum)
return userNum
while get_num() != '':... |
test = { 'name': 'q8_8',
'points': 1,
'suites': [ { 'cases': [ { 'code': ">>> # Please actually go on Piazza and look at the threads.;\n>>> # Looks like you didn't make a string.;\n>>> type(secret) == str\nTrue",
'hidden': False,
... | test = {'name': 'q8_8', 'points': 1, 'suites': [{'cases': [{'code': ">>> # Please actually go on Piazza and look at the threads.;\n>>> # Looks like you didn't make a string.;\n>>> type(secret) == str\nTrue", 'hidden': False, 'locked': False}, {'code': '>>> len(secret) == 11\nTrue', 'hidden': False, 'locked': False}], '... |
"""
Configuration
Constants for package use.
"""
# -------------------------
# API Base URL
# -------------------------
# default API URL for v0
API_BASE_URL = "https://api.letterboxd.com/api/v0"
# TODO: Move the LBXD_API_KEY and LBXD_API_KEY in here?
| """
Configuration
Constants for package use.
"""
api_base_url = 'https://api.letterboxd.com/api/v0' |
class BaseETL:
def __init__(self, base_url, access_token, s3_bucket):
self.base_url = base_url
self.access_token = access_token
self.s3_bucket = s3_bucket
def files_to_submissions(self):
pass
def submit_metadata(self):
pass
| class Baseetl:
def __init__(self, base_url, access_token, s3_bucket):
self.base_url = base_url
self.access_token = access_token
self.s3_bucket = s3_bucket
def files_to_submissions(self):
pass
def submit_metadata(self):
pass |
num = int(input("Enter a number: "))
count = 0
i = 2
while (i <= num / 2):
if (num % i) == 0:
count = count + 1
break
i = i + 1
if (count == 0 and num != 1):
print(f" {num} is a prime number")
else:
print(f"{num} is not a prime number")
| num = int(input('Enter a number: '))
count = 0
i = 2
while i <= num / 2:
if num % i == 0:
count = count + 1
break
i = i + 1
if count == 0 and num != 1:
print(f' {num} is a prime number')
else:
print(f'{num} is not a prime number') |
'''
Created on 06.02.2020
@author: JM
'''
class TMC4330_fields(object):
"""
Define all register bitfields of the TMC4330.
Each field is defined as a tuple consisting of ( Address, Mask, Shift ).
The name of the register is written as a comment behind each tuple. This is
intended for IDE users vi... | """
Created on 06.02.2020
@author: JM
"""
class Tmc4330_Fields(object):
"""
Define all register bitfields of the TMC4330.
Each field is defined as a tuple consisting of ( Address, Mask, Shift ).
The name of the register is written as a comment behind each tuple. This is
intended for IDE users vi... |
yaw_kp = 0.47
yaw_setpoint = 0.0
roll_kp = 0.38
roll_setpoint = 0.0
pitch_kp = 0.32
pitch_setpoint = 0.0
range_kp = 0.09
range_setpoint = 0.0
horizontal_kp = 0.45
horizontal_setpoint = 0.0
vertical_kp = 0.18
vertical_setpoint = 0.0 | yaw_kp = 0.47
yaw_setpoint = 0.0
roll_kp = 0.38
roll_setpoint = 0.0
pitch_kp = 0.32
pitch_setpoint = 0.0
range_kp = 0.09
range_setpoint = 0.0
horizontal_kp = 0.45
horizontal_setpoint = 0.0
vertical_kp = 0.18
vertical_setpoint = 0.0 |
class ApiError(Exception):
def __init__(self, code, message):
self.code = code
self.message = message
def __repr__(self):
return self.__str__()
def __str__(self):
return repr(self.message)
| class Apierror(Exception):
def __init__(self, code, message):
self.code = code
self.message = message
def __repr__(self):
return self.__str__()
def __str__(self):
return repr(self.message) |
username = 'XXXXXXXXX' #your username
password = 'YYYYYYYYYYYYY' #your password
#Here, your username and pw are asked not to be intrusive, but just because ig hates
#other ways than the app to post pictures.
#So there is no official API Keys to use. Sorry for that.
| username = 'XXXXXXXXX'
password = 'YYYYYYYYYYYYY' |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class GetLinuxSupportUser2FAResult(object):
"""Implementation of the 'GetLinuxSupportUser2FAResult' model.
Attributes:
email_id (string): TODO: Type Description here.
to_tp_qr_code_url (string): TODO: Type Description here.
to_tp... | class Getlinuxsupportuser2Faresult(object):
"""Implementation of the 'GetLinuxSupportUser2FAResult' model.
Attributes:
email_id (string): TODO: Type Description here.
to_tp_qr_code_url (string): TODO: Type Description here.
to_tp_secret_key (string): TODO: Type Description here.
... |
input=str(input())
# print(len(input))
def getRes(input):
for i in range(0,len(input)):
# print("i=",input[i])
if(int(input[i])%8==0):
print("YES")
print(input[i])
return
for j in range(i+1,len(input)):
a=10*int(input[i])+int(input[j])
... | input = str(input())
def get_res(input):
for i in range(0, len(input)):
if int(input[i]) % 8 == 0:
print('YES')
print(input[i])
return
for j in range(i + 1, len(input)):
a = 10 * int(input[i]) + int(input[j])
if a % 8 == 0:
... |
__author__ = 'krasnykh'
class Film(object):
def __init__(self, name = "", aka = "", year = "", duration = "", rating = "", notes = "", text_languages_0 = "", subtitles = "", audio = "", video = "", country = "", genres = "", music = ""):
self.name = name
self.aka = aka
self.year = year
... | __author__ = 'krasnykh'
class Film(object):
def __init__(self, name='', aka='', year='', duration='', rating='', notes='', text_languages_0='', subtitles='', audio='', video='', country='', genres='', music=''):
self.name = name
self.aka = aka
self.year = year
self.duration = durat... |
#
# @lc app=leetcode id=590 lang=python3
#
# [590] N-ary Tree Postorder Traversal
#
# @lc code=start
# Definition for a Node.
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
class Solution:
def postorder(self, root):
ls = []
de... | class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
class Solution:
def postorder(self, root):
ls = []
def generator(root):
if not root:
return
for child in root.children:
gen... |
"""
New Driver's License
You have to get a new driver's license and you show up at the office at the same time as 4 other people. The office says that they will see everyone in alphabetical order and it takes 20 minutes for them to process each new license. All of the agents are available now, and they can each see one... | """
New Driver's License
You have to get a new driver's license and you show up at the office at the same time as 4 other people. The office says that they will see everyone in alphabetical order and it takes 20 minutes for them to process each new license. All of the agents are available now, and they can each see one... |
def application(environ, start_response):
body = []
content_length = 0
for l in environ['wsgi.input'].__iter__():
body.append(l)
content_length += len(l)
start_response(
'200',
[
('Content-Length', str(content_length)),
('X-Lines-Count', str(len(... | def application(environ, start_response):
body = []
content_length = 0
for l in environ['wsgi.input'].__iter__():
body.append(l)
content_length += len(l)
start_response('200', [('Content-Length', str(content_length)), ('X-Lines-Count', str(len(body)))])
return body |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: flat
class GameMode(object):
Soccer = 0
Hoops = 1
Dropshot = 2
Hockey = 3
Rumble = 4
| class Gamemode(object):
soccer = 0
hoops = 1
dropshot = 2
hockey = 3
rumble = 4 |
class Solution:
def reverseBits(self, n: int) -> int:
res = 0
for _ in range(32):
tmp = n & 0x80000000
tmp = 1 if tmp else 0
n <<= 1
if tmp:
res += 2 ** _
print(bin(res))
return res
| class Solution:
def reverse_bits(self, n: int) -> int:
res = 0
for _ in range(32):
tmp = n & 2147483648
tmp = 1 if tmp else 0
n <<= 1
if tmp:
res += 2 ** _
print(bin(res))
return res |
class Hyperparameters():
def __init__(self):
self.IMAGESIZE = [30,30]
self.MEAN_REWARD_BOUND = 19.0
self.CHANNEL_NUM = 4
self.ACTION_SPACE = 6
self.GAMMA = 0.99
self.BATCH_SIZE = 32
self.REPLAY_SIZE = 10000
self.REPLA... | class Hyperparameters:
def __init__(self):
self.IMAGESIZE = [30, 30]
self.MEAN_REWARD_BOUND = 19.0
self.CHANNEL_NUM = 4
self.ACTION_SPACE = 6
self.GAMMA = 0.99
self.BATCH_SIZE = 32
self.REPLAY_SIZE = 10000
self.REPLAY_START_SIZE = 10000
self.L... |
def sayHello1(name):
print(f"hello to {name}")
sayHello1("Atilla")
sayHello1("Duru")
sayHello1("")
#sayHello1() # TypeError: sayHello1() missing 1 required positional argument: 'name'
sayHello1(name = "Atilla") | def say_hello1(name):
print(f'hello to {name}')
say_hello1('Atilla')
say_hello1('Duru')
say_hello1('')
say_hello1(name='Atilla') |
class Interface:
def __init__(self, name, operations):
self.name = name
self.operations = operations
| class Interface:
def __init__(self, name, operations):
self.name = name
self.operations = operations |
list = [5, 10, 15, 20, 25, 50, 20]
for i in range(len(list)):
if list[i] == 20:
list[i] = 200
print(list)
print(list[2:6]) | list = [5, 10, 15, 20, 25, 50, 20]
for i in range(len(list)):
if list[i] == 20:
list[i] = 200
print(list)
print(list[2:6]) |
# Declare Variables Here
binary = "binary"
do_not = "don't"
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
# Print Strings Here
x = "There are %d types of people" % 10
y = "Those who know %s and those who %s." % (binary, do_not)
w = "This is the left side of "
e = "a string with a right side."
... | binary = 'binary'
do_not = "don't"
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
x = 'There are %d types of people' % 10
y = 'Those who know %s and those who %s.' % (binary, do_not)
w = 'This is the left side of '
e = 'a string with a right side.'
print(x)
print(y)
print('I said: %r.' % x)
print("... |
# -*- coding: utf-8 -*-
class Solution:
def getMaximumGenerated(self, n: int) -> int:
nums, result = [0] * (n + 1), 0
for i in range(1, n + 1):
if i == 1:
nums[i] = 1
elif i % 2 == 0:
nums[i] = nums[i // 2]
elif i % 2 == 1:
... | class Solution:
def get_maximum_generated(self, n: int) -> int:
(nums, result) = ([0] * (n + 1), 0)
for i in range(1, n + 1):
if i == 1:
nums[i] = 1
elif i % 2 == 0:
nums[i] = nums[i // 2]
elif i % 2 == 1:
nums[i] =... |
class Solution:
def modifyString(self, s: str) -> str:
sl=list(s)
for i in range(len(sl)):
if sl[i]=='?':
if i==0 or sl[i-1]!='a':
sl[i]='a'
else:
sl[i]='b'
if i!=len(sl)-1 and sl[i+1]==sl[i]... | class Solution:
def modify_string(self, s: str) -> str:
sl = list(s)
for i in range(len(sl)):
if sl[i] == '?':
if i == 0 or sl[i - 1] != 'a':
sl[i] = 'a'
else:
sl[i] = 'b'
if i != len(sl) - 1 and sl[... |
_sensor_mode_to_resolution = {
0: None,
1: '1920x1080',
2: '3280x2464',
3: '3280x2464',
4: '1640x1232',
5: '1640x922',
6: '1280x720',
7: '640x480',
}
_sensor_mode_to_framerate = {
0: None,
1: 24, # Maximum is 30
2: 10, # Maximum is 15
3: 10, # Maximum is 15
4: 15,... | _sensor_mode_to_resolution = {0: None, 1: '1920x1080', 2: '3280x2464', 3: '3280x2464', 4: '1640x1232', 5: '1640x922', 6: '1280x720', 7: '640x480'}
_sensor_mode_to_framerate = {0: None, 1: 24, 2: 10, 3: 10, 4: 15, 5: 15, 6: 30, 7: 30}
default_sensor_mode = 4
default_preview_sensor_mode = 7
def get_picamera_options(sens... |
class School:
class_roster = []
def __init__(self):
pass
def add_student(self, name, grade):
self.name = name
self.grade = grade
return True
def roster(self):
name = self.name
return self.class_roster
def grade(self, grade_number):
... | class School:
class_roster = []
def __init__(self):
pass
def add_student(self, name, grade):
self.name = name
self.grade = grade
return True
def roster(self):
name = self.name
return self.class_roster
def grade(self, grade_number):
self.gra... |
# model settings
seed = 1024
num_sclies_one_img=3
cfg_3dce = dict(
samples_per_gpu=20,
num_slices=3,
num_images_3dce=1,
img_do_clip=True,
windowing=[-1024, 3071],
norm_spacing=0.8,
max_size=512, #to do
slice_intervals=2.,
image_path='./datasets/deeplesion/Images',
val_avg_fp=[0.... | seed = 1024
num_sclies_one_img = 3
cfg_3dce = dict(samples_per_gpu=20, num_slices=3, num_images_3dce=1, img_do_clip=True, windowing=[-1024, 3071], norm_spacing=0.8, max_size=512, slice_intervals=2.0, image_path='./datasets/deeplesion/Images', val_avg_fp=[0.5, 1, 2, 4, 8, 16], val_iou_th=0.5)
model = dict(type='FasterRC... |
while True :
num = str(input('Enter two digit number here : '))
if len(num)==2 :
result = int(num[0]) + int(num[1])
print(result)
break
else :
print('Please enter two digit number !') | while True:
num = str(input('Enter two digit number here : '))
if len(num) == 2:
result = int(num[0]) + int(num[1])
print(result)
break
else:
print('Please enter two digit number !') |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: param root: The root of the binary search tree
@param k1: An integer
@param k2: An integer
@return: return: Return all keys... | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: param root: The root of the binary search tree
@param k1: An integer
@param k2: An integer
@return: return: Return all keys... |
'''
Created on 10-Dec-2020
@author: couchbase
'''
spec = {
# Accepted values are > 0
"max_thread_count" : 25,
# Accepted values are 0 or any positive int. 0 and 1 means no dataverse will be created and Default dataverse will be used.
"no_of_dataverses" : 25,
# Accepted values are 0 or any... | """
Created on 10-Dec-2020
@author: couchbase
"""
spec = {'max_thread_count': 25, 'no_of_dataverses': 25, 'no_of_links': 0, 'percent_of_remote_links': 0, 'percent_of_external_links': 0, 'no_of_datasets_per_dataverse': 2, 'percent_of_local_datasets': 100, 'percent_of_remote_datasets': 0, 'percent_of_external_datasets':... |
def leerTablero(ruta):
with open(ruta, "r") as f:
tablero = []
for line in f:
linea = []
for campo in line.split(","):
linea.append(campo.split("\n")[0] if campo != "\n" else " ")
tablero.append(linea)
return tablero
| def leer_tablero(ruta):
with open(ruta, 'r') as f:
tablero = []
for line in f:
linea = []
for campo in line.split(','):
linea.append(campo.split('\n')[0] if campo != '\n' else ' ')
tablero.append(linea)
return tablero |
"""gbooru_images_download - Serve booru for hydrus"""
__version__ = '0.0.1'
__author__ = 'Rachmadani Haryono <foreturiga@gmail.com>'
| """gbooru_images_download - Serve booru for hydrus"""
__version__ = '0.0.1'
__author__ = 'Rachmadani Haryono <foreturiga@gmail.com>' |
class Solution:
def findLUSlength(self, a: str, b: str) -> int:
'''
God, this solution was so simple but I over-thought it.
Consider the following:
1. The strings are the same
There can be no uncommon subsequence, return -1
2. The strings are the same
... | class Solution:
def find_lu_slength(self, a: str, b: str) -> int:
"""
God, this solution was so simple but I over-thought it.
Consider the following:
1. The strings are the same
There can be no uncommon subsequence, return -1
2. The strings are the same
... |
class MyClass:
x=3
y=4
def __init__(self):
print("in constructor")
def classMemberFunc(self):
print(self.x)
def myFunc(in1,in2):
print("in function")
return in1+in2
print("hello world")
x=3
y=x+4
print(y)
floatDiv = 7 / 3 # 2.3
intDiv = 7 //3 # 2
exp = 2 ** 4 # 16
print("The exponentiated value is " + s... | class Myclass:
x = 3
y = 4
def __init__(self):
print('in constructor')
def class_member_func(self):
print(self.x)
def my_func(in1, in2):
print('in function')
return in1 + in2
print('hello world')
x = 3
y = x + 4
print(y)
float_div = 7 / 3
int_div = 7 // 3
exp = 2 ** 4
print('T... |
global grits_diagnose_next_status
grits_diagnose_next_status = 'success'
def make_next_test_fail():
global grits_diagnose_next_status
grits_diagnose_next_status = 'failure'
# Simple mocking of the grits-api package
def handleDiagnosis(*arg, **kw):
global grits_diagnose_next_status
stat = grits_dia... | global grits_diagnose_next_status
grits_diagnose_next_status = 'success'
def make_next_test_fail():
global grits_diagnose_next_status
grits_diagnose_next_status = 'failure'
def handle_diagnosis(*arg, **kw):
global grits_diagnose_next_status
stat = grits_diagnose_next_status
grits_diagnose_next_sta... |
"""
Write program, that will count the sum of all numbers from 1 to
number that was entered by user.
1,2,3,4,5,... 100
(1 + 100) / 2 * 100
For 5:
1+2+3+4+5
the result is gonna be:
15
(1 + 5) / 2 * 5 = 15
range(1, 6)
1,2,3,4,5
"""
def sum_up_to(end):
sum = 0 # 15
for number in range(1, end+1): #number = ... | """
Write program, that will count the sum of all numbers from 1 to
number that was entered by user.
1,2,3,4,5,... 100
(1 + 100) / 2 * 100
For 5:
1+2+3+4+5
the result is gonna be:
15
(1 + 5) / 2 * 5 = 15
range(1, 6)
1,2,3,4,5
"""
def sum_up_to(end):
sum = 0
for number in range(1, end + 1):
sum = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class PkgEnv(object):
def __init__(self, conanfile):
self.conanfile = conanfile
self.env = {}
def add_pkg(self, dep_name, **args):
deps = self.conanfile.deps_cpp_info[dep_name]
CFLAGS = " -I".join([""] + deps.include_paths)
... | class Pkgenv(object):
def __init__(self, conanfile):
self.conanfile = conanfile
self.env = {}
def add_pkg(self, dep_name, **args):
deps = self.conanfile.deps_cpp_info[dep_name]
cflags = ' -I'.join([''] + deps.include_paths)
libs = ' -L'.join([''] + deps.lib_paths)
... |
# Clean up the class to make it more pythonic
class MyDemoClass(object):
def __init__(self, data, filename="names.txt"):
self._data = data
self._filename = filename
self._file_contents = ""
def set_data(data):
self.data = data
def get_data(data):
return self.data
... | class Mydemoclass(object):
def __init__(self, data, filename='names.txt'):
self._data = data
self._filename = filename
self._file_contents = ''
def set_data(data):
self.data = data
def get_data(data):
return self.data
def compare(self):
return self._da... |
#!/usr/bin/python
'''
This is a test file to see if it is possible to have a python file with all the
permanent variables for potato (S. tuberosum) which can then be imported into
individual scripts when required.
'''
# A dictionary containing the background frequencies of all bases
# The background is considered to... | """
This is a test file to see if it is possible to have a python file with all the
permanent variables for potato (S. tuberosum) which can then be imported into
individual scripts when required.
"""
bkgrddict = {'A': 0.344, 'C': 0.164, 'G': 0.156, 'T': 0.336} |
# -*- coding: utf-8 -*-
DEFAULT_FIELDS = [
'timestamp',
'distance',
'temperature',
'heartratebpm',
'cadence',
'power',
'altitude',
'speed',
'latitude',
'longitude',
]
| default_fields = ['timestamp', 'distance', 'temperature', 'heartratebpm', 'cadence', 'power', 'altitude', 'speed', 'latitude', 'longitude'] |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Description: Get the intersection of two line segment
# Date: 09/Dec/2021
# Author: Steven Huang, Auckland, NZ
# Copyright (c) 2020-2021, Steven Huang
# License: MIT License
class GetLineSegInterPoint():
def __init__(self, line1, line2):
self.line1 = line... | class Getlineseginterpoint:
def __init__(self, line1, line2):
self.line1 = line1
self.line2 = line2
self.interPoint = self.calculate_cross_point(line1, line2)
def get_inter(self):
return self.interPoint
def in_segment(self, p, line1, line2):
""""check the cross poi... |
class HtmlWindowCollection(object, ICollection, IEnumerable):
""" Represents the windows contained within another System.Windows.Forms.HtmlWindow. """
def GetEnumerator(self):
"""
GetEnumerator(self: HtmlWindowCollection) -> IEnumerator
Returns an enumerator that can iterate through ... | class Htmlwindowcollection(object, ICollection, IEnumerable):
""" Represents the windows contained within another System.Windows.Forms.HtmlWindow. """
def get_enumerator(self):
"""
GetEnumerator(self: HtmlWindowCollection) -> IEnumerator
Returns an enumerator that can iterate through all elem... |
class LoginError(Exception):
def __init__(self, addr, user):
msg = f"{user} failed auth to server {addr}"
super().__init__(msg)
class WorkflowStateNotSetError(Exception):
def __init__(self, module_name):
msg = f"WorkflowState is not set in {module_name}"
super().__init__(msg)
... | class Loginerror(Exception):
def __init__(self, addr, user):
msg = f'{user} failed auth to server {addr}'
super().__init__(msg)
class Workflowstatenotseterror(Exception):
def __init__(self, module_name):
msg = f'WorkflowState is not set in {module_name}'
super().__init__(msg)
... |
"""Top-level package for vplatoon."""
__author__ = """Andres Ladino"""
__email__ = 'aladinoster@gmail.com'
__version__ = '0.3.0'
| """Top-level package for vplatoon."""
__author__ = 'Andres Ladino'
__email__ = 'aladinoster@gmail.com'
__version__ = '0.3.0' |
n = int(input())
list_odd = []
list_even = []
if n >= 1:
for i in range(n):
t = int(input())
if t % 2 > 0:
list_odd.append(t)
else:
list_even.append(t)
list_odd.sort(reverse=True)
list_even.sort()
print(list_even + list_odd)
| n = int(input())
list_odd = []
list_even = []
if n >= 1:
for i in range(n):
t = int(input())
if t % 2 > 0:
list_odd.append(t)
else:
list_even.append(t)
list_odd.sort(reverse=True)
list_even.sort()
print(list_even + list_odd) |
class Mymother(object):
def __init__(self):
self.num1 = 10
print("I am a Mother class constructor")
def mydisplay_mother(self):
print("I am a Mother class instance method")
class MyDaughter(Mymother):
def mydisplay_Daughter(self):
print("I am a Daughter class instan... | class Mymother(object):
def __init__(self):
self.num1 = 10
print('I am a Mother class constructor')
def mydisplay_mother(self):
print('I am a Mother class instance method')
class Mydaughter(Mymother):
def mydisplay__daughter(self):
print('I am a Daughter class instance me... |
class HeapMax(object):
def __init__(self, *args):
self.nodes = [0]
self.size = 0
for item in args:
self.push(item)
def __len__(self):
return self.size
def __repr__(self):
return self.nodes[1:]
def move_up(self, size):
while size // 2 > 0:
... | class Heapmax(object):
def __init__(self, *args):
self.nodes = [0]
self.size = 0
for item in args:
self.push(item)
def __len__(self):
return self.size
def __repr__(self):
return self.nodes[1:]
def move_up(self, size):
while size // 2 > 0:
... |
"""
operation.py
~~~~~~~~~~~~~
This stores the information of each individual operation in the
production line.
- name improves readability when printing
- machine is the machine in which that operation will be executed
- duration is the amount of time in which the operation will be completed
- job_model is the rad... | """
operation.py
~~~~~~~~~~~~~
This stores the information of each individual operation in the
production line.
- name improves readability when printing
- machine is the machine in which that operation will be executed
- duration is the amount of time in which the operation will be completed
- job_model is the rad... |
def rle_encode(data):
encoding = ''
prev_char = ''
count = 1
if not data: return ''
for char in data:
# If the prev and current characters
# don't match...
if char != prev_char:
# ...then add the count and character
# to our encoding
if p... | def rle_encode(data):
encoding = ''
prev_char = ''
count = 1
if not data:
return ''
for char in data:
if char != prev_char:
if prev_char:
encoding += str(count) + prev_char
count = 1
prev_char = char
else:
count ... |
# https://leetcode.com/problems/excel-sheet-column-number/
class Solution:
def titleToNumber(self, s: str) -> int:
power = 0
val = 0
for i in range(len(s) - 1, -1, -1):
val += (ord(s[i]) - 64) * (26 ** power)
power += 1
return val
| class Solution:
def title_to_number(self, s: str) -> int:
power = 0
val = 0
for i in range(len(s) - 1, -1, -1):
val += (ord(s[i]) - 64) * 26 ** power
power += 1
return val |
def arithmetic_arranger(problems, flag=False):
op1Array = []
op2Array = []
lineArray = []
result = []
separator = " "
if len(problems) > 5:
return "Error: Too many problems."
for problem in problems:
op = problem.split()
lenght = max(len(op[0]), len(op[2])) + 2
if op[1] != '+' and op... | def arithmetic_arranger(problems, flag=False):
op1_array = []
op2_array = []
line_array = []
result = []
separator = ' '
if len(problems) > 5:
return 'Error: Too many problems.'
for problem in problems:
op = problem.split()
lenght = max(len(op[0]), len(op[2])) + 2
... |
# Source: https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ffc7/00000000001d3f56#problem
# Time Complexity: O(nlogn)
# Can be improved to O(n) using count sort as the length of array is fixed and can be upto 1000.
def allocation(prices, budget):
prices.sort()
houses = 0
for price in pr... | def allocation(prices, budget):
prices.sort()
houses = 0
for price in prices:
if price <= budget:
houses += 1
budget -= price
else:
break
return houses
def input_function():
num_test_case = int(input())
for i in range(numTestCase):
(n,... |
def filter_one(lines):
rho_threshold = 15
theta_threshold = 0.1
# how many lines are similar to a given one
similar_lines = {i: [] for i in range(len(lines))}
for i in range(len(lines)):
for j in range(len(lines)):
if i == j:
continue
rho_i, theta_i ... | def filter_one(lines):
rho_threshold = 15
theta_threshold = 0.1
similar_lines = {i: [] for i in range(len(lines))}
for i in range(len(lines)):
for j in range(len(lines)):
if i == j:
continue
(rho_i, theta_i) = lines[i][0]
(rho_j, theta_j) = lin... |
def natural_sum(x):
return x * (x + 1) // 2
def count(n):
n = n - 1
return 3 * natural_sum(n // 3) + 5 * natural_sum(n // 5) - 15 * natural_sum(n // 15)
if __name__ == "__main__":
t = int(input())
for i in range(t):
n = int(input())
result = count(n)
print(str(result)) | def natural_sum(x):
return x * (x + 1) // 2
def count(n):
n = n - 1
return 3 * natural_sum(n // 3) + 5 * natural_sum(n // 5) - 15 * natural_sum(n // 15)
if __name__ == '__main__':
t = int(input())
for i in range(t):
n = int(input())
result = count(n)
print(str(result)) |
# Class for an advertisement on Kijiji, to hold all ad parameters
class Ad:
def __init__(self, title: str, price: float, description: str, tags: list, image_fps: list, category_id: str):
self.category_id = category_id # the number representing the posting category.
... | class Ad:
def __init__(self, title: str, price: float, description: str, tags: list, image_fps: list, category_id: str):
self.category_id = category_id
self.title = title
self.price = price
self.description = description
self.tags = tags
self.image_fps = image_fps |
#
# PySNMP MIB module NMS-EPON-ONU-SERIAL-PORT (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NMS-EPON-ONU-SERIAL-PORT
# Produced by pysmi-0.3.4 at Wed May 1 14:21:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ... |
# SPDX-License-Identifier: MIT
"""App-specific implementations of :class:`django.forms.Form` and related stuff like fields and widgets.
Warnings
--------
Siblings of :class:`django.forms.ModelForm` are (by definition) semantically
related to the respective implementation of :class:`django.db.models.Model`.
Thus, the... | """App-specific implementations of :class:`django.forms.Form` and related stuff like fields and widgets.
Warnings
--------
Siblings of :class:`django.forms.ModelForm` are (by definition) semantically
related to the respective implementation of :class:`django.db.models.Model`.
Thus, the specific forms for the app's mo... |
running = True
while running:
guess = str(input("Please enter a number:"))
isdigit = str.isdigit(guess)
if isdigit == True:
print("True")
else:
print("False")
else:
print("Done.")
| running = True
while running:
guess = str(input('Please enter a number:'))
isdigit = str.isdigit(guess)
if isdigit == True:
print('True')
else:
print('False')
else:
print('Done.') |
class DataGridViewCellStyleContentChangedEventArgs(EventArgs):
""" Provides data for the System.Windows.Forms.DataGridView.CellStyleContentChanged event. """
def Instance(self):
""" This function has been arbitrarily put into the stubs"""
return DataGridViewCellStyleContentChangedEventArgs()
CellStyle=pro... | class Datagridviewcellstylecontentchangedeventargs(EventArgs):
""" Provides data for the System.Windows.Forms.DataGridView.CellStyleContentChanged event. """
def instance(self):
""" This function has been arbitrarily put into the stubs"""
return data_grid_view_cell_style_content_changed_event_a... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
"""
time: nlgn + nlgn
space: 2n
"""
class Solution:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
prehead = ListNode()
heap = []
... | """
time: nlgn + nlgn
space: 2n
"""
class Solution:
def merge_k_lists(self, lists: List[ListNode]) -> ListNode:
prehead = list_node()
heap = []
for i in range(len(lists)):
node = lists[i]
while node:
heapq.heappush(heap, node.val)
nod... |
__version__ = '0.1.0'
def cli():
print("Hello from parent CLI!")
| __version__ = '0.1.0'
def cli():
print('Hello from parent CLI!') |
class Speed:
def __init__(self, base_speed):
self.base_speed = base_speed
self.misc = []
def get_speed(self):
return (
self.base_speed +
sum(map(lambda x: x(), self.misc)))
| class Speed:
def __init__(self, base_speed):
self.base_speed = base_speed
self.misc = []
def get_speed(self):
return self.base_speed + sum(map(lambda x: x(), self.misc)) |
#!/usr/bin/env python3
# For loop triangle
STAR = 9
for i in range(0, STAR):
for j in range(i):
print("*", end='')
print()
print()
# For Loop for reverse triangel
for i in range(STAR, 0, -1):
for j in range(i):
print("*", end='')
print("")
print()
# For Loop for opposite triangle
for i ... | star = 9
for i in range(0, STAR):
for j in range(i):
print('*', end='')
print()
print()
for i in range(STAR, 0, -1):
for j in range(i):
print('*', end='')
print('')
print()
for i in range(STAR, 0, -1):
for j in range(i):
print(' ', end='')
for k in range(STAR - j):
... |
t = int(input())
answer = []
for a in range(t):
line = [int(i) for i in input().split()]
n = line[3]
line.pop(3)
line.sort()
a = line[0]
b = line[1]
c = line[2]
if(n<2*c-b-a):
answer.append("NO")
elif((n-2*c+b+a)%3==0):
answer.append("Yes")
else:
answer.ap... | t = int(input())
answer = []
for a in range(t):
line = [int(i) for i in input().split()]
n = line[3]
line.pop(3)
line.sort()
a = line[0]
b = line[1]
c = line[2]
if n < 2 * c - b - a:
answer.append('NO')
elif (n - 2 * c + b + a) % 3 == 0:
answer.append('Yes')
else:... |
#
# PySNMP MIB module OMNI-gx2RX200-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OMNI-gx2RX200-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:33:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) ... |
# -*- coding: utf-8 -*-
# Scrapy settings for code_scraper project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
AUTOTHROTTLE_ENABLED = 1
BOT_NAME = 'MsdnApiExtractor'
COO... | autothrottle_enabled = 1
bot_name = 'MsdnApiExtractor'
cookies_enabled = False
depth_limit = 5
download_delay = 2
item_pipelines = {'MsdnApiExtractor.pipelines.ApiExportPipeline': 1}
newspider_module = 'MsdnApiExtractor.spiders'
retry_enabled = True
robotstxt_obey = True
spider_modules = ['MsdnApiExtractor.spiders']
us... |
name = input("What is your name?\n")
years = input("How old are you?\n")
adress = input("Where are you live?\n")
print("This is " + name)
print("It is " + years)
print("(S)he live in " + adress) | name = input('What is your name?\n')
years = input('How old are you?\n')
adress = input('Where are you live?\n')
print('This is ' + name)
print('It is ' + years)
print('(S)he live in ' + adress) |
# Created by MechAviv
# Map ID :: 302000000
# Grand Athenaeum : Grand Athenaeum
if "" in sm.getQuestEx(32666, "clear"):
sm.setQuestEx(32666, "clear", "0"); | if '' in sm.getQuestEx(32666, 'clear'):
sm.setQuestEx(32666, 'clear', '0') |
'''
Project: gen-abq-S9R5
Creator: Nicholas Fantuzzi
Contact: @sniis84
Version: 1.0
Date: 5-Jul-2015
To test just place 'Job-1.inp' in the Abaqus working directory and
select 'Run Script...' from the menu. A new file will be created as 'Job-1-finale.inp'.
Running that file using Abaqus/CAE or command line will result ... | """
Project: gen-abq-S9R5
Creator: Nicholas Fantuzzi
Contact: @sniis84
Version: 1.0
Date: 5-Jul-2015
To test just place 'Job-1.inp' in the Abaqus working directory and
select 'Run Script...' from the menu. A new file will be created as 'Job-1-finale.inp'.
Running that file using Abaqus/CAE or command line will result ... |
# Time: O(n)
# Space: O(1)
# 918
# Given a circular array C of integers represented by A,
# find the maximum possible sum of a non-empty subarray of C.
#
# Here, a circular array means the end of the array connects to the beginning of the array.
# (Formally, C[i] = A[i] when 0 <= i < A.length, and C[i+A.length] = C[i... | class Solution(object):
def max_subarray_sum_circular(self, A):
"""
:type A: List[int]
:rtype: int
"""
(total, cur_max, cur_min) = (0, 0, 0)
(global_max, global_min) = (-float('inf'), float('inf'))
for a in A:
cur_max = max(cur_max, 0) + a
... |
# -*- coding: utf-8 -*-
N = int(input())
for i in range(N):
X, Y = map(int, input().split())
start = X if (X % 2 != 0) else X + 1
answer = sum(range(start, start + (2 * Y), 2))
print(answer) | n = int(input())
for i in range(N):
(x, y) = map(int, input().split())
start = X if X % 2 != 0 else X + 1
answer = sum(range(start, start + 2 * Y, 2))
print(answer) |
{
"targets": [
{
"target_name": "atomicCounters",
"sources": [ "src/C/atomicCounters.c" ],
"conditions": [
["OS==\"linux\"", {
"cflags_cc": [ "-fpermissive", "-Os" ]
}],
["OS=='mac'", {
"xcode_settings": {
}
}],
["OS=='win'", ... | {'targets': [{'target_name': 'atomicCounters', 'sources': ['src/C/atomicCounters.c'], 'conditions': [['OS=="linux"', {'cflags_cc': ['-fpermissive', '-Os']}], ["OS=='mac'", {'xcode_settings': {}}], ["OS=='win'", {}]]}]} |
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
a = [0]*3 + a
for i in range(n):
i *= 3
t, x, y = map(lambda j:abs(a[i+3+j]-a[i+j]), [0,1,2])
d = x+y
if d>t or d%2-t%2: print("No"); exit()
print("Yes") | (n, *a) = map(int, open(0).read().split())
a = [0] * 3 + a
for i in range(n):
i *= 3
(t, x, y) = map(lambda j: abs(a[i + 3 + j] - a[i + j]), [0, 1, 2])
d = x + y
if d > t or d % 2 - t % 2:
print('No')
exit()
print('Yes') |
db = {
"European Scripts": {
"Armenian": [
1328,
1423
],
"Armenian Ligatures": [
64275,
64279
],
"Carian": [
66208,
66271
],
"Caucasian Albanian": [
66864,
66927
],
"Cypriot Syllabary": [
67584,
67647
],
"Cyrillic"... | db = {'European Scripts': {'Armenian': [1328, 1423], 'Armenian Ligatures': [64275, 64279], 'Carian': [66208, 66271], 'Caucasian Albanian': [66864, 66927], 'Cypriot Syllabary': [67584, 67647], 'Cyrillic': [1024, 1279], 'Cyrillic Supplement': [1280, 1327], 'Cyrillic Extended-A': [11744, 11775], 'Cyrillic Extended-B': [42... |
class Reader:
def __init__(self, stream, sep=None, buf_size=1024 * 4):
self.stream = stream
self.sep = sep
self.buf_size = buf_size
self.__buffer = None
self.__eof = False
def __iter__(self):
return self
def __next__(self):
if not self.__buffer:
... | class Reader:
def __init__(self, stream, sep=None, buf_size=1024 * 4):
self.stream = stream
self.sep = sep
self.buf_size = buf_size
self.__buffer = None
self.__eof = False
def __iter__(self):
return self
def __next__(self):
if not self.__buffer:
... |
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | load(':googleapis.bzl', 'googleapis_repositories')
load(':service_control.bzl', 'service_control_client_repositories')
load(':bazel_rules_python.bzl', 'bazel_rules_python_repositories')
def service_control_repositories():
googleapis_repositories()
service_control_client_repositories()
bazel_rules_python_re... |
class NeuronLayer:
def __init__(self, neurons):
self.neurons = {}
for n in neurons:
self.neurons[n] = None # Value: output
def __str__(self):
msg = "| | "
for n in self.neurons:
msg += str(n) + " | "
msg += "|"
return msg
def activat... | class Neuronlayer:
def __init__(self, neurons):
self.neurons = {}
for n in neurons:
self.neurons[n] = None
def __str__(self):
msg = '| | '
for n in self.neurons:
msg += str(n) + ' | '
msg += '|'
return msg
def activate(self, event):
... |
class Solution:
def subsetXORSum(self, nums: List[int]) -> int:
ans = 0
n = len(nums)
for i in nums:
ans |= i
return ans * pow(2, n - 1)
| class Solution:
def subset_xor_sum(self, nums: List[int]) -> int:
ans = 0
n = len(nums)
for i in nums:
ans |= i
return ans * pow(2, n - 1) |
# https://leetcode.com/problems/lru-cache/
class Node:
def __init__(self, key, val):
self.key = key
self.val = val
self.prev = None
self.next = None
class LRUCache:
"""
Uses a dictionary to cache nodes
and a doubly linked list to keep track of the least used nodes
... | class Node:
def __init__(self, key, val):
self.key = key
self.val = val
self.prev = None
self.next = None
class Lrucache:
"""
Uses a dictionary to cache nodes
and a doubly linked list to keep track of the least used nodes
Time complexity: O(1)
Space complexity... |
"""caching helps speed up data
MEMOIZATION - specific form of caching that involves caching the return value of func based on its paramaters, and if paramater doesnt change, then its memoized, it uses the cache version
"""
# without MEMOIZATION
def addTo80(n):
print("long time")
return n + 80
print(addTo... | """caching helps speed up data
MEMOIZATION - specific form of caching that involves caching the return value of func based on its paramaters, and if paramater doesnt change, then its memoized, it uses the cache version
"""
def add_to80(n):
print('long time')
return n + 80
print(add_to80(5))
print(add_to80(5)... |
#
# PySNMP MIB module PDN-MGMT-IP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-MGMT-IP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:39:08 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint) ... |
'''Return a string obtained interlacing RECURSIVELY two input strings'''
__author__ = 'Nicola Moretto'
__license__ = "MIT"
def laceStringsRecur(s1, s2):
'''
Returns a new str with elements of s1 and s2 interlaced,
beginning with s1. If strings are not of same length,
then the extra elements should app... | """Return a string obtained interlacing RECURSIVELY two input strings"""
__author__ = 'Nicola Moretto'
__license__ = 'MIT'
def lace_strings_recur(s1, s2):
"""
Returns a new str with elements of s1 and s2 interlaced,
beginning with s1. If strings are not of same length,
then the extra elements should ap... |
arr = [
[3109, 7337, 4317, 3411, 4921, 2505, 7337, 8847, 1297, 2807, 4317, 7337, 1901, 3713, 1297, 8545, 3109, 4619, 4619,
8545, 89, 3713, 7337, 2807, 89, 1599, 9753, 9451, 7337, 7337, 5223, 9753, 693, 3713, 4317, 9149, 89, 4317, 5525,
1901, 3713, 3713, 5525, 4619, 2807, 5223, 9149, 8847, 3109, 9753, 391,... | arr = [[3109, 7337, 4317, 3411, 4921, 2505, 7337, 8847, 1297, 2807, 4317, 7337, 1901, 3713, 1297, 8545, 3109, 4619, 4619, 8545, 89, 3713, 7337, 2807, 89, 1599, 9753, 9451, 7337, 7337, 5223, 9753, 693, 3713, 4317, 9149, 89, 4317, 5525, 1901, 3713, 3713, 5525, 4619, 2807, 5223, 9149, 8847, 3109, 9753, 391, 5827, 6129, 67... |
# # 01 solution using 2 lists and 1 for loop
# lines = int(input())
# key = input()
# word_list = []
# found_match = []
# for _ in range(lines):
# words = input()
# word_list.append(words)
# if key in words:
# found_match.append(words)
# print(word_list)
# print(found_match)
# 02 solution using 1 li... | lines = int(input())
key = input()
word_list = []
for _ in range(lines):
words = input()
word_list.append(words)
print(word_list)
for i in range(len(word_list) - 1, -1, -1):
element = word_list[i]
if key not in element:
word_list.remove(element)
print(word_list) |
# use shift enter on highlighted code
#
#print("Hello")
# def search (x, nums):
# # nums is a list of numbers and x is a number
# # Returns the position in the list where x occurs or -1 if
# # x is not in the list
# try:
# return nums.index(x)
# except:
# return -1
# print(search(1,[... | def linear_search(x, nums):
for i in range(len(nums)):
if nums[i] == x:
print('The desired value was ', x, ' and it was found at index ', i)
return i
return -1
num_list = list(range(1, 101))
def binary_search(x, nums):
low = 0
high = len(nums) - 1
while low <= high:
... |
"""
Constants for interview_generator.py
"""
# This is to workaround fact you can't do local import in Docassemble playground
class Object(object):
pass
generator_constants = Object()
# Words that are reserved exactly as they are
generator_constants.RESERVED_WHOLE_WORDS = [
'signature_date',
'docket_number',
... | """
Constants for interview_generator.py
"""
class Object(object):
pass
generator_constants = object()
generator_constants.RESERVED_WHOLE_WORDS = ['signature_date', 'docket_number', 'user_needs_interpreter', 'user_preferred_language']
generator_constants.UNDEFINED_PERSON_PREFIXES = ['trial_court']
generator_consta... |
class BaseClimber(object):
"""
The Base hill-climbing class
"""
def __init__(self, tweak, quality, stop_condition,
solution):
"""
BaseClimber constructor
:param:
- `solution`: initial candidate solution
- `tweak`: callable that tweaks solutio... | class Baseclimber(object):
"""
The Base hill-climbing class
"""
def __init__(self, tweak, quality, stop_condition, solution):
"""
BaseClimber constructor
:param:
- `solution`: initial candidate solution
- `tweak`: callable that tweaks solutions
- `qu... |
class Album:
def __init__(self, album: dict):
self.album_id = album["id"]
self.name = album["name"]
images = dict()
for image in album["images"]:
images[image["height"]] = image["url"]
self._images = tuple(images)
def image_url(self, resolution: int = 640) ->... | class Album:
def __init__(self, album: dict):
self.album_id = album['id']
self.name = album['name']
images = dict()
for image in album['images']:
images[image['height']] = image['url']
self._images = tuple(images)
def image_url(self, resolution: int=640) -> ... |
# Find the number of letters "a" or "A" in a string using control flow
counter = 0
string = 'Python is a widely used high-level programming language for general-purpose programming, ' \
'created by Guido van Rossum and first released in 1991. An interpreted language, Python has a design ' \
'philos... | counter = 0
string = 'Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991. An interpreted language, Python has a design philosophy that emphasizes code readability (notably using whitespace indentation to delimit code blocks rat... |
APPVERSION = "0.2.4"
DBVERSION = 4 # Make sure this is an integer
MANDATORY_DBVERSION = 4 # What version of the database has to be used for the application to run at all
CONFIGFILE = "config.db"
IMAGESROOT = "images"
| appversion = '0.2.4'
dbversion = 4
mandatory_dbversion = 4
configfile = 'config.db'
imagesroot = 'images' |
#!/usr/bin/env python3
#
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | subsets = ['adlam', 'ahom', 'anatolian-hieroglyphs', 'arabic', 'armenian', 'avestan', 'balinese', 'bamum', 'bassa-vah', 'batak', 'bengali', 'bhaiksuki', 'brahmi', 'buginese', 'buhid', 'canadian-aboriginal', 'carian', 'caucasian-albanian', 'chakma', 'cham', 'cherokee', 'chinese-hongkong', 'chinese-simplified', 'chinese-... |
size = int(input())
matrix = []
for _ in range(size):
row = []
for x in input().split():
row.append(int(x))
matrix.append(row)
primary = []
secondary = []
for row in range(size):
primary.append(matrix[row][row])
secondary.append(matrix[row][size - 1 - row])
print(abs(sum(primary) - sum(s... | size = int(input())
matrix = []
for _ in range(size):
row = []
for x in input().split():
row.append(int(x))
matrix.append(row)
primary = []
secondary = []
for row in range(size):
primary.append(matrix[row][row])
secondary.append(matrix[row][size - 1 - row])
print(abs(sum(primary) - sum(secon... |
num = [1, 2, 4.5, 6.3242321, 32434.333, 22]
print('int: ', "{0:d}".format(num[1]))
print('float: ', "{0:.2f}".format(num[3]))
print('float round: ', "{0:0f}".format(num[4]))
print('bin: ', "{0:b}".format(num[5]))
print('hex: ', "{0:x}".format(num[5]))
print('oct: ', "{0:o}".format(num[5]))
print('string: ','{1}{2}{0}'.... | num = [1, 2, 4.5, 6.3242321, 32434.333, 22]
print('int: ', '{0:d}'.format(num[1]))
print('float: ', '{0:.2f}'.format(num[3]))
print('float round: ', '{0:0f}'.format(num[4]))
print('bin: ', '{0:b}'.format(num[5]))
print('hex: ', '{0:x}'.format(num[5]))
print('oct: ', '{0:o}'.format(num[5]))
print('string: ', '{1}{2}{0}'... |
#!/usr/bin/env python
"""
Merge Sort Algorithm
Author: Gianluca Biccari
Description: sort an input array of integers and return a sorted array
"""
def merge_sort(iarray):
if iarray is None or len(iarray) < 2:
return iarray
else:
return __merge_sort(iarray, 0, len(iarray)-1)
def __... | """
Merge Sort Algorithm
Author: Gianluca Biccari
Description: sort an input array of integers and return a sorted array
"""
def merge_sort(iarray):
if iarray is None or len(iarray) < 2:
return iarray
else:
return __merge_sort(iarray, 0, len(iarray) - 1)
def __merge_sort(iarray, fi... |
a = input ("ingrese numero ")
a = int(a)
b = input ("ingrese numero ")
b = int(b)
c = input ("ingrese numero ")
c = int(c)
d = input ("ingrese numero ")
d = int(d)
e = input ("ingrese numero ")
e = int(e)
f = (a+b)
f = int(f)
print("la suma de a+b es:")
print (f)
g = (f-e)
g = in... | a = input('ingrese numero ')
a = int(a)
b = input('ingrese numero ')
b = int(b)
c = input('ingrese numero ')
c = int(c)
d = input('ingrese numero ')
d = int(d)
e = input('ingrese numero ')
e = int(e)
f = a + b
f = int(f)
print('la suma de a+b es:')
print(f)
g = f - e
g = int(g)
print('la resta de f y e es:')
prin... |
class FinancialIndependence():
def __init__(self, in_TFSA, in_RRSP, in_unregistered, suggested_TFSA, suggested_RRSP, suggested_unregistered,
annual_budget):
"""
Initialize an Instance of Financial Independence
"""
# Possible issue is that TFSA is only 5500 ev... | class Financialindependence:
def __init__(self, in_TFSA, in_RRSP, in_unregistered, suggested_TFSA, suggested_RRSP, suggested_unregistered, annual_budget):
"""
Initialize an Instance of Financial Independence
"""
self.TFSA_annual_contribution_room = 5500
if suggested_TFSA > s... |
class Node:
class_id = 0
def __init__(self, id=None, position=(0,0), label="", **kwargs) -> None:
self.id = Node.class_id if not id else id
self.pos = position
self.label = label
self.attr = kwargs if len(kwargs) > 0 else {}
Node.class_id += 1
def __str__(self) -> ... | class Node:
class_id = 0
def __init__(self, id=None, position=(0, 0), label='', **kwargs) -> None:
self.id = Node.class_id if not id else id
self.pos = position
self.label = label
self.attr = kwargs if len(kwargs) > 0 else {}
Node.class_id += 1
def __str__(self) -> ... |
'''
Given a boolean expression with following symbols.
Symbols
'T' ---> true
'F' ---> false
And following operators filled between symbols
Operators
& ---> boolean AND
| ---> boolean OR
^ ---> boolean XOR
Count the number of ways we can parenthesize the expression so that the value of e... | """
Given a boolean expression with following symbols.
Symbols
'T' ---> true
'F' ---> false
And following operators filled between symbols
Operators
& ---> boolean AND
| ---> boolean OR
^ ---> boolean XOR
Count the number of ways we can parenthesize the expression so that the value of e... |
class News:
# category = ''
# title = ''
# description = ''
# locations = []
# link = ''
# summery = ''
# date_time= ''
def __init__(self,title, description,summary,link,category,date_time):
self.category = category
self.title = title
self.description = descripti... | class News:
def __init__(self, title, description, summary, link, category, date_time):
self.category = category
self.title = title
self.description = description
self.summary = summary
self.link = link
self.date_time = date_time
def print_test(self):
pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.