content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class PingError(Exception):
pass
class TimeExceeded(PingError):
pass
class TimeToLiveExpired(TimeExceeded):
def __init__(self, message="Time exceeded: Time To Live expired.", ip_header=None, icmp_header=None):
self.ip_header = ip_header
self.icmp_header = icmp_header
self.message... | class Pingerror(Exception):
pass
class Timeexceeded(PingError):
pass
class Timetoliveexpired(TimeExceeded):
def __init__(self, message='Time exceeded: Time To Live expired.', ip_header=None, icmp_header=None):
self.ip_header = ip_header
self.icmp_header = icmp_header
self.message ... |
# -*- coding: utf-8 -*-
description = 'Sample table'
group = 'lowlevel'
devices = dict(
st_phi = device('nicos.devices.generic.VirtualMotor',
unit = 'deg',
abslimits = (-50, 116.1),
speed = 1.5,
visibility = (),
),
co_phi = device('nicos.devices.generic.VirtualCoder',
... | description = 'Sample table'
group = 'lowlevel'
devices = dict(st_phi=device('nicos.devices.generic.VirtualMotor', unit='deg', abslimits=(-50, 116.1), speed=1.5, visibility=()), co_phi=device('nicos.devices.generic.VirtualCoder', motor='st_phi', visibility=()), phi=device('nicos.devices.generic.Axis', description='Samp... |
# demo of looping through the characters of a string, using the sorted and reversed functions
s = input("Enter a string:")
n = len(s)
print("The first character of", s, "is", s[0])
print("The entered string will appear character wise as:")
for i in range(0, n):
print(s[i])
print("The entered string will appear char... | s = input('Enter a string:')
n = len(s)
print('The first character of', s, 'is', s[0])
print('The entered string will appear character wise as:')
for i in range(0, n):
print(s[i])
print('The entered string will appear character wise as:')
for i in s:
print(i)
print('String with its characters sorted is', sorted... |
# ------------------------------------------------------------------------------------
# Tutorial: How to make a recursive function
# A recursive function is a function that calls itself
# ------------------------------------------------------------------------------------
# find the factorial of a user entered numbe... | mul = 1
def fact(num):
if num == 1:
return num
else:
return num * fact(num - 1)
num = int(input('Enter a number to get the factorial of it: '))
if num == 0:
print('Factorial of 0: 1')
else:
print('Factorial of ', num, ':', fact(num)) |
#03_personal-info.py
space= " "
firstName = input("What is your first name?")
lastName = input("What is your last name?")
location = input("What is your location?")
age = input("What is your age?")
print("Hi "+ firstName + space + lastName +"! Your location is "+ location + " and you are "+age + " years old!")
| space = ' '
first_name = input('What is your first name?')
last_name = input('What is your last name?')
location = input('What is your location?')
age = input('What is your age?')
print('Hi ' + firstName + space + lastName + '! Your location is ' + location + ' and you are ' + age + ' years old!') |
# Space : O(len(word))
# Time : O(n * len(word))
class Solution:
def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]:
ans = []
pn = len(pattern)
for word in words:
if len(word) != pn:
continue
mem1, mem2 = {}, {}
... | class Solution:
def find_and_replace_pattern(self, words: List[str], pattern: str) -> List[str]:
ans = []
pn = len(pattern)
for word in words:
if len(word) != pn:
continue
(mem1, mem2) = ({}, {})
defect = False
for i in range(p... |
'''Crie um programa que leia idade e sexo de varias pessoas
e pergunte se o usuario quer conrinuar
no final mostre
quantas pessoas tem mais de 18 anos
quantos homens foram cadastrados
e quantas mulheres tem menos de 20 anos'''
pessoas_18 = mulher_20 = homen = 0
while True:
idade = int(input('Digite a Idade: '))
... | """Crie um programa que leia idade e sexo de varias pessoas
e pergunte se o usuario quer conrinuar
no final mostre
quantas pessoas tem mais de 18 anos
quantos homens foram cadastrados
e quantas mulheres tem menos de 20 anos"""
pessoas_18 = mulher_20 = homen = 0
while True:
idade = int(input('Digite a Idade: '))
... |
# Common use case - File IO
# "Everything not saved will be lost."
#
# Prereq:
# string operations: split(), strip(), format(), join()
# list operations: append()
# built-in functions: len(), open()
#
# Reading:
# open()
# https://docs.python.org/3/library/functions.html#open
# string.strip()
# ht... | f = open('offshore_assets.txt', 'w')
f.write('squirrel tail')
f.write('basilisk hide')
f.write('kikimore claw')
f.write('may contain peanut')
f.close()
f = open('offshore_assets.txt')
while True:
line = f.readline()
if len(line) > 0:
print(line)
else:
break
f.close()
for line in open('offsho... |
class admin():
def __init__(self):
pass
def get_id(self):
pass | class Admin:
def __init__(self):
pass
def get_id(self):
pass |
def get_hello():
return 'Hello'
class HelloSayer():
def say_hello(self):
print('Hello') | def get_hello():
return 'Hello'
class Hellosayer:
def say_hello(self):
print('Hello') |
####################################
### The router base class
class Router(object):
'''Common superclass of routers'''
pass
| class Router(object):
"""Common superclass of routers"""
pass |
# Global parameter
examples_root = None
process_type_name_ns_to_clean = None
synopsis_maxlen_function = 120
synopsis_class_list = None
| examples_root = None
process_type_name_ns_to_clean = None
synopsis_maxlen_function = 120
synopsis_class_list = None |
sum=0
i=0
while i<=4:
if sum<=5000:
item=int(input("Enter the item amount"))
sum=sum+item
i=i+1
print("Total items",i,"selected and total amount is:",sum)
else:
print("Account limit crossed")
break
| sum = 0
i = 0
while i <= 4:
if sum <= 5000:
item = int(input('Enter the item amount'))
sum = sum + item
i = i + 1
print('Total items', i, 'selected and total amount is:', sum)
else:
print('Account limit crossed')
break |
DOWNLOAD_CHUNK_SIZE = 32768
FETCH_LIMIT = 200
def count_motions(db, project_ids=None, institution_ids=None, description_filter=None):
count = db.countMotions(None, project_ids, institution_ids, None, None, description_filter)
return count
def fetch_motions(db, project_ids=None, institution_ids=None, description_f... | download_chunk_size = 32768
fetch_limit = 200
def count_motions(db, project_ids=None, institution_ids=None, description_filter=None):
count = db.countMotions(None, project_ids, institution_ids, None, None, description_filter)
return count
def fetch_motions(db, project_ids=None, institution_ids=None, descripti... |
# Recursive function to perform pre-order traversal of the tree
def preorder(root):
# return if the current node is empty
if root is None:
return
# Display the data part of the root (or current node)
print(root.data, end=' ')
# Traverse the left subtree
preorder(root.left)
# ... | def preorder(root):
if root is None:
return
print(root.data, end=' ')
preorder(root.left)
preorder(root.right) |
# defining object file1 to
# open GeeksforGeeks file in
# read mode
file1 = open('GeeksforGeeks.txt',
'r')
# defining object file2 to
# open GeeksforGeeksUpdated file
# in write mode
file2 = open('GeeksforGeeksUpdated.txt',
'w')
# reading each line from original
# text file
for line in file1.readlin... | file1 = open('GeeksforGeeks.txt', 'r')
file2 = open('GeeksforGeeksUpdated.txt', 'w')
for line in file1.readlines():
if not line.startswith('TextGenerator'):
print(line)
file2.write(line)
file2.close()
file1.close() |
template_string = '''#!/bin/bash
#PBS -S /bin/bash
#PBS -N ${jobname}
#PBS -m n
#PBS -l walltime=$walltime
#PBS -l select=${nodes_per_block}:ncpus=${ncpus}${select_options}
#PBS -o ${submit_script_dir}/${jobname}.submit.stdout
#PBS -e ${submit_script_dir}/${jobname}.submit.stderr
${scheduler_options}
${worker_init}
... | template_string = '#!/bin/bash\n\n#PBS -S /bin/bash\n#PBS -N ${jobname}\n#PBS -m n\n#PBS -l walltime=$walltime\n#PBS -l select=${nodes_per_block}:ncpus=${ncpus}${select_options}\n#PBS -o ${submit_script_dir}/${jobname}.submit.stdout\n#PBS -e ${submit_script_dir}/${jobname}.submit.stderr\n${scheduler_options}\n\n${worke... |
number = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729... | number = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729... |
# This program demonstrates the use of the == operator using numbers
print (5 == 6)
# Using variables
x = 5
y = 8
print(x == y)
| print(5 == 6)
x = 5
y = 8
print(x == y) |
class Core:
def gen_range(self, StartNumber, EndNumber, GapNumber):
number_range_result = []
row_number_sp = StartNumber
gap = int(EndNumber) - int(StartNumber)
if gap > GapNumber:
for X in range(int(gap / GapNumber)):
temp = []
temp.appen... | class Core:
def gen_range(self, StartNumber, EndNumber, GapNumber):
number_range_result = []
row_number_sp = StartNumber
gap = int(EndNumber) - int(StartNumber)
if gap > GapNumber:
for x in range(int(gap / GapNumber)):
temp = []
temp.appen... |
manager_num1 =10
manager_num2 =11
zhangsan_num1 = 22
num3 = 30
pp = 36
ll = 23
nishuia
| manager_num1 = 10
manager_num2 = 11
zhangsan_num1 = 22
num3 = 30
pp = 36
ll = 23
nishuia |
class FilterModule:
def filters(self):
return {
'user_home': self.user_home
}
def user_home(self, d, username):
for user in d["results"]:
if user["item"] == username:
return user["home"]
return ValueError("Cannot find the home directory f... | class Filtermodule:
def filters(self):
return {'user_home': self.user_home}
def user_home(self, d, username):
for user in d['results']:
if user['item'] == username:
return user['home']
return value_error('Cannot find the home directory for user {}'.format(us... |
class Solution:
def depthSumInverse(self, nestedList: List[NestedInteger]) -> int:
dic = {}
level = 0
q = collections.deque()
q.append(nestedList)
res = 0
while q:
size = len(q)
level += 1
sums = 0
for _ in range(size):
... | class Solution:
def depth_sum_inverse(self, nestedList: List[NestedInteger]) -> int:
dic = {}
level = 0
q = collections.deque()
q.append(nestedList)
res = 0
while q:
size = len(q)
level += 1
sums = 0
for _ in range(size... |
class Solution:
def reverseWords(self, s: str) -> str:
# Using Python's built-in string manipulation methods
# Split the string into words at the spaces, reverse and join the
# individual words, then rejoin the words with a space
s = s.split(' ')
for i, word in enumerate(s):
... | class Solution:
def reverse_words(self, s: str) -> str:
s = s.split(' ')
for (i, word) in enumerate(s):
s[i] = ''.join(list(reversed(word)))
return ' '.join(s) |
KEY_QUESTION_TYPE = 'question_type'
KEY_QUESTION = 'question'
KEY_ANSWER = 'answer'
KEY_OPTIONS = 'options'
KEY_COMPREHENSION = 'comprehension'
KEY_EXPLANATION = 'explanation'
| key_question_type = 'question_type'
key_question = 'question'
key_answer = 'answer'
key_options = 'options'
key_comprehension = 'comprehension'
key_explanation = 'explanation' |
# 1. Property-specific details
# Timezone string follows TZ format (see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
PROP_NAME = "Ascott Raffles Place Singapore"
TIMEZONE = "Asia/Singapore"
# 2. Languages expected to be in use at this property
BABEL_LOCALES = ('en', 'zh', 'ms', 'ta')
BABEL_DEFAULT_LO... | prop_name = 'Ascott Raffles Place Singapore'
timezone = 'Asia/Singapore'
babel_locales = ('en', 'zh', 'ms', 'ta')
babel_default_locale = 'en'
debug = False
mysql_database_user = 'root'
mysql_database_password = 'classroom'
mysql_database_db = 'Ascott_InvMgmt'
mysql_database_host = 'ascott.coxb3venarbl.ap-southeast-1.rd... |
result = []
for count in range (1,100):
if count % 3 == 0:
result.append("Fizz")
if count % 5 == 0:
result.append("Buzz")
else:
result.append(count)
print(result)
| result = []
for count in range(1, 100):
if count % 3 == 0:
result.append('Fizz')
if count % 5 == 0:
result.append('Buzz')
else:
result.append(count)
print(result) |
class ListView:
__slots__ = ['_list']
def __init__(self, list_object):
self._list = list_object
def __add__(self, other):
return self._list.__add__(other)
def __getitem__(self, other):
return self._list.__getitem__(other)
def __contains__(self, item):
return self.... | class Listview:
__slots__ = ['_list']
def __init__(self, list_object):
self._list = list_object
def __add__(self, other):
return self._list.__add__(other)
def __getitem__(self, other):
return self._list.__getitem__(other)
def __contains__(self, item):
return self.... |
class DSSnet_hosts:
'class for meta process/IED info'
p_id = 0
def __init__(self, msg, IED_id, command, ip, pipe = True):
self.properties= msg
self.IED_id = IED_id
self.process_id= DSSnet_hosts.p_id
self.command = command
self.ip = ip
self.pipe = pipe... | class Dssnet_Hosts:
"""class for meta process/IED info"""
p_id = 0
def __init__(self, msg, IED_id, command, ip, pipe=True):
self.properties = msg
self.IED_id = IED_id
self.process_id = DSSnet_hosts.p_id
self.command = command
self.ip = ip
self.pipe = pipe
... |
'''
Longest Increasing Subarray
Find the longest increasing subarray (subarray is when all elements are neighboring in the original array).
Input: [10, 1, 3, 8, 2, 0, 5, 7, 12, 3]
Output: 4
=========================================
Only in one iteration, check if the current element is bigger than the previous and i... | """
Longest Increasing Subarray
Find the longest increasing subarray (subarray is when all elements are neighboring in the original array).
Input: [10, 1, 3, 8, 2, 0, 5, 7, 12, 3]
Output: 4
=========================================
Only in one iteration, check if the current element is bigger than the previous and i... |
def main():
# input
a, b = input().split()
# compute
# output
print('H' if a==b else 'D')
if __name__ == '__main__':
main()
| def main():
(a, b) = input().split()
print('H' if a == b else 'D')
if __name__ == '__main__':
main() |
# -*- coding: utf-8 -*-
description = 'DNS detector setup'
group = 'lowlevel'
includes = ['counter']
sysconfig = dict(
datasinks = ['LiveView'],
)
tango_base = 'tango://phys.dns.frm2:10000/dns/'
devices = dict(
LiveView = device('nicos.devices.datasinks.LiveViewSink',
),
dettof = device('nicos_mlz.... | description = 'DNS detector setup'
group = 'lowlevel'
includes = ['counter']
sysconfig = dict(datasinks=['LiveView'])
tango_base = 'tango://phys.dns.frm2:10000/dns/'
devices = dict(LiveView=device('nicos.devices.datasinks.LiveViewSink'), dettof=device('nicos_mlz.dns.devices.detector.TofChannel', description='TOF data c... |
#/* n=int(input("Enter the number to print the tables for:"))
#for i in range(1,11):
# print(n,"x",i,"=",n*i)
n=int(input("Enter the number"))
for i in range(1,11):
print (n ,"x", i, "=", n * i)
| n = int(input('Enter the number'))
for i in range(1, 11):
print(n, 'x', i, '=', n * i) |
class CMDDiffLevelEnum:
BreakingChange = 1 # diff breaking change part
Structure = 2 #
Associate = 5 # include diff for links
All = 10 # including description and help messages
| class Cmddifflevelenum:
breaking_change = 1
structure = 2
associate = 5
all = 10 |
def isColoured(mult,i,j):
if i//mult%2==j//mult%2:
return True
return False
def colour(i,j):
col = False
for each in mults:
if isColoured(each,i,j):
col = (col==False)
return col
data = open("DATA21.txt")
input = data.readline
for j in range(10):
n = int(input())
mults = []
for i in ... | def is_coloured(mult, i, j):
if i // mult % 2 == j // mult % 2:
return True
return False
def colour(i, j):
col = False
for each in mults:
if is_coloured(each, i, j):
col = col == False
return col
data = open('DATA21.txt')
input = data.readline
for j in range(10):
n =... |
def is_narcissistic_number(n):
original_number = n
number_of_digits = get_number_of_digits(n)
sum = 0
while n != 0:
sum += (n % 10) ** number_of_digits
n //= 10
return original_number == sum
def get_number_of_digits(n):
return len(str(n))
if __name__ == "__main__":
n = ... | def is_narcissistic_number(n):
original_number = n
number_of_digits = get_number_of_digits(n)
sum = 0
while n != 0:
sum += (n % 10) ** number_of_digits
n //= 10
return original_number == sum
def get_number_of_digits(n):
return len(str(n))
if __name__ == '__main__':
n = int(i... |
# Program to work with file input / output (i/o)
# This is pulling the days.txt file in this directory in this repo
path = 'days.txt'
days_file = open(path,'r')
days = days_file.read()
new_path = 'new_days.txt'
new_days = open(new_path,'w')
title = 'Days of the Week\n'
new_days.write(title)
print(title)
new_days.w... | path = 'days.txt'
days_file = open(path, 'r')
days = days_file.read()
new_path = 'new_days.txt'
new_days = open(new_path, 'w')
title = 'Days of the Week\n'
new_days.write(title)
print(title)
new_days.write(days)
print(days)
days_file.close()
new_days.close() |
#!/usr/bin/env python
# coding: utf-8
# In[3]:
# DEMO OF WEAK TYPING in PYTHON
# int age = 4 <-strongly typed variables, declare type along with id
age = 4; # we CANNOT declare a type for variable age
print(age)
print(type(age))
age = ('calico','calico','himalyian')
print(age)
print(type(age))
# # Allegheny county... | age = 4
print(age)
print(type(age))
age = ('calico', 'calico', 'himalyian')
print(age)
print(type(age))
def iterate_ems_records(file_path):
"""
Retrieve each record from a CSV of EMS records from the filepath
Intended for use with the WPRDC's record of EMS dispatches
in Allegheny County and will p... |
class Rectangle(object):
def __init__(self, x, y):
self._x = x # don't trigger _setSide prematurely
self.y = y # now trigger it, so area gets computed
def _setSide(self, attrname, value):
setattr(self, attrname, value)
self.area = self._x * ... | class Rectangle(object):
def __init__(self, x, y):
self._x = x
self.y = y
def _set_side(self, attrname, value):
setattr(self, attrname, value)
self.area = self._x * self._y
x = common_property('_x', fset=_setSide, fdel=None)
y = common_property('_y', fset=_setSide, fdel... |
orders = ["daisies", "periwinkle"]
print(orders)
orders.append("tulips")
orders.append("roses")
print(orders) | orders = ['daisies', 'periwinkle']
print(orders)
orders.append('tulips')
orders.append('roses')
print(orders) |
def test_parameters(api_client, api_prefix):
url = f"{api_prefix}/parameterset/"
response = api_client.get(url)
assert response.status_code == 200
json_dict = response.json
expected = {
"parameter_list_url": f"{api_prefix}/parameters/",
"parameter_set": {
"name": None,
... | def test_parameters(api_client, api_prefix):
url = f'{api_prefix}/parameterset/'
response = api_client.get(url)
assert response.status_code == 200
json_dict = response.json
expected = {'parameter_list_url': f'{api_prefix}/parameters/', 'parameter_set': {'name': None, 'parameters': [{'excluded': [], ... |
#! /usr/bin/python3
DATA_FILENAME = "data.txt"
data_file = open(DATA_FILENAME, 'r') # open the file for reading
date_string = data_file.readline()
date_string = date_string.strip()
year, month, day = tuple(date_string.split('-'))
year, month, day = int(year), int(month), int(day)
month_names = {1:'January', 2:'Februa... | data_filename = 'data.txt'
data_file = open(DATA_FILENAME, 'r')
date_string = data_file.readline()
date_string = date_string.strip()
(year, month, day) = tuple(date_string.split('-'))
(year, month, day) = (int(year), int(month), int(day))
month_names = {1: 'January', 2: 'February', 3: 'March', 4: 'April', 5: 'May', 6: ... |
def handle_error_response(resp):
codes = {
-1: FATdAPIError,
-32600: InvalidRequest,
-32601: MethodNotFound,
-32602: InvalidParam,
-32603: InternalError,
-32700: ParseError,
-32800: TokenNotFound,
-32801: InvalidToken,
-32802: InvalidAddress,
... | def handle_error_response(resp):
codes = {-1: FATdAPIError, -32600: InvalidRequest, -32601: MethodNotFound, -32602: InvalidParam, -32603: InternalError, -32700: ParseError, -32800: TokenNotFound, -32801: InvalidToken, -32802: InvalidAddress, -32803: TransactionNotFound, -32804: InvalidTransaction, -32805: TokenSync... |
class Hitbox:
def __init__(self):
pass
def point_inside(self, obj, point):
return False
class Box(Hitbox):
def __init__(self, width, height):
Hitbox.__init__(self)
self.width = width
self.height = height
def point_inside(self, obj, pos):
x = obj.x
y = obj.y
xm = x + (self.width*obj.scale)
ym =... | class Hitbox:
def __init__(self):
pass
def point_inside(self, obj, point):
return False
class Box(Hitbox):
def __init__(self, width, height):
Hitbox.__init__(self)
self.width = width
self.height = height
def point_inside(self, obj, pos):
x = obj.x
... |
def Function(anumber):
if anumber == 1:
print ("One")
elif anumber == 2:
print ("Two")
elif anumber == 3:
print ("Three")
elif anumber == 4:
print ("Four")
elif anumber == 5:
print ("Five")
elif anumber == 6:
print ("Six")
elif anumber == 7:
... | def function(anumber):
if anumber == 1:
print('One')
elif anumber == 2:
print('Two')
elif anumber == 3:
print('Three')
elif anumber == 4:
print('Four')
elif anumber == 5:
print('Five')
elif anumber == 6:
print('Six')
elif anumber == 7:
... |
def disp(*txt, p):
print(*txt)
ask = lambda p : p.b(input())
functions = {">>":disp,"?":ask}
| def disp(*txt, p):
print(*txt)
ask = lambda p: p.b(input())
functions = {'>>': disp, '?': ask} |
val = int(input(print("Enter a number: ")))
option = {
"n":"Nae nigga nae \n", "c":"Uohhhhhh :sob::sob::sob: \n",
"i":"I am living in your walls, oomfie. \n"
}
userinput = input("Choose your poison: [N]iggas, [C]unny, [I]solation")
with open("outputtings.txt",'w') as f:
f.write(option[userinput.l... | val = int(input(print('Enter a number: ')))
option = {'n': 'Nae nigga nae \n', 'c': 'Uohhhhhh :sob::sob::sob: \n', 'i': 'I am living in your walls, oomfie. \n'}
userinput = input('Choose your poison: [N]iggas, [C]unny, [I]solation')
with open('outputtings.txt', 'w') as f:
f.write(option[userinput.lower()] * val)
pr... |
'''
Ganon's Tower
'''
__all__ = 'LOCATIONS',
LOCATIONS = {
"Ganon's Tower Entrance (I)": {
'type': 'interior',
'link': {
'Castle Tower Entrance (E)': [('settings', 'inverted')],
"Ganon's Tower Entrance (E)": [('nosettings', 'inverted')],
"Ganon's Tower Lobby": ... | """
Ganon's Tower
"""
__all__ = ('LOCATIONS',)
locations = {"Ganon's Tower Entrance (I)": {'type': 'interior', 'link': {'Castle Tower Entrance (E)': [('settings', 'inverted')], "Ganon's Tower Entrance (E)": [('nosettings', 'inverted')], "Ganon's Tower Lobby": [('and', [('or', [('settings', 'placement_advanced'), ('and'... |
def siOr(s0, s1):
'''Performs s0 | s1 where s0 and s1 are lists of sections or intervals'''
actSec = [False, False]
secs = []
k0 = [i for s in s0 for i in s]
k1 = [i for s in s1 for i in s]
keyPoints = list(sorted([(k, 0) for k in k0]
+ [(k, 1) for k in k1], key=lam... | def si_or(s0, s1):
"""Performs s0 | s1 where s0 and s1 are lists of sections or intervals"""
act_sec = [False, False]
secs = []
k0 = [i for s in s0 for i in s]
k1 = [i for s in s1 for i in s]
key_points = list(sorted([(k, 0) for k in k0] + [(k, 1) for k in k1], key=lambda x: x[0]))
x = None
... |
class Solution:
def numIslands(self, grid: 'List[List[str]]') -> 'int':
if not grid:
return 0
no_lines = len(grid)
no_cols = len(grid[0])
def solve(line_idx, col_idx):
grid[line_idx][col_idx] = '-1'
queue = [(line_idx, col_idx)]
idx =... | class Solution:
def num_islands(self, grid: 'List[List[str]]') -> 'int':
if not grid:
return 0
no_lines = len(grid)
no_cols = len(grid[0])
def solve(line_idx, col_idx):
grid[line_idx][col_idx] = '-1'
queue = [(line_idx, col_idx)]
idx ... |
a = [[3,],[]]
for x in a:
x.append(4)
# print (x)
print (a)
b= []
for x in b:
print (3)
print (x) | a = [[3], []]
for x in a:
x.append(4)
print(a)
b = []
for x in b:
print(3)
print(x) |
filename='pi_million_digits.txt'
with open(filename) as file_object:
lines=file_object.readlines()
pi_string=''
for line in lines:
pi_string+=line.strip()
birthday=input("Enter your birthday, in the form mmddyy:")
if birthday in pi_string:
print("Your birthday appears in the first millions digits of pi!")
... | filename = 'pi_million_digits.txt'
with open(filename) as file_object:
lines = file_object.readlines()
pi_string = ''
for line in lines:
pi_string += line.strip()
birthday = input('Enter your birthday, in the form mmddyy:')
if birthday in pi_string:
print('Your birthday appears in the first millions digits ... |
def outer():
def inner():
print(out_var)
out_var = 10
inner()
if "__main__" == __name__:
outer() | def outer():
def inner():
print(out_var)
out_var = 10
inner()
if '__main__' == __name__:
outer() |
# Copyright (c) Vera Galstyan Jan 2018
favorite_places ={
'vera': ['lyon','paris','london'],
'ofa':['berlin','madrid','milan'],
'karen':['dubai','barcelona']
}
for name,places in favorite_places.items():
print("\n" + name + "'s favorite places are:")
for place in places:
print(place) | favorite_places = {'vera': ['lyon', 'paris', 'london'], 'ofa': ['berlin', 'madrid', 'milan'], 'karen': ['dubai', 'barcelona']}
for (name, places) in favorite_places.items():
print('\n' + name + "'s favorite places are:")
for place in places:
print(place) |
# -*- coding: utf-8 -*-
# See /usr/include/sysexits.h
EX_OK = 0
EX_USAGE = 64
EX_DATAERR = 65
EX_NOUSER = 67
EX_PROTOCOL = 76
EX_TEMPFAIL = 75
EX_CONFIG = 78
# Standard for Bash: <http://www.tldp.org/LDP/abs/html/exitcodes.html>
EX_CTRL_C = 130
exit_vals = {
'success': EX_OK,
'config_error': EX_CONFIG,
'url... | ex_ok = 0
ex_usage = 64
ex_dataerr = 65
ex_nouser = 67
ex_protocol = 76
ex_tempfail = 75
ex_config = 78
ex_ctrl_c = 130
exit_vals = {'success': EX_OK, 'config_error': EX_CONFIG, 'url_bung': EX_USAGE, 'communication_failure': EX_PROTOCOL, 'socket_error': EX_PROTOCOL, 'json_decode_error': EX_PROTOCOL, 'no_user': EX_NOUSE... |
class Error:
def __init__(self, error_type: str, details: str, file: str, line: int, column: int):
self.error_type = error_type
self.details = details
self.file = file
self.line = line
self.column = column
def __repr__(self):
return "{} ERROR: '{}', fi... | class Error:
def __init__(self, error_type: str, details: str, file: str, line: int, column: int):
self.error_type = error_type
self.details = details
self.file = file
self.line = line
self.column = column
def __repr__(self):
return "{} ERROR: '{}', file {}, lin... |
#!/usr/bin/env python3
def main():
s = str(input('What country are you from? '))
print('I have heard that {0} is a beautiful country.'.format(s))
if __name__ == "__main__":
main()
| def main():
s = str(input('What country are you from? '))
print('I have heard that {0} is a beautiful country.'.format(s))
if __name__ == '__main__':
main() |
{
"targets": [
{
"target_name": "nodeNativeInput",
"sources": [
"src/nodeNativeInput.cpp",
"src/getOne/getOne.cpp",
"src/getTwo/getTwo.cpp",
"src/getThree/getThree.cpp"
],
"include_dirs": ["<!(node -e \"require('nan')\")"],
"conditions": [
["OS... | {'targets': [{'target_name': 'nodeNativeInput', 'sources': ['src/nodeNativeInput.cpp', 'src/getOne/getOne.cpp', 'src/getTwo/getTwo.cpp', 'src/getThree/getThree.cpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'conditions': [['OS == "win"', {'defines': ['Windows'], 'link_settings': {'libraries': []}}], ['OS ==... |
message_decrypter=input("Votre message a decrypter:")
cle=int(input("Nombre de decalage ?:"))
longueur=len(message_decrypter)
i=0
alph=""
resultat=""
for i in range(longueur):
asc=ord(message_decrypter[i])
if asc>=65 or asc<=90:
asc=asc-cle
resultat=resultat+chr(asc)
print (resultat) | message_decrypter = input('Votre message a decrypter:')
cle = int(input('Nombre de decalage ?:'))
longueur = len(message_decrypter)
i = 0
alph = ''
resultat = ''
for i in range(longueur):
asc = ord(message_decrypter[i])
if asc >= 65 or asc <= 90:
asc = asc - cle
resultat = resultat + chr(asc)
print(... |
class Kilobyte:
def __init__(self, value_kilobytes: int):
self._value_kilobytes = value_kilobytes
self.one_kilobyte_in_bits = 8000
self._value_bits = self._convert_into_bits(value_kilobytes)
self.id = "KB"
def _convert_into_bits(self, value_kilobytes: int) -> int:
return value_kilobytes * self.one_kilobyt... | class Kilobyte:
def __init__(self, value_kilobytes: int):
self._value_kilobytes = value_kilobytes
self.one_kilobyte_in_bits = 8000
self._value_bits = self._convert_into_bits(value_kilobytes)
self.id = 'KB'
def _convert_into_bits(self, value_kilobytes: int) -> int:
retur... |
# Inheritance is used to share property and functionality across similar code.
# like car and 2 wheels
# It creates resuable code.
# Breaks code into hierarchy, more generics to more specific.
# Objects higher up in the hiearchy is more generics.
# Multiple inheritance is possible in Python.z
class Vehicle:
def _... | class Vehicle:
def __init__(self, make, model, fuel='gas'):
self.make = make
self.model = model
self.fuel = fuel
def is_eco_friendly(self):
if self.fuel == 'gas':
return True
else:
return False
class Car(Vehicle):
def __init__(self, make, m... |
#########################################################
# Fred12 Setup the Head Servos
#########################################################
# We will be using the following services:
# Servo Service
#########################################################
# In Fred's head, we have a Servo to turn the head fr... | head_x = Runtime.createAndStart('headX', 'Servo')
headX.attach(head, 3)
headX.setMinMax(0, 180)
headX.map(0, 180, 1, 180)
headX.setRest(90)
headX.setInverted(True)
headX.setVelocity(60)
headX.setAutoDisable(True)
headX.rest()
jaw = Runtime.createAndStart('jaw', 'Servo')
jaw.attach(head, 2)
jaw.setMinMax(90, 165)
jaw.ma... |
# Done by Carlos Amaral (16/09/2020)
# SCU_2.7 - Modify a User-Defined Function
def my_function(x, y):
return (x+y)/2
x = 4
y = 5
print("The average is: ", my_function(x,y))
| def my_function(x, y):
return (x + y) / 2
x = 4
y = 5
print('The average is: ', my_function(x, y)) |
def fib(n):
if n < 0:
raise FibonacciError
elif n <= 2:
return 1
else:
return fib(n-1) + fib(n-2)
class FibonacciError(Exception):
pass
class FibTestClass:
pass
| def fib(n):
if n < 0:
raise FibonacciError
elif n <= 2:
return 1
else:
return fib(n - 1) + fib(n - 2)
class Fibonaccierror(Exception):
pass
class Fibtestclass:
pass |
COLLECTION_NAME = "types"
TYPE_NAME_KEY = "name"
TYPE_VERSION_KEY = "version"
DEFAULT_TYPE_VERSION = 1
TYPE_COLLECTION_KEY = "collection"
TYPE_PRIMITIVE_VALUE = "primitive"
DEFAULT_TYPE_COLLECTION = TYPE_PRIMITIVE_VALUE
STRING_VALUE = "String"
NUMBER_VALUE = "Number"
def make_app_stack_type(type_name, **kwargs):
... | collection_name = 'types'
type_name_key = 'name'
type_version_key = 'version'
default_type_version = 1
type_collection_key = 'collection'
type_primitive_value = 'primitive'
default_type_collection = TYPE_PRIMITIVE_VALUE
string_value = 'String'
number_value = 'Number'
def make_app_stack_type(type_name, **kwargs):
a... |
# Autonr : Biswadeep Roy
# import os
''' thiple single quote is used to
do multiple line comments'''
print("Hello world")
| """ thiple single quote is used to
do multiple line comments"""
print('Hello world') |
class Box:
def __init__(self, xmin, xmax, ymin, ymax):
assert xmax > xmin >= 0, ("Got invalid box with xmin: {0} and xmax {1}".format(xmin, xmax))
assert ymax > ymin >= 0, ("Got invalid box with ymin: {0} and ymax {1}".format(ymin, ymax))
self._xmin = xmin
self._xmax = xmax
s... | class Box:
def __init__(self, xmin, xmax, ymin, ymax):
assert xmax > xmin >= 0, 'Got invalid box with xmin: {0} and xmax {1}'.format(xmin, xmax)
assert ymax > ymin >= 0, 'Got invalid box with ymin: {0} and ymax {1}'.format(ymin, ymax)
self._xmin = xmin
self._xmax = xmax
self... |
class FindShortestID:
__slots__ = 'short_id', 'new_id'
def __init__(self):
self.short_id = ''
self.new_id = None
def step(self, other_id, new_id):
self.new_id = new_id
for i in range(len(self.new_id)):
if other_id[i] != self.new_id[i]:
if i > len... | class Findshortestid:
__slots__ = ('short_id', 'new_id')
def __init__(self):
self.short_id = ''
self.new_id = None
def step(self, other_id, new_id):
self.new_id = new_id
for i in range(len(self.new_id)):
if other_id[i] != self.new_id[i]:
if i > l... |
class PradamClass(object):
def __init__(self, name, age):
self._name = name
self._age = age
@property
def name(self):
return self._name
@name.setter
def name(self, val):
if val.lower() == 'pradam':
print('Corrent Name.')
else:
rai... | class Pradamclass(object):
def __init__(self, name, age):
self._name = name
self._age = age
@property
def name(self):
return self._name
@name.setter
def name(self, val):
if val.lower() == 'pradam':
print('Corrent Name.')
else:
raise ... |
'''MongoExceptions'''
class MongoExceptions(Exception):
def __init__(self, *args):
self.args = args
class NoDatabaseException(MongoExceptions):
def __init__(self, message = 'No such Database!', code = 422, args = ('No such Database!',)):
self.args = args
self.message = message
... | """MongoExceptions"""
class Mongoexceptions(Exception):
def __init__(self, *args):
self.args = args
class Nodatabaseexception(MongoExceptions):
def __init__(self, message='No such Database!', code=422, args=('No such Database!',)):
self.args = args
self.message = message
self... |
# cook your dish here
test = int(input())
while test > 0 :
n = int(input())
l = list(map(int,input().split()))
l.sort()
count = 0
for i in range(n - 1) :
if l[i] == l[i + 1] :
print("NO")
break
else :
count += 1
if count == n - 1 :
prin... | test = int(input())
while test > 0:
n = int(input())
l = list(map(int, input().split()))
l.sort()
count = 0
for i in range(n - 1):
if l[i] == l[i + 1]:
print('NO')
break
else:
count += 1
if count == n - 1:
print('YES')
test -= 1 |
def mean(u):
if type(u) == dict:
the_mean = sum(u.values())/len(u)
else:
the_mean = sum(u) / len(u)
return the_mean
student_grades = {"Marry":9.8, "jhon":2.1, "Kayle":6.5}
mondey_temparature = [2,3,54,48,48,57]
print('This is a mean of a Dictonary',mean(student_grades))
print('This is a m... | def mean(u):
if type(u) == dict:
the_mean = sum(u.values()) / len(u)
else:
the_mean = sum(u) / len(u)
return the_mean
student_grades = {'Marry': 9.8, 'jhon': 2.1, 'Kayle': 6.5}
mondey_temparature = [2, 3, 54, 48, 48, 57]
print('This is a mean of a Dictonary', mean(student_grades))
print('Thi... |
#Filter Fucntion Example 2
def isVow(x):
if x=='a' or x=='e' or x=='i' or x=='o' or x=='u':
return True
def isCons(x):
if x!='a' and x!='e' and x!='i' and x!='o' and x!='u':
return True
print("Enter the letters:")
lst = [x for x in input().split()]
print('-'*40)
vowlist = list(f... | def is_vow(x):
if x == 'a' or x == 'e' or x == 'i' or (x == 'o') or (x == 'u'):
return True
def is_cons(x):
if x != 'a' and x != 'e' and (x != 'i') and (x != 'o') and (x != 'u'):
return True
print('Enter the letters:')
lst = [x for x in input().split()]
print('-' * 40)
vowlist = list(filter(isV... |
print(2**3)
print(2**3.)
print(2.**3)
print(2.**3.)
print(5//2)
print(2**2**3)
print(2*4)
print(2**4)
print(2.*4)
print(2**4.)
print(2/4)
print(2//4)
print(-2/4)
print(-2//4)
print(2%4)
print(2%-4) | print(2 ** 3)
print(2 ** 3.0)
print(2.0 ** 3)
print(2.0 ** 3.0)
print(5 // 2)
print(2 ** 2 ** 3)
print(2 * 4)
print(2 ** 4)
print(2.0 * 4)
print(2 ** 4.0)
print(2 / 4)
print(2 // 4)
print(-2 / 4)
print(-2 // 4)
print(2 % 4)
print(2 % -4) |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-AtmNetworkingMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AtmNetworkingMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:29:08 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_size_constraint, value_range_constraint, constraints_intersection) ... |
DIRECT_LINK_SCHEMA = {
"type": "object",
"properties": {
"local_file": {
"type": ["string", "null"],
"description": "local zip file path"
}
}
}
IMAGE_SCHEMA = {
"type": "object",
"properties": {
"original": {
"type": "file"
},
... | direct_link_schema = {'type': 'object', 'properties': {'local_file': {'type': ['string', 'null'], 'description': 'local zip file path'}}}
image_schema = {'type': 'object', 'properties': {'original': {'type': 'file'}, 'size': {'type': 'array', 'items': {'type': 'number'}}, 'custom_size': {'type': 'file', 'processors': [... |
# by usingt he above trick we see that kidney_data.gsms is a dictionary (you can validate this)
type(kidney_data.gsms)
# a dict is a container of key,value pairs. The values in this case are of the class GEOparse.GEOTypes.GSM
# e.g.
print(type(list(kidney_data.gsms.values())[0]))
## to get the available methods:
f... | type(kidney_data.gsms)
print(type(list(kidney_data.gsms.values())[0]))
fst = list(kidney_data.gsms.values())[0]
dir(fst)
fst.metadata |
def remove_smallest(n, lst):
if n <= 0:
return lst
elif n > len(lst):
return []
dex = [b[1] for b in sorted((a, i) for i, a in enumerate(lst))[:n]]
return [c for i, c in enumerate(lst) if i not in dex]
| def remove_smallest(n, lst):
if n <= 0:
return lst
elif n > len(lst):
return []
dex = [b[1] for b in sorted(((a, i) for (i, a) in enumerate(lst)))[:n]]
return [c for (i, c) in enumerate(lst) if i not in dex] |
class Solution:
def countServers(self, grid: List[List[int]]) -> int:
rows = defaultdict(set)
cols = defaultdict(set)
m = len(grid)
n = len(grid[0])
for i in range(m):
for j in range(n):
if grid[i][j]:
rows[i].add(j)
... | class Solution:
def count_servers(self, grid: List[List[int]]) -> int:
rows = defaultdict(set)
cols = defaultdict(set)
m = len(grid)
n = len(grid[0])
for i in range(m):
for j in range(n):
if grid[i][j]:
rows[i].add(j)
... |
#https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/880/
#%%
input=-123
output=321
class Solution:
def reverse(self, x: int) -> int:
string=list(str(abs(x)))
string.reverse()
if x>=0:
temp=int(''.join(string)... | input = -123
output = 321
class Solution:
def reverse(self, x: int) -> int:
string = list(str(abs(x)))
string.reverse()
if x >= 0:
temp = int(''.join(string))
if temp > 2 ** 31 - 1:
return 0
else:
return temp
if x ... |
#py_list_comp_1.py
print([str(x)+"!" for x in [y for y in range(10)]])
| print([str(x) + '!' for x in [y for y in range(10)]]) |
class Solution:
def dominantIndex(self, nums: List[int]) -> int:
max_index = 0
for index, num in enumerate(nums):
if num > nums[max_index]:
max_index = index
for index, num in enumerate(nums):
if index == max_index:
co... | class Solution:
def dominant_index(self, nums: List[int]) -> int:
max_index = 0
for (index, num) in enumerate(nums):
if num > nums[max_index]:
max_index = index
for (index, num) in enumerate(nums):
if index == max_index:
continue
... |
SCRIPT=r'''
import sys,time
fi=open(sys.argv[1])
time.sleep(8)
fo=open(sys.argv[2],'w')
fo.write(fi.read())
fi.close()
fo.close()
'''
| script = "\nimport sys,time\nfi=open(sys.argv[1])\ntime.sleep(8)\nfo=open(sys.argv[2],'w')\nfo.write(fi.read())\nfi.close()\nfo.close()\n" |
def dot(n,m):
r=['+'+'---+'*n]
for _ in range(m):
r.append('|'+' o |'*n)
r.append('+'+'---+'*n)
return '\n'.join(r) | def dot(n, m):
r = ['+' + '---+' * n]
for _ in range(m):
r.append('|' + ' o |' * n)
r.append('+' + '---+' * n)
return '\n'.join(r) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def recoverTree(self, root: TreeNode) -> None:
# there are two nodes to find
self.nodes = []
self.inorder(root)
... | class Solution:
def recover_tree(self, root: TreeNode) -> None:
self.nodes = []
self.inorder(root)
(t1, t2) = (None, None)
for i in range(len(self.nodes) - 1):
if self.nodes[i + 1] < self.nodes[i]:
t1 = self.nodes[i + 1]
if t2 == None:
... |
def biggest_cycle_before(limit):
num = longest = 1
for n in range(3, limit, 2):
if n % 5 == 0:
continue
p = 1
while (10 ** p) % n != 1:
p += 1
if p > longest:
num, longest = n, p
print(num)
if __name__ == "__main__":
biggest_cycle_... | def biggest_cycle_before(limit):
num = longest = 1
for n in range(3, limit, 2):
if n % 5 == 0:
continue
p = 1
while 10 ** p % n != 1:
p += 1
if p > longest:
(num, longest) = (n, p)
print(num)
if __name__ == '__main__':
biggest_cycle_bef... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__version__ = "2.0.3"
__author__ = "Amir Zeldes"
__copyright__ = "Copyright 2015-2018, Amir Zeldes"
__license__ = "MIT License"
| __version__ = '2.0.3'
__author__ = 'Amir Zeldes'
__copyright__ = 'Copyright 2015-2018, Amir Zeldes'
__license__ = 'MIT License' |
t = int(input())
answer = []
for a in range(t):
n = int(input())
count = [0 for i in range(26)]
for j in range(n):
line = list(input())
for k in line:
count[ord(k)-97] += 1
ans = True
for k in count:
if(k%n != 0):
ans = False
break
... | t = int(input())
answer = []
for a in range(t):
n = int(input())
count = [0 for i in range(26)]
for j in range(n):
line = list(input())
for k in line:
count[ord(k) - 97] += 1
ans = True
for k in count:
if k % n != 0:
ans = False
break
... |
class LogSystem:
def __init__(self):
self.time_position_dict = {"Year": 0, "Month": 1,
"Day": 2, "Hour": 3,
"Minute": 4, "Second": 5}
self.logs = {}
def put(self, id, timestamp):
self.logs[timestamp] = id
def r... | class Logsystem:
def __init__(self):
self.time_position_dict = {'Year': 0, 'Month': 1, 'Day': 2, 'Hour': 3, 'Minute': 4, 'Second': 5}
self.logs = {}
def put(self, id, timestamp):
self.logs[timestamp] = id
def retrieve(self, s, e, gra):
retrieve_logs = []
need_lengt... |
a = 'AJisa'
a = a.upper()
print(a)
a = a.lower()
print(a)
n = "89*"
print(n.isnumeric())
print(n.isalpha()) | a = 'AJisa'
a = a.upper()
print(a)
a = a.lower()
print(a)
n = '89*'
print(n.isnumeric())
print(n.isalpha()) |
# pylint: skip-file
class GitRebase(GitCLI):
''' Class to wrap the git merge line tools
'''
# pylint: disable=too-many-arguments
def __init__(self,
path,
branch,
rebase_branch,
ssh_key=None):
''' Constructor for GitPush '''
... | class Gitrebase(GitCLI):
""" Class to wrap the git merge line tools
"""
def __init__(self, path, branch, rebase_branch, ssh_key=None):
""" Constructor for GitPush """
super(GitRebase, self).__init__(path, ssh_key=ssh_key)
self.path = path
self.branch = branch
self.re... |
# Acorn 2.0: Cocoa Butter
# Booleans are treated as integers
# Allow hex
#Number meta class
class N():
def __init__(self,n):
try:
self.n = float(n)
if(self.n.is_integer()):
self.n = int(n)
except:
self.n = int(n,16)
def N(self):
retur... | class N:
def __init__(self, n):
try:
self.n = float(n)
if self.n.is_integer():
self.n = int(n)
except:
self.n = int(n, 16)
def n(self):
return self.n
def __repr__(self):
return 'N(%s)' % self.n
class B:
def __init__... |
COM = ['wink', 'double blink', 'close your eyes', 'jump']
def commands(binary_str):
handshake = []
for couple in zip(binary_str[::-1],COM):
if couple[0] == '1':
handshake.append(couple[1])
if binary_str[0] == '1':
handshake = handshake[::-1]
return handshake
... | com = ['wink', 'double blink', 'close your eyes', 'jump']
def commands(binary_str):
handshake = []
for couple in zip(binary_str[::-1], COM):
if couple[0] == '1':
handshake.append(couple[1])
if binary_str[0] == '1':
handshake = handshake[::-1]
return handshake |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == "__main__":
u = set("abcdefghijklmnopqrstuvwxyz")
a = {"a", "b", "d", "i", "x"}
b = {"d", "e", "h", "i", "n", "u"}
c = {"e", "f", "m", "n"}
d = {"a", "c", "h", "k", "r", "s", "w", "x"}
bu = u.difference(b)
x = (a.difference(c)... | if __name__ == '__main__':
u = set('abcdefghijklmnopqrstuvwxyz')
a = {'a', 'b', 'd', 'i', 'x'}
b = {'d', 'e', 'h', 'i', 'n', 'u'}
c = {'e', 'f', 'm', 'n'}
d = {'a', 'c', 'h', 'k', 'r', 's', 'w', 'x'}
bu = u.difference(b)
x = a.difference(c).intersection(bu)
print(f'x = {x}')
ba = u.d... |
#List of constants accessed in our main transit_tracker.py script
#URL for downloading data
URL = 'https://www.psrc.org/sites/default/files/2014-hhsurvey.zip'
#list of age ranges used to make labels
AGE_RANGE_LIST = list(range(0,12))
#List of education ranges used to make labels
EDU_RANGE_LIST = list(range(0,7))
#Tool... | url = 'https://www.psrc.org/sites/default/files/2014-hhsurvey.zip'
age_range_list = list(range(0, 12))
edu_range_list = list(range(0, 7))
tools = 'pan,wheel_zoom,reset,poly_select,box_select,tap,box_zoom,save'
used_zips_psrc = ['98101', '98102', '98103', '98104', '98105', '98106', '98107', '98108', '98109', '98112', '9... |
SHARES = [
0.5, 0.6, 0.7, 0.8, 0.9,
0.91, 0.92, 0.93, 0.94,
0.95, 0.96, 0.97, 0.98,
0.99, 1.0
]
def pop(items):
return items[0], items[1:]
def get_quantiles(records, shares=SHARES):
if not shares:
return
counts = [count for _, count in records]
total = sum(counts)
acc... | shares = [0.5, 0.6, 0.7, 0.8, 0.9, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0]
def pop(items):
return (items[0], items[1:])
def get_quantiles(records, shares=SHARES):
if not shares:
return
counts = [count for (_, count) in records]
total = sum(counts)
accumulator = 0
sha... |
'''
Probem Task : A number is said to be Harshad if it's exactly divisible by
the sum of its digits. Create a function that determines whether a number
is a Harshad or not.
Problem Link : https://edabit.com/challenge/Rrauvu8afRbjqPM8L
'''
sum=0
def harshad(n):
global sum
if(n>0):
rem=... | """
Probem Task : A number is said to be Harshad if it's exactly divisible by
the sum of its digits. Create a function that determines whether a number
is a Harshad or not.
Problem Link : https://edabit.com/challenge/Rrauvu8afRbjqPM8L
"""
sum = 0
def harshad(n):
global sum
if n > 0:
r... |
a,b = 10,20
print(a+b) #Output: 30
print(a*b) #Output: 200
print(b/a) #Output: 2.0
print(b%a) #Output: 0 | (a, b) = (10, 20)
print(a + b)
print(a * b)
print(b / a)
print(b % a) |
# -*- coding: utf-8 -*-
MSG_DATE_SEP = ">>>:"
END_MSG = "THEEND"
ALLOWED_KEYS = [
'q',
'e',
's',
'z',
'c',
'',
]
| msg_date_sep = '>>>:'
end_msg = 'THEEND'
allowed_keys = ['q', 'e', 's', 'z', 'c', ''] |
# coding: utf-8
class Service:
pass
| class Service:
pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.