content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def findMaxLength(self, nums):
count = 0
map = {0:-1}
maxlen = 0
for i, number in enumerate(nums):
if number:
count += 1
else:
count -= 1
if count in map:
maxlen = max(maxlen, (i-ma... | class Solution:
def find_max_length(self, nums):
count = 0
map = {0: -1}
maxlen = 0
for (i, number) in enumerate(nums):
if number:
count += 1
else:
count -= 1
if count in map:
maxlen = max(maxlen, i ... |
def ComesBefore(n, lines):
result = []
s = str(n)
for line in lines:
position = line.find(s)
if position > 0:
for d in range(0,position):
c = int(line[d])
if c not in result:
result.append(c)
result.sort()
return result
... | def comes_before(n, lines):
result = []
s = str(n)
for line in lines:
position = line.find(s)
if position > 0:
for d in range(0, position):
c = int(line[d])
if c not in result:
result.append(c)
result.sort()
return resul... |
courts = [
{
"name": "United Kingdom Supreme Court",
"href": "/judgments/advanced_search?court=uksc",
"years": "2014 – 2022",
},
{
"name": "Privy Council",
"href": "/judgments/advanced_search?court=ukpc",
"years": "2014 – 2022",
},
{
... | courts = [{'name': 'United Kingdom Supreme Court', 'href': '/judgments/advanced_search?court=uksc', 'years': '2014 – 2022'}, {'name': 'Privy Council', 'href': '/judgments/advanced_search?court=ukpc', 'years': '2014 – 2022'}, {'name': 'Court of Appeal Civil Division', 'href': '/judgments/advanced_search?cour... |
########################################
# User Processing Server configuration #
########################################
core_session_type = 'Memory'
core_coordinator_db_username = 'weblab'
core_coordinator_db_password = 'weblab'
weblab_db_username = 'weblab'
weblab_db_password = 'weblab'
core_coordinator_laborat... | core_session_type = 'Memory'
core_coordinator_db_username = 'weblab'
core_coordinator_db_password = 'weblab'
weblab_db_username = 'weblab'
weblab_db_password = 'weblab'
core_coordinator_laboratory_servers = {'laboratory:main_instance@main_machine': {'exp1|ud-dummy|Dummy experiments': 'dummy@dummy', 'exp1|javadummy|Dumm... |
#!/usr/bin/python3
# -*- coding: utf8 -*-
# Default settings screen
screen = {
"screensize": "1920x1080",
"fullscreen": False,
"title": "Python Project",
"resizable": {"height": True, "width": True},
}
# True is use default template in first
default_template = True
# set time refresh in ms
refresh = ... | screen = {'screensize': '1920x1080', 'fullscreen': False, 'title': 'Python Project', 'resizable': {'height': True, 'width': True}}
default_template = True
refresh = 200 |
class WigikiError(Exception):
pass
class WigikiConfigError(WigikiError):
def __init__(self, msg=None):
self.code = 2
self.msg = msg or "Configuration error, try the --help switch"
def __str__(self):
return self.msg
class WigikiParserError(WigikiError):
def __init__(self, msg... | class Wigikierror(Exception):
pass
class Wigikiconfigerror(WigikiError):
def __init__(self, msg=None):
self.code = 2
self.msg = msg or 'Configuration error, try the --help switch'
def __str__(self):
return self.msg
class Wigikiparsererror(WigikiError):
def __init__(self, msg... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 2 22:04:55 2021
@author: aboisvert
"""
#%% Day 3
"""
The submarine has been making some odd creaking noises, so you ask it to produce a diagnostic report just in case.
The diagnostic report (your puzzle input) consists of a list of binary number... | """
Created on Thu Dec 2 22:04:55 2021
@author: aboisvert
"""
'\nThe submarine has been making some odd creaking noises, so you ask it to produce a diagnostic report just in case.\n\nThe diagnostic report (your puzzle input) consists of a list of binary numbers which, when decoded properly, can tell you many useful t... |
# Copyright Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" fil... | slow = True
expected_pipeline_names = ['zeta', '0', '00', '01', '1', 'Beta', 'alpha', 'beta', 'beta1', 'beta2', 'betaa', 'delta', 'epsilon', 'gamma']
def get_init_args():
return {'kwargs': {'project': 'sorted_pipeline_names'}}
def get_jobs():
jobs = []
jobs.append({'kwargs': {'command': '/usr/bin/false', ... |
settings = {
'DB_HOST': '[RDS_ID_DATABASE].[AWS_REGION].rds.amazonaws.com',
'DB_USER': 'teste',
'DB_NAME': 'teste',
'DB_PASSWORD':'my_password'
} | settings = {'DB_HOST': '[RDS_ID_DATABASE].[AWS_REGION].rds.amazonaws.com', 'DB_USER': 'teste', 'DB_NAME': 'teste', 'DB_PASSWORD': 'my_password'} |
# LONE_SUM
def lone_sum(a, b, c):
if a==b: return 0 if b==c else c
elif b==c: return 0 if a==c else a
elif a==c: return 0 if b==c else b
else: return a+b+c | def lone_sum(a, b, c):
if a == b:
return 0 if b == c else c
elif b == c:
return 0 if a == c else a
elif a == c:
return 0 if b == c else b
else:
return a + b + c |
#
# PySNMP MIB module ELFIQ-INC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELFIQ-INC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:45:14 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... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
class A:
def bestaande_functie():
pass
A.bestaande_functie()
| class A:
def bestaande_functie():
pass
A.bestaande_functie() |
def open_chrome():
opts = Options()
# # opts.add_argument('headless')
# chrome_options = Options()
# chrome_options.binary_location = os.environ['GOOGLE_CHROME_BIN']
# chrome_options.add_argument('--disable-gpu')
# chrome_options.add_argument('--no-sandbox')
# browser = Chrome(executable_pat... | def open_chrome():
opts = options()
browser = chrome(os.path.join(os.getcwd(), 'chromedriver'), options=opts)
return browser
def open_loan_payment_calc(browser):
browser.get('https://studentloanhero.com/calculators/student-loan-payment-calculator/')
balance = browser.find_element_by_xpath("//input[... |
S = input()
K = 'oda' if S == 'yukiko' else 'yukiko'
B = [input() for _ in range(8)]
print(S if sum(len([x for x in row if x in 'bw']) for row in B) % 2 == 0 else K)
| s = input()
k = 'oda' if S == 'yukiko' else 'yukiko'
b = [input() for _ in range(8)]
print(S if sum((len([x for x in row if x in 'bw']) for row in B)) % 2 == 0 else K) |
# Problem: https://www.hackerrank.com/challenges/string-validators/problem
# Score: 10
s = input()
print(any([char.isalnum() for char in s]))
print(any([char.isalpha() for char in s]))
print(any([char.isdigit() for char in s]))
print(any([char.islower() for char in s]))
print(any([char.isupper() for char in s]))
| s = input()
print(any([char.isalnum() for char in s]))
print(any([char.isalpha() for char in s]))
print(any([char.isdigit() for char in s]))
print(any([char.islower() for char in s]))
print(any([char.isupper() for char in s])) |
# coding=utf-8
# Author: Han
# Question: 313. Super Ugly Number
# Date: 2017-03-09
# Complexity: O(N) O(N)
class Solution(object):
def nthSuperUglyNumber(self, n, primes):
"""
:type n: int
:type primes: List[int]
:rtype: int
"""
ugly = [1]
iprime = [0] * le... | class Solution(object):
def nth_super_ugly_number(self, n, primes):
"""
:type n: int
:type primes: List[int]
:rtype: int
"""
ugly = [1]
iprime = [0] * len(primes)
while len(ugly) < n:
for (i, p) in enumerate(primes):
while ... |
class Solution:
def XXX(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
results = []
self.__XXX(nums, 0, [], results)
return results
def __XXX(self, nums, i, subset, results):
results.append(subset)
... | class Solution:
def xxx(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
results = []
self.__XXX(nums, 0, [], results)
return results
def __xxx(self, nums, i, subset, results):
results.append(subset)
for i in range(i, le... |
class BOOL:
""" Boolean container -- supports global boolean variables """
def __init__(self, v: bool) -> None:
self.v = v
def __bool__(self):
return self.v
def __str__(self):
return str(self.v)
GLOBAL_STRICT = BOOL(True)
def strict() -> bool:
""" Switch to global st... | class Bool:
""" Boolean container -- supports global boolean variables """
def __init__(self, v: bool) -> None:
self.v = v
def __bool__(self):
return self.v
def __str__(self):
return str(self.v)
global_strict = bool(True)
def strict() -> bool:
""" Switch to global strict... |
class Solution(object):
def shortestPalindrome(self, s):
"""
:type s: str
:rtype: str
"""
"""
Find the max length of palindom start from 0, and add the reverse part in the previous
The smartest way to solve this problem is combine kmp and reverse
... | class Solution(object):
def shortest_palindrome(self, s):
"""
:type s: str
:rtype: str
"""
'\n Find the max length of palindom start from 0, and add the reverse part in the previous\n \n The smartest way to solve this problem is combine kmp and reverse\n... |
""" Lab 04 """
this_file = __file__
def skip_add(n):
""" Takes a number n and returns n + n-2 + n-4 + n-6 + ... + 0.
>>> skip_add(5) # 5 + 3 + 1 + 0
9
>>> skip_add(10) # 10 + 8 + 6 + 4 + 2 + 0
30
>>> # Do not use while/for loops!
>>> from construct_check import check
>>> # ban itera... | """ Lab 04 """
this_file = __file__
def skip_add(n):
""" Takes a number n and returns n + n-2 + n-4 + n-6 + ... + 0.
>>> skip_add(5) # 5 + 3 + 1 + 0
9
>>> skip_add(10) # 10 + 8 + 6 + 4 + 2 + 0
30
>>> # Do not use while/for loops!
>>> from construct_check import check
>>> # ban iterati... |
AUTH_BASIC_LOGIN = '/users/login'
AUTH_LOGOUT = '/users/logout'
AUTH_STEP_START = '/auth/login/multi_step/start'
AUTH_STEP_CHECK_LOGIN = '/auth/login/multi_step/check_login'
AUTH_STEP_CHECK_PASSWORD = '/auth/login/multi_step/commit_pwd'
AUTH_STEP_FINISH = '/auth/login/multi_step/finish'
PASSWD_START = '/auth/restore_... | auth_basic_login = '/users/login'
auth_logout = '/users/logout'
auth_step_start = '/auth/login/multi_step/start'
auth_step_check_login = '/auth/login/multi_step/check_login'
auth_step_check_password = '/auth/login/multi_step/commit_pwd'
auth_step_finish = '/auth/login/multi_step/finish'
passwd_start = '/auth/restore_pw... |
class Solution:
def canConstruct(self, s: str, k: int) -> bool:
digit_count = {}
if len(s) < k:
return False
elif len(s) == k:
return True
else:
odd = 0
for i in set(s):
digit_count[i] = s.count(i)
... | class Solution:
def can_construct(self, s: str, k: int) -> bool:
digit_count = {}
if len(s) < k:
return False
elif len(s) == k:
return True
else:
odd = 0
for i in set(s):
digit_count[i] = s.count(i)
for i in... |
class can_id:
def __init__ (self, can_id, description, attributes):
self.can_id = can_id.upper()
self.pgn = self.get_pgn(can_id)
self.description = description
self.attributes = attributes
def get_pgn(self, can_id):
if(can_id[2].upper() == 'E'):
return int(can_id[2:4], 16)
else:
return int(can_id[... | class Can_Id:
def __init__(self, can_id, description, attributes):
self.can_id = can_id.upper()
self.pgn = self.get_pgn(can_id)
self.description = description
self.attributes = attributes
def get_pgn(self, can_id):
if can_id[2].upper() == 'E':
return int(can... |
# Copyright 2015 Rackspace US, Inc.
#
# 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 wri... | """Fastfood package attributes and metadata."""
__all__ = ('__title__', '__summary__', '__author__', '__email__', '__version__', '__license__', '__copyright__', '__url__')
__title__ = 'fastfood'
__summary__ = 'Chef Cookbook Wizardry'
__author__ = 'Rackers'
__email__ = 'samuel.stavinoha@rackspace.com'
__version__ = '1.1... |
class LyricsNotFoundError(Exception):
pass
class ExistingLyricsError(Exception):
pass
class UnsupportedTypeError(Exception):
pass
class UnknownTypeError(Exception):
pass | class Lyricsnotfounderror(Exception):
pass
class Existinglyricserror(Exception):
pass
class Unsupportedtypeerror(Exception):
pass
class Unknowntypeerror(Exception):
pass |
"""Day 16: Dragon Checksum
https://adventofcode.com/2016/day/16
"""
def dragon_step(a):
"""
Call the data you have at this point "a".
Make a copy of "a"; call this copy "b".
Reverse the order of the characters in "b".
In "b", replace all instances of 0 with 1 and all 1s with 0.
The resulting ... | """Day 16: Dragon Checksum
https://adventofcode.com/2016/day/16
"""
def dragon_step(a):
"""
Call the data you have at this point "a".
Make a copy of "a"; call this copy "b".
Reverse the order of the characters in "b".
In "b", replace all instances of 0 with 1 and all 1s with 0.
The resulting ... |
def Hypno(thoughts, eyes, eye, tongue):
return f"""
{thoughts}
___ _--_
/ - / \\
( {eyes} \\ ( {eyes} )
| {eyes} _;\\-/| {eyes} _|
\\___/######\\___/\\
/##############\\
/ ###### ## #|
/ ##@##@## |
/ ###### ## \\
<______-------___\\ ... | def hypno(thoughts, eyes, eye, tongue):
return f"\n {thoughts}\n ___ _--_\n / - / \\\n ( {eyes} \\ ( {eyes} )\n | {eyes} _;\\-/| {eyes} _|\n \\___/######\\___/\\\n /##############\\\n / ###### ## #|\n / ##@##@## |\n / ###### ## \\\n <______---... |
# https://wiki.haskell.org/99_questions/Solutions/39
# Finding prime numbers in a range. (Using Sieve of Eratosthenes)
#
# Author: Bedir Tapkan
def sieve_of_eratosthenes(n):
"""
Sieve of Eratosthenes implementation
"""
primes = [True] * (n + 1)
primes[0] = False
primes[1] = False
results = ... | def sieve_of_eratosthenes(n):
"""
Sieve of Eratosthenes implementation
"""
primes = [True] * (n + 1)
primes[0] = False
primes[1] = False
results = []
for i in range(2, int(n ** 0.5) + 1):
if primes[i]:
results.append(i)
for j in range(i * i, n + 1, i):
... |
def lambda_handler(event, context):
if 'Arg1' not in event or 'Arg2' not in event:
raise ValueError("Missing Argument")
else:
return "%s: %s" % (event['Arg1'],event['Arg2']) | def lambda_handler(event, context):
if 'Arg1' not in event or 'Arg2' not in event:
raise value_error('Missing Argument')
else:
return '%s: %s' % (event['Arg1'], event['Arg2']) |
'''
Created on Jan 14, 2016
@author: Dave
This module does not actually *do* anything. It just gives an import hook, so that we can find the
package location in the filesystem.
'''
| """
Created on Jan 14, 2016
@author: Dave
This module does not actually *do* anything. It just gives an import hook, so that we can find the
package location in the filesystem.
""" |
input_data = open("output", 'rb').read()
input_data = input_data[0x2c:]
flag = ""
for i in range(0, len(input_data), 2):
flag += str(1 - input_data[i + 1] & 0x1)
flag += str(1 - input_data[i] & 0x1)
print(bytes.fromhex(hex(int(flag[:216], 2))[2:])) | input_data = open('output', 'rb').read()
input_data = input_data[44:]
flag = ''
for i in range(0, len(input_data), 2):
flag += str(1 - input_data[i + 1] & 1)
flag += str(1 - input_data[i] & 1)
print(bytes.fromhex(hex(int(flag[:216], 2))[2:])) |
# Author: Elaine Laguerta
# Date: 11 March 2020
# Description: Portfolio project for CS162 W2020.
# Implements a two-player version of Xiangqi, Chinese chess.
# Supports checking for legal moves based on specific piece type, and disallows moves that place one's self in check.
# Supports stalemate and checkmate endgames... | class Xiangqigame:
""" Creates Xiangqi Games
Language note: 'side' refers to a player side of interest, and is string that may be 'red' or 'black'.
'player' is used to refer to Player objects."""
def __init__(self):
self._board = board()
self._red_player = player('red', self._board)
... |
COIN_STPT = "STPT"
COIN_MXN = "MXN"
COIN_UGX = "UGX"
COIN_RENBTC = "RENBTC"
COIN_GLM = "GLM"
COIN_NEAR = "NEAR"
COIN_AUDIO = "AUDIO"
COIN_HNT = "HNT"
COIN_ADADOWN = "ADADOWN"
COIN_CDT = "CDT"
COIN_SPARTA = "SPARTA"
COIN_SUSD = "SUSD"
COIN_AION = "AION"
COIN_NPXS = "NPXS"
COIN_DGB = "DGB"
COIN_ZRX = "ZRX"
COIN_BCD = "BC... | coin_stpt = 'STPT'
coin_mxn = 'MXN'
coin_ugx = 'UGX'
coin_renbtc = 'RENBTC'
coin_glm = 'GLM'
coin_near = 'NEAR'
coin_audio = 'AUDIO'
coin_hnt = 'HNT'
coin_adadown = 'ADADOWN'
coin_cdt = 'CDT'
coin_sparta = 'SPARTA'
coin_susd = 'SUSD'
coin_aion = 'AION'
coin_npxs = 'NPXS'
coin_dgb = 'DGB'
coin_zrx = 'ZRX'
coin_bcd = 'BC... |
# Using python list
def add_one(nums):
carry = 1
for num in nums:
sums, carry = (num+carry)%10, (num+carry)//10
nums[-1] = sums
if carry == 0:
return nums
if carry == 1:
return [1] + nums
# Using linked list
def add_one(head):
# Reverse
rev_head = re... | def add_one(nums):
carry = 1
for num in nums:
(sums, carry) = ((num + carry) % 10, (num + carry) // 10)
nums[-1] = sums
if carry == 0:
return nums
if carry == 1:
return [1] + nums
def add_one(head):
rev_head = reverse(head)
tail = rev_head
while tail:... |
#!/usr/bin/env python
#
# Given 2 sorted lists, merge them in sequential order using least
# number of iterations/compute power.
#
l1 = [1, 3, 6, 7, 15, 22]
l2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100]
len1 = len(l1)
len2 = len(l2)
i,j = 0, 0
merged = []
while i < len1 and j < len2:
if l1[i] < l2[j]:
if l1... | l1 = [1, 3, 6, 7, 15, 22]
l2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100]
len1 = len(l1)
len2 = len(l2)
(i, j) = (0, 0)
merged = []
while i < len1 and j < len2:
if l1[i] < l2[j]:
if l1[i] not in merged:
merged.append(l1[i])
i += 1
else:
if l2[j] not in merged:
merged.ap... |
class Cuid(str):
# de.arago.graphit.server.api.graph.GraphIdGenerator
# https://github.com/ericelliott/cuid
# https://github.com/prisma/cuid-java
# https://github.com/necaris/cuid.py
@property
def valid(self) -> bool:
if self.identifier != 'c':
raise ValueError(f"""Expected ... | class Cuid(str):
@property
def valid(self) -> bool:
if self.identifier != 'c':
raise value_error(f"Expected first char 'c'; got '{self.identifier}'")
if len(self) != 25:
raise value_error(f'Expected len() == 25; got {len(self)}')
if not self.isascii():
... |
'''
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Note:
Division between two integers should truncate toward zero.
The given RPN expression is always valid. That means the expression... | """
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Note:
Division between two integers should truncate toward zero.
The given RPN expression is always valid. That means the expression... |
{
"targets": [
{
"target_name": "modexp_postbuild",
"dependencies": ["modexp"],
"conditions": [
['OS=="win"', {
'copies': [{
'destination': '<(PRODUCT_DIR)',
'files': [
'<(module_root_dir)/openssl-1.1.1g-win64-mingw/libcrypto-1_1-x64.dll',
... | {'targets': [{'target_name': 'modexp_postbuild', 'dependencies': ['modexp'], 'conditions': [['OS=="win"', {'copies': [{'destination': '<(PRODUCT_DIR)', 'files': ['<(module_root_dir)/openssl-1.1.1g-win64-mingw/libcrypto-1_1-x64.dll']}]}]]}, {'target_name': 'modexp', 'sources': ['modexp.cc'], 'cflags!': ['-fno-exceptions... |
'''
| Write a program to input 3 sides of a triangle and prints whether it is an equilateral, isosceles or scale triangle |
|---------------------------------------------------------------------------------------------------------------------|
| Boolean comparision ... | """
| Write a program to input 3 sides of a triangle and prints whether it is an equilateral, isosceles or scale triangle |
|---------------------------------------------------------------------------------------------------------------------|
| Boolean comparision ... |
"""Convert ABNF grammars to Python regular expressions."""
# Do not forget to update in setup.py!
__version__ = "1.0.0"
__author__ = "Marko Ristin"
__license__ = "License :: OSI Approved :: MIT License"
__status__ = "Production/Stable"
| """Convert ABNF grammars to Python regular expressions."""
__version__ = '1.0.0'
__author__ = 'Marko Ristin'
__license__ = 'License :: OSI Approved :: MIT License'
__status__ = 'Production/Stable' |
print(dict([(1, "foo")]))
d = dict([("foo", "foo2"), ("bar", "baz")])
print(sorted(d.keys()))
print(sorted(d.values()))
try:
dict(((1,),))
except ValueError:
print("ValueError")
try:
dict(((1, 2, 3),))
except ValueError:
print("ValueError")
| print(dict([(1, 'foo')]))
d = dict([('foo', 'foo2'), ('bar', 'baz')])
print(sorted(d.keys()))
print(sorted(d.values()))
try:
dict(((1,),))
except ValueError:
print('ValueError')
try:
dict(((1, 2, 3),))
except ValueError:
print('ValueError') |
"""An unofficial Python wrapper for the OKEx exchange API v3
.. moduleauthor:: gx_wind
"""
| """An unofficial Python wrapper for the OKEx exchange API v3
.. moduleauthor:: gx_wind
""" |
instructions = [
[[6, 6, 6, 6, 1, 1, 1, 1, 1, 6, 6, 6, 2, 2, 2, 2],
[6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 6, 6, 2, 2, 2, 2],
[6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 6, 6, 2, 2, 2],
[6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 2],
[6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 2],
[6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6],
[6... | instructions = [[[6, 6, 6, 6, 1, 1, 1, 1, 1, 6, 6, 6, 2, 2, 2, 2], [6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 6, 6, 2, 2, 2, 2], [6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 6, 6, 2, 2, 2], [6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 2], [6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 2], [6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6], [6,... |
'''CORES NO TERMINAL using the standard ANSI >>> Example "/033[0:30:40m"
STYLE:
0 = None;
1 = Bold;
4 = Underline;
7 = Negative.
TEXT COLOR:
30 = White;
31 = Red;
32 = Green;
33 = Yellow;
34 = Blue;
35 = Purple;
36 = Agua;
37 = Gray.
BACK COLOR:
40 = White;
41 = R... | """CORES NO TERMINAL using the standard ANSI >>> Example "/033[0:30:40m"
STYLE:
0 = None;
1 = Bold;
4 = Underline;
7 = Negative.
TEXT COLOR:
30 = White;
31 = Red;
32 = Green;
33 = Yellow;
34 = Blue;
35 = Purple;
36 = Agua;
37 = Gray.
BACK COLOR:
40 = White;
41 = R... |
description = 'presets for the detector position'
group = 'configdata'
# Assigns presets for the detector z position and x/y displacement of the
# beamstop for each selector preset.
#
# When you add a new detector z position, make sure to add a real offset as
# well in the DETECTOR_OFFSETS table below.
FIXED_X = 0.0
... | description = 'presets for the detector position'
group = 'configdata'
fixed_x = 0.0
fixed_x_tilt = 16.0
fixed_y = 520.0
detector_presets = {'2.9A tilt': {'1.5m': dict(z=1.5, x=FIXED_X, y=FIXED_Y), '1.5m DB': dict(z=1.5, x=FIXED_X, y=500.0), '2m': dict(z=2, x=FIXED_X, y=FIXED_Y), '4m': dict(z=4, x=FIXED_X, y=FIXED_Y), ... |
def sum_dicts(
*dict_arguments
) -> dict:
result = {}
for dict_argument in dict_arguments:
for key, value in dict_argument.items():
if key not in result:
result[key] = []
result[key].append(value)
for key, value in result.items():
if len(value) =... | def sum_dicts(*dict_arguments) -> dict:
result = {}
for dict_argument in dict_arguments:
for (key, value) in dict_argument.items():
if key not in result:
result[key] = []
result[key].append(value)
for (key, value) in result.items():
if len(value) == 1:... |
legend = {
9: ("positive very high", "#006400"),
8: ("positive high", "#228b22"),
7: ("positive medium", "#008000"),
6: ("positive low", "#98fb98"),
1: ("no change", "#f5f5dc"),
2: ("negative low", "#ffff00"),
3: ("negative medium", "#ffa500"),
4: ("negative high", "#ff0000"),
5: ("n... | legend = {9: ('positive very high', '#006400'), 8: ('positive high', '#228b22'), 7: ('positive medium', '#008000'), 6: ('positive low', '#98fb98'), 1: ('no change', '#f5f5dc'), 2: ('negative low', '#ffff00'), 3: ('negative medium', '#ffa500'), 4: ('negative high', '#ff0000'), 5: ('negative very high', '#8b0000')} |
l1=[]
for i in range(0,3):
l2=list(map(int,input().split()))
l1.append(l2)
l3=[]
for i in range(0,3):
l3.append(l1[i][0]+l1[i][1]+l1[i][2])
for i in range(0,3):
l3.append(l1[0][i]+l1[1][i]+l1[2][i])
l3.append(l1[0][2]+l1[1][1]+l1[2][0])
c=max(l3)
j=1
while l1[0][2]+l1[1][1]+l1[2][0]!=l1[0][0]+l1[1][1]+l1[2][2... | l1 = []
for i in range(0, 3):
l2 = list(map(int, input().split()))
l1.append(l2)
l3 = []
for i in range(0, 3):
l3.append(l1[i][0] + l1[i][1] + l1[i][2])
for i in range(0, 3):
l3.append(l1[0][i] + l1[1][i] + l1[2][i])
l3.append(l1[0][2] + l1[1][1] + l1[2][0])
c = max(l3)
j = 1
while l1[0][2] + l1[1][1] +... |
class RNode:
def __eq__(self, other):
if not isinstance(other, (RNode,)):
return False
if hasattr(self, 'id') and hasattr(other, 'id'):
return self.id == other.id
| class Rnode:
def __eq__(self, other):
if not isinstance(other, (RNode,)):
return False
if hasattr(self, 'id') and hasattr(other, 'id'):
return self.id == other.id |
#Cities:
def describe_city(name, country='india'):
print(name,"is in",country+".")
describe_city('newyork','USA')
describe_city('mumbai')
describe_city(name = 'paris',country='France') | def describe_city(name, country='india'):
print(name, 'is in', country + '.')
describe_city('newyork', 'USA')
describe_city('mumbai')
describe_city(name='paris', country='France') |
def bubble_sort(vetor):
troca = False
ultimo = len(vetor)-1
while True:
for i in range(0,ultimo):
troca = False
if vetor[i]>vetor[i+1]:
print('Troca ', vetor[i], 'com ', vetor[i+1])
aux = vetor[i]
vetor[i] = vetor[i+1]
... | def bubble_sort(vetor):
troca = False
ultimo = len(vetor) - 1
while True:
for i in range(0, ultimo):
troca = False
if vetor[i] > vetor[i + 1]:
print('Troca ', vetor[i], 'com ', vetor[i + 1])
aux = vetor[i]
vetor[i] = vetor[i + 1... |
# Codes and tutorials are from: https://www.tutorialsteacher.com/python/property-function
class person:
def __init__(self):
self.__name = ''
def setname(self, name):
print('setname() called')
self.__name = name
def getname(self):
print('getname() called')
return sel... | class Person:
def __init__(self):
self.__name = ''
def setname(self, name):
print('setname() called')
self.__name = name
def getname(self):
print('getname() called')
return self.__name
name = property(getname, setname) |
def set_authorize_current_user():
pass
def check_update_order_allowed():
pass | def set_authorize_current_user():
pass
def check_update_order_allowed():
pass |
maior_idade=0
idades=[int(input("idade1:")),
int(input("idade2:")),
int(input("idade3:"))]
for idade in idades:
if idade>maior_idade:
maior_idade=idade
print("maior idade: ", maior_idade)
| maior_idade = 0
idades = [int(input('idade1:')), int(input('idade2:')), int(input('idade3:'))]
for idade in idades:
if idade > maior_idade:
maior_idade = idade
print('maior idade: ', maior_idade) |
class Http_denied(Exception):
"""
If https is denied for some reason, it will post out status code such as 404, 400, 504 etc and print out content for giving reason
"""
def __init__(self,status,content):
self.status = status
self.content = content
class Unverify_account(Exception):
... | class Http_Denied(Exception):
"""
If https is denied for some reason, it will post out status code such as 404, 400, 504 etc and print out content for giving reason
"""
def __init__(self, status, content):
self.status = status
self.content = content
class Unverify_Account(Exception):
... |
#!/usr/bin/python3
with open('input.txt') as f:
input = f.read().splitlines()
def execute(instructions):
accumulator = 0
ip = 0
ip_visited = []
while ip < len(instructions):
if ip in ip_visited:
raise Exception()
ip_visited.append(ip)
instruction = instructions[ip]
op = instruction[:3... | with open('input.txt') as f:
input = f.read().splitlines()
def execute(instructions):
accumulator = 0
ip = 0
ip_visited = []
while ip < len(instructions):
if ip in ip_visited:
raise exception()
ip_visited.append(ip)
instruction = instructions[ip]
op = ins... |
# coding: utf-8
"""
Default configuration values for service gateway package.
Copy this file, rename it if you like, then edit to keep only the values you
need to override for the keys found within.
To have the programs in the package override the values with the values
found in this file, you need to set the enviro... | """
Default configuration values for service gateway package.
Copy this file, rename it if you like, then edit to keep only the values you
need to override for the keys found within.
To have the programs in the package override the values with the values
found in this file, you need to set the environment variable na... |
def bina(n):
l1=[]
num=n
rem=0
while(num>0):
rem=num%2
num=num//2
l1.append(str(rem))
l1.reverse()
str1="".join(l1)
return str1
def octa(n):
l1=[]
num=n
rem=0
while(num!=0):
rem=num%8
num=num//8
l1.append(str(rem))
l1.rever... | def bina(n):
l1 = []
num = n
rem = 0
while num > 0:
rem = num % 2
num = num // 2
l1.append(str(rem))
l1.reverse()
str1 = ''.join(l1)
return str1
def octa(n):
l1 = []
num = n
rem = 0
while num != 0:
rem = num % 8
num = num // 8
... |
#import sys
#a=sys.stdin.read().split()
f = open("i.txt",'r')
a=f.read().split()
sum=0
t={0}#set only with value 0
while(True):
for x in a:
sum+=int(x)
if(sum in t):
print(sum)
exit()
else:
t.add(sum)
| f = open('i.txt', 'r')
a = f.read().split()
sum = 0
t = {0}
while True:
for x in a:
sum += int(x)
if sum in t:
print(sum)
exit()
else:
t.add(sum) |
def near_hundred(n):
if abs(100 - n) <= 10 or abs(200 - n) <= 10:
return True
return False
| def near_hundred(n):
if abs(100 - n) <= 10 or abs(200 - n) <= 10:
return True
return False |
PINK = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def underline(s):
return UNDERLINE + s + ENDC
def errmsg(s):
return FAIL + s + ENDC
def cyan(s):
return OKCYAN + s + ENDC
def blue... | pink = '\x1b[95m'
okblue = '\x1b[94m'
okcyan = '\x1b[96m'
okgreen = '\x1b[92m'
warning = '\x1b[93m'
fail = '\x1b[91m'
endc = '\x1b[0m'
bold = '\x1b[1m'
underline = '\x1b[4m'
def underline(s):
return UNDERLINE + s + ENDC
def errmsg(s):
return FAIL + s + ENDC
def cyan(s):
return OKCYAN + s + ENDC
def blue... |
models = {
"BODY_25": {
"path": "pose/body_25/pose_deploy.prototxt",
"body_parts": ["Nose", "Neck", "RShoulder", "RElbow", "RWrist", "LShoulder", "LElbow", "LWrist", "MidHip",
"RHip", "RKnee", "RAnkle", "LHip", "LKnee", "LAnkle", "REye", "LEye", "REar", "LEar", "LBigToe",
... | models = {'BODY_25': {'path': 'pose/body_25/pose_deploy.prototxt', 'body_parts': ['Nose', 'Neck', 'RShoulder', 'RElbow', 'RWrist', 'LShoulder', 'LElbow', 'LWrist', 'MidHip', 'RHip', 'RKnee', 'RAnkle', 'LHip', 'LKnee', 'LAnkle', 'REye', 'LEye', 'REar', 'LEar', 'LBigToe', 'LSmallToe', 'LHeel', 'RBigToe', 'RSmallToe', 'RH... |
class LogicalPlanner:
def __init__(self, operation, planning_svc, stopping_conditions=[]):
self.operation = operation
self.planning_svc = planning_svc
self.stopping_conditions = stopping_conditions
self.stopping_condition_met = False
async def execute(self, phase):
for ... | class Logicalplanner:
def __init__(self, operation, planning_svc, stopping_conditions=[]):
self.operation = operation
self.planning_svc = planning_svc
self.stopping_conditions = stopping_conditions
self.stopping_condition_met = False
async def execute(self, phase):
for ... |
b = int(input("Input the base : "))
h = int(input("Input the height : "))
area = b*h/2
print("area = ", area) | b = int(input('Input the base : '))
h = int(input('Input the height : '))
area = b * h / 2
print('area = ', area) |
def handler(event, context):
# --- Add your own custom authorization logic here. ---
print(event)
return {
"principalId": "my-user",
"policyDocument": {
"Version": "2012-10-17",
"Statement": [{
"Action": "execute-api:Invoke",
"Effect": ... | def handler(event, context):
print(event)
return {'principalId': 'my-user', 'policyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': 'execute-api:Invoke', 'Effect': 'Allow' if event['headers']['Authorization'] == 'goodToken' else 'Deny', 'Resource': event['methodArn']}]}} |
#
# PySNMP MIB module DELL-NETWORKING-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DELL-NETWORKING-SMI
# Produced by pysmi-0.3.4 at Wed May 1 12:37:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (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_union, constraints_intersection, value_range_constraint) ... |
print("Arithmetic Progression V3.0")
print("-"*27)
num1 = int(input("First number: "))
num2 = int(input("Second number: "))
c = 1
total = 0
plus = 10
while plus != 0:
total = total + plus
while c < total:
print(num1)
num1 = num1 + num2
c +=1
plus = int(input("How many you want to sh... | print('Arithmetic Progression V3.0')
print('-' * 27)
num1 = int(input('First number: '))
num2 = int(input('Second number: '))
c = 1
total = 0
plus = 10
while plus != 0:
total = total + plus
while c < total:
print(num1)
num1 = num1 + num2
c += 1
plus = int(input('How many you want to ... |
print(True and True) # True
print(True and False) # False
print(False and False) # False
print("------")
print(True or True) # True
print(True or False) # True
print(False or False) # False | print(True and True)
print(True and False)
print(False and False)
print('------')
print(True or True)
print(True or False)
print(False or False) |
"""
# PROBLEM 16
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
"""
print(sum(int(digit) for digit in str(2**1000)))
| """
# PROBLEM 16
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
"""
print(sum((int(digit) for digit in str(2 ** 1000)))) |
# -*- python -*-
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_package",
)
def nix_gflags():
nixpkgs_package(
name = "nix-gflags",
attribute_path = "gflags",
repositories = {"nixpkgs": "@nixpkgs"},
build_file_content = """
package(default_visibility = ["//v... | load('@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl', 'nixpkgs_package')
def nix_gflags():
nixpkgs_package(name='nix-gflags', attribute_path='gflags', repositories={'nixpkgs': '@nixpkgs'}, build_file_content='\npackage(default_visibility = ["//visibility:public"])\ncc_library(\n name = "nix-gflags",\n hdrs = glob... |
# Texture generator
ctx.params_gen_texture = cell(("cson", "seamless", "transformer_params"))
link(ctx.params_gen_texture, ".", "params_gen_texture.cson")
if not ctx.params_gen_texture.value: ### kludge: to be fixed in seamless 0.2
ctx.params_gen_texture.set("{}")
ctx.gen_texture = transformer(ctx.params_gen_textur... | ctx.params_gen_texture = cell(('cson', 'seamless', 'transformer_params'))
link(ctx.params_gen_texture, '.', 'params_gen_texture.cson')
if not ctx.params_gen_texture.value:
ctx.params_gen_texture.set('{}')
ctx.gen_texture = transformer(ctx.params_gen_texture)
link(ctx.gen_texture.code.cell(), '.', 'cell-gen-texture.... |
PROJECT = 'my-first-project-238015'
DATASET = 'waste'
TABLE_WEIGHT = 'weight'
TABLE_ROUTE = 'route'
TABLE_MERGE = 'merge'
BQ_TABLE_WEIGHT = '.'.join([DATASET, TABLE_WEIGHT])
BQ_TABLE_ROUTE = '.'.join([PROJECT, DATASET, TABLE_ROUTE])
BQ_TABLE_MERGE = '.'.join([DATASET, TABLE_MERGE])
BUCKET = 'austin_waste'
FOLDER_DAT... | project = 'my-first-project-238015'
dataset = 'waste'
table_weight = 'weight'
table_route = 'route'
table_merge = 'merge'
bq_table_weight = '.'.join([DATASET, TABLE_WEIGHT])
bq_table_route = '.'.join([PROJECT, DATASET, TABLE_ROUTE])
bq_table_merge = '.'.join([DATASET, TABLE_MERGE])
bucket = 'austin_waste'
folder_dat = ... |
# Using conditionals (if-then statements) in Python
age = int(input("How old are you? > ")) # variable age equals the input converted into an integer
if age >= 18: # if age is greater than or equal to 18:
print("You are an adult")
if age <= 19 and age >= 13: # if age is less than or equal to 19 and age is greate... | age = int(input('How old are you? > '))
if age >= 18:
print('You are an adult')
if age <= 19 and age >= 13:
print('You are a teenager')
elif age < 13:
print('You are a child') |
_base_ = [
'../_base_/models/hv_pointpillars_fpn_nus.py',
'../_base_/datasets/nus-3d.py', '../_base_/schedules/schedule_2x.py',
'../_base_/default_runtime.py'
]
# pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa
voxel_size = [0.25, 0... | _base_ = ['../_base_/models/hv_pointpillars_fpn_nus.py', '../_base_/datasets/nus-3d.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py']
voxel_size = [0.25, 0.25, 8]
model = dict(pts_voxel_layer=dict(max_num_points=64, point_cloud_range=[-50, -50, -5, 50, 50, 3], voxel_size=voxel_size, max_voxels=... |
#350111
#a3_p10.py
#Alexander_Mchedlishvili
#a.mchedlish@jacobs-university.de
n=int(input("Enter the width(horizontal): "))
m=int(input("Enter the length(vertical): "))
c="c"
def print_frame(n, m, c):
row = n * c
ln = len(row)-2
for a in range(m):
if a == 0 or a == (m-1):
... | n = int(input('Enter the width(horizontal): '))
m = int(input('Enter the length(vertical): '))
c = 'c'
def print_frame(n, m, c):
row = n * c
ln = len(row) - 2
for a in range(m):
if a == 0 or a == m - 1:
print(row)
else:
print('c', ln * ' ', 'c')
print_frame(n, m, c) |
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
prev = -1
for i, a in enumerate(A):
ans += B[a-1]
if a == prev + 1:
ans += C[prev - 1]
prev = a
print(ans) | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
prev = -1
for (i, a) in enumerate(A):
ans += B[a - 1]
if a == prev + 1:
ans += C[prev - 1]
prev = a
print(ans) |
"""
Given two numbers, find their product using recursion
"""
x = 5532
y = 256
def recursive_multiply(x, y):
# This cuts down on the total number of
# recursive calls:
if x < y:
return recursive_multiply(y, x)
if y == 0:
return 0
return x + recursive_multiply(x, y-1)
print(x... | """
Given two numbers, find their product using recursion
"""
x = 5532
y = 256
def recursive_multiply(x, y):
if x < y:
return recursive_multiply(y, x)
if y == 0:
return 0
return x + recursive_multiply(x, y - 1)
print(x * y)
print(recursive_multiply(x, y)) |
# Title
TITLE = "The Game of Life"
# Screen Dimensions
ROWS = 40
COLS = 40
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
# Square (or Rectangle) Dimensions
SQR_WIDTH = int(SCREEN_WIDTH // COLS)
SQR_HEIGHT = int(SCREEN_HEIGHT // ROWS)
# Times
FPS = 10
# Text
FONT_NAME = "freesansbold.ttf"
FONT_SIZE = 15
TEXT_X = SCREEN_WID... | title = 'The Game of Life'
rows = 40
cols = 40
screen_width = 600
screen_height = 600
sqr_width = int(SCREEN_WIDTH // COLS)
sqr_height = int(SCREEN_HEIGHT // ROWS)
fps = 10
font_name = 'freesansbold.ttf'
font_size = 15
text_x = SCREEN_WIDTH - 125
text_y = SCREEN_HEIGHT - 25
black = (0, 0, 0)
red = (255, 0, 0)
green = (... |
'''from constants import *
from jobs import *
from download import *
from convert import *
from upload import *
from polling import*
''' | """from constants import *
from jobs import *
from download import *
from convert import *
from upload import *
from polling import*
""" |
def test():
assert (
"docs = list(nlp.pipe(TEXTS))" in __solution__
), "Verwendest du nlp.pipe in einer Liste?"
__msg__.good("Gute Arbeit!")
| def test():
assert 'docs = list(nlp.pipe(TEXTS))' in __solution__, 'Verwendest du nlp.pipe in einer Liste?'
__msg__.good('Gute Arbeit!') |
"""Utility functions
"""
def get_phase_number(total_number_of_phases, phase_number):
"""Summary
Parameters
----------
total_number_of_phases : TYPE
Description
phase_number : TYPE
Description
Returns
-------
TYPE
Description
"""
# wrap around ... | """Utility functions
"""
def get_phase_number(total_number_of_phases, phase_number):
"""Summary
Parameters
----------
total_number_of_phases : TYPE
Description
phase_number : TYPE
Description
Returns
-------
TYPE
Description
"""
while phase_numb... |
MOVES_LIMIT = 2*10**5
class Queue:
def __init__(self): self.queue = []
def push(self, data):
self.queue.insert(0, data)
return "ok"
def pop(self): return self.queue.pop()
def front(self): return self.queue[-1]
def size(self): return len(self.queue)
def clear(self):
s... | moves_limit = 2 * 10 ** 5
class Queue:
def __init__(self):
self.queue = []
def push(self, data):
self.queue.insert(0, data)
return 'ok'
def pop(self):
return self.queue.pop()
def front(self):
return self.queue[-1]
def size(self):
return len(self.... |
"""
Contains exception base classes for Behave Restful.
"""
class BehaveRestfulException(Exception):
"""
Base class for exceptions raised by behave_restful.
"""
def __str__(self):
return self.__repr__()
def __repr__(self):
return "BehaveResfulException('Unknown Error')"
| """
Contains exception base classes for Behave Restful.
"""
class Behaverestfulexception(Exception):
"""
Base class for exceptions raised by behave_restful.
"""
def __str__(self):
return self.__repr__()
def __repr__(self):
return "BehaveResfulException('Unknown Error')" |
__all__ = [
"ParamScheduler",
"ConstantParamScheduler",
"CosineParamScheduler",
"LinearParamScheduler",
"CompositeParamScheduler",
"MultiStepParamScheduler",
"StepParamScheduler",
"StepWithFixedGammaParamScheduler",
"PolynomialDecayParamScheduler",
] | __all__ = ['ParamScheduler', 'ConstantParamScheduler', 'CosineParamScheduler', 'LinearParamScheduler', 'CompositeParamScheduler', 'MultiStepParamScheduler', 'StepParamScheduler', 'StepWithFixedGammaParamScheduler', 'PolynomialDecayParamScheduler'] |
name = str(input("Please enter your name: ")) #These two lines ask for password and name, then store them in variable
pw = str(input("Please enter a password: "))
print("Welcome", name) # Prints name
pwLength = len(pw) #Checks the length of the password
pwList = list(pw) #Lists each character of the string in a singl... | name = str(input('Please enter your name: '))
pw = str(input('Please enter a password: '))
print('Welcome', name)
pw_length = len(pw)
pw_list = list(pw)
print('Your password has ' + str(pwLength) + ' characters.')
if pwLength < 8:
print('Your password has less than 8 characters. We recommend at least 8 characters f... |
class DuplicateStageName(TypeError):
pass
class IncompleteStage(TypeError):
pass
class StageNotFound(ValueError):
pass
class ReservedNameError(TypeError):
pass
| class Duplicatestagename(TypeError):
pass
class Incompletestage(TypeError):
pass
class Stagenotfound(ValueError):
pass
class Reservednameerror(TypeError):
pass |
class Warrior:
def __init__(self, name, level, experience, rank):
self.name = name
self.level = level
self.experience = experience
self.rank = rank
def __str__(self):
return '[Warrior: %s, %s, %s, %s]' % (self.name, self.level, self.experience, self.rank)
def ran... | class Warrior:
def __init__(self, name, level, experience, rank):
self.name = name
self.level = level
self.experience = experience
self.rank = rank
def __str__(self):
return '[Warrior: %s, %s, %s, %s]' % (self.name, self.level, self.experience, self.rank)
def rank... |
#
# PySNMP MIB module BayNetworks-IISIS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BayNetworks-IISIS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:42:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
n, m = map(int, input().strip().split())
bo... | """
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
(n, m) = map(int, input().strip().split())
boxes = [0] * m
for _ in... |
env = MDPEnvironment()
for step in range(n_steps):
action = exploration_policy(env.state)
state = env.state
next_state, reward = env.step(action)
next_value = np.max(q_values[next_state]) # greedy policy
q_values[state, action] = (1-alpha)*q_values[state, action] + alpha*(reward + gamma * next_value... | env = mdp_environment()
for step in range(n_steps):
action = exploration_policy(env.state)
state = env.state
(next_state, reward) = env.step(action)
next_value = np.max(q_values[next_state])
q_values[state, action] = (1 - alpha) * q_values[state, action] + alpha * (reward + gamma * next_value)
q_val... |
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
g = int(input())
h = int(input())
i = int(input())
A = []
A.append(a)
A.append(b)
A.append(c)
A.append(d)
A.append(e)
A.append(f)
A.append(g)
A.append(h)
A.append(i)
B = sorted(A)
maxnum = B[8]
for k in range(len... | a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
g = int(input())
h = int(input())
i = int(input())
a = []
A.append(a)
A.append(b)
A.append(c)
A.append(d)
A.append(e)
A.append(f)
A.append(g)
A.append(h)
A.append(i)
b = sorted(A)
maxnum = B[8]
for k in range(len(A)):
... |
#- Hours in a year. How many hours are in a year?
print (365 * 24)
#for the leap year e.g 2020
print (366 * 24)
#- Minutes in a decade. How many minutes are in a decade?
# Year has 365 days, day has 24 hour, hour has 60 minutes and decade equels 10 years
print (365 * 24 * 60 * 10)
#for the leap year e.g 2020
print (366... | print(365 * 24)
print(366 * 24)
print(365 * 24 * 60 * 10)
print(366 * 24 * 60 * 10)
print(26 * 366 * 24 * 60 * 60) |
""""
Auth
"""
auth_client_id: str = 'carp'
auth_client_secret: str = 'carp'
auth_client_password_grant_type: str = 'password'
auth_client_refresh_token_grant_type: str = 'refresh_token'
auth_client_researcher_username: str = 'ossi0004@gmail.com'
auth_client_researcher_password: str = 'xxxx'
auth_client_researcher_new_p... | """"
Auth
"""
auth_client_id: str = 'carp'
auth_client_secret: str = 'carp'
auth_client_password_grant_type: str = 'password'
auth_client_refresh_token_grant_type: str = 'refresh_token'
auth_client_researcher_username: str = 'ossi0004@gmail.com'
auth_client_researcher_password: str = 'xxxx'
auth_client_researcher_new_p... |
# -*- coding: utf-8 -*-
"""
@ author: Javad Fattahi
@ detail: Configuration file for Customer Agent (The Great-DR project)
"""
# UNIT DETAILS
MRID = '\x0a\xaf\x72\x05\x44\x04\xff\xa0\xed\x54\xc1\xab\x00\x00\x87\xb4'
HEMSC_MRID = '\xE7\xF7\x5C\x8D\x24\x99\x67\x6C\x5D\x1D\x47\x5B\x00\x00\x87\xB4'
SFDI = 26948382356... | """
@ author: Javad Fattahi
@ detail: Configuration file for Customer Agent (The Great-DR project)
"""
mrid = '\n¯r\x05D\x04ÿ\xa0íTÁ«\x00\x00\x87´'
hemsc_mrid = 'ç÷\\\x8d$\x99gl]\x1dG[\x00\x00\x87´'
sfdi = 269483823564
lfdi = 'dcúéI\x07«\x89¼,j\x02-§î\x12X\x9f\x00N'
pin = 610328
response = 1.0 / 6
event = 1.0 / 6... |
# replace the function below in sphinx.ext.autodoc.py (tested with Sphinx version 0.4.1)
__author__ = "Martin Felder"
def prepare_docstring(s):
"""
Convert a docstring into lines of parseable reST. Return it as a list of
lines usable for inserting into a docutils ViewList (used as argument
of nested_p... | __author__ = 'Martin Felder'
def prepare_docstring(s):
"""
Convert a docstring into lines of parseable reST. Return it as a list of
lines usable for inserting into a docutils ViewList (used as argument
of nested_parse().) An empty line is added to act as a separator between
this docstring and fol... |
config = {
'unit_designation' : 'SALUD',
'sleep_interval' : 300, # seconds to sleep. Increase to have less frequent updates and longer battery life
'warn_threshold' : 1000,
'alarm_threshold' : 2100,
'temperature_offset' : 3, # if you care about temp from the sensor. Probably shouldn't.
... | config = {'unit_designation': 'SALUD', 'sleep_interval': 300, 'warn_threshold': 1000, 'alarm_threshold': 2100, 'temperature_offset': 3, 'calibration_ppm': 425, 'elevation': 93, 'barometric_pressure': 1014, 'significant_change': 25, 'power_saving_light_level': 350, 'power_saving_sleep_interval': 900, 'helpful_url': 'htt... |
class Rick:
def never(self) -> "Rick":
print("never ", end="")
return self
def gonna(self) -> "Rick":
print("gonna ", end="")
return self
def give(self) -> "Rick":
print("let ", end="")
return self
def you(self) -> "Rick":
print("you ", end="")
... | class Rick:
def never(self) -> 'Rick':
print('never ', end='')
return self
def gonna(self) -> 'Rick':
print('gonna ', end='')
return self
def give(self) -> 'Rick':
print('let ', end='')
return self
def you(self) -> 'Rick':
print('you ', end='')... |
#!/usr/bin/env python3
######################################################################################
# #
# Program purpose: There are 10 vertical and horizontal squares on a plane. #
# Each squa... | if __name__ == '__main__':
c = 0
def f(x, y, z):
if 0 <= y < 10 and 0 <= z < 10 and (x[z][y] == '1'):
x[z][y] = '0'
for (dy, dz) in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
f(x, y + dy, z + dz)
print('Input 10 rows of 10 numbers representing green squares (island)... |
class NoCache(object):
def process_response(self, request, response):
"""
set the "Cache-Control" header to "must-revalidate, no-cache"
"""
if request.path.startswith('/static/'):
response['Cache-Control'] = 'must-revalidate, no-cache'
return response | class Nocache(object):
def process_response(self, request, response):
"""
set the "Cache-Control" header to "must-revalidate, no-cache"
"""
if request.path.startswith('/static/'):
response['Cache-Control'] = 'must-revalidate, no-cache'
return response |
n = int(input("Enter number of terms of the series to be displayed: "))
def fibonacci(_n):
if _n <= 1:
return _n
else:
return fibonacci(_n - 1) + fibonacci(_n - 2)
for i in range(n):
print(fibonacci(i), end=", ")
| n = int(input('Enter number of terms of the series to be displayed: '))
def fibonacci(_n):
if _n <= 1:
return _n
else:
return fibonacci(_n - 1) + fibonacci(_n - 2)
for i in range(n):
print(fibonacci(i), end=', ') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.