content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
print("----------")
say = list(range(2,4))
for i in say:
if i%2==0:
print("Even")
# continue
break
else:
print("Odd")
break
# continue
print("----------")
# av = 10
# candy = int(input("Enter The no. of candies you want?\n"))
# i = 1
# for i in range(1,candy... | print('----------')
say = list(range(2, 4))
for i in say:
if i % 2 == 0:
print('Even')
break
else:
print('Odd')
break
print('----------')
print('----------') |
track = dict(
author_username='residentmario',
course_name='Pandas',
course_url='https://www.kaggle.com/learn/pandas'
)
lessons = []
notebooks = []
lessons = [ {'topic': topic_name} for topic_name in
["Creating, Reading and Writing",
"Indexing, Selecting & Assigning"... | track = dict(author_username='residentmario', course_name='Pandas', course_url='https://www.kaggle.com/learn/pandas')
lessons = []
notebooks = []
lessons = [{'topic': topic_name} for topic_name in ['Creating, Reading and Writing', 'Indexing, Selecting & Assigning', 'Summary Functions and Maps', 'Grouping And Sorting', ... |
while 1:
try:
x,y=map(int,input().split())
print('%.2f'%(x/y))
except: break | while 1:
try:
(x, y) = map(int, input().split())
print('%.2f' % (x / y))
except:
break |
def say(message, foobar):
print(message * foobar)
say("hello", 3)
| def say(message, foobar):
print(message * foobar)
say('hello', 3) |
class LoggerInterface:
def log(self, to_log: str) -> None:
pass
def publish(self) -> None:
pass
| class Loggerinterface:
def log(self, to_log: str) -> None:
pass
def publish(self) -> None:
pass |
"""Configuration settings for Grade Converter Program."""
# Numerical grade minimum values from greatest to least.
GRADE_MINIMUMS = {
'A': 88,
'B': 80,
'C': 67,
'D': 60,
'F': 0
} | """Configuration settings for Grade Converter Program."""
grade_minimums = {'A': 88, 'B': 80, 'C': 67, 'D': 60, 'F': 0} |
galera = [['Chun', 74], ['Cunino', 16], ['Ana', 15], ['Bela', 98]]
print(galera[0])
print(galera[0][0])
print(galera[3][1])
| galera = [['Chun', 74], ['Cunino', 16], ['Ana', 15], ['Bela', 98]]
print(galera[0])
print(galera[0][0])
print(galera[3][1]) |
"""Property objects specify system and avd properties."""
def new_props(boot_properties = None, avd_properties = None):
"""Creates a new properties object."""
return {"boot": boot_properties or {}, "avd": avd_properties or {}}
def props_boot(props):
"""Accesses boot properties."""
return props["boot"]... | """Property objects specify system and avd properties."""
def new_props(boot_properties=None, avd_properties=None):
"""Creates a new properties object."""
return {'boot': boot_properties or {}, 'avd': avd_properties or {}}
def props_boot(props):
"""Accesses boot properties."""
return props['boot']
de... |
class InvalidExif(Exception):
pass
class ExifNotFound(Exception):
pass
| class Invalidexif(Exception):
pass
class Exifnotfound(Exception):
pass |
def create_post_sms_response_from_notification(
notification_id, client_reference, template_id, template_version, service_id,
content, from_number, url_root
):
resp = __create_notification_response(
notification_id, client_reference, template_id, template_version, service_id, url_root
)
re... | def create_post_sms_response_from_notification(notification_id, client_reference, template_id, template_version, service_id, content, from_number, url_root):
resp = __create_notification_response(notification_id, client_reference, template_id, template_version, service_id, url_root)
resp['content'] = {'from_num... |
#!/usr/bin/env python
"""The test package contains test data files as well as unit tests.
run_tests
===========
.. automodule:: test.run_tests
:members:
test_navigation
===============
.. automodule:: test.test_navigation
:members:
test_parse
===========
.. automodule:: test.test_parse
:members... | """The test package contains test data files as well as unit tests.
run_tests
===========
.. automodule:: test.run_tests
:members:
test_navigation
===============
.. automodule:: test.test_navigation
:members:
test_parse
===========
.. automodule:: test.test_parse
:members:
test_wsClaims
=====... |
#################################################
# Test sample
#################################################
def fmtfa(fasta: list):
prev = True
header = []
seq = []
for f in fasta:
if ">" in f:
header.append(f[1:])
prev = True
elif prev:
seq.ap... | def fmtfa(fasta: list):
prev = True
header = []
seq = []
for f in fasta:
if '>' in f:
header.append(f[1:])
prev = True
elif prev:
seq.append(f)
prev = False
else:
seq[-1] += f
return (header, seq)
file_in = 'sample/d... |
class Alarme:
def __init__(self, estado: bool) -> None:
self.__estado = estado
def getEstado(self) -> bool:
return self.__estado
def setEstado(self, valor: bool) -> None:
if isinstance(valor, bool):
self.__estado = valor
| class Alarme:
def __init__(self, estado: bool) -> None:
self.__estado = estado
def get_estado(self) -> bool:
return self.__estado
def set_estado(self, valor: bool) -> None:
if isinstance(valor, bool):
self.__estado = valor |
magic = {
'SX_OBJECT': b'\x00', # ( 0): Already stored object
'SX_LSCALAR': b'\x01', # ( 1): Scalar (large binary) follows (length, data)
'SX_ARRAY': b'\x02', # ( 2): Array forthcoming (size, item list)
'SX_HASH': b'\x03', # ( 3): Hash forthcoming (size, key/value pair list)
'SX_R... | magic = {'SX_OBJECT': b'\x00', 'SX_LSCALAR': b'\x01', 'SX_ARRAY': b'\x02', 'SX_HASH': b'\x03', 'SX_REF': b'\x04', 'SX_UNDEF': b'\x05', 'SX_INTEGER': b'\x06', 'SX_DOUBLE': b'\x07', 'SX_BYTE': b'\x08', 'SX_NETINT': b'\t', 'SX_SCALAR': b'\n', 'SX_TIED_ARRAY': b'\x0b', 'SX_TIED_HASH': b'\x0c', 'SX_TIED_SCALAR': b'\r', 'SX_... |
"""
Created on Jul 1, 2018
@author: lubo
"""
class EffectGene(object):
def __init__(self, symbol=None, effect=None):
self.symbol = symbol
self.effect = effect
@staticmethod
def from_string(data):
if not data:
return None
parts = [p.strip() for p in data.split... | """
Created on Jul 1, 2018
@author: lubo
"""
class Effectgene(object):
def __init__(self, symbol=None, effect=None):
self.symbol = symbol
self.effect = effect
@staticmethod
def from_string(data):
if not data:
return None
parts = [p.strip() for p in data.split(... |
iterable = ['spring', 'summer', 'autumn', 'winter']
print(iterable)
iterator = iter(iterable)
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
| iterable = ['spring', 'summer', 'autumn', 'winter']
print(iterable)
iterator = iter(iterable)
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator)) |
class Environment(object):
chargebee_domain = None
protocol= "https"
API_VERSION = "v2"
def __init__(self, options):
self.api_key = options['api_key']
self.site = options['site']
if self.chargebee_domain is None:
self.api_endpoint = 'https://%s.chargebee.com/api/%s... | class Environment(object):
chargebee_domain = None
protocol = 'https'
api_version = 'v2'
def __init__(self, options):
self.api_key = options['api_key']
self.site = options['site']
if self.chargebee_domain is None:
self.api_endpoint = 'https://%s.chargebee.com/api/%s'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Package exceptions.
"""
class Error(Exception):
"""Generic package error"""
pass
class ReadError(Error):
"""Package file read error"""
pass
class WriteError(Error):
"""Package file write error"""
pass
| """
Package exceptions.
"""
class Error(Exception):
"""Generic package error"""
pass
class Readerror(Error):
"""Package file read error"""
pass
class Writeerror(Error):
"""Package file write error"""
pass |
class _FieldConfig:
def __init__(self, accessor, default):
if not callable(accessor):
raise TypeError('accessor must be callable')
if type(default) is not bool:
raise TypeError('default must be bool')
self.accessor = accessor
self.default = default
def _fe... | class _Fieldconfig:
def __init__(self, accessor, default):
if not callable(accessor):
raise type_error('accessor must be callable')
if type(default) is not bool:
raise type_error('default must be bool')
self.accessor = accessor
self.default = default
def _fe... |
#
# PySNMP MIB module CISCO-SLB-DFP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SLB-DFP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:55:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, constraints_union, value_size_constraint) ... |
class Metric(object):
"""Base class for all metrics.
From: https://github.com/pytorch/tnt/blob/master/torchnet/meter/meter.py
Arguments:
name (str): a name for the metric. Default: miou.
"""
def __init__(self, name):
self.name = name
def reset(self):
pass
def add... | class Metric(object):
"""Base class for all metrics.
From: https://github.com/pytorch/tnt/blob/master/torchnet/meter/meter.py
Arguments:
name (str): a name for the metric. Default: miou.
"""
def __init__(self, name):
self.name = name
def reset(self):
pass
def add... |
class Solution:
def assignBikes(self, workers: List[List[int]], bikes: List[List[int]]) -> int:
self.workers = workers
self.bikes = bikes
self.nw = len(workers)
self.nb = len(bikes)
return self.search(0, 0)
def search(self, worker, bike_used):
if worker == self.... | class Solution:
def assign_bikes(self, workers: List[List[int]], bikes: List[List[int]]) -> int:
self.workers = workers
self.bikes = bikes
self.nw = len(workers)
self.nb = len(bikes)
return self.search(0, 0)
def search(self, worker, bike_used):
if worker == self... |
"""
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string.
Example 1:
Input:s1 = "ab" s2 = "eidbaooo"
Output:True
Explanation: s2 contains one permutation of s1 ("ba").
Example 2:
I... | """
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string.
Example 1:
Input:s1 = "ab" s2 = "eidbaooo"
Output:True
Explanation: s2 contains one permutation of s1 ("ba").
Example 2:
I... |
EMAIL = "YOUR_FACEBOOK_EMAIL"
UNAME = "YOUR_FB_USER_NAME"
passw = r"YOUR_FACBOOK_PASSWORD"
torBrowserPath = 'PATH_TO_TORBROWSERDIRECTORY'
exePath = 'PATH_TO_DRIVER_EXE'
| email = 'YOUR_FACEBOOK_EMAIL'
uname = 'YOUR_FB_USER_NAME'
passw = 'YOUR_FACBOOK_PASSWORD'
tor_browser_path = 'PATH_TO_TORBROWSERDIRECTORY'
exe_path = 'PATH_TO_DRIVER_EXE' |
class FileDoesNotExist(Exception):
""" Raised when the input file does not exist"""
def __init__(self, file_path):
self.message = "Input file '%s' does not exist!"% file_path
super().__init__(self.message)
| class Filedoesnotexist(Exception):
""" Raised when the input file does not exist"""
def __init__(self, file_path):
self.message = "Input file '%s' does not exist!" % file_path
super().__init__(self.message) |
class TesterResponse():
def __init__(self, error=0, accuracy =0 , predicted_targets={}, real_targets={}):
self.error = error
self.accuracy = accuracy
self.predicted_targets = predicted_targets
self.real_targets = real_targets
| class Testerresponse:
def __init__(self, error=0, accuracy=0, predicted_targets={}, real_targets={}):
self.error = error
self.accuracy = accuracy
self.predicted_targets = predicted_targets
self.real_targets = real_targets |
### This program prompts the user for his/her fullname ###
###(recapitalizes if need be) and then greets them ###
print("Welcome to ask your first & last name and THEN greet you, version 1.0, ")
print("the first and last version!\n")
print("Please input your first name now: ", end = " ")
first = input()
first = first... | print('Welcome to ask your first & last name and THEN greet you, version 1.0, ')
print('the first and last version!\n')
print('Please input your first name now: ', end=' ')
first = input()
first = first.capitalize()
print('Please input your last name now: ', end=' ')
last = input()
last = last.capitalize()
print('Supri... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Problem 066
Standardize Mobile Number Using Decorators
Source : https://www.hackerrank.com/challenges/standardize-mobile-number-using-decorators/problem
"""
#import re
def wrapper(f):
def fun(l):
f("+91 {} {}".format(n[-10:-5], n[-5:]) for n in l)
... | """Problem 066
Standardize Mobile Number Using Decorators
Source : https://www.hackerrank.com/challenges/standardize-mobile-number-using-decorators/problem
"""
def wrapper(f):
def fun(l):
f(('+91 {} {}'.format(n[-10:-5], n[-5:]) for n in l))
return fun
@wrapper
def sort_phone(l):
print(*sorted(... |
def extractAzureSky(item):
"""
# extractAzureSky
"""
chp, vol, frag = extractChapterVolFragment(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Shinde Hajimaru'.lower() in item['title'].lower():
postfix = ''
if 'prologue' in item['title'].lower():
postfix = 'Pro... | def extract_azure_sky(item):
"""
# extractAzureSky
"""
(chp, vol, frag) = extract_chapter_vol_fragment(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Shinde Hajimaru'.lower() in item['title'].lower():
postfix = ''
if 'prologue' in ite... |
s=input()
k=int(input())
l=list(map(int,input().split()))
initial=0
c=1
for i in s:
ind=ord(i)-97
initial+=l[ind]*c
c+=1
print(initial+(((k*c)+(k*(k-1))//2)*max(l))) | s = input()
k = int(input())
l = list(map(int, input().split()))
initial = 0
c = 1
for i in s:
ind = ord(i) - 97
initial += l[ind] * c
c += 1
print(initial + (k * c + k * (k - 1) // 2) * max(l)) |
expected_output = {
'lisp_id': {
0: {
'instance_id': {
4100: {
'entries': 3,
'prefix': {
'2001:192:168:1::/64': {
'producer': ['away table']
},
... | expected_output = {'lisp_id': {0: {'instance_id': {4100: {'entries': 3, 'prefix': {'2001:192:168:1::/64': {'producer': ['away table']}, '2001:192:168:1::1/128': {'producer': ['local EID']}, '2001:192:168:1::71/128': {'producer': ['local EID']}}}}}}} |
# Copyright (c) 2019.
# Designed and codded with love by Aleksander Dremov
#
#
#
#
name = "PyYaMusic"
| name = 'PyYaMusic' |
"""Convert strings to numbers and numbers to strings.
Gustavo Picon
https://tabo.pe/projects/numconv/
"""
__version__ = '2.1.1'
# from april fool's rfc 1924
BASE85 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' \
'!#$%&()*+-;<=>?@^_`{|}~'
# rfc4648 alphabets
BASE16 = BASE85[:16]
BASE3... | """Convert strings to numbers and numbers to strings.
Gustavo Picon
https://tabo.pe/projects/numconv/
"""
__version__ = '2.1.1'
base85 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~'
base16 = BASE85[:16]
base32 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
base32_hex = BASE85[:32]
bas... |
# coding=utf-8
"""
This is a convenience module to centrally define command line
parameters including help messages for commonly used options
"""
# file parameters
single_input = {'args': ('--input', '-i'),
'kwargs': {'required': True,
'dest': 'inputfile', 'type': str,
... | """
This is a convenience module to centrally define command line
parameters including help messages for commonly used options
"""
single_input = {'args': ('--input', '-i'), 'kwargs': {'required': True, 'dest': 'inputfile', 'type': str, 'help': 'Specify full path to single input file, e.g., /long/path/to/file.ext'}}
mu... |
# Numeri
base = 10
altezza = 20
area_rettangolo = base * altezza
area_triangolo = 0.5 * base * altezza
print(area_rettangolo)
print(area_triangolo)
print(22/7) | base = 10
altezza = 20
area_rettangolo = base * altezza
area_triangolo = 0.5 * base * altezza
print(area_rettangolo)
print(area_triangolo)
print(22 / 7) |
def partition_list(array, pivot):
"""
Given an unsorted list and a pivot integer, partition the list in two depending if the elements are smaller or greater than the pivot.
O(n) time & space
"""
smaller = []
bigger = []
for element in array:
if element < pivot:
smaller.append(element)
else:
bigger.appe... | def partition_list(array, pivot):
"""
Given an unsorted list and a pivot integer, partition the list in two depending if the elements are smaller or greater than the pivot.
O(n) time & space
"""
smaller = []
bigger = []
for element in array:
if element < pivot:
smaller.append(elem... |
# Screen Options
SCREEN_WIDTH = 1000
SCREEN_HEIGTH = 700
# Colors
BLACK = (0, 0, 0)
RED = (238, 64, 53)
GREEN = (118, 255, 3)
BLUE = (24, 255, 255)
YELLOW = (255, 235, 59)
ORANGE = (255, 140, 0)
INDIGO = (0, 0, 128)
VIOLET = (238, 130, 238)
WHITE = (255, 255, 255)
WALL_OPACITY = 40 # 0 -> 255
# Directions
STAY = 0
... | screen_width = 1000
screen_heigth = 700
black = (0, 0, 0)
red = (238, 64, 53)
green = (118, 255, 3)
blue = (24, 255, 255)
yellow = (255, 235, 59)
orange = (255, 140, 0)
indigo = (0, 0, 128)
violet = (238, 130, 238)
white = (255, 255, 255)
wall_opacity = 40
stay = 0
right = 1
left = 2
invalid = 0
wall = 1
avaiable = 2
i... |
class NumberSystemDisplayRule(Enum,IComparable,IFormattable,IConvertible):
"""
The available options for display of numeric values in the number system.
enum NumberSystemDisplayRule,values: All (0),Even (2),Odd (1),StartAndEnd (3)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x... | class Numbersystemdisplayrule(Enum, IComparable, IFormattable, IConvertible):
"""
The available options for display of numeric values in the number system.
enum NumberSystemDisplayRule,values: All (0),Even (2),Odd (1),StartAndEnd (3)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__... |
collections = [
"https://www.loc.gov/collections/abraham-lincoln-papers/",
"https://www.loc.gov/collections/slave-narratives-from-the-federal-writers-project-1936-to-1938/"
]
date_filtered_collections = [
# supreme court opinions
"https://www.loc.gov/collections/united-states-reports/",
# this is h... | collections = ['https://www.loc.gov/collections/abraham-lincoln-papers/', 'https://www.loc.gov/collections/slave-narratives-from-the-federal-writers-project-1936-to-1938/']
date_filtered_collections = ['https://www.loc.gov/collections/united-states-reports/', 'https://www.loc.gov/collections/united-states-statutes-at-l... |
# Python3 program to find the longest path in a matrix
n = 3 # size
def findLongestFromACell(i, j, mat, dp):
if (i<0 or i>= n or j<0 or j>= n):
return 0
if (dp[i][j] != -1):
return dp[i][j]
x, y, z, w = -1, -1, -1, -1
if (j<n-1 and ((mat[i][j] +1) == mat[i][j + 1])):
x = 1 + findLongestFromACell(i, j +... | n = 3
def find_longest_from_a_cell(i, j, mat, dp):
if i < 0 or i >= n or j < 0 or (j >= n):
return 0
if dp[i][j] != -1:
return dp[i][j]
(x, y, z, w) = (-1, -1, -1, -1)
if j < n - 1 and mat[i][j] + 1 == mat[i][j + 1]:
x = 1 + find_longest_from_a_cell(i, j + 1, mat, dp)
if j >... |
CODE = """
< 3 0 4
< 3 1 5
+ 4 5 6
< 3 6 7
< 7 6 8
"""
"""
< 9 0 13
< 12 1 14
+ 13 14 15
< 7 15 15
+ 2 15 2
"""
memory = [0] * 20
memory[0] = 7
memory[1] = 9
for line in CODE.strip().split("\n"):
cmd, i, j, k = line.split()
i = int(i)
j = int(j)
k = int(k)
if cmd == "+":
memory[k] = memo... | code = '\n< 3 0 4\n< 3 1 5\n+ 4 5 6\n< 3 6 7\n< 7 6 8\n'
'\n< 9 0 13 \n< 12 1 14\n+ 13 14 15\n< 7 15 15\n+ 2 15 2\n\n'
memory = [0] * 20
memory[0] = 7
memory[1] = 9
for line in CODE.strip().split('\n'):
(cmd, i, j, k) = line.split()
i = int(i)
j = int(j)
k = int(k)
if cmd == '+':
memory[k] =... |
"""
From Kapil Sharma's lecture 7-28-2020
Given an array of non-negative numbers and non-negative int k, find num of subarrays with their sum less than k.
Subarrays are contiguous elements.
Examples:
arr = [2,5,6], k= 10 -> Return 4.
Subarrays are [2], [5], [6], [2,5]
arr = [1,11,2,3,15], k=10 -> Return 4.
Subarrays... | """
From Kapil Sharma's lecture 7-28-2020
Given an array of non-negative numbers and non-negative int k, find num of subarrays with their sum less than k.
Subarrays are contiguous elements.
Examples:
arr = [2,5,6], k= 10 -> Return 4.
Subarrays are [2], [5], [6], [2,5]
arr = [1,11,2,3,15], k=10 -> Return 4.
Subarrays... |
"""feedshepherd
"""
def main():
"""Actual entrypoint for the package."""
print("No main implemented yet")
if __name__ == "__main__":
main()
| """feedshepherd
"""
def main():
"""Actual entrypoint for the package."""
print('No main implemented yet')
if __name__ == '__main__':
main() |
# June 2 20
def non_repeat_substring(str):
# init vars
window_start = 0
# char
d = {}
maxLen = 0
# window range [window_start, window_end]
# my name is yasin
# name can be window [left -- right]
for window_end in range(len(str)):
rightMostChar = str[window_end]
if rightMostChar not in d:
... | def non_repeat_substring(str):
window_start = 0
d = {}
max_len = 0
for window_end in range(len(str)):
right_most_char = str[window_end]
if rightMostChar not in d:
d[rightMostChar] = 0
d[rightMostChar] += 1
while d[rightMostChar] > 1:
left_most_char... |
# OpenWeatherMap API Key
weather_api_key = ""
# Google API Key
g_key = ""
| weather_api_key = ''
g_key = '' |
def _get_version(version_info):
"""
converts version info tuple to version string
example:
(0, 1, 2, 'beta', 3) returns '0.1.2-beta.3'
"""
vi = [str(e) for e in version_info]
suffix = ''
if len(vi) > 3:
suffix = '-' + '.'.join(vi[3:])
version = '.'.join(vi[:3]) + suffix
... | def _get_version(version_info):
"""
converts version info tuple to version string
example:
(0, 1, 2, 'beta', 3) returns '0.1.2-beta.3'
"""
vi = [str(e) for e in version_info]
suffix = ''
if len(vi) > 3:
suffix = '-' + '.'.join(vi[3:])
version = '.'.join(vi[:3]) + suffix
... |
class InstanceRules:
def __init__(self):
pass
def review_instance(self, instance):
pass
def check_for_new_instance(self):
pass | class Instancerules:
def __init__(self):
pass
def review_instance(self, instance):
pass
def check_for_new_instance(self):
pass |
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
l, r = 0, len(numbers) - 1
while l < r:
if numbers[l] + numbers[r] == target:
return [l+1, r+1]
elif numbers[l] + numbers[r] > target:
r -= 1
else:
... | class Solution:
def two_sum(self, numbers: List[int], target: int) -> List[int]:
(l, r) = (0, len(numbers) - 1)
while l < r:
if numbers[l] + numbers[r] == target:
return [l + 1, r + 1]
elif numbers[l] + numbers[r] > target:
r -= 1
... |
# Time: O(1) for a particular query
# Space: O(unique messages)
# Can also do O(10) space, that only stores data for last 10 seconds
# But the question suggests we can have multiple elements coming in at roughly
# the same time, "It is possible that several messages arrive roughly at the same time."
class Logger:
... | class Logger:
def __init__(self):
"""
Initialize your data structure here.
"""
self.imap = {}
def should_print_message(self, timestamp: int, message: str) -> bool:
"""
Returns true if the message should be printed in the given timestamp, otherwise returns false.... |
x = 300
def my_func():
x = 200
print(x)
my_func()
print(x)
# change global var value inside a function
def my_func_2():
global x
x = 500
my_func_2()
print(x)
| x = 300
def my_func():
x = 200
print(x)
my_func()
print(x)
def my_func_2():
global x
x = 500
my_func_2()
print(x) |
coordinates_E0E1E1 = ((128, 116),
(128, 118), (128, 119), (128, 120), (129, 114), (129, 121), (129, 122), (129, 124), (130, 116), (130, 120), (130, 123), (131, 113), (131, 117), (131, 118), (131, 119), (131, 123), (132, 112), (132, 116), (132, 123), (133, 111), (133, 114), (133, 124), (134, 110), (134, 112), (134, 12... | coordinates_e0_e1_e1 = ((128, 116), (128, 118), (128, 119), (128, 120), (129, 114), (129, 121), (129, 122), (129, 124), (130, 116), (130, 120), (130, 123), (131, 113), (131, 117), (131, 118), (131, 119), (131, 123), (132, 112), (132, 116), (132, 123), (133, 111), (133, 114), (133, 124), (134, 110), (134, 112), (134, 12... |
def simplify(number):
multiply="1"+"0"*(len(str(number))-1)
res=[]
for i in str(number):
if i!="0":
res.append(f"{i}*{multiply}") if multiply!="1" else res.append(f"{i}")
multiply=multiply[:-1]
return "+".join(res) | def simplify(number):
multiply = '1' + '0' * (len(str(number)) - 1)
res = []
for i in str(number):
if i != '0':
res.append(f'{i}*{multiply}') if multiply != '1' else res.append(f'{i}')
multiply = multiply[:-1]
return '+'.join(res) |
class NdComputations(object):
def __init__(self, lerp, nd_distance):
self.lerp = lerp
self.nd_distance = nd_distance | class Ndcomputations(object):
def __init__(self, lerp, nd_distance):
self.lerp = lerp
self.nd_distance = nd_distance |
'''
Statement
Given an integer greater than 9, print its last two digits.
Example input
1234
Example output
34
'''
print(int(input()) % 100)
| """
Statement
Given an integer greater than 9, print its last two digits.
Example input
1234
Example output
34
"""
print(int(input()) % 100) |
class A(object):
pass
print(A.__doc__)
# <ref> | class A(object):
pass
print(A.__doc__) |
"""Various utility functions."""
def damerau_levenshtein_distance(word_1: str, word_2: str) -> int:
"""Calculates the distance between two words."""
inf = len(word_1) + len(word_2)
table = [
[inf for _ in range(len(word_1) + 2)] for _ in range(len(word_2) + 2)
]
for i in range(1, len(word... | """Various utility functions."""
def damerau_levenshtein_distance(word_1: str, word_2: str) -> int:
"""Calculates the distance between two words."""
inf = len(word_1) + len(word_2)
table = [[inf for _ in range(len(word_1) + 2)] for _ in range(len(word_2) + 2)]
for i in range(1, len(word_1) + 2):
... |
#
# PySNMP MIB module ASCEND-MIBB52TEST-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBB52TEST-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:10:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration')
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constra... |
class Result:
def __init__(
self,
data,
content_type="application/json",
content_encoding="utf-8",
error=False,
cacheable=True,
):
self.data = data
self.content_type = content_type
self.content_encoding = content_encoding
self.error... | class Result:
def __init__(self, data, content_type='application/json', content_encoding='utf-8', error=False, cacheable=True):
self.data = data
self.content_type = content_type
self.content_encoding = content_encoding
self.error = error
self.cacheable = cacheable |
# @author: https://github.com/luis2ra from https://www.w3schools.com/python/python_comments.asp
'''
Python Comments
Comments can be used to explain Python code.
Comments can be used to make the code more readable.
Comments can be used to prevent execution when testing code.
Comments starts with a #, and Python will... | """
Python Comments
Comments can be used to explain Python code.
Comments can be used to make the code more readable.
Comments can be used to prevent execution when testing code.
Comments starts with a #, and Python will ignore them.
"""
print('Hello, World!') |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | project = 'Sphinx LuaLaTeX sample project'
copyright = '2019, Yoshi Yamaguchi'
author = 'Yoshi Yamaguchi'
release = '0.1.0'
extensions = ['sphinxcontrib.blockdiag', 'sphinxcontrib.seqdiag', 'sphinxcontrib.actdiag', 'sphinxcontrib.nwdiag', 'sphinxcontrib.rackdiag']
templates_path = ['_templates']
language = 'ja'
exclude... |
# Definition for an interval.
class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[Interval... | class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[Interval]
"""
parts ... |
# Link : https://leetcode.com/problems/invert-binary-tree/submissions/
# YT Link : https://www.youtube.com/watch?v=OnSn2XEQ4MY
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.rig... | class Solution(object):
def invert_tree(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
if not root:
return None
temp = root.left
root.left = root.right
root.right = temp
self.invertTree(root.left)
self.invertTre... |
CHAR_VECTOR = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
letters = [letter for letter in CHAR_VECTOR]
num_classes = len(letters) + 1
img_w, img_h = 200, 40
# Network parameters
batch_size = 32
val_batch_size = 32
max_text_len = 10
downsample_factor = 4 #depends on number of (2,2) max pooling layers used or factor by... | char_vector = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
letters = [letter for letter in CHAR_VECTOR]
num_classes = len(letters) + 1
(img_w, img_h) = (200, 40)
batch_size = 32
val_batch_size = 32
max_text_len = 10
downsample_factor = 4 |
#Barnaby Skinner
#2016/05/25
#Homework 2
#LISTS
#1) Make a list of the following numbers: 22, 90, 0, -10, 3, 22, and 48
#1) Display the number of elements in the list
random_numbers = [22, 90, 0, -10, 3, 22, 48]
print(len(random_numbers))
#2) Display the 4th element of this list.
print(random_numbers[3])
#3) Displa... | random_numbers = [22, 90, 0, -10, 3, 22, 48]
print(len(random_numbers))
print(random_numbers[3])
number2 = random_numbers[1]
number4 = random_numbers[3]
print(int(number2) + int(number4))
random_numbers_sorted = sorted(random_numbers)
print(random_numbers_sorted[-2])
print(random_numbers[-1])
for number in random_numbe... |
SYNCWORD = '0011111111111101'
FRAMESIZE = (64,80)
HEX_UBITS = True
DEF_FPS = 30
def ltc(bm, fps_25=False, ubits_hex=HEX_UBITS):
# Get bitmap
if isinstance(bm,int):
bm = bin(bm)[2:][::-1]
elif not isinstance(bm, str): return -1
bm += '0'*(FRAMESIZE[0] - len(bm))
if len(bm) > FRAMESIZE[0]: b... | syncword = '0011111111111101'
framesize = (64, 80)
hex_ubits = True
def_fps = 30
def ltc(bm, fps_25=False, ubits_hex=HEX_UBITS):
if isinstance(bm, int):
bm = bin(bm)[2:][::-1]
elif not isinstance(bm, str):
return -1
bm += '0' * (FRAMESIZE[0] - len(bm))
if len(bm) > FRAMESIZE[0]:
... |
__author__ = 'ganzhou'
def result(input1,input2):
return input1+input2+1;
| __author__ = 'ganzhou'
def result(input1, input2):
return input1 + input2 + 1 |
age = int(input())
if age<10:
print('child')
elif 10 < age <= 18:
print('teen')
else:
print('adult')
| age = int(input())
if age < 10:
print('child')
elif 10 < age <= 18:
print('teen')
else:
print('adult') |
#
# Copyright 2016 Import.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | class Extractordata(object):
pass
class Csvdata(ExtractorData):
def __init__(self, header=None, data=None):
self._header = header
self._data = data
def __getitem__(self, item):
return self._data[item]
def __len__(self):
return len(self._data)
class Logdata(ExtractorD... |
priority = {'*': 3, '?': 2, '+': 1}
def is_alphabet(c):
return c not in priority.keys() and c not in ['(', ')']
def add_concat_symbol(reg_exp):
'''
Replace 'and' operation with ? symbol
'''
new_reg_exp = ""
for current_char in reg_exp:
if(len(new_reg_exp)>0):
prev_char = ne... | priority = {'*': 3, '?': 2, '+': 1}
def is_alphabet(c):
return c not in priority.keys() and c not in ['(', ')']
def add_concat_symbol(reg_exp):
"""
Replace 'and' operation with ? symbol
"""
new_reg_exp = ''
for current_char in reg_exp:
if len(new_reg_exp) > 0:
prev_char = n... |
app_name = "pusta1"
prefix_url = "pusta1"
static_files = {
'js': {
'pusta1/js/': ['main.js', ]
},
'css': {
'pusta1/css/': ['main.css', ]
},
'html': {
'pusta1/html/': ['index.html', ]
}
}
permissions = {
"edit": "Editing actualy nothing.",
"sample1": "sample1longve... | app_name = 'pusta1'
prefix_url = 'pusta1'
static_files = {'js': {'pusta1/js/': ['main.js']}, 'css': {'pusta1/css/': ['main.css']}, 'html': {'pusta1/html/': ['index.html']}}
permissions = {'edit': 'Editing actualy nothing.', 'sample1': 'sample1longversion'} |
"""
Datos de entrada
lectura_anterior-->la-->float
lectura actual-->lt-->float
valor_kilovatio-->kw-->float
Datos de salida
valor_pagar-->vp-->float
"""
#Entradas
la=float(input("Digita la lectura anterior del medidor: "))
lt=float(input("Digite la lectura actual del medidor: "))
kw=float(input("Digite el valor por kil... | """
Datos de entrada
lectura_anterior-->la-->float
lectura actual-->lt-->float
valor_kilovatio-->kw-->float
Datos de salida
valor_pagar-->vp-->float
"""
la = float(input('Digita la lectura anterior del medidor: '))
lt = float(input('Digite la lectura actual del medidor: '))
kw = float(input('Digite el valor por kilovat... |
# returns roman numeral of number between 1 and 100
def to_numeral(num):
"int -> string"
ints = (100, 90, 50, 40, 10, 9, 5, 4, 1)
nums = ('C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I')
result = ""
for i in range(len(ints)):
count = int(num // ints[i])
result += nums[i] * count
... | def to_numeral(num):
"""int -> string"""
ints = (100, 90, 50, 40, 10, 9, 5, 4, 1)
nums = ('C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I')
result = ''
for i in range(len(ints)):
count = int(num // ints[i])
result += nums[i] * count
num -= ints[i] * count
return result
de... |
'''
Reciprocal cycles
Problem 26
A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Where 0.1(6) means 0.166666..., and ha... | """
Reciprocal cycles
Problem 26
A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Where 0.1(6) means 0.166666..., and ha... |
# 0x0 to 0xFFF (0-4095) accessible memory
# 4 switch-case per file
for a in range(6):
c = 0
for n in range(4**a):
with open(f'..\\data\\cpu\\functions\\memory\\write_memory\\{4**(6-a)}write_memory_{(4**(6-a))*n}-{((4**(6-a))*n)+((4**(6-a))-1)}.mcfunction', 'w') as f:
if a != 5:
... | for a in range(6):
c = 0
for n in range(4 ** a):
with open(f'..\\data\\cpu\\functions\\memory\\write_memory\\{4 ** (6 - a)}write_memory_{4 ** (6 - a) * n}-{4 ** (6 - a) * n + (4 ** (6 - a) - 1)}.mcfunction', 'w') as f:
if a != 5:
for i in range(4):
p = 4 *... |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
DIRECTIONS = {
'right': 'down',
'down': 'left',
'left': 'up',
'up': 'right'
}
def right(spiral: list, coordinates: dict) -> bool:
"""
Move spiral right
:param coordinates: star... | directions = {'right': 'down', 'down': 'left', 'left': 'up', 'up': 'right'}
def right(spiral: list, coordinates: dict) -> bool:
"""
Move spiral right
:param coordinates: starting point
:param spiral: NxN spiral 2D array
:return: boolean 'done'
"""
done = True
while coordinates['col'] < len(spiral[coordina... |
ANNOTATION_CORRESPONDENCES = {
"categorization": {
"coarse_grained_pai": {
0: "genuine",
1: "print",
2: "replay",
3: "mask",
5: "makeup",
6: "partial",
},
"fine_grained_pai": {
0: "genuine",
1: "p... | annotation_correspondences = {'categorization': {'coarse_grained_pai': {0: 'genuine', 1: 'print', 2: 'replay', 3: 'mask', 5: 'makeup', 6: 'partial'}, 'fine_grained_pai': {0: 'genuine', 1: 'print low quality', 2: 'print medium quality', 3: 'print high quality', 4: 'replay low quality', 5: 'replay medium quality', 6: 're... |
n = int(input(""))
i = 1
l = 0
while i <= n and l != -1:
a, b, c = map(int, input().split())
if a + b + c >= 2:
l += 1
i += 1
print(int(l))
| n = int(input(''))
i = 1
l = 0
while i <= n and l != -1:
(a, b, c) = map(int, input().split())
if a + b + c >= 2:
l += 1
i += 1
print(int(l)) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 21:18:26 2020
@author: ravi
"""
li = []
def kaprekar(n):
if n == 1:
li.append(n)
if n>=2 and n < 10:
q = n**2
q = str(q)
l = len(q)
if l>=2:
q = n**2
q = str(q)
l... | """
Created on Wed Mar 11 21:18:26 2020
@author: ravi
"""
li = []
def kaprekar(n):
if n == 1:
li.append(n)
if n >= 2 and n < 10:
q = n ** 2
q = str(q)
l = len(q)
if l >= 2:
q = n ** 2
q = str(q)
l = len(q)
x = l // 2
... |
api_key = 'PUT_YOUR_API_KEY_HERE'
api_secret = 'PUT_YOUR_API_SECRET_HERE'
client_id = 1
order_id = 'ORDER_NUMBER_HERE'
sample_id = '{}.SAMPLE_NUMBER_HERE'.format(order_id)
upload_file_path = 'path-to-file'
sample_coa_path = 'path-to-coa-file.pdf'
sample_image_path = 'path-to-image.png'
set_sample_cover = True
bad_te... | api_key = 'PUT_YOUR_API_KEY_HERE'
api_secret = 'PUT_YOUR_API_SECRET_HERE'
client_id = 1
order_id = 'ORDER_NUMBER_HERE'
sample_id = '{}.SAMPLE_NUMBER_HERE'.format(order_id)
upload_file_path = 'path-to-file'
sample_coa_path = 'path-to-coa-file.pdf'
sample_image_path = 'path-to-image.png'
set_sample_cover = True
bad_test_... |
class Solution:
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
return pow(x,n)
if __name__ == "__main__":
solution = Solution()
print(solution.myPow(6,7)) | class Solution:
def my_pow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
return pow(x, n)
if __name__ == '__main__':
solution = solution()
print(solution.myPow(6, 7)) |
# SPDX-FileCopyrightText: 2019-2021 REFITT Team
# SPDX-License-Identifier: Apache-2.0
"""Web integration tests."""
# NOTE: local web server should be running for tests
URL_BASE: str = 'http://localhost:5000'
| """Web integration tests."""
url_base: str = 'http://localhost:5000' |
def should_display_button(output):
return 'button' in output
def display_data_for_button(url):
content = {
'data': {
'text/html': '<a href="{}" target="_blank"><button class="button">Open UI</button></a>'.format(url)
},
'metadata': {}
}
return content
| def should_display_button(output):
return 'button' in output
def display_data_for_button(url):
content = {'data': {'text/html': '<a href="{}" target="_blank"><button class="button">Open UI</button></a>'.format(url)}, 'metadata': {}}
return content |
N = int(input())
matrix = []
for i in range(N):
matrix.append(list(map(int, input().split())))
for i in range(N):
for j in range(N):
if i < j :
matrix[i][j],matrix[j][i] = matrix[j][i],matrix[i][j]
for i in range(N):
for j in range(N//2):
matrix[i][j],mat... | n = int(input())
matrix = []
for i in range(N):
matrix.append(list(map(int, input().split())))
for i in range(N):
for j in range(N):
if i < j:
(matrix[i][j], matrix[j][i]) = (matrix[j][i], matrix[i][j])
for i in range(N):
for j in range(N // 2):
(matrix[i][j], matrix[i][N - 1 - j... |
def pre_save_title(instance, **kwargs):
''' Update article.languages
'''
if instance.article.languages:
languages = instance.article.languages.split(',')
else:
languages = []
if instance.language not in languages:
languages.append(instance.language)
instance.article.l... | def pre_save_title(instance, **kwargs):
""" Update article.languages
"""
if instance.article.languages:
languages = instance.article.languages.split(',')
else:
languages = []
if instance.language not in languages:
languages.append(instance.language)
instance.article.l... |
# -*- coding:utf-8 -*-
# --
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
# TODO: make it a board extension
class BoardCardFilter(object):
d... | class Boardcardfilter(object):
def __init__(self, card_schema, board_id, exclude_archived, search_engine_service):
self.card_schema = card_schema
self.board_id = board_id
self._exclude_archived = exclude_archived
self.search_engine = search_engine_service
self.last_search = ... |
"""
Playing with digits
http://www.codewars.com/kata/playing-with-digits/train/python
"""
def dig_pow(n, p):
num = str(n)
total = sum([int(num[i]) ** (p + i) for i in range(len(num))])
return total / n if (total % n) == 0 else -1
| """
Playing with digits
http://www.codewars.com/kata/playing-with-digits/train/python
"""
def dig_pow(n, p):
num = str(n)
total = sum([int(num[i]) ** (p + i) for i in range(len(num))])
return total / n if total % n == 0 else -1 |
def sweet(x):
return (x*2)**2
for n in range(5):
print(sweet(n))
print(list(map(sweet, range(5))))
| def sweet(x):
return (x * 2) ** 2
for n in range(5):
print(sweet(n))
print(list(map(sweet, range(5)))) |
class Node(object):
def __init__(self, value):
self.value = value
self.next_node = None
def reverse_linked_list(head):
current = head
prev_node = None
while current:
next_node = current.next_node
current.next_node = prev_node
prev_node = current
curr... | class Node(object):
def __init__(self, value):
self.value = value
self.next_node = None
def reverse_linked_list(head):
current = head
prev_node = None
while current:
next_node = current.next_node
current.next_node = prev_node
prev_node = current
current ... |
'''
This module provides validators that are shared across all the sub-packages of the
clubadmin package in order to reduce the duplication of code.
'''
def PhoneValidator(value, *args, **kwds):
pass
def MobileValidator(value, *args, **kwds):
pass
def EmailValidator(value, *args, **kwds):
pass
def LifeValidat... | """
This module provides validators that are shared across all the sub-packages of the
clubadmin package in order to reduce the duplication of code.
"""
def phone_validator(value, *args, **kwds):
pass
def mobile_validator(value, *args, **kwds):
pass
def email_validator(value, *args, **kwds):
pass
def li... |
#!/usr/bin/env python3
"""
Exercise 18: Final Line
Display the final (last) line of a file.
"""
def get_final_line(filename):
f = open(filename)
line = f.readlines()[-1][:-1]
f.close()
return line
if __name__ == '__main__':
print(get_final_line('rev_eli.txt'))
| """
Exercise 18: Final Line
Display the final (last) line of a file.
"""
def get_final_line(filename):
f = open(filename)
line = f.readlines()[-1][:-1]
f.close()
return line
if __name__ == '__main__':
print(get_final_line('rev_eli.txt')) |
# Art belongs to trinket.io.
# Everything else belongs to me
art = (
"""
------
| |
|
|
|
|
|
|
----------
""",
"""
------
| |
| 0
|
|
|
|
|
----------
""",
"""
------
| |
| 0
| +
|... | art = ('\n ------\n | |\n |\n |\n |\n |\n |\n |\n ----------\n ', '\n ------\n | |\n | 0\n |\n |\n |\n |\n |\n ----------\n ', '\n ------\n | |\n | 0\n | +\n |\n |\n |\n |\n ----------\n ', '\n -----... |
#!/usr/bin/env python3
# coding: utf-8
version = 'v1'
| version = 'v1' |
class Err(Exception):
def __init__(self, msg: str):
super(Exception, self).__init__(msg)
def f(x: int) -> int:
if x > 0:
return 10
else:
raise Err("Expected positive number.")
def g() -> int:
raise Err("Error always raised")
def h(x: int) -> int:
if x < 0:
raise... | class Err(Exception):
def __init__(self, msg: str):
super(Exception, self).__init__(msg)
def f(x: int) -> int:
if x > 0:
return 10
else:
raise err('Expected positive number.')
def g() -> int:
raise err('Error always raised')
def h(x: int) -> int:
if x < 0:
raise e... |
# -*- coding: utf-8 -*-
def water_heating_requirement (
assumed_occupancy,
V_dm_table_1c,
days_in_month,
T_table_1d,
water_storage_loss_manufacturer,
temperature_factor_table_2b,
storage_volume_litres,
hot_water_storage_loss_table_2,
volume_facto... | def water_heating_requirement(assumed_occupancy, V_dm_table_1c, days_in_month, T_table_1d, water_storage_loss_manufacturer, temperature_factor_table_2b, storage_volume_litres, hot_water_storage_loss_table_2, volume_factor_table_2a, Vs_appendix_G3, solar_storage_WWHRS_factor, primary_circuit_loss_table_3, combi_loss_tab... |
# 1.0
# The following is appended by build.cmd -- do not edit!!
repo = "https://dlp_cm/val/pico/dpp2607_redist"
revision = "ff6ca9ee71cd"
version = "1.0.19"
| repo = 'https://dlp_cm/val/pico/dpp2607_redist'
revision = 'ff6ca9ee71cd'
version = '1.0.19' |
##
# @filename : imagedata.py
# @brief : data file for epd demo
#
# Copyright (C) Waveshare July 26 2017
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without re... | image_black = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, ... |
#
# PySNMP MIB module CISCO-STACK-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-STACK-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:12:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_range_constraint, constraints_union, value_size_constraint) ... |
arquivo = open("exerciso simulador")
print("arquivo")
| arquivo = open('exerciso simulador')
print('arquivo') |
def primo(n):
if n==2:return True
if n<2:return False
if n%2==0:return False
k=3
while k*k<=n:
if n%k==0:return False
k+=2
return True
for _ in range(int(input())):
n=int(input())
print(f"{n} eh primo") if primo(n) else print(f"{n} nao eh primo")
| def primo(n):
if n == 2:
return True
if n < 2:
return False
if n % 2 == 0:
return False
k = 3
while k * k <= n:
if n % k == 0:
return False
k += 2
return True
for _ in range(int(input())):
n = int(input())
print(f'{n} eh primo') if prim... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Cisco Systems
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r"""
---
module: aci_settings
short_description: Resource module for Aci Settings
description:
- Manage operation update of the res... | documentation = "\n---\nmodule: aci_settings\nshort_description: Resource module for Aci Settings\ndescription:\n- Manage operation update of the resource Aci Settings.\nversion_added: '1.0.0'\nextends_documentation_fragment:\n - cisco.ise.module\nauthor: Rafael Campos (@racampos)\noptions:\n aci50:\n description:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.