content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
top = left = 0
right = bottom = len(matrix) - 1
while top < bottom:
for i in range(bottom - top):
temp = mat... | class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
top = left = 0
right = bottom = len(matrix) - 1
while top < bottom:
for i in range(bottom - top):
temp = mat... |
someone = input("Enter a famous name: ").strip().title()
place = input("Enter a place: ").strip().lower()
weekday = ""
while weekday not in ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]:
weekday = input("Enter a weekday: ").strip().lower()
adjective = input("Enter an adjective: ")... | someone = input('Enter a famous name: ').strip().title()
place = input('Enter a place: ').strip().lower()
weekday = ''
while weekday not in ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']:
weekday = input('Enter a weekday: ').strip().lower()
adjective = input('Enter an adjective: ').s... |
# Question: https://projecteuler.net/problem=73
# F(n) -> length of Farey Sequence (https://mathworld.wolfram.com/FareySequence.html)
N = 12000
# https://en.wikipedia.org/wiki/Farey_sequence#Next_term
# From 0/1 to end_n/end_d
def farey_sequence_length(end_n, end_d, n):
a, b, c, d = 0, 1, 1, n
ans = 1
w... | n = 12000
def farey_sequence_length(end_n, end_d, n):
(a, b, c, d) = (0, 1, 1, n)
ans = 1
while not (a == end_n and b == end_d):
x = (n + b) // d
(a, b, c, d) = (c, d, x * c - a, x * d - b)
ans = ans + 1
return ans
print(farey_sequence_length(1, 2, 12000) - farey_sequence_length... |
#
# PySNMP MIB module RDN-CMTS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RDN-CMTS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:46:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) ... |
# Nokia messages
nokia_update = [
(
"openconfig-interfaces:interfaces/interface[name=1/1/c1/2]",
{
"config": {
"name": "1/1/c1/2",
"enabled": True,
"type": "ethernetCsmacd",
"description": "Test Interface @ pygnmi"
... | nokia_update = [('openconfig-interfaces:interfaces/interface[name=1/1/c1/2]', {'config': {'name': '1/1/c1/2', 'enabled': True, 'type': 'ethernetCsmacd', 'description': 'Test Interface @ pygnmi'}, 'subinterfaces': {'subinterface': [{'index': 0, 'config': {'index': 0, 'enabled': True}, 'ipv4': {'addresses': {'address': [... |
class _Snake:
def __init__(self, color):
self.head = ()
self.body = []
self.color = color
self.last_op = 'w'
self.score = 0
self.operation = {
'w': lambda x, y: (x - 1, y),
'a': lambda x, y: (x, y - 1),
's': lambda x, y: (x + 1, y)... | class _Snake:
def __init__(self, color):
self.head = ()
self.body = []
self.color = color
self.last_op = 'w'
self.score = 0
self.operation = {'w': lambda x, y: (x - 1, y), 'a': lambda x, y: (x, y - 1), 's': lambda x, y: (x + 1, y), 'd': lambda x, y: (x, y + 1)}
... |
c = 1
while True:
n = int(input())
if n == -1: break
print('Experiment {}: {} full cycle(s)'.format(c, n // 2))
c += 1
| c = 1
while True:
n = int(input())
if n == -1:
break
print('Experiment {}: {} full cycle(s)'.format(c, n // 2))
c += 1 |
# Write a function that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A.
# SIMPLER APPROACH: 1 is the min answer we return. Iterate through the list and if we we see the val of min then increment min.
# O(n)t | O(1)s
def smallestPositiveInteger(A):
... | def smallest_positive_integer(A):
A.sort()
min = 1
for val in A:
if val == min:
min += 1
return min |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def countNodes(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root is N... | class Solution(object):
def count_nodes(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root is None:
return 0
if not root.left and (not root.right):
return 1
elif not root.left and root.right:
return 2
eli... |
for i in range(0,10):
for j in range(10, -1, -1): # we count backwards to -1 so we include 0
if(i == j):
print("i == j, so we break")
break
else:
print("i = %d, j= %d" % (i, j))
| for i in range(0, 10):
for j in range(10, -1, -1):
if i == j:
print('i == j, so we break')
break
else:
print('i = %d, j= %d' % (i, j)) |
temp = 0
respuesta = ''
def escribirArchivo(var):
archivo = open('temp.dat', 'a')
archivo.write(var+"\n")
def cerrarArchivo():
archivo = open('temp.dat', 'a')
archivo.close()
b = True
try:
while b == True:
temp = input(" Ingresa tu temperatura: ")
if(float(temp) > 37.5):
... | temp = 0
respuesta = ''
def escribir_archivo(var):
archivo = open('temp.dat', 'a')
archivo.write(var + '\n')
def cerrar_archivo():
archivo = open('temp.dat', 'a')
archivo.close()
b = True
try:
while b == True:
temp = input(' Ingresa tu temperatura: ')
if float(temp) > 37.5:
... |
name = "TensorFlow"
description = None
args_and_kwargs = (
(("--run-eagerly",), {
"help":"Running tensorflow in eager mode may be required for high memory models.",
"action":'store_true',
"default":False,
}),
(("--disable-gpu",), {
"help":"Disable GPU for high memory mode... | name = 'TensorFlow'
description = None
args_and_kwargs = ((('--run-eagerly',), {'help': 'Running tensorflow in eager mode may be required for high memory models.', 'action': 'store_true', 'default': False}), (('--disable-gpu',), {'help': 'Disable GPU for high memory models.', 'action': 'store_true', 'default': False}),... |
#encoding:utf-8
subreddit = 'behindthegifs'
t_channel = '@r_behindthegifs'
def send_post(submission, r2t):
return r2t.send_simple(submission,
min_upvotes_limit=100,
text=False,
gif=False,
img=False,
album=True,
other=False
) | subreddit = 'behindthegifs'
t_channel = '@r_behindthegifs'
def send_post(submission, r2t):
return r2t.send_simple(submission, min_upvotes_limit=100, text=False, gif=False, img=False, album=True, other=False) |
class DPDSettingsObject(object):
DPD_API_USERNAME = None
DPD_API_PASSWORD = None
DPD_API_FID = None
DPD_API_SANDBOX_USERNAME = None
DPD_API_SANDBOX_PASSWORD = None
DPD_API_SANDBOX_FID = None
| class Dpdsettingsobject(object):
dpd_api_username = None
dpd_api_password = None
dpd_api_fid = None
dpd_api_sandbox_username = None
dpd_api_sandbox_password = None
dpd_api_sandbox_fid = None |
class recipe_defs:
def __init__(self):
self.tags = ["Vegetarian",
"Vegan",
"Burger",
"Baby",
"High protein",
"Gluten free",
"Meat",
"Fish",
"Cold",
... | class Recipe_Defs:
def __init__(self):
self.tags = ['Vegetarian', 'Vegan', 'Burger', 'Baby', 'High protein', 'Gluten free', 'Meat', 'Fish', 'Cold', 'Hot', 'Take away']
self.types = ['Breakfast', 'Main', 'Dessert', 'Fika', 'Starter', 'Juice', 'Smoothie', 'Soup']
class Ingredient_Def:
def __ini... |
# scored.py
# Repeatedly read test scores (from 0 to 100), until the user
# enter -1 to finish. The input part of the program will ensure
# that the numbers are in the correct range.
# For each score, report the corresponding grade:
# 90-100 = A, 80-89 = B, 70-79 = C, 60-69 = D, < 60 = F
# When you have all the scores,... | def display_grade(score):
if score >= 90:
print('Congratulations! That is an A.')
elif score >= 80:
print('Good job. That is a B.')
elif score >= 70:
print('You are passing with a C.')
elif score >= 60:
print('Please study more. You have a D.')
else:
print('So... |
def is_possible(m, n, times):
re = 0
for t in times:
re += m // t
if re >= n:
return True
return False
def solution(n, times):
answer = 0
times.sort()
l=0; r=1_000_000_000_000_000; m=0
while l <= r:
m = (l+r)//2
if is_possible(m, n, times):
... | def is_possible(m, n, times):
re = 0
for t in times:
re += m // t
if re >= n:
return True
return False
def solution(n, times):
answer = 0
times.sort()
l = 0
r = 1000000000000000
m = 0
while l <= r:
m = (l + r) // 2
if is_possible(m, n, tim... |
list1=[1,2,6,12]
iteration=0
print ("iteration", iteration, list1)
for i in range(len(list1)):
for j in range(len(list1)-1-i):
iteration=iteration+1
if list1[j]> list1[j+1]:
temp=list1[j]
list1[j] = list1[j+1]
list1[j+1]=temp # Swap!
print ("iteration", ... | list1 = [1, 2, 6, 12]
iteration = 0
print('iteration', iteration, list1)
for i in range(len(list1)):
for j in range(len(list1) - 1 - i):
iteration = iteration + 1
if list1[j] > list1[j + 1]:
temp = list1[j]
list1[j] = list1[j + 1]
list1[j + 1] = temp
print... |
class TrackGroupStyle:
def __init__(self, distance=5, internal_offset=2, x_multiplier=1.05, show_label=True,
label_fontsize=16, label_fontweight="normal",
label_fontstyle='normal',
label_hor_aln='right', label_vert_aln='center',
label_y_shift=0,... | class Trackgroupstyle:
def __init__(self, distance=5, internal_offset=2, x_multiplier=1.05, show_label=True, label_fontsize=16, label_fontweight='normal', label_fontstyle='normal', label_hor_aln='right', label_vert_aln='center', label_y_shift=0, label_x_shift=-15):
self.distance = distance
self.int... |
def new_if(predicate, then, otherwise):
if predicate:
then
else:
otherwise
def p(x):
new_if(x > 5, print(x), p(x+1))
p(1) # what happens here? | def new_if(predicate, then, otherwise):
if predicate:
then
else:
otherwise
def p(x):
new_if(x > 5, print(x), p(x + 1))
p(1) |
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
#################
# List indexing #
#################
# Classical position indexing
i = 0
while i < len(a):
print(a[i])
i += 1
# Negative indices
print(a[-1])
print(a[-2])
print(a[-3])
################
# List slicing #
################
# Elements between indices 3 and 7
p... | a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
i = 0
while i < len(a):
print(a[i])
i += 1
print(a[-1])
print(a[-2])
print(a[-3])
print(a[3:7])
print(a[5:])
print(a[:8])
l = [x * x for x in range(1, 10)]
print(l)
l = [x * x for x in range(1, 10) if x * x % 2 == 0]
print(l)
l = [x for x in a if x > 2 and x < 7]
print(l)
l = zip... |
'''
Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note:
The solution set must not contain duplicate quadruplets.
Example:
Given array nums = [1, 0, -1, 0, -2... | """
Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note:
The solution set must not contain duplicate quadruplets.
Example:
Given array nums = [1, 0, -1, 0, -2... |
"""
@Author :Furqan Khan
@Email :furqankhan08@gmail.com
@Date :1/3/2017
Objective :
The purpose of this file /module /Class is to map to serve teh Rest request
Depending upon the requested url the views module will fetch the data from the backend
python files and would transform the data to json format ,and would... | """
@Author :Furqan Khan
@Email :furqankhan08@gmail.com
@Date :1/3/2017
Objective :
The purpose of this file /module /Class is to map to serve teh Rest request
Depending upon the requested url the views module will fetch the data from the backend
python files and would transform the data to json format ,and would... |
#SPDX-License-Identifier: MIT
"""
Metrics that provide data about platform & their associated activity
"""
| """
Metrics that provide data about platform & their associated activity
""" |
#
# PySNMP MIB module Juniper-HTTP-Profile-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-HTTP-Profile-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:02:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
# create_trusted_globals_dict takes in a module name [module_name], a trusted values dictionary [trusted_values_dict],
# and a boolean [first_time].
# Called by run_test
def create_trusted_globals_dict(self):
# If module is being run for the first time, a trusted_values_dict entry doesn't exist; return an empt... | def create_trusted_globals_dict(self):
if self.first_time:
return {}
else:
return self.trusted_values_dict[self.trusted_values_dict_name] |
class Truckloads:
def numTrucks(self, numCrates, loadSize):
if numCrates <= loadSize:
return 1
return self.numTrucks(numCrates/2, loadSize) + self.numTrucks((numCrates+1)/2, loadSize)
| class Truckloads:
def num_trucks(self, numCrates, loadSize):
if numCrates <= loadSize:
return 1
return self.numTrucks(numCrates / 2, loadSize) + self.numTrucks((numCrates + 1) / 2, loadSize) |
#!/usr/bin/env python3
def proc(x):
print(x)
x = proc("testing 1, 2, 3...")
print("below is x: ")
print(x)
print("above is x: ")
| def proc(x):
print(x)
x = proc('testing 1, 2, 3...')
print('below is x: ')
print(x)
print('above is x: ') |
GET_POWER_FLOW_REALTIME_DATA = {
'timestamp': {
'value': '2019-01-10T23:33:12+01:00'
},
'status': {
'Code': 0,
'Reason': '',
'UserMessage': ''
},
'energy_day': {
'value': 0,
'unit': 'Wh'
},
'energy_total': {
'value': 26213502,
'... | get_power_flow_realtime_data = {'timestamp': {'value': '2019-01-10T23:33:12+01:00'}, 'status': {'Code': 0, 'Reason': '', 'UserMessage': ''}, 'energy_day': {'value': 0, 'unit': 'Wh'}, 'energy_total': {'value': 26213502, 'unit': 'Wh'}, 'energy_year': {'value': 12400.100586, 'unit': 'Wh'}, 'meter_location': {'value': 'loa... |
"""
Problem 4.
The greatest common divisor of two positive integers is the largest
integer that divides each of them without remainder. For example:
gcd(2, 12) = 2
gcd(6, 12) = 6
gcd(9, 12) = 3
gcd(17, 12) = 1
Write an iterative function, gcdIter(a, b), that implements this
idea. One easy way to do this i... | """
Problem 4.
The greatest common divisor of two positive integers is the largest
integer that divides each of them without remainder. For example:
gcd(2, 12) = 2
gcd(6, 12) = 6
gcd(9, 12) = 3
gcd(17, 12) = 1
Write an iterative function, gcdIter(a, b), that implements this
idea. One easy way to do this i... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Python implementation of BlastLine, an alternative Cython implementation is
available in .cblast.BlastLine, which may be up to 2x faster
"""
class BlastLine(object):
__slots__ = ('query', 'subject', 'pctid', 'hitlen', 'nmismatch', 'ngaps', \
'qsta... | """
Python implementation of BlastLine, an alternative Cython implementation is
available in .cblast.BlastLine, which may be up to 2x faster
"""
class Blastline(object):
__slots__ = ('query', 'subject', 'pctid', 'hitlen', 'nmismatch', 'ngaps', 'qstart', 'qstop', 'sstart', 'sstop', 'evalue', 'score', 'qseqid', 'sse... |
#
# PySNMP MIB module Wellfleet-CONSOLE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-CONSOLE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:39:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ... |
##Q1
def sumOfDigits(String):
sumNumber=0
for i in range(0,len(String)):
if String[i].isdigit():
sumNumber=sumNumber+int(String[i])
return sumNumber
##Q2
def smallerThanN(intList,integer):
newList=[]
for intInList in intList:
if intInList<integer:
newList.... | def sum_of_digits(String):
sum_number = 0
for i in range(0, len(String)):
if String[i].isdigit():
sum_number = sumNumber + int(String[i])
return sumNumber
def smaller_than_n(intList, integer):
new_list = []
for int_in_list in intList:
if intInList < integer:
... |
'''
Calculating Function
'''
n = int(input())
result = 0
if n % 2 == 0:
result = n // 2
else:
result = n // 2 - n
print(result) | """
Calculating Function
"""
n = int(input())
result = 0
if n % 2 == 0:
result = n // 2
else:
result = n // 2 - n
print(result) |
## this file is for common methods that are not necessarily Pokemon related
## for now, i'll just call this common or convenience functions.
## they might be added TO dnio later, if they're useful enough
# import pokefunctions as pkf
def make_nicknames_dictionary(input_names, nickname_as_key=True, verbose=False):
'''... | def make_nicknames_dictionary(input_names, nickname_as_key=True, verbose=False):
"""
This makes nicknames that are absolute and WILL refer to one specific name. This is not a FCFS system for nicknames.
i.e.,
CORRECT: ["Abra","Absol"] -> ["abr","abs"]
INCORRECT: ["Abra","Absol"] -> ["a","ab"]
"""
names =... |
Motivations = [ # Acolyte
'I ran away from home at an early age and found refuge in a temple.',
'My family gave me to a temple, since they were unable or unwilling to care for me.',
'I grew up in a household with strong religious convictions. Entering the service of one or more gods seemed natural.',
'An impassioned se... | motivations = ['I ran away from home at an early age and found refuge in a temple.', 'My family gave me to a temple, since they were unable or unwilling to care for me.', 'I grew up in a household with strong religious convictions. Entering the service of one or more gods seemed natural.', 'An impassioned sermon struck... |
"""Stack implementation."""
class Stack():
"""Stack class."""
def __init__(self):
"""
:type None
:rtype None
"""
self.items = []
def push(self, item):
"""
Push item onto the stack.
:type item to add to the top of the stack.
:rtype None
"""
self.items.append(ite... | """Stack implementation."""
class Stack:
"""Stack class."""
def __init__(self):
"""
:type None
:rtype None
"""
self.items = []
def push(self, item):
"""
Push item onto the stack.
:type item to add to the top of the stack.
:rtype None
"""
self.it... |
# coding: utf8
# Copyright 2017 Vincent Jacques <vincent@vincent-jacques.net>
project = "sphinxcontrib-ocaml"
author = '<a href="http://vincent-jacques.net/">Vincent Jacques</a>'
copyright = ('2017 {} <script>var jacquev6_ribbon_github="{}"</script>'.format(author, project) +
'<script src="https://jacque... | project = 'sphinxcontrib-ocaml'
author = '<a href="http://vincent-jacques.net/">Vincent Jacques</a>'
copyright = '2017 {} <script>var jacquev6_ribbon_github="{}"</script>'.format(author, project) + '<script src="https://jacquev6.github.io/ribbon.js"></script>'
version = '0.3.0'
release = version
master_doc = 'index'
ex... |
def add(x, *args):
total = x
for i in args:
total += i
print(f'{x=} + {args=} = {total}')
add(1, 2, 3)
add(1, 2)
add(1, 2, 3, 4, 5, 6, 7)
add(1)
| def add(x, *args):
total = x
for i in args:
total += i
print(f'x={x!r} + args={args!r} = {total}')
add(1, 2, 3)
add(1, 2)
add(1, 2, 3, 4, 5, 6, 7)
add(1) |
class orphan_external_exception(Exception):
def __init__(self, args=None):
if args:
self.args = (args,)
else:
self.args = ("Wow I have been imported",)
self.external_demo_attr = "Now imported"
| class Orphan_External_Exception(Exception):
def __init__(self, args=None):
if args:
self.args = (args,)
else:
self.args = ('Wow I have been imported',)
self.external_demo_attr = 'Now imported' |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def increment_string(string: str) -> str:
"""
A function which increments a string, to create a new string:
1. If the string already ends with a number, the number should be incremented b... | def increment_string(string: str) -> str:
"""
A function which increments a string, to create a new string:
1. If the string already ends with a number, the number should be incremented by 1.
2. If the string does not end with a number. the number 1 should be appended to the new string.
:param stri... |
__title__ = 'imgur-cli'
__author__ = 'Usman Ehtesham Gul'
__email__ = 'uehtesham90@gmail.com'
__license__ = 'MIT'
__version__ = '0.0.1'
__url__ = 'https://github.com/ueg1990/imgur-cli.git'
| __title__ = 'imgur-cli'
__author__ = 'Usman Ehtesham Gul'
__email__ = 'uehtesham90@gmail.com'
__license__ = 'MIT'
__version__ = '0.0.1'
__url__ = 'https://github.com/ueg1990/imgur-cli.git' |
class Solution:
# @param candidates, a list of integers
# @param target, integer
# @return a list of lists of integers
def combinationSum(self, candidates, target):
self.results = []
candidates.sort()
self.combination(candidates, target, 0, [])
return self.results
... | class Solution:
def combination_sum(self, candidates, target):
self.results = []
candidates.sort()
self.combination(candidates, target, 0, [])
return self.results
def combination(self, candidates, target, start, result):
if target == 0:
self.results.append(r... |
a = True
b = False
print('AND Logic:')
print('a and a =', a and a)
print('a and b =', a and b)
print('b and b =', b and b)
print('b and a =', b and a)
print('\nOR Logic:')
print('a or a =', a or a)
print('a or b =', a or b)
print('b or b =', b or b)
print('\nNOT Logic:')
print('a =' , a , '\tnot a =' , not a )
print... | a = True
b = False
print('AND Logic:')
print('a and a =', a and a)
print('a and b =', a and b)
print('b and b =', b and b)
print('b and a =', b and a)
print('\nOR Logic:')
print('a or a =', a or a)
print('a or b =', a or b)
print('b or b =', b or b)
print('\nNOT Logic:')
print('a =', a, '\tnot a =', not a)
print('b =',... |
'''https://leetcode.com/problems/non-overlapping-intervals/
435. Non-overlapping Intervals
Medium
2867
79
Add to List
Share
Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
Exam... | """https://leetcode.com/problems/non-overlapping-intervals/
435. Non-overlapping Intervals
Medium
2867
79
Add to List
Share
Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
Exam... |
# LANGUAGE: Python 3
# AUTHOR: Luiz Devitte
# GitHub: https://github.com/LuizDevitte
def greetings(name):
print('\n')
print('Hello, World!')
print('And Hello, {}!'.format(name))
print('\n')
return 0
def main():
name = input('Hey, who are you? ')
greetings(name)
if __name__=='__main__':
... | def greetings(name):
print('\n')
print('Hello, World!')
print('And Hello, {}!'.format(name))
print('\n')
return 0
def main():
name = input('Hey, who are you? ')
greetings(name)
if __name__ == '__main__':
main() |
# ---------------------------------------------------------------------------
# Copyright 2018 The Open Source Electronic Health Record Agent
#
# 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
#... | footer = '\n<center>\n<br/>\n<br/>\n<br/>\n<br/>\n<div id="footer">©2011-2018 Open Source Electronic Health Record Alliance<br />This work is licensed under a <a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a> <a href="https://creativecommons.org/licen... |
#!/usr/bin/env python
MAX_LOG_LENGTH = 1000
MESSAGE_MAX_LENGTH = 2000
class ScriptLogger:
def __init__(self, db):
self.db = db
def save(self, user_name, path, logs):
# Don't save empty logs
if len(logs) == 0:
return
# If logs are longer than the ... | max_log_length = 1000
message_max_length = 2000
class Scriptlogger:
def __init__(self, db):
self.db = db
def save(self, user_name, path, logs):
if len(logs) == 0:
return
if len(logs) > MAX_LOG_LENGTH:
logs = logs[-MAX_LOG_LENGTH:]
all_messages = self.tr... |
#
# PySNMP MIB module Fore-DSX1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-DSX1-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:03:21 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint) ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 18:30:07 2021
@author: SethHarden
Given an array nums of distinct integers,
return all the possible permutations.
You can return the answer in any order.
"""
nums = [1,5,4,3]
list = ['a','b','c']
list.append('s')
popped = list.pop()
courses_2 = ['x', 'z']
list.i... | """
Created on Mon Jan 18 18:30:07 2021
@author: SethHarden
Given an array nums of distinct integers,
return all the possible permutations.
You can return the answer in any order.
"""
nums = [1, 5, 4, 3]
list = ['a', 'b', 'c']
list.append('s')
popped = list.pop()
courses_2 = ['x', 'z']
list.insert(0, courses_2)
li... |
class BattleEventsListener:
def on_battle_begins(self):
pass
def on_battle_ends(self):
pass
def on_reflected_attack(self, attack_obj):
pass
def on_unit_damaged(self, attack_obj):
pass
def on_unit_killed(self, attack_obj):
pass
def on_s... | class Battleeventslistener:
def on_battle_begins(self):
pass
def on_battle_ends(self):
pass
def on_reflected_attack(self, attack_obj):
pass
def on_unit_damaged(self, attack_obj):
pass
def on_unit_killed(self, attack_obj):
pass
def on_squad_killed(sel... |
# -*- coding: utf-8 -*-
class GameConfig:
# Frame dimensions
width = 30
height = 15
# Start the game at this speed
initial_speed = 3.0
# For every point scored, increase game speed by this amount
speed_increase_factor = 0.15
# Maximum game speed.
max_speed = 30
# Enforce co... | class Gameconfig:
width = 30
height = 15
initial_speed = 3.0
speed_increase_factor = 0.15
max_speed = 30
solid_walls = True
initial_food_count = 1
max_food_count = 5
food_increase_interval = 10 |
# fibonaccisequence2.py
# This program sums numbers in a Fibonacci sequence to a point specified by the
# user.
"""The Fibonacci sequence starts 1, 1, 2, 3, 5, 8,... Each number in the
sequence (after the first two) is the sum of the previous two. Write a program
that computes and outputs the nth Fibonacci number, whe... | """The Fibonacci sequence starts 1, 1, 2, 3, 5, 8,... Each number in the
sequence (after the first two) is the sum of the previous two. Write a program
that computes and outputs the nth Fibonacci number, where n is a value entered
by the user."""
def get_input():
while True:
try:
n = int(input... |
print("%s" % 1.0)
print("%r" % 1.0)
print("%d" % 1.0)
print("%i" % 1.0)
print("%u" % 1.0)
# these 3 have different behaviour in Python 3.x versions
# uPy raises a TypeError, following Python 3.5 (earlier versions don't)
#print("%x" % 18.0)
#print("%o" % 18.0)
#print("%X" % 18.0)
print("%e" % 1.23456)
print("%E" % 1.... | print('%s' % 1.0)
print('%r' % 1.0)
print('%d' % 1.0)
print('%i' % 1.0)
print('%u' % 1.0)
print('%e' % 1.23456)
print('%E' % 1.23456)
print('%f' % 1.23456)
print('%F' % 1.23456)
print('%g' % 1.23456)
print('%G' % 1.23456)
print('%06e' % float('inf'))
print('%06e' % float('-inf'))
print('%06e' % float('nan'))
print('%02... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def binaryTreePaths(self, root):
"""
:type root: TreeNode
:rtype: List[str]
"""
result = []
... | class Solution:
def binary_tree_paths(self, root):
"""
:type root: TreeNode
:rtype: List[str]
"""
result = []
if not root:
return result
if not root.left and (not root.right):
result.append(str(root.val))
return result
... |
N,K=map(int,input().split())
S=[int(input()) for i in range(N)]
length=left=0
mul=1
if 0 in S:
length=N
else:
for right in range(N):
mul*=S[right]
if mul<=K:
length=max(length,right-left+1)
else:
mul//=S[left]
left+=1
print(length) | (n, k) = map(int, input().split())
s = [int(input()) for i in range(N)]
length = left = 0
mul = 1
if 0 in S:
length = N
else:
for right in range(N):
mul *= S[right]
if mul <= K:
length = max(length, right - left + 1)
else:
mul //= S[left]
left += 1
pri... |
class SERPException(Exception):
pass
class ItemNotFoundException(SERPException):
pass
| class Serpexception(Exception):
pass
class Itemnotfoundexception(SERPException):
pass |
#! /usr/bin/python3
def parts(arr):
arr.append(0)
arr.append(max(arr)+3)
arr.sort()
_type1 = 0
_type2 = 0
for _x in range(0, len(arr)-1):
_difference = arr[_x+1] - arr[_x]
if _difference == 1:
_type1 += 1
elif _difference == 3:
_type2 += 1
_... | def parts(arr):
arr.append(0)
arr.append(max(arr) + 3)
arr.sort()
_type1 = 0
_type2 = 0
for _x in range(0, len(arr) - 1):
_difference = arr[_x + 1] - arr[_x]
if _difference == 1:
_type1 += 1
elif _difference == 3:
_type2 += 1
_dict = {}
de... |
# Debug flag
DEBUG = False
# Menu tuple IDX return
IDX_STOCK = 0
IDX_DATE_RANGE = 1
IDX_PERCENT_TRAINED = 2 | debug = False
idx_stock = 0
idx_date_range = 1
idx_percent_trained = 2 |
""" Detecting Loop in a given linked list """
class Node:
# Function to initialise the node object
def __init__(self, data):
self.data = data # Assign data
self.next = None # Initialize next as null
class LinkedList:
# Function to initialize head
def __init__(self):
self.h... | """ Detecting Loop in a given linked list """
class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def print_list(self):
temp = self.head
while temp:
print(temp.data, end=' -> '... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | """Blaze targets for golden file testing.
This file defines targets `diff_test` and `cmd_diff_test` for "golden file
testing".
The diff_test target computes the diff of some `actual` output and some
`expected` output, either succeeding if the diff is empty or failing and
printing the nonempty diff otherwise. To auto-... |
def deep_reverse(arr):
if len(arr) == 0:
return []
last_el = arr[-1]
rem_list = deep_reverse(arr[:-1]) # remaining list
if type(last_el) is list:
last_el = deep_reverse(last_el)
rem_list.insert(0, last_el)
return rem_list
def test_function(test_case):
arr = test_case[... | def deep_reverse(arr):
if len(arr) == 0:
return []
last_el = arr[-1]
rem_list = deep_reverse(arr[:-1])
if type(last_el) is list:
last_el = deep_reverse(last_el)
rem_list.insert(0, last_el)
return rem_list
def test_function(test_case):
arr = test_case[0]
solution = test_c... |
# problem link: https://leetcode.com/problems/combination-sum-iii/
class Solution:
def combinationSum3(self, k: int, n: int) -> List[List[int]]:
end_num = 10 # candidates numbers are btw 0 - 9
def dfs(cur_list, cur_size, next_num):
if cur_size == k and sum(cur_list) == n:
... | class Solution:
def combination_sum3(self, k: int, n: int) -> List[List[int]]:
end_num = 10
def dfs(cur_list, cur_size, next_num):
if cur_size == k and sum(cur_list) == n:
res.append(cur_list)
return
if cur_size > k or sum(cur_list) > n:
... |
def insertion_sort(arr):
for k in range(1, len(arr)):
key = arr[k]
j = k
while j > 0 and arr[j-1] > arr[j]:
arr[j], arr[j-1] = arr[j-1], arr[j]
j = j - 1
my_list = [24, 81, 13, 57, 16]
insertion_sort(my_list)
print(my_list) | def insertion_sort(arr):
for k in range(1, len(arr)):
key = arr[k]
j = k
while j > 0 and arr[j - 1] > arr[j]:
(arr[j], arr[j - 1]) = (arr[j - 1], arr[j])
j = j - 1
my_list = [24, 81, 13, 57, 16]
insertion_sort(my_list)
print(my_list) |
#
# PySNMP MIB module ELTEX-MES-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-VLAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:02:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint, constraints_union) ... |
L, R = int(input()), int(input())
max_xor = 0
for i in range(L, R+1):
for j in range(i+1, R+1):
if i^j > max_xor:
max_xor = i^j
print(max_xor)
| (l, r) = (int(input()), int(input()))
max_xor = 0
for i in range(L, R + 1):
for j in range(i + 1, R + 1):
if i ^ j > max_xor:
max_xor = i ^ j
print(max_xor) |
f = open("file_name.txt", "w") # open file for writing
f.write("Some text with out new line ")
f.write("Some text.\nSome text.\nSome text.")
f.close() # always close the file
# "D:\\myfiles\file_name.txt" - backslash symbol (\) is for path in windows
# "/myfiles/file_name.txt" - slash symbol (/) is for path in ... | f = open('file_name.txt', 'w')
f.write('Some text with out new line ')
f.write('Some text.\nSome text.\nSome text.')
f.close()
f = open('file_name.txt', 'r')
print(f.read())
f.close()
f = open('file_name', 'w')
f.write('line to file')
f.close()
f = open('file_name', 'r')
f.read()
f.close()
f = open('file_name', 'r')
f.... |
class ActivitiesHelper:
'''
Given a pressure data timeseries, calculate a step count
'''
def calculate_step_count(self, dataframe, low_threshold = 0, high_threshold = 4):
p_avg = dataframe.mean(axis=1)
p_diff = p_avg.diff()
status = 0
step_count = 0
for p_diff_t ... | class Activitieshelper:
"""
Given a pressure data timeseries, calculate a step count
"""
def calculate_step_count(self, dataframe, low_threshold=0, high_threshold=4):
p_avg = dataframe.mean(axis=1)
p_diff = p_avg.diff()
status = 0
step_count = 0
for p_diff_t in p... |
class SemiFinder:
def __init__(self):
self.f = ""
self.counter = 0
#Path is inputted from AIPController
#Returns semicolon counter
def sendFile(self, path):
self.f = open(path)
for line in self.f:
try:
self.counter += self.get_all_semis(line... | class Semifinder:
def __init__(self):
self.f = ''
self.counter = 0
def send_file(self, path):
self.f = open(path)
for line in self.f:
try:
self.counter += self.get_all_semis(line)
except:
continue
c = self.counter
... |
#operate string of imgdata ,get the new string after ','
def cutstr(sStr1,sStr2):
nPos = sStr1.index(sStr2)
return sStr1[(nPos+1):]
if __name__ == '__main__':
print (cutstr('qwe,qw123123e2134123',','))
| def cutstr(sStr1, sStr2):
n_pos = sStr1.index(sStr2)
return sStr1[nPos + 1:]
if __name__ == '__main__':
print(cutstr('qwe,qw123123e2134123', ',')) |
flame_graph_template = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstr... | flame_graph_template = '\n<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8">\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n\n <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/b... |
"""
Chapter 01 - Problem 01 - Is Unique - CTCI 6th Edition page 90
Problem Statement:
Implement an algorithm to determine if a string has all unique characters.
What if you cannot use additional data structures?
Example:
"aalex" -> False
Solution:
Assume that the input string will contain only ASCII characters. Trav... | """
Chapter 01 - Problem 01 - Is Unique - CTCI 6th Edition page 90
Problem Statement:
Implement an algorithm to determine if a string has all unique characters.
What if you cannot use additional data structures?
Example:
"aalex" -> False
Solution:
Assume that the input string will contain only ASCII characters. Trav... |
class Node:
def __init__(self,data,freq):
self.left=None
self.right=None
self.data=data
self.freq=freq
root=Node("x",5)
root.left=Node("x",2)
root.right=Node("A",3)
root.left.left=Node("B",1)
root.left.right=Node("C",1)
s="1001011" #encoded data
ans=""
root2=roo... | class Node:
def __init__(self, data, freq):
self.left = None
self.right = None
self.data = data
self.freq = freq
root = node('x', 5)
root.left = node('x', 2)
root.right = node('A', 3)
root.left.left = node('B', 1)
root.left.right = node('C', 1)
s = '1001011'
ans = ''
root2 = root
fo... |
class NehushtanMPTerminatedSituation(Exception):
"""
Since 0.2.13
"""
pass
| class Nehushtanmpterminatedsituation(Exception):
"""
Since 0.2.13
"""
pass |
# Q6. Write a programs to print the following pattern :
''' a)A
A B
A B C
A B C D
A B C D E
b)1
1 2
1 2 3
1 2 3 4
c) 4 3 2 1
3 2 1
2 1
1 '''
| """ a)A
A B
A B C
A B C D
A B C D E
b)1
1 2
1 2 3
1 2 3 4
c) 4 3 2 1
3 2 1
2 1
1 """ |
"""
Project constants module.
All the constants are included in this script.
"""
# ======================================= Comma.ai dataset test data size and random state constants
TEST_SIZE = .2
RANDOM_STATE = 42
# ======================================= Comma.ai dataset training data and label directories
TRAIN_D... | """
Project constants module.
All the constants are included in this script.
"""
test_size = 0.2
random_state = 42
train_data_dir = './dataset/64_batched_sunny/frames/*.npy'
train_labels_fl_dir = './dataset/64_batched_sunny/angles/*.npy'
c_test_data_dir = './dataset/64_batched_cloudy/frames/*.npy'
c_test_labels_fl_dir... |
data = (
'Shou ', # 0x00
'Yi ', # 0x01
'Zhi ', # 0x02
'Gu ', # 0x03
'Chu ', # 0x04
'Jiang ', # 0x05
'Feng ', # 0x06
'Bei ', # 0x07
'Cay ', # 0x08
'Bian ', # 0x09
'Sui ', # 0x0a
'Qun ', # 0x0b
'Ling ', # 0x0c
'Fu ', # 0x0d
'Zuo ', # 0x0e
'Xia ', # 0x0f
'Xiong ', # 0x10
... | data = ('Shou ', 'Yi ', 'Zhi ', 'Gu ', 'Chu ', 'Jiang ', 'Feng ', 'Bei ', 'Cay ', 'Bian ', 'Sui ', 'Qun ', 'Ling ', 'Fu ', 'Zuo ', 'Xia ', 'Xiong ', '[?] ', 'Nao ', 'Xia ', 'Kui ', 'Xi ', 'Wai ', 'Yuan ', 'Mao ', 'Su ', 'Duo ', 'Duo ', 'Ye ', 'Qing ', 'Uys ', 'Gou ', 'Gou ', 'Qi ', 'Meng ', 'Meng ', 'Yin ', 'Huo ', 'Ch... |
# -*- coding: utf-8 -*-
# Exercise 2.24
# Author: Little Horned Owl
x = 1 # valid, integer
x = 1. # valid, float
x = 1; # valid, integer (with a end-of-statement semicolon)
# x = 1! # invalid
# x = 1? # invalid
# x = 1: # invalid
x = 1, # valid, tuple (but with only one element)
""... | x = 1
x = 1.0
x = 1
x = (1,)
'\nTrial run\npython3 punctuation.py\n\n' |
def Even_Length(Test_string):
return "\n".join([words for words in Test_string.split() if len(words) % 2 == 0])
Test_string = input("Enter a String: ")
print(f"Output: {Even_Length(Test_string)}") | def even__length(Test_string):
return '\n'.join([words for words in Test_string.split() if len(words) % 2 == 0])
test_string = input('Enter a String: ')
print(f'Output: {even__length(Test_string)}') |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2020 - Chris Griffith - MIT License
_roman_dict = {
"I": 1,
"IV": 4,
"V": 5,
"IX": 9,
"X": 10,
"XL": 40,
"L": 50,
"XC": 90,
"C": 100,
"CD": 400,
"D": 500,
"CM": 900,
... | _roman_dict = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000}
_numbers = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14:... |
batch_size = 32
stages = 4
epochs = 32
learning_rate = 0.00005
| batch_size = 32
stages = 4
epochs = 32
learning_rate = 5e-05 |
class InvalidSignError(Exception):
pass
class PositionTakenError(Exception):
pass
class ColumnIsFullError(Exception):
pass | class Invalidsignerror(Exception):
pass
class Positiontakenerror(Exception):
pass
class Columnisfullerror(Exception):
pass |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class AlertTypeBucketEnum(object):
"""Implementation of the 'AlertTypeBucket' enum.
Specifies the Alert type bucket.
Specifies the Alert type bucket.
kSoftware - Alerts which are related to Cohesity services.
kHardware - Alerts related to har... | class Alerttypebucketenum(object):
"""Implementation of the 'AlertTypeBucket' enum.
Specifies the Alert type bucket.
Specifies the Alert type bucket.
kSoftware - Alerts which are related to Cohesity services.
kHardware - Alerts related to hardware on which Cohesity software is
running.
kSer... |
def test_cookie(request):
"""
Return the result of the last staged test cookie.
returns cookie_state = bool
"""
if request.session.test_cookie_worked():
request.session.delete_test_cookie()
cookie_state = True
else:
cookie_state = False
return cookie_state
class C... | def test_cookie(request):
"""
Return the result of the last staged test cookie.
returns cookie_state = bool
"""
if request.session.test_cookie_worked():
request.session.delete_test_cookie()
cookie_state = True
else:
cookie_state = False
return cookie_state
class Cook... |
"""Helper for creating connections to AMQP servers"""
def aio_pika_connect_params(config, keypath: str = None) -> dict:
"""Return a dict keyword arguments that can be passed to
aio_pika.connect
"""
if keypath is None:
mq_conf = config
else:
mq_conf = config.get(keypath)
re... | """Helper for creating connections to AMQP servers"""
def aio_pika_connect_params(config, keypath: str=None) -> dict:
"""Return a dict keyword arguments that can be passed to
aio_pika.connect
"""
if keypath is None:
mq_conf = config
else:
mq_conf = config.get(keypath)
return {'h... |
def adjust_travellers_number(travellers_input_val, num, subtract_btn, add_btn):
while travellers_input_val > num:
subtract_btn.click()
travellers_input_val -= 1
while travellers_input_val < num:
add_btn.click()
travellers_input_val += 1
def set_travellers_number(driver, num, fo... | def adjust_travellers_number(travellers_input_val, num, subtract_btn, add_btn):
while travellers_input_val > num:
subtract_btn.click()
travellers_input_val -= 1
while travellers_input_val < num:
add_btn.click()
travellers_input_val += 1
def set_travellers_number(driver, num, for... |
class Default:
""" No-op Implementation """
def __init__(self, *args, **kwargs):
pass
def gauge(self, name, value):
pass
def report_time(self, fn):
pass
| class Default:
""" No-op Implementation """
def __init__(self, *args, **kwargs):
pass
def gauge(self, name, value):
pass
def report_time(self, fn):
pass |
# Copyright 2020 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | """Support macros to assist in detecting build features."""
load('@bazel_skylib//lib:new_sets.bzl', 'sets')
def _compute_enabled_features(*, requested_features, unsupported_features):
"""Returns a list of features for the given build.
Args:
requested_features: A list of features requested. Typically fro... |
data_format = {
"Inputs": {
"input2":
{
"ColumnNames": ["temperature", "humidity"],
"Values": [ [ "value", "value" ], ]
}, },
"GlobalParameters": {
}
}
sensor_value = { "ColumnNames": ["currentTime... | data_format = {'Inputs': {'input2': {'ColumnNames': ['temperature', 'humidity'], 'Values': [['value', 'value']]}}, 'GlobalParameters': {}}
sensor_value = {'ColumnNames': ['currentTime', 'indoorTemp', 'indoorHumid', 'indoorIllum', 'outdoorIllum'], 'Values': [['value', 'value', 'value', 'value', 'value']]}
user_input = {... |
#
# Generic error collection for pynucleus.
# This file is part of pynucleus.
#
class BoardNotFoundError(IOError):
""" Class representing a condition where no board was found. """
class ProgrammingFailureError(IOError):
""" Class representing a condition where programming failed. """
| class Boardnotfounderror(IOError):
""" Class representing a condition where no board was found. """
class Programmingfailureerror(IOError):
""" Class representing a condition where programming failed. """ |
"""
Premium Question
"""
__author__ = 'Daniel'
"""
This is the interface that allows for creating nested lists.
You should not implement it, or speculate about its implementation
"""
class NestedInteger(object):
def isInteger(self):
"""
@return True if this NestedInteger holds a single integer, ... | """
Premium Question
"""
__author__ = 'Daniel'
'\nThis is the interface that allows for creating nested lists.\nYou should not implement it, or speculate about its implementation\n'
class Nestedinteger(object):
def is_integer(self):
"""
@return True if this NestedInteger holds a single integer, ra... |
def Eyes(thoughts, eyes, eye, tongue):
return f"""
{thoughts}
{thoughts}
.::!!!!!!!:.
.!!!!!:. .:!!!!!!!!!!!!
~~~~!!!!!!. .:!!!!!!!!!UWWW\$\$\$
:\$\$NWX!!: .:!!!!!!XUWW\$\$\$\$\$\$\$\$\$P
\$\$\$\$\$##WX!: ... | def eyes(thoughts, eyes, eye, tongue):
return f'''\n {thoughts}\n {thoughts}\n .::!!!!!!!:.\n .!!!!!:. .:!!!!!!!!!!!!\n ~~~~!!!!!!. .:!!!!!!!!!UWWW\\$\\$\\$ \n :\\$\\$NWX!!: .:!!!!!!XUWW\\$\\$\\$\\$\\$\\$\\$\\$\\$P \n ... |
class VegaScatterPlot(object):
def __init__(self, width: int, height: int):
self._width = width
self._height = height
def build(self):
# TODO error log here
print("illegal")
assert 0
| class Vegascatterplot(object):
def __init__(self, width: int, height: int):
self._width = width
self._height = height
def build(self):
print('illegal')
assert 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Astounding Horror 1930s
chart = ["only", "absent-mindedly", "absolutely", "afterward", "ahead", "alike", "alongside", "always", "around", "asleep", "audibly", "away", "backward", "barely", "blankly", "blind", "blindly", "bravely", "brilliantly", "brokenly", "calmly", "clo... | chart = (['only', 'absent-mindedly', 'absolutely', 'afterward', 'ahead', 'alike', 'alongside', 'always', 'around', 'asleep', 'audibly', 'away', 'backward', 'barely', 'blankly', 'blind', 'blindly', 'bravely', 'brilliantly', 'brokenly', 'calmly', 'close', 'composedly', 'contemptuously', 'curiously', 'decidedly', 'definit... |
#Program 4
#Write a user defined function to accept two strings and concatenate them
#Name:Vikhyat
#Class:12
#Date of Execution:15.06.2021
def FuncConcat(x,y):
print(x+y)
print("Enter 2 strings to see them concatenated:")
l=(input("Enter String 1:"))
u=(input("Enter String 2:"))
FuncConcat(l,u)
'''O... | def func_concat(x, y):
print(x + y)
print('Enter 2 strings to see them concatenated:')
l = input('Enter String 1:')
u = input('Enter String 2:')
func_concat(l, u)
'Output for Program 4\n\nEnter 2 strings to see them concatenated:\nEnter String 1:I love\nEnter String 2:Computers\nI loveComputers\n\n' |
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
index = 0
result = 0
count = 0
cutline = -1
dictionary = {}
while index < len(s):
chr = s[index]
oldIndex = dictio... | class Solution(object):
def length_of_longest_substring(self, s):
"""
:type s: str
:rtype: int
"""
index = 0
result = 0
count = 0
cutline = -1
dictionary = {}
while index < len(s):
chr = s[index]
old_index = dic... |
def nocache(app):
@app.after_request
def add_header(resp):
resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
resp.headers['Pragma'] = 'no-cache'
resp.headers['Expires'] = '0'
resp.headers['Cache-Control'] = 'public, max-age=0'
return resp
| def nocache(app):
@app.after_request
def add_header(resp):
resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
resp.headers['Pragma'] = 'no-cache'
resp.headers['Expires'] = '0'
resp.headers['Cache-Control'] = 'public, max-age=0'
return resp |
"""
This module registers the models we created for the "educator" application. After registering
the model, the data will be accessible through Django's admin functionality.
"""
| """
This module registers the models we created for the "educator" application. After registering
the model, the data will be accessible through Django's admin functionality.
""" |
KEY = 'key'
DESCRIPTION = 'description'
TAGS = 'tags'
XTRA_ATTRS = 'xtra_attrs'
SEARCH_TERMS = 'search_terms'
def list_search_terms(key):
'''Given a stat key, returns a list of search terms.'''
terms = []
if KEY in key:
terms += key[KEY].lower().split('.')
terms.append(key[KEY].lower())
... | key = 'key'
description = 'description'
tags = 'tags'
xtra_attrs = 'xtra_attrs'
search_terms = 'search_terms'
def list_search_terms(key):
"""Given a stat key, returns a list of search terms."""
terms = []
if KEY in key:
terms += key[KEY].lower().split('.')
terms.append(key[KEY].lower())
... |
#
# PySNMP MIB module ADTRAN-AOS-DNS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-AOS-DNS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:13:59 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (ad_gen_aos_conformance, ad_gen_aos_applications) = mibBuilder.importSymbols('ADTRAN-AOS', 'adGenAOSConformance', 'adGenAOSApplications')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.