content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def removeKdigits(self, num: str, k: int) -> str:
stack, i = [], 0
while i < len(num):
if not stack:
if num[i] != "0":
stack.append(num[i])
elif stack[-1] <= num[i]:
stack.append(num[i])
else:
... | class Solution:
def remove_kdigits(self, num: str, k: int) -> str:
(stack, i) = ([], 0)
while i < len(num):
if not stack:
if num[i] != '0':
stack.append(num[i])
elif stack[-1] <= num[i]:
stack.append(num[i])
els... |
# Create a function named stringcases that takes a string and
# returns a tuple of four versions of the string:
# uppercased, lowercased, titlecased (where every word's first letter
# is capitalized), and a reversed version of the string.
# Handy functions:
# .upper() - uppercases a string
# .lower() - lowercases a... | def stringcases(aString):
a_upper = aString.upper()
a_lower = aString.lower()
a_title = aString.title()
a_rev = aString[::-1]
return (aUpper, aLower, aTitle, aRev)
my_string = "This is my tuple of my string's variants"
tup = stringcases(myString)
print(tup[0])
print(tup[1])
print(tup[2])
print(tup[3... |
# Leo colorizer control file for eiffel mode.
# This file is in the public domain.
# Properties for eiffel mode.
properties = {
"lineComment": "--",
}
# Attributes dict for eiffel_main ruleset.
eiffel_main_attributes_dict = {
"default": "null",
"digit_re": "",
"escape": "\\",
"highlig... | properties = {'lineComment': '--'}
eiffel_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '\\', 'highlight_digits': 'true', 'ignore_case': 'true', 'no_word_sep': ''}
attributes_dict_dict = {'eiffel_main': eiffel_main_attributes_dict}
eiffel_main_keywords_dict = {'alias': 'keyword1', 'all': 'keyword... |
"""container_pull macro with improved API"""
load("@io_bazel_rules_docker//container:container.bzl", _container_pull = "container_pull")
load("//bazel/workspace:image_digests.bzl", "IMAGE_DIGESTS")
def container_pull(
name,
registry,
repository,
tag = None,
digest = None,
... | """container_pull macro with improved API"""
load('@io_bazel_rules_docker//container:container.bzl', _container_pull='container_pull')
load('//bazel/workspace:image_digests.bzl', 'IMAGE_DIGESTS')
def container_pull(name, registry, repository, tag=None, digest=None, **kwargs):
"""container_pull macro that improves ... |
"""
Telescope Spectral Response Class
===================================
This class calculates the output flux of an astronomical object as a funtion
of the 1.6 m Perkin-Elmer spectral response.
"""
class Telescope_Spectral_Response:
pass
| """
Telescope Spectral Response Class
===================================
This class calculates the output flux of an astronomical object as a funtion
of the 1.6 m Perkin-Elmer spectral response.
"""
class Telescope_Spectral_Response:
pass |
"""Main module."""
def say(num: int):
"""
Convert large number to sayable text format.
Arguments:
num : A (large) number
"""
under_20 = [
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
... | """Main module."""
def say(num: int):
"""
Convert large number to sayable text format.
Arguments:
num : A (large) number
"""
under_20 = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen',... |
#!/usr/local/bin/python
# Code Fights Array Change Problem
def arrayChange(inputArray):
count = 0
for i in range(1, len(inputArray)):
diff = inputArray[i] - inputArray[i - 1]
if diff <= 0:
inputArray[i] += abs(diff) + 1
count += abs(diff) + 1
return count
def main... | def array_change(inputArray):
count = 0
for i in range(1, len(inputArray)):
diff = inputArray[i] - inputArray[i - 1]
if diff <= 0:
inputArray[i] += abs(diff) + 1
count += abs(diff) + 1
return count
def main():
tests = [[[1, 1, 1], 3]]
for t in tests:
... |
class LanguageSpecification:
def __init__(self):
pass
@staticmethod
def java_keywords():
keywords = ['abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'const']
keywords += ['continue', 'default', 'do', 'double', 'else', 'enum', 'extends', 'final'... | class Languagespecification:
def __init__(self):
pass
@staticmethod
def java_keywords():
keywords = ['abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'const']
keywords += ['continue', 'default', 'do', 'double', 'else', 'enum', 'extends', 'final', ... |
class MODAK_sql:
CREATE_INFRA_TABLE = "create external table \
infrastructure(infra_id int, \
name string, \
num_nodes int, \
is_active boolean, \
... | class Modak_Sql:
create_infra_table = "create external table infrastructure(infra_id int, name string, num_nodes int, is_active boolean, descri... |
"""
ZODB Browser has the following submodules:
diff -- compute differences between two dictionaries
testing -- doodads to make writing tests easier
cache -- caching logic
history -- extracts historical state information from the ZODB
state -- IStateInterpreter adapters for ma... | """
ZODB Browser has the following submodules:
diff -- compute differences between two dictionaries
testing -- doodads to make writing tests easier
cache -- caching logic
history -- extracts historical state information from the ZODB
state -- IStateInterpreter adapters for ma... |
name = 'http'
__doc__ = "The http module provides access to methods concerning the http request and response"
def build(env,path):
self = env.get_new_module(path+'.'+name)
dbpy = env.get_module('dbpy')
#TODO:
#look... all this duplication of data in the request.
#eh.
#DOC:get_params
"""
The parsed... | name = 'http'
__doc__ = 'The http module provides access to methods concerning the http request and response'
def build(env, path):
self = env.get_new_module(path + '.' + name)
dbpy = env.get_module('dbpy')
'\n\tThe parsed parameters from the request url in a multidict\n\t'
self.get_params = env.get_pa... |
class Store:
def callStore(nestedList, store, inpCounter):
counter=[0]
i=nestedList
inList=[["("],["("]]
quit=False
while not quit:
repeat=True
while repeat:
repeat=False
i=nestedList
number=0
... | class Store:
def call_store(nestedList, store, inpCounter):
counter = [0]
i = nestedList
in_list = [['('], ['(']]
quit = False
while not quit:
repeat = True
while repeat:
repeat = False
i = nestedList
nu... |
SOCIAL_AUTH_TWITTER_KEY = 'LXgJdyaJRF0PeGlKakqg1HRF9'
SOCIAL_AUTH_TWITTER_SECRET = 'rjGbkkELyUhGt3GiEUUIW2A2S2yFtyB2GXmf23nDrgcqoQPZ5R'
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
| social_auth_twitter_key = 'LXgJdyaJRF0PeGlKakqg1HRF9'
social_auth_twitter_secret = 'rjGbkkELyUhGt3GiEUUIW2A2S2yFtyB2GXmf23nDrgcqoQPZ5R'
social_auth_login_redirect_url = '/' |
class MyClassName:
__private = 123
non_private = __private * 2
mine = MyClassName()
mine.non_private
246
mine.__private
mine._MyClassName__private
123
| class Myclassname:
__private = 123
non_private = __private * 2
mine = my_class_name()
mine.non_private
246
mine.__private
mine._MyClassName__private
123 |
# Eoin Lees
# Ascii Table
for i in range(0, 256):
print(f"{i:3} {i:08b} {chr(i)}") | for i in range(0, 256):
print(f'{i:3} {i:08b} {chr(i)}') |
class Signal:
def __init__(self):
pass
def generate(self, df):
pass
| class Signal:
def __init__(self):
pass
def generate(self, df):
pass |
# https://www.codingame.com/training/easy/brick-in-the-wall
def solution():
max_row_bricks = int(input())
num_bricks = int(input())
bricks = map(int, input().split())
work = 0
row, row_bricks = 1, 0
for brick in sorted(bricks, reverse=True):
work += ((row - 1) * 6.5 / 100) * 10 * bric... | def solution():
max_row_bricks = int(input())
num_bricks = int(input())
bricks = map(int, input().split())
work = 0
(row, row_bricks) = (1, 0)
for brick in sorted(bricks, reverse=True):
work += (row - 1) * 6.5 / 100 * 10 * brick
row_bricks += 1
if row_bricks == max_row_br... |
""" Prompts user to provide integer within a range """
def request_integer_in_range(prompt, lowest, highest):
"""
Purpose: prompts user for an integer, tests that an integer was
provided, and verifies the integer is within an acceptable range.
Inputs:
prompt (str): request to present to us... | """ Prompts user to provide integer within a range """
def request_integer_in_range(prompt, lowest, highest):
"""
Purpose: prompts user for an integer, tests that an integer was
provided, and verifies the integer is within an acceptable range.
Inputs:
prompt (str): request to present to use... |
# -*- coding: utf-8 -*-
"""
sphinxcontrib.napoleon._upstream
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Functions to help compatibility with upstream sphinx.ext.napoleon.
:copyright: Copyright 2013-2018 by Rob Ruana, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
def _(message, *args):
"""
... | """
sphinxcontrib.napoleon._upstream
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Functions to help compatibility with upstream sphinx.ext.napoleon.
:copyright: Copyright 2013-2018 by Rob Ruana, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
def _(message, *args):
"""
NOOP implementation of... |
#!/usr/bin/env python
str="../data/example-data-english.csv"
file = open(str, "r")
fileout = open(str+"B", "w")
for line in file:
array=line.split(",")
for i in range(len(array)-5):
#print (line.split(",")[i])
fileout.write(line.split(",")[i]+", ");
fileout.write(line.split(",")[i+1]+"\n... | str = '../data/example-data-english.csv'
file = open(str, 'r')
fileout = open(str + 'B', 'w')
for line in file:
array = line.split(',')
for i in range(len(array) - 5):
fileout.write(line.split(',')[i] + ', ')
fileout.write(line.split(',')[i + 1] + '\n ')
fileout.close()
file.close() |
# vim: set et ts=4 sw=4 fileencoding=utf-8:
'''
tests
=====
'''
| """
tests
=====
""" |
num_list = []
num = input('Please enter a number: ')
while num != 'done' and num != 'DONE':
try:
num_list.append(int(num))
num = input('Please enter a number: ')
except:
num = input("Not a number. Please enter a number Or 'done' to finish: ")
try:
print('Maximum number: ', max(num... | num_list = []
num = input('Please enter a number: ')
while num != 'done' and num != 'DONE':
try:
num_list.append(int(num))
num = input('Please enter a number: ')
except:
num = input("Not a number. Please enter a number Or 'done' to finish: ")
try:
print('Maximum number: ', max(num_li... |
#!/usr/bin/env python3
class Graph:
"""A collection of components and edges"""
def __init__(self, name):
self.name = name
self.nodes = {}
self.edges = {}
self.initializers = {}
def add_node(self, name, component):
'adds a node to the graph with name name.'
... | class Graph:
"""A collection of components and edges"""
def __init__(self, name):
self.name = name
self.nodes = {}
self.edges = {}
self.initializers = {}
def add_node(self, name, component):
"""adds a node to the graph with name name."""
self.nodes[name] = {... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def convertBST(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
def dfs(node):
... | class Solution:
def convert_bst(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
def dfs(node):
if node is not None:
yield from dfs(node.right)
yield node
yield from dfs(node.left)
acc = 0
... |
summary_response = {
'data': {
'battery': {
'state': 'ONLINE',
'val': 2.0
},
'grid': {
'state': 'ONLINE',
'val': 40.0,
'something_else': 'not_included'
},
'house': {
'state': 'ONLINE',
'val': ... | summary_response = {'data': {'battery': {'state': 'ONLINE', 'val': 2.0}, 'grid': {'state': 'ONLINE', 'val': 40.0, 'something_else': 'not_included'}, 'house': {'state': 'ONLINE', 'val': 25.0}, 'solar': {'state': 'ONLINE', 'val': 30.0, 'other_key': 'blah'}, 'key5': {'this_isnt': 'included'}}}
expected = {'battery': {'sta... |
def merge(left, right):
result = []
i, j = 0, 0
while len(left) and j < len(right):
if left[i] <= right[j]:
result.append(left[i])
i += 1
else:
result.append(right[j])
j += 1
result += left[i:]
result += right[j:]
return result
... | def merge(left, right):
result = []
(i, j) = (0, 0)
while len(left) and j < len(right):
if left[i] <= right[j]:
result.append(left[i])
i += 1
else:
result.append(right[j])
j += 1
result += left[i:]
result += right[j:]
return result
... |
class OperationABC:
pass
class BaseTable(OperationABC):
def __init__(self, table, db):
self.table = table
self.database = db
class Selection(OperationABC):
def __init__(self, pred):
self.predicate = pred
| class Operationabc:
pass
class Basetable(OperationABC):
def __init__(self, table, db):
self.table = table
self.database = db
class Selection(OperationABC):
def __init__(self, pred):
self.predicate = pred |
# Question 6
num = float(input("Enter a number: "))
print("difference:", num-17)
if num > 17:
print("double of absolute value of difference:", abs(num - 17) * 2)
| num = float(input('Enter a number: '))
print('difference:', num - 17)
if num > 17:
print('double of absolute value of difference:', abs(num - 17) * 2) |
# Time: O(n + logc), c is the number of candies
# Space: O(1)
class Solution(object):
def distributeCandies(self, candies, num_people):
"""
:type candies: int
:type num_people: int
:rtype: List[int]
"""
# find max integer p s.t. sum(1 + 2 + ... + p) <= C
# =... | class Solution(object):
def distribute_candies(self, candies, num_people):
"""
:type candies: int
:type num_people: int
:rtype: List[int]
"""
p = int((2 * candies + 0.25) ** 0.5 - 0.5)
remaining = candies - (p + 1) * p // 2
(rows, cols) = divmod(p, nu... |
class Notification(object):
def __init__(self, token, chat_id, logger):
super(Notification, self).__init__()
self.token = token
self.chat_id = chat_id
self.logger = logger
self.chat_id_list = chat_id.split()
def notify(self, user, message):
pass
def broadcas... | class Notification(object):
def __init__(self, token, chat_id, logger):
super(Notification, self).__init__()
self.token = token
self.chat_id = chat_id
self.logger = logger
self.chat_id_list = chat_id.split()
def notify(self, user, message):
pass
def broadca... |
# 250. Count Univalue Subtrees
# ttungl@gmail.com
# Given a binary tree, count the number of uni-value subtrees.
# A Uni-value subtree means all nodes of the subtree have the same value.
# For example:
# Given binary tree,
# 5
# / \
# 1 5
# / \ \
# 5 5... | class Solution(object):
def count_unival_subtrees(self, root):
"""
:type root: TreeNode
:rtype: int
"""
self.cnt = 0
def dfs(root):
if not root:
return True
(left, right) = (dfs(root.left), dfs(root.right))
if left... |
class Board():
def __init__(self, height, width, food, hazards, snakes):
self.height = height
self.width = width
self.food = food
self.hazards = hazards
self.snakes = snakes
| class Board:
def __init__(self, height, width, food, hazards, snakes):
self.height = height
self.width = width
self.food = food
self.hazards = hazards
self.snakes = snakes |
# print(3 + 5)
# print(7 - 4)
# print(3 * 2)
# print(6 / 3)
# print(2 ** 3)
# PEDMAS LR
# ()
# **
# * /
# + -
print(3 * 3 + 3 / 3 - 3)
# Adding brackets around the addition increases priority
print(3 * (3 + 3) / 3 - 3) | print(3 * 3 + 3 / 3 - 3)
print(3 * (3 + 3) / 3 - 3) |
# write a function that takes a list of lists
# Each list has 5 numbers
# reverse each list in the big list but maintain the order of the lists
# e.g given [[1, 2, 3], [4, 5, 6], [7, 8]] return [[3, 2, 1], [6, 5, 4], [8, 7]]
# for more info on this quiz, go to this url: http://www.programmr.com/reverse-lists
def reve... | def reverse_lists(arr_y):
rev_lst = []
for i in arr_y:
i.reverse()
rev_lst.append(i)
return rev_lst
print(reverse_lists([[1, 2, 3], [4, 5, 6], [7, 8]])) |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This data is in a separate file so that src/chrome/app/policy/PRESUBMIT.py
# can load it too without having to load pyautolib.
c... | class Policyprefstestcases(object):
"""A list of test cases for policy_prefs_ui.py."""
browser = 0
search_engines = 1
passwords = 2
autofill = 3
content = 4
homepage = 5
languages = 6
accounts = 7
policies = {'HomepageLocation': ('http://chromium.org', [HOMEPAGE]), 'HomepageIsNew... |
# Licensed under an MIT style license -- see LICENSE.md
__author__ = ["Charlie Hoy <charlie.hoy@ligo.org>"]
def psd_plot(
read_variable, default_analysis=None, plot_kwargs={}, extra_lines=[],
text="As an example, we now plot the PSDs stored in the file"
):
"""Return a string containing the function to ge... | __author__ = ['Charlie Hoy <charlie.hoy@ligo.org>']
def psd_plot(read_variable, default_analysis=None, plot_kwargs={}, extra_lines=[], text='As an example, we now plot the PSDs stored in the file'):
"""Return a string containing the function to generate a plot showing the
stored PSDs
Parameters
------... |
head = '''<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mob... | head = '<!DOCTYPE html>\n<html>\n<head>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">\n<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>\n<script src="https://code.jquery.com/mobil... |
class Solution:
def getNoZeroIntegers(self, n: int) -> List[int]:
while True:
a = random.randint(1, n - 1)
b = n - a
if '0' not in str(a) and '0' not in str(b):
return [a, b]
| class Solution:
def get_no_zero_integers(self, n: int) -> List[int]:
while True:
a = random.randint(1, n - 1)
b = n - a
if '0' not in str(a) and '0' not in str(b):
return [a, b] |
print("Welcome to MiOS")
yesValues = ["y", "yes", "true", "t"]
on = True
loggedIn = False
def yn(val):
return val.lower() in yesValues
while on:
account = input("Do you have an account? (y/n): ")
if yn(account):
print("Please login: ")
user = input("Enter your username: ")
userpassFi... | print('Welcome to MiOS')
yes_values = ['y', 'yes', 'true', 't']
on = True
logged_in = False
def yn(val):
return val.lower() in yesValues
while on:
account = input('Do you have an account? (y/n): ')
if yn(account):
print('Please login: ')
user = input('Enter your username: ')
userpas... |
class Solution(object):
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
d = {")":"(","}":"{","]":"["}
inneed = ["(","[","{"]
list1 = []
input_lens = len(s)
if input_lens == 0:
return True
for i in range(input_lens): ... | class Solution(object):
def is_valid(self, s):
"""
:type s: str
:rtype: bool
"""
d = {')': '(', '}': '{', ']': '['}
inneed = ['(', '[', '{']
list1 = []
input_lens = len(s)
if input_lens == 0:
return True
for i in range(inpu... |
class Solution(object):
def numSquares(self, n):
"""
:type n: int
:rtype: int
"""
dp = [n] * (n + 1)
dp[0] = 0
for target in range(1, n+1):
for s in range(1, target + 1):
square = s * s
if target - square < 0:
... | class Solution(object):
def num_squares(self, n):
"""
:type n: int
:rtype: int
"""
dp = [n] * (n + 1)
dp[0] = 0
for target in range(1, n + 1):
for s in range(1, target + 1):
square = s * s
if target - square < 0:
... |
def createPageFile(title: str, description: str, rating: float):
pagestr = "{{-start-}}\n ${description}\n ====Rating===\n ${rating}\n{{-stop-}}"
f = open("%s" % (title), "w+")
pagestr = pagestr.replace("${description}", description)
pagestr = pagestr.replace("${rating}", str(rating))
f.write(pages... | def create_page_file(title: str, description: str, rating: float):
pagestr = '{{-start-}}\n ${description}\n ====Rating===\n ${rating}\n{{-stop-}}'
f = open('%s' % title, 'w+')
pagestr = pagestr.replace('${description}', description)
pagestr = pagestr.replace('${rating}', str(rating))
f.write(pagest... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==================================================
# @Time : 2019-05-30 19:44
# @Author : ryuchen
# @File : constants.py
# @Desc :
# ==================================================
CUCKOO_GUEST_PORT = 8000
CUCKOO_GUEST_INIT = 0x001
CUCKOO_GUEST_RUNNING = 0x002
CUCKOO_G... | cuckoo_guest_port = 8000
cuckoo_guest_init = 1
cuckoo_guest_running = 2
cuckoo_guest_completed = 3
cuckoo_guest_failed = 4
github_url = 'https://github.com/cuckoosandbox/cuckoo'
issues_page_url = 'https://github.com/cuckoosandbox/cuckoo/issues'
docs_url = 'https://cuckoo.sh/docs'
def faq(entry):
return '%s/faq/ind... |
class Config(object):
DEBUG = False
TESTING = False
UPLOAD_FOLDER = 'store'
class DevConfig(Config):
DEBUG = True
class TestConfig(Config):
TESTING = True
DEBUG = False
UPLOAD_FOLDER = 'test_store'
| class Config(object):
debug = False
testing = False
upload_folder = 'store'
class Devconfig(Config):
debug = True
class Testconfig(Config):
testing = True
debug = False
upload_folder = 'test_store' |
# clean code
def is_even(num):
return num % 2 == 0
print(is_even(51))
# *args **args
def super_func(*args):
return sum(args)
print(super_func(1,2,3,4,5)) #15
def another_super_func(**kwargs):
print(kwargs)
total = 0
for items in kwargs.values():
total += items
return total
print(another_super_f... | def is_even(num):
return num % 2 == 0
print(is_even(51))
def super_func(*args):
return sum(args)
print(super_func(1, 2, 3, 4, 5))
def another_super_func(**kwargs):
print(kwargs)
total = 0
for items in kwargs.values():
total += items
return total
print(another_super_func(num1=5, num2=10... |
class Fabric:
def __init__(self, width, height):
self._width = width
self._height = height
self._area = []
for row in range(0, height):
self._area.append([])
for column in range(0, width):
self._area[row].append(0)
def claim(self, piece):
... | class Fabric:
def __init__(self, width, height):
self._width = width
self._height = height
self._area = []
for row in range(0, height):
self._area.append([])
for column in range(0, width):
self._area[row].append(0)
def claim(self, piece):... |
DAY = 11
def part1(data):
data = [ord(c) for c in data]
while not is_valid(data):
for j in range(len(data)-1, -1,-1):
data[j] = data[j]+1
if data[j] > ord("z"):
data[j] = ord("a")
else:
break
return "".join(chr(c) for c in data)
... | day = 11
def part1(data):
data = [ord(c) for c in data]
while not is_valid(data):
for j in range(len(data) - 1, -1, -1):
data[j] = data[j] + 1
if data[j] > ord('z'):
data[j] = ord('a')
else:
break
return ''.join((chr(c) for c in da... |
# colorsystem.py is the full list of colors that can be used to easily create themes.
class Gray:
B0 = '#000000'
B10 = '#19232D'
B20 = '#293544'
B30 = '#37414F'
B40 = '#455364'
B50 = '#54687A'
B60 = '#60798B'
B70 = '#788D9C'
B80 = '#9DA9B5'
B90 = '#ACB1B6'
B100 = '#B9BDC1'
... | class Gray:
b0 = '#000000'
b10 = '#19232D'
b20 = '#293544'
b30 = '#37414F'
b40 = '#455364'
b50 = '#54687A'
b60 = '#60798B'
b70 = '#788D9C'
b80 = '#9DA9B5'
b90 = '#ACB1B6'
b100 = '#B9BDC1'
b110 = '#C9CDD0'
b120 = '#CED1D4'
b130 = '#E0E1E3'
b140 = '#FAFAFA'
... |
# encoding: utf-8
##################################################
# This script shows an example of variable assignment. It explores the different options for storing vales into
# variables
##################################################
#
##################################################
# Author: Diego Pajari... | x = 99
y = 63
z = x * y
print('The value assigned is:')
print(z)
z = x * y - x + y
print('The value assigned is:')
print(z)
z = x - y
print('The value assigned now is:')
print(z)
x = z
y = 'Now I store text'
print('The value in -x- now is:')
print(x)
print('The value in -y- now is:')
print(y)
print('The value in -x- no... |
data = []
with open("input.txt", "r") as file:
for line in file.readlines():
line = line.replace("\n", "")
data.append(line)
def countTrees(data, step_right, step_down):
check_index = step_right
count = 0
for i in range(step_down, len(data), step_down):
if data[i][check_index %... | data = []
with open('input.txt', 'r') as file:
for line in file.readlines():
line = line.replace('\n', '')
data.append(line)
def count_trees(data, step_right, step_down):
check_index = step_right
count = 0
for i in range(step_down, len(data), step_down):
if data[i][check_index %... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"source": "01_noisyimagenette.ipynb",
"df": "01_noisyimagenette.ipynb",
"get_inverse_transform": "01_noisyimagenette.ipynb",
"lbl_dict": "01_noisyimagenette.ipynb",
"lbl_di... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'source': '01_noisyimagenette.ipynb', 'df': '01_noisyimagenette.ipynb', 'get_inverse_transform': '01_noisyimagenette.ipynb', 'lbl_dict': '01_noisyimagenette.ipynb', 'lbl_dict_inv': '01_noisyimagenette.ipynb', 'get_dls': '01_noisyimagenette.ipynb', '... |
# Program to sort the array according to count of set bits in binary representation :)
def count_1(var):
count = 0
while var:
count += var % 2
var = var // 2
return count
arr = list(map(int, input("Enter the elements of array *With spaces b/w number* :").split()))
arr_new = [(arr[i], i) ... | def count_1(var):
count = 0
while var:
count += var % 2
var = var // 2
return count
arr = list(map(int, input('Enter the elements of array *With spaces b/w number* :').split()))
arr_new = [(arr[i], i) for i in range(len(arr))]
sort_list = sorted(arr_new, key=lambda x: count_1(x[0]), reverse=... |
#!/usr/bin/python
# --------------------------------------
# Filters
# --------------------------------------
class FilterModule(object):
def filters(self):
return {
'assign_underlay_asn': self.assign_underlay_asn,
'get_local_asn': self.get_local_asn,
'filter_own_link... | class Filtermodule(object):
def filters(self):
return {'assign_underlay_asn': self.assign_underlay_asn, 'get_local_asn': self.get_local_asn, 'filter_own_links': self.filter_own_links}
def assign_underlay_asn(self, links, asn_start, filter_device=None):
"""
Incrementally picks an autono... |
# max(iterable, *[, key, default])
list1 = [1, 2, 3, 2, 1, 2, 4, 3]
max_item = max(list1)
max_item = max(list1, key=lambda x: list1.count(x), default=1)
print('max_item: ', max_item)
# max_item: 2
print('default: ', max((), default=111))
# default: 111
lstobj = [
{'name': 'xiaoming', 'age': 18, 'gender': '... | list1 = [1, 2, 3, 2, 1, 2, 4, 3]
max_item = max(list1)
max_item = max(list1, key=lambda x: list1.count(x), default=1)
print('max_item: ', max_item)
print('default: ', max((), default=111))
lstobj = [{'name': 'xiaoming', 'age': 18, 'gender': 'male'}, {'name': 'xiaohong', 'age': 20, 'gender': 'female'}]
print('max age: '... |
data = input()
elements = data.split(' ')
products = {}
for index in range(0, len(elements), 2):
key = elements[index]
quantity = int(elements[index + 1])
products[key] = quantity
searched_products = input().split(' ')
for item in searched_products:
if item in products.keys():
... | data = input()
elements = data.split(' ')
products = {}
for index in range(0, len(elements), 2):
key = elements[index]
quantity = int(elements[index + 1])
products[key] = quantity
searched_products = input().split(' ')
for item in searched_products:
if item in products.keys():
quantity = product... |
#!/usr/bin/env python3
# Day 30: Check If a String Is a Valid Sequence from Root to Leaves Path in a
# Binary Tree
#
# Given a binary tree where each path going from the root to any leaf form a
# valid sequence, check if a given string is a valid sequence in such binary
# tree.
# We get the given string from the conc... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def is_valid_sequence(self, root: TreeNode, arr: [int]) -> bool:
if root is None:
return False
if root.val != arr[0]:
... |
class Solution(object):
def matrixReshape(self, nums, r, c):
"""
:type nums: List[List[int]]
:type r: int
:type c: int
:rtype: List[List[int]]
"""
if len(nums) * len(nums[0]) != r * c:
return nums
res = []
for i in range(len(nums)):... | class Solution(object):
def matrix_reshape(self, nums, r, c):
"""
:type nums: List[List[int]]
:type r: int
:type c: int
:rtype: List[List[int]]
"""
if len(nums) * len(nums[0]) != r * c:
return nums
res = []
for i in range(len(nums)... |
data = (
'yeoss', # 0x00
'yeong', # 0x01
'yeoj', # 0x02
'yeoc', # 0x03
'yeok', # 0x04
'yeot', # 0x05
'yeop', # 0x06
'yeoh', # 0x07
'ye', # 0x08
'yeg', # 0x09
'yegg', # 0x0a
'yegs', # 0x0b
'yen', # 0x0c
'yenj', # 0x0d
'yenh', # 0x0e
'yed', # 0x0f
'yel', # 0x10
'yelg', ... | data = ('yeoss', 'yeong', 'yeoj', 'yeoc', 'yeok', 'yeot', 'yeop', 'yeoh', 'ye', 'yeg', 'yegg', 'yegs', 'yen', 'yenj', 'yenh', 'yed', 'yel', 'yelg', 'yelm', 'yelb', 'yels', 'yelt', 'yelp', 'yelh', 'yem', 'yeb', 'yebs', 'yes', 'yess', 'yeng', 'yej', 'yec', 'yek', 'yet', 'yep', 'yeh', 'o', 'og', 'ogg', 'ogs', 'on', 'onj',... |
def test():
# if an assertion fails, the message will be displayed
# --> must have the correct arithmetic mean
assert numbers_one_mean == 4.0, "Are you calculating the arithmetic mean?"
# --> must have the first function call
assert "mean(numbers_one)" in __solution__, "Did you call the mean functio... | def test():
assert numbers_one_mean == 4.0, 'Are you calculating the arithmetic mean?'
assert 'mean(numbers_one)' in __solution__, 'Did you call the mean function with numbers_one as input?'
assert 'inspect(numbers_one' in __solution__, 'Did you call the inspect function with numbers_one as input?'
asse... |
class Category:
"""It should be able to instantiate objects based on different budget
categories like food, clothing, and entertainment. When objects are created,
they are passed in the name of the category.
Attributes:
category: A string of category of the category class
ledger: A list of al leger
... | class Category:
"""It should be able to instantiate objects based on different budget
categories like food, clothing, and entertainment. When objects are created,
they are passed in the name of the category.
Attributes:
category: A string of category of the category class
ledger: A list of al leger
... |
class EndLine (Exception):
pass
| class Endline(Exception):
pass |
# Time: O(n)
# Space: O(n)
# freq table
class Solution(object):
def findLonely(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
cnt = collections.Counter(nums)
return [x for x in nums if cnt[x] == 1 and x-1 not in cnt and x+1 not in cnt]
| class Solution(object):
def find_lonely(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
cnt = collections.Counter(nums)
return [x for x in nums if cnt[x] == 1 and x - 1 not in cnt and (x + 1 not in cnt)] |
# 7_lineNumbers.py
# A program that rewrites a file with line numbers
# Date: 10/6/2020
# Name: Ben Goldstone
def main():
readFileName = input("What is the name of the input file? ")
writeFileName = input("What do you want the name of your output file to be? ")
readFile = open(readFileName, "r")
writeFi... | def main():
read_file_name = input('What is the name of the input file? ')
write_file_name = input('What do you want the name of your output file to be? ')
read_file = open(readFileName, 'r')
write_file = open(writeFileName, 'w')
line_number = 1
for line in readFile:
writeFile.write(f'{l... |
height = int(input())
for i in range(1,height+1):
for j in range(0,i+1):
print(end=" ")
for j in range(i,(2*height)-i+1):
print(j,end=" ")
print()
for i in range(1,height):
for j in range(0,height-i+1):
print(end=" ")
for j in range(height-i,height+i+1):
prin... | height = int(input())
for i in range(1, height + 1):
for j in range(0, i + 1):
print(end=' ')
for j in range(i, 2 * height - i + 1):
print(j, end=' ')
print()
for i in range(1, height):
for j in range(0, height - i + 1):
print(end=' ')
for j in range(height - i, height + i ... |
class Solution:
def solve(self, nums):
if len(nums) <= 1:
return len(nums)
sign = lambda x: (x>0)-(x<0)
d = sign(nums[1]-nums[0])
streak = 1 if d == 0 else 2
ans = streak
for i in range(1,len(nums)-1):
if nums[i+1]-nums[i] == 0:
... | class Solution:
def solve(self, nums):
if len(nums) <= 1:
return len(nums)
sign = lambda x: (x > 0) - (x < 0)
d = sign(nums[1] - nums[0])
streak = 1 if d == 0 else 2
ans = streak
for i in range(1, len(nums) - 1):
if nums[i + 1] - nums[i] == 0:... |
def getFirst(pair):
return pair[0]
with open("../inputs/day4.txt","r") as f:
data=f.read()
# [1518-05-29 00:00] Guard #1151 begins shift
data=data.split("\n")
data.pop()
processedData=[]
for el in data:
piece=el.split("]")
piece[0]=piece[0].replace("[","")
piece[0]=piece[0].replace(... | def get_first(pair):
return pair[0]
with open('../inputs/day4.txt', 'r') as f:
data = f.read()
data = data.split('\n')
data.pop()
processed_data = []
for el in data:
piece = el.split(']')
piece[0] = piece[0].replace('[', '')
piece[0] = piece[0].replace('-', '')
piece[0] = piece[0].replace(':', '... |
# 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 = 'Kcli'
copyright = '2020, karmab'
author = 'karmab'
release = '99.0'
master_doc = 'index'
extensions = ['sphinx_rtd_theme', 'sphinx.ext.napoleon']
templates_path = ['_templates']
exclude_patterns = []
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static'] |
"""
Book: Hands-On MQTT Programming with Python
Author: Gaston C. Hillar - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
SURFBOARD_STATUS_IDLE = 0
SURFBOARD_STATUS_PADDLING = 1
SURFBOARD_STATUS_RIDING = 2
SURFBOARD_STATUS_RIDE_FINISHED = 3
SURFBOARD_STATUS_WIPED_OUT = 4
SURFBO... | """
Book: Hands-On MQTT Programming with Python
Author: Gaston C. Hillar - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
surfboard_status_idle = 0
surfboard_status_paddling = 1
surfboard_status_riding = 2
surfboard_status_ride_finished = 3
surfboard_status_wiped_out = 4
surfboa... |
def parsinator(x):
s=dict()
for i in range(0,len(x)):
for j in range(0,len(x[i])):
if x[i][j]=='#':
s[j,i,0,0]=True
return (s,0,0,0,0,len(x)-1,len(x[i])-1,0,0)
banana = [(a,b,c,d) for a in [-1,0,1] for b in [-1,0,1] for c in [-1,0,1] for d in [-1,0,1] if (a,b,c,d... | def parsinator(x):
s = dict()
for i in range(0, len(x)):
for j in range(0, len(x[i])):
if x[i][j] == '#':
s[j, i, 0, 0] = True
return (s, 0, 0, 0, 0, len(x) - 1, len(x[i]) - 1, 0, 0)
banana = [(a, b, c, d) for a in [-1, 0, 1] for b in [-1, 0, 1] for c in [-1, 0, 1] for d ... |
grafo3 = [{
"a": [
{
"aresta": "ac",
"incidencia": 1
},
{
"aresta": "ad",
"incidencia": 1
},
{
"aresta": "af",
"incidencia": 1
},
{
"aresta": "bd",
"incidencia": 0
},
{
"aresta": "be",
"incidencia": 0
},
{
"aresta": "cf",
"incidencia": 0
},
{
... | grafo3 = [{'a': [{'aresta': 'ac', 'incidencia': 1}, {'aresta': 'ad', 'incidencia': 1}, {'aresta': 'af', 'incidencia': 1}, {'aresta': 'bd', 'incidencia': 0}, {'aresta': 'be', 'incidencia': 0}, {'aresta': 'cf', 'incidencia': 0}, {'aresta': 'de', 'incidencia': 0}, {'aresta': 'df', 'incidencia': 0}]}, {'b': [{'aresta': 'ac... |
#!/bin/python
def insertNewElement(ar, pos):
e = ar[pos]
idx = pos - 1
while idx >=0 and ar[idx] > e:
ar[idx+1] = ar[idx]
idx -= 1
ar[idx+1] = e
def insertionSort(ar):
if len(ar) <= 1:
return
for pos in range(1, len(ar)):
insertNewElement(ar, pos)
print('... | def insert_new_element(ar, pos):
e = ar[pos]
idx = pos - 1
while idx >= 0 and ar[idx] > e:
ar[idx + 1] = ar[idx]
idx -= 1
ar[idx + 1] = e
def insertion_sort(ar):
if len(ar) <= 1:
return
for pos in range(1, len(ar)):
insert_new_element(ar, pos)
print(' '.j... |
Sys_User_Name = "EthanWayne"
Sys_Password = "123456"
User_Name = input("Please enter your name: ")
User_Password = input("Please enter your password: ")
if User_Name != Sys_User_Name and User_Password == Sys_Password:
print("Wrong user name...")
elif User_Name == Sys_User_Name and User_Password != Sys_Password:... | sys__user__name = 'EthanWayne'
sys__password = '123456'
user__name = input('Please enter your name: ')
user__password = input('Please enter your password: ')
if User_Name != Sys_User_Name and User_Password == Sys_Password:
print('Wrong user name...')
elif User_Name == Sys_User_Name and User_Password != Sys_Password... |
def to_method(view, **base_kwargs):
"""Convert view function to instance method
"""
def _view(self, request, *args, **kwargs):
_kwargs = base_kwargs.copy()
_kwargs.update(kwargs)
return view(request, *args, **_kwargs)
return _view
| def to_method(view, **base_kwargs):
"""Convert view function to instance method
"""
def _view(self, request, *args, **kwargs):
_kwargs = base_kwargs.copy()
_kwargs.update(kwargs)
return view(request, *args, **_kwargs)
return _view |
"""
T: O(N)
S: O(N)
Walk down the tree and calculate all created binary numbers. Calculating the
next number is as simple as shifting previous left(multiplying by two) and
adding additional digit to the end using OR.
"""
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
... | """
T: O(N)
S: O(N)
Walk down the tree and calculate all created binary numbers. Calculating the
next number is as simple as shifting previous left(multiplying by two) and
adding additional digit to the end using OR.
"""
class Treenode:
def __init__(self, x):
self.val = x
self.left = None
... |
#
# PySNMP MIB module IP-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/IP-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:17:37 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( OctetString, I... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
fin = open("input_18.txt")
digits = '1234567890'
def end_of_operand(text):
if text[0] == '(':
plevel = 1
for i, char in enumerate(text[1:], 1):
if char == '(':
plevel += 1
elif char == ')':
plevel += -1
if plevel == 0:
... | fin = open('input_18.txt')
digits = '1234567890'
def end_of_operand(text):
if text[0] == '(':
plevel = 1
for (i, char) in enumerate(text[1:], 1):
if char == '(':
plevel += 1
elif char == ')':
plevel += -1
if plevel == 0:
... |
"""Constants for EQ3 Bluetooth Smart Radiator Valves."""
PRESET_PERMANENT_HOLD = "permanent_hold"
PRESET_NO_HOLD = "no_hold"
PRESET_OPEN = "open"
PRESET_CLOSED = "closed"
| """Constants for EQ3 Bluetooth Smart Radiator Valves."""
preset_permanent_hold = 'permanent_hold'
preset_no_hold = 'no_hold'
preset_open = 'open'
preset_closed = 'closed' |
"""
Question:
Given an array of integers nums and integer k, return the total number of continuous subarrays whose sum equals to k.
nums = [1,-2,1,2,1,1] k =3
nums = [1,-2,1,2,1,1] k = 3
nums[i:j]
"""
def sub_array_sum(nums, k):
n = len(nums)
res = 0
for i in range(n-1):
cum_sum = nums[i]
... | """
Question:
Given an array of integers nums and integer k, return the total number of continuous subarrays whose sum equals to k.
nums = [1,-2,1,2,1,1] k =3
nums = [1,-2,1,2,1,1] k = 3
nums[i:j]
"""
def sub_array_sum(nums, k):
n = len(nums)
res = 0
for i in range(n - 1):
cum_sum = nums[i]
... |
class DeleteDeniedException(Exception):
pass
class FileBrowser(object):
pass
| class Deletedeniedexception(Exception):
pass
class Filebrowser(object):
pass |
"""This problem was asked by Google.
You are writing an AI for a 2D map game. You are somewhere in a 2D grid,
and there are coins strewn about over the map.
Given the position of all the coins and your current position,
find the closest coin to you in terms of Manhattan distance.
That is, you can move around up, d... | """This problem was asked by Google.
You are writing an AI for a 2D map game. You are somewhere in a 2D grid,
and there are coins strewn about over the map.
Given the position of all the coins and your current position,
find the closest coin to you in terms of Manhattan distance.
That is, you can move around up, d... |
'''
Fox and Snake
String Output
'''
n, m = list(map(int, input().split(' ')))
for i in range(n):
if i % 2 == 0:
print('#'*m)
elif (i+1) % 4 == 0:
print('#'+'.'*(m-1))
else:
print('.'*(m-1)+'#')
| """
Fox and Snake
String Output
"""
(n, m) = list(map(int, input().split(' ')))
for i in range(n):
if i % 2 == 0:
print('#' * m)
elif (i + 1) % 4 == 0:
print('#' + '.' * (m - 1))
else:
print('.' * (m - 1) + '#') |
#
# PySNMP MIB module Unisphere-Data-ATM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-ATM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:23:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
"""
1152. Analyze User Website Visit Pattern
Medium
We are given some website visits: the user with name username[i] visited the website website[i] at time timestamp[i].
A 3-sequence is a list of websites of length 3 sorted in ascending order by the time of their visits. (The websites in a 3-sequence are not necessa... | """
1152. Analyze User Website Visit Pattern
Medium
We are given some website visits: the user with name username[i] visited the website website[i] at time timestamp[i].
A 3-sequence is a list of websites of length 3 sorted in ascending order by the time of their visits. (The websites in a 3-sequence are not necessa... |
filepath = "List of alternative rock artists - Wikipedia.html"
classifiedAs = "alternative rock"
file = open(filepath)
outputLines = []
for line in file:
if "</a></li>" in line:
outputLine = line.split("</a></li>")[0].split(">").pop() + " - " + classifiedAs
outputLines.append(outputLine)
... | filepath = 'List of alternative rock artists - Wikipedia.html'
classified_as = 'alternative rock'
file = open(filepath)
output_lines = []
for line in file:
if '</a></li>' in line:
output_line = line.split('</a></li>')[0].split('>').pop() + ' - ' + classifiedAs
outputLines.append(outputLine)
file.clo... |
def flatten_dict(nested_dict, sep=None):
"""
flatten_dict flattens a dictionary,
The flattened keys are joined using a separater which is default to '__'.
:param nested_dict: input nested dictionary to be flattened.
:type nested_dict: dict
:param sep: seperator for the joined keys, defaults to... | def flatten_dict(nested_dict, sep=None):
"""
flatten_dict flattens a dictionary,
The flattened keys are joined using a separater which is default to '__'.
:param nested_dict: input nested dictionary to be flattened.
:type nested_dict: dict
:param sep: seperator for the joined keys, defaults to... |
class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
values = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
res, prev = 0, 0
for c in reversed(s.upper()):
res += +values[c] if values[c] >= prev else ... | class Solution(object):
def roman_to_int(self, s):
"""
:type s: str
:rtype: int
"""
values = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
(res, prev) = (0, 0)
for c in reversed(s.upper()):
res += +values[c] if values[c] >= pre... |
N = int(input())
result = 0
for i in range(1, N + 1, 2):
t = 0
for j in range(1, i + 1):
if i % j == 0:
t += 1
if t == 8:
result += 1
print(result)
| n = int(input())
result = 0
for i in range(1, N + 1, 2):
t = 0
for j in range(1, i + 1):
if i % j == 0:
t += 1
if t == 8:
result += 1
print(result) |
# -*- coding: utf-8 -*-
class Optimizer(object):
def __init__(self, parameters, lr=0.01):
self.parameters = parameters
self.lr = lr
def step(self):
raise NotImplementedError
def zero_grad(self):
for param in self.parameters:
param.zero_grad()
| class Optimizer(object):
def __init__(self, parameters, lr=0.01):
self.parameters = parameters
self.lr = lr
def step(self):
raise NotImplementedError
def zero_grad(self):
for param in self.parameters:
param.zero_grad() |
a = rtdpy.Ncstr(tau=1, n=2, dt=.001, time_end=10)
b = rtdpy.Pfr(tau=3, dt=.001, time_end=10)
c = rtdpy.Elist([a, b])
plt.plot(c.time, c.exitage)
plt.xlabel('Time')
plt.ylabel('Exit Age Function')
plt.title('Combined RTD Model') | a = rtdpy.Ncstr(tau=1, n=2, dt=0.001, time_end=10)
b = rtdpy.Pfr(tau=3, dt=0.001, time_end=10)
c = rtdpy.Elist([a, b])
plt.plot(c.time, c.exitage)
plt.xlabel('Time')
plt.ylabel('Exit Age Function')
plt.title('Combined RTD Model') |
"""
Write a Python program to display the examination schedule. (extract the date from exam_st_date).
exam_st_date = (11, 12, 2014)
Sample Output : The examination will start from : 11 / 12 / 2014
"""
exam_st_date = (11, 12, 2014)
print("The examination will start from:",'{}/{}/{}'.format(exam_st_date[0],exam_st_date[1... | """
Write a Python program to display the examination schedule. (extract the date from exam_st_date).
exam_st_date = (11, 12, 2014)
Sample Output : The examination will start from : 11 / 12 / 2014
"""
exam_st_date = (11, 12, 2014)
print('The examination will start from:', '{}/{}/{}'.format(exam_st_date[0], exam_st_date... |
#!/usr/bin/env python
#
# (c) Copyright Rosetta Commons Member Institutions.
# (c) This file is part of the Rosetta software suite and is made available under license.
# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
# (c) For more information, see http://www.rosettacommons.or... | class Definitions:
def __init__(self):
self.restypes = ('All', 'Charged', 'Positive', 'Negative', 'Non-Polar', 'Polar-Uncharged', 'Polar', 'Aromatic', 'Hydroxyl', 'Conserved', 'etc')
self.restype_info = dict()
self.resinfo = dict()
self.set_mutation_info()
self.set_residue_i... |
tipos_de_classes = {
(1, 'Economica'),
(2, 'Executiva'),
(3, 'Primeira classe')
} | tipos_de_classes = {(1, 'Economica'), (2, 'Executiva'), (3, 'Primeira classe')} |
#
# PySNMP MIB module JUNIPER-JS-IF-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-JS-IF-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:59:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ... |
while True:
n = int(input())
if n == 0:
break
arr = []
for i in range(n):
word = input()
arr.append(word)
flag = 0
for i in range(len(arr)):
for j in range(i+1, len(arr)):
if arr[j].startswith(arr[i]):
flag = 1
if flag ... | while True:
n = int(input())
if n == 0:
break
arr = []
for i in range(n):
word = input()
arr.append(word)
flag = 0
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
if arr[j].startswith(arr[i]):
flag = 1
if flag == 1:
... |
#
# PySNMP MIB module HP-MEMPROC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-MEMPROC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:23:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
a = 0 # FIRST, set the initial value of the variable a to 0(zero).
while a < 10: # While the value of the variable a is less than 10 do the following:
a = a + 1 # Increase the value of the variable a by 1, as in: a = a + 1!
print(a) # Print to screen what the present value of the variable a... | a = 0
while a < 10:
a = a + 1
print(a) |
'''Fdb Genie Ops Object Outputs for IOSXE.'''
class FdbOutput(object):
ShowMacAddressTable = {
"mac_table": {
"vlans": {
'100': {
"mac_addresses": {
"ecbd.1d09.5689": {
"drop": {
... | """Fdb Genie Ops Object Outputs for IOSXE."""
class Fdboutput(object):
show_mac_address_table = {'mac_table': {'vlans': {'100': {'mac_addresses': {'ecbd.1d09.5689': {'drop': {'drop': True, 'entry_type': 'dynamic'}, 'mac_address': 'ecbd.1d09.5689'}, '3820.5672.fc03': {'interfaces': {'Port-channel12': {'interface': ... |
config = {
'SECRET_CAPTCHA_KEY': 'CHANGEME - 40 or 50 character long key here',
'METHOD': 'pbkdf2:sha256:100',
'CAPTCHA_LENGTH': 5,
'CAPTCHA_DIGITS': False
}
| config = {'SECRET_CAPTCHA_KEY': 'CHANGEME - 40 or 50 character long key here', 'METHOD': 'pbkdf2:sha256:100', 'CAPTCHA_LENGTH': 5, 'CAPTCHA_DIGITS': False} |
class Node:
def __init__(self, data=None, next_node=None):
self.data = data
self.next_node = next_node
def __str__(self):
return Node.pretty_string(self)
@staticmethod
def list_to_LL(L):
"""
Converts the given Python list into a linked list.
"""
... | class Node:
def __init__(self, data=None, next_node=None):
self.data = data
self.next_node = next_node
def __str__(self):
return Node.pretty_string(self)
@staticmethod
def list_to_ll(L):
"""
Converts the given Python list into a linked list.
"""
... |
class Navio:
def __init__(self, nome, tamanho, direcao):
self.nome = nome
self.tamanho = tamanho
self.direcao = direcao | class Navio:
def __init__(self, nome, tamanho, direcao):
self.nome = nome
self.tamanho = tamanho
self.direcao = direcao |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.