content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
enru=open('en-ru.txt','r')
input=open('input.txt','r')
output=open('output.txt','w')
s=enru.read()
x=''
prov={'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m'}
slovar={}
s=s.replace('\t-\t',' ')
while len(s)>0:
slovar[s[:s.index(' ')]]=s[s.index(' '):s.index('\... | enru = open('en-ru.txt', 'r')
input = open('input.txt', 'r')
output = open('output.txt', 'w')
s = enru.read()
x = ''
prov = {'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm'}
slovar = {}
s = s.replace('\t-\t', ' ')
while len(s) > 0:
slo... |
def conv(x):
return int(''.join(t[c] for c in x))
b = input().split()
N = int(input())
a = [input() for _ in range(N)]
t = {b[i]: str(i) for i in range(10)}
a.sort(key = lambda x: conv(x))
print(*a, sep='\n')
| def conv(x):
return int(''.join((t[c] for c in x)))
b = input().split()
n = int(input())
a = [input() for _ in range(N)]
t = {b[i]: str(i) for i in range(10)}
a.sort(key=lambda x: conv(x))
print(*a, sep='\n') |
IS_TEST = True
REPOSITORY = 'cms-sw/cmssw'
def get_repo_url():
return 'https://github.com/' + REPOSITORY + '/'
CERN_SSO_CERT_FILE = 'private/cert.pem'
CERN_SSO_KEY_FILE = 'private/cert.key'
CERN_SSO_COOKIES_LOCATION = 'private/'
TWIKI_CONTACTS_URL = 'https://ppdcontacts.web.cern.ch/PPDContacts/ppd_contacts'
TWI... | is_test = True
repository = 'cms-sw/cmssw'
def get_repo_url():
return 'https://github.com/' + REPOSITORY + '/'
cern_sso_cert_file = 'private/cert.pem'
cern_sso_key_file = 'private/cert.key'
cern_sso_cookies_location = 'private/'
twiki_contacts_url = 'https://ppdcontacts.web.cern.ch/PPDContacts/ppd_contacts'
twiki_... |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftIMPLIESSIMPLIESleftANDORleftRPARENLPARENrightNEGATIONALPHABET AND IMPLIES LPAREN NEGATION OR PREDICATE RPAREN SIMPLIESexpr : expr AND exprexpr : ALPHABETexpr : expr... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftIMPLIESSIMPLIESleftANDORleftRPARENLPARENrightNEGATIONALPHABET AND IMPLIES LPAREN NEGATION OR PREDICATE RPAREN SIMPLIESexpr : expr AND exprexpr : ALPHABETexpr : expr OR exprexpr : NEGATION exprexpr : expr IMPLIES exprexpr : expr SIMPLIES exprexpr : LPAREN exp... |
def find_paths(start, connections, visited=None, small_cave_visited_twice=False):
if visited is None:
visited = ["start"]
possible_connections = [e for s, e in connections if s == start] + [s for s, e in connections if e == start]
paths = []
if not possible_connections:
raise ValueErro... | def find_paths(start, connections, visited=None, small_cave_visited_twice=False):
if visited is None:
visited = ['start']
possible_connections = [e for (s, e) in connections if s == start] + [s for (s, e) in connections if e == start]
paths = []
if not possible_connections:
raise value_e... |
"""An unofficial Python wrapper for the Binance exchange API v3
.. moduleauthor:: Sam McHardy
.. modified by Stephan Avenwedde for Pythonic
"""
| """An unofficial Python wrapper for the Binance exchange API v3
.. moduleauthor:: Sam McHardy
.. modified by Stephan Avenwedde for Pythonic
""" |
class Tree:
def __init__(self, val,left = None, right = None):
self.val = val
self.left = left
self.right = right
root = Tree(4, left = Tree(3), right=Tree(5, left= Tree(4)))
#InOrderTraversal
def InOrderTraversal(root, res = []):
if root is None:
return res
... | class Tree:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
root = tree(4, left=tree(3), right=tree(5, left=tree(4)))
def in_order_traversal(root, res=[]):
if root is None:
return res
in_order_traversal(root.left, res)
... |
def groups_for_user(environ, user):
if user == 'feng':
return ['secret-agents']
return ['']
| def groups_for_user(environ, user):
if user == 'feng':
return ['secret-agents']
return [''] |
SOLIDITY_TO_BQ_TYPES = {
'address': 'STRING',
}
table_description = ''
def abi_to_table_definitions_for_solana(
abi,
dataset_name,
contract_name,
contract_address=None,
include_functions=False
):
result = {}
for a in abi.get('events') if abi.get('events') else []:
... | solidity_to_bq_types = {'address': 'STRING'}
table_description = ''
def abi_to_table_definitions_for_solana(abi, dataset_name, contract_name, contract_address=None, include_functions=False):
result = {}
for a in abi.get('events') if abi.get('events') else []:
parser_type = 'log'
table_name = cr... |
"""Metadata presets for commonly used keywords."""
presets = {
chest : {"Anatomical Region":
{"ID": "0001443",
"Name": "chest",
"Ontology Acronym": "UBERON",
"Ontology Name": "Uber Anatomy Ontology",
"Resource URL":
"http://pur... | """Metadata presets for commonly used keywords."""
presets = {chest: {'Anatomical Region': {'ID': '0001443', 'Name': 'chest', 'Ontology Acronym': 'UBERON', 'Ontology Name': 'Uber Anatomy Ontology', 'Resource URL': 'http://purl.obolibrary.org/obo/UBERON_0001443'}}, abdomen: {'Anatomical Region': {'ID': '0000916', 'Name'... |
class Solution:
def validPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
left = 0
right = len(s)-1
while left < right:
if s[left] != s[right]:
return self.isPalindrome(s, left, right-1) or self.isPalindrome(s, left+1, right)... | class Solution:
def valid_palindrome(self, s):
"""
:type s: str
:rtype: bool
"""
left = 0
right = len(s) - 1
while left < right:
if s[left] != s[right]:
return self.isPalindrome(s, left, right - 1) or self.isPalindrome(s, left + 1,... |
roman_dict = {
"I" : 1,
"V" : 5,
"X" : 10,
"L" : 50,
"C" : 100,
"D" : 500,
"M" : 1000
}
class Solution:
def romanToInt(self, s: str) -> int:
previous = 0
current = 0
result = 0
for x in s[::-1]:
current = roman_dict[x]
if (previous > current):
... | roman_dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
class Solution:
def roman_to_int(self, s: str) -> int:
previous = 0
current = 0
result = 0
for x in s[::-1]:
current = roman_dict[x]
if previous > current:
result ... |
# Usage: execute
# $ python support/generate.py
# at wpt/upgrade-insecure-requests/.
#
# Note: Some tests (link-upgrade.sub.https.html and
# websocket-upgrade.https.html) are not covered by this generator script.
template = '''<!DOCTYPE html>
<html>
<head>
<!-- Generated by wpt/upgrade-insecure-requests/support/genera... | template = '<!DOCTYPE html>\n<html>\n<head>\n<!-- Generated by wpt/upgrade-insecure-requests/support/generate.py -->%(additionalMeta)s\n<title>Upgrade Insecure Requests: %(name)s.</title>\n<script src="/resources/testharness.js"></script>\n<script src="/resources/testharnessreport.js"></script>\n<script src="./support/... |
#!usr/bin/env python3
color_chart = {
'1C1':[13.24, 88.89, 228.98, 0.], '1N1':[14.2, 95.37, 233.82, 0.], '1N2':[12.95, 91.79, 219.5, 0.],
'1W1':[14.67, 103.64, 229.41, 0.], '1W2':[14.69, 106.34, 227.28, 0.], '2C0':[15.73, 134.68, 222.32, 0.],
'2C1':[14.57, 125.89, 220.69, 0.], '2C3':[13.7, 103.72, 199.4... | color_chart = {'1C1': [13.24, 88.89, 228.98, 0.0], '1N1': [14.2, 95.37, 233.82, 0.0], '1N2': [12.95, 91.79, 219.5, 0.0], '1W1': [14.67, 103.64, 229.41, 0.0], '1W2': [14.69, 106.34, 227.28, 0.0], '2C0': [15.73, 134.68, 222.32, 0.0], '2C1': [14.57, 125.89, 220.69, 0.0], '2C3': [13.7, 103.72, 199.46, 0.0], '2N1': [15.0, 1... |
# !!!!!!! This file is OBSOLETE. Its content has been absorbed into pilotController.py in the autopilot repository.
# !!!!!!! Questions to Torre Wenaus.
PandaSiteIDs = {
'AGLT2' : {'nickname':'AGLT2-condor','status':'OK'},
'ALBERTA-LCG2' : {'nickname':'ALBERTA-LCG2-lcgce01-atlas-lcgpb... | panda_site_i_ds = {'AGLT2': {'nickname': 'AGLT2-condor', 'status': 'OK'}, 'ALBERTA-LCG2': {'nickname': 'ALBERTA-LCG2-lcgce01-atlas-lcgpbs', 'status': 'OK'}, 'ANALY_AGLT2': {'nickname': 'ANALY_AGLT2-condor', 'status': 'OK'}, 'ANALY_ALBERTA': {'nickname': 'ALBERTA-LCG2-lcgce01-atlas-lcgpbs', 'status': 'OK'}, 'ANALY_BEIJI... |
class ScenarioError(Exception):
pass
class ScenarioTxError(ScenarioError):
pass
class TokenRegistrationError(ScenarioTxError):
pass
class ChannelError(ScenarioError):
pass
class TransferFailed(ScenarioError):
pass
class NodesUnreachableError(ScenarioError):
pass
class RESTAPIError(Sc... | class Scenarioerror(Exception):
pass
class Scenariotxerror(ScenarioError):
pass
class Tokenregistrationerror(ScenarioTxError):
pass
class Channelerror(ScenarioError):
pass
class Transferfailed(ScenarioError):
pass
class Nodesunreachableerror(ScenarioError):
pass
class Restapierror(Scenario... |
def truncatechars(value, arg):
"""
Truncates a string after a certain number of chars.
Argument: Number of chars to truncate after.
"""
try:
length = int(arg)
except ValueError: # Invalid literal for int().
return value # Fail silently.
if len(value) > length:
retu... | def truncatechars(value, arg):
"""
Truncates a string after a certain number of chars.
Argument: Number of chars to truncate after.
"""
try:
length = int(arg)
except ValueError:
return value
if len(value) > length:
return value[:length] + '...'
return value |
def convertToHEXForChar(charList):
convertedCharList = []
for message in charList:
convertedCharList.append(ord(message))
return convertedCharList
def displayChar(line, *args):
concatedList = []
for argItem in args:
concatedList.extend(argItem)
print(len(concatedList))
for message in c... | def convert_to_hex_for_char(charList):
converted_char_list = []
for message in charList:
convertedCharList.append(ord(message))
return convertedCharList
def display_char(line, *args):
concated_list = []
for arg_item in args:
concatedList.extend(argItem)
print(len(concatedList))
... |
# ------------------------------------------------------- class: Constants ------------------------------------------------------- #
class Constants:
# --------------------------------------------------- Public properties -------------------------------------------------- #
USER_AGENT_FILE_NAME = 'ua.... | class Constants:
user_agent_file_name = 'ua.txt'
general_cookies_folder_name = 'cookies'
general_profile_folder_name = 'selenium-python-profile'
default_profile_id = 'test'
default_find_func_timeout = 2.5 |
expected = [
{
"abstract_type": None,
"content": "RET can be activated in cis or trans by its co-receptors and ligands in vitro, but the physiological roles of trans signaling are unclear. Rapidly adapting (RA) mechanoreceptors in dorsal root ganglia (DRGs) express Ret and the co-receptor Gfr\u03b12... | expected = [{'abstract_type': None, 'content': 'RET can be activated in cis or trans by its co-receptors and ligands in vitro, but the physiological roles of trans signaling are unclear. Rapidly adapting (RA) mechanoreceptors in dorsal root ganglia (DRGs) express Ret and the co-receptor Gfrα2 and depend on Ret for surv... |
# Prim's Algorithm in Python
INF = 9999999
# number of vertices in graph
V = 5
# create a 2d array of size 5x5
# for adjacency matrix to represent graph
G = [
[0, 9, 75, 0, 0],
[9, 0, 95, 19, 42],
[75, 95, 0, 51, 66],
[0, 19, 51, 0, 31],
[0, 42, 66, 31, 0],
]
# create a array to track... | inf = 9999999
v = 5
g = [[0, 9, 75, 0, 0], [9, 0, 95, 19, 42], [75, 95, 0, 51, 66], [0, 19, 51, 0, 31], [0, 42, 66, 31, 0]]
selected = [0, 0, 0, 0, 0]
no_edge = 0
selected[0] = True
print('Edge : Weight\n')
while no_edge < V - 1:
minimum = INF
x = 0
y = 0
for i in range(V):
if selected[i]:
... |
def func(a, b):
return a + b
def func2(a):
print(a)
print("Hello")
| def func(a, b):
return a + b
def func2(a):
print(a)
print('Hello') |
# Dimmer Switch class
class DimmerSwitch():
def __init__(self, label):
self.label = label
self.isOn = False
self.brightness = 0
def turnOn(self):
self.isOn = True
# turn the light on at self.brightness
def turnOff(self):
self.isOn = False
# ... | class Dimmerswitch:
def __init__(self, label):
self.label = label
self.isOn = False
self.brightness = 0
def turn_on(self):
self.isOn = True
def turn_off(self):
self.isOn = False
def raise_level(self):
if self.brightness < 10:
self.brightnes... |
print(list(range(10, 0, -2)))
# if start > end and step > 0:
# a list generated from start to no more than end with step as constant increment
# if start > end and step < 0:
# an empty list generated
# if start < end and step > 0:
# an empty list generated
# if start < end and step < 0
# a list generated from start to ... | print(list(range(10, 0, -2))) |
start = 104200
end = 702648265
for arm1 in range(start, end + 1):
exp = len(str(arm1))
num_sum = 0
c = arm1
while c > 0:
num = c % 10
num_sum += num ** exp
c //= 10
if arm1 != num_sum:
continue
else:
if arm1 == num_sum:
... | start = 104200
end = 702648265
for arm1 in range(start, end + 1):
exp = len(str(arm1))
num_sum = 0
c = arm1
while c > 0:
num = c % 10
num_sum += num ** exp
c //= 10
if arm1 != num_sum:
continue
else:
if arm1 == num_sum:
print('The first... |
def _do_set(env, name, value):
if env.contains(name):
env.set(name, value)
elif env.parent is not None:
_do_set(env.parent, name, value)
else:
raise Exception(
"Attempted to set name '%s' but it does not exist." %
name
)
def set_(env, symbol_name, va... | def _do_set(env, name, value):
if env.contains(name):
env.set(name, value)
elif env.parent is not None:
_do_set(env.parent, name, value)
else:
raise exception("Attempted to set name '%s' but it does not exist." % name)
def set_(env, symbol_name, value):
if symbol_name[0] != 'str... |
class PostgresQueryPart:
""" Object representing Postgres query part
"""
def get_query(self) -> str:
""" Get query
Returns:
str
"""
pass
| class Postgresquerypart:
""" Object representing Postgres query part
"""
def get_query(self) -> str:
""" Get query
Returns:
str
"""
pass |
def email_subject(center_name):
return f"[Urgent Reminder] Vaccine slot is now available at {center_name}"
def email_body(email_data):
return f"Hi, \n" \
f"Vaccine slot is available for below centers \n " \
f"Center name and available data \n {email_data} \n" \
f"Please regis... | def email_subject(center_name):
return f'[Urgent Reminder] Vaccine slot is now available at {center_name}'
def email_body(email_data):
return f'Hi, \nVaccine slot is available for below centers \n Center name and available data \n {email_data} \nPlease register at cowin website https://cowin.gov.in \nHave a l... |
# -*- coding: utf-8 -*-
#
# Copyright Contributors to the Conu project.
# SPDX-License-Identifier: MIT
#
# TODO: move this line to some generic constants, instead of same in
# docker and nspawn
CONU_ARTIFACT_TAG = 'CONU.'
CONU_IMAGES_STORE = "/opt/conu-nspawn-images/"
CONU_NSPAWN_BASEPACKAGES = [
"dnf",
"ipro... | conu_artifact_tag = 'CONU.'
conu_images_store = '/opt/conu-nspawn-images/'
conu_nspawn_basepackages = ['dnf', 'iproute', 'dhcp-client', 'initscripts', 'passwd', 'systemd', 'rpm', 'bash', 'shadow-utils', 'sssd-client', 'util-linux', 'libcrypt', 'sssd-client', 'coreutils', 'glibc-all-langpacks', 'vim-minimal']
bootstrap_... |
def get_p_distance(list1, list2):
count = 0
i = 0
while i < len(list1):
if (list1[i] != list2[i]):
count += .1
i += 1
return count
def get_p_distance_matrix(list1, list2, list3, list4):
dna1 = get_p_distance(list1, list1), get_p_distance(list1, list2), get_p_distance(lis... | def get_p_distance(list1, list2):
count = 0
i = 0
while i < len(list1):
if list1[i] != list2[i]:
count += 0.1
i += 1
return count
def get_p_distance_matrix(list1, list2, list3, list4):
dna1 = (get_p_distance(list1, list1), get_p_distance(list1, list2), get_p_distance(lis... |
#
# PySNMP MIB module ZHONE-COM-IP-FILTER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-COM-IP-FILTER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:47:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
"""Exceptions for this library"""
class NSBaseError(Exception):
"""Base Error for all custom exceptions"""
pass
class RateLimitReached(NSBaseError):
"""Rate Limit was reached"""
class NSServerBaseException(NSBaseError):
"""Exceptions that the server returns"""
pass
class APIError(NSServerBaseEx... | """Exceptions for this library"""
class Nsbaseerror(Exception):
"""Base Error for all custom exceptions"""
pass
class Ratelimitreached(NSBaseError):
"""Rate Limit was reached"""
class Nsserverbaseexception(NSBaseError):
"""Exceptions that the server returns"""
pass
class Apierror(NSServerBaseExc... |
def sync_read(socket, size):
"""
Perform a (temporary) blocking read.
The amount read may be smaller than the amount requested if a
timeout occurs.
"""
timeout = socket.gettimeout()
socket.settimeout(None)
try:
return socket.recv(size)
finally:
socket.settimeout(time... | def sync_read(socket, size):
"""
Perform a (temporary) blocking read.
The amount read may be smaller than the amount requested if a
timeout occurs.
"""
timeout = socket.gettimeout()
socket.settimeout(None)
try:
return socket.recv(size)
finally:
socket.settimeout(time... |
"""
Q146
LRU Cache
Medium
Author: Lingqing Gan
Date: 08/06/2019
Question:
Design and implement a data structure for Least Recently Used (LRU) cache.
It should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the key if the key
exists in the cache, otherwise return ... | """
Q146
LRU Cache
Medium
Author: Lingqing Gan
Date: 08/06/2019
Question:
Design and implement a data structure for Least Recently Used (LRU) cache.
It should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the key if the key
exists in the cache, otherwise return ... |
# https://leetcode.com/problems/contains-duplicate/
# We are forming whole set always which isn't optimal though time complexity is O(n).
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
return len(nums) != len(set(nums)) | class Solution:
def contains_duplicate(self, nums: List[int]) -> bool:
return len(nums) != len(set(nums)) |
a=''
n=int(input())
while n != 0:
a=str(n%2)+a
n//=2
print(a)
| a = ''
n = int(input())
while n != 0:
a = str(n % 2) + a
n //= 2
print(a) |
"""
ALGORITHM : Merge Sort
WORST CASE => {
PERFORMANCE: O(n log(n))
SPACE: O(n)
}
"""
def merge_sort(arr):
size = len(arr)
if size == 1:
return arr
elif size == 2:
if arr[1] > arr[0]:
return [arr[0], arr[1]]
mid = len(arr) // 2
lef... | """
ALGORITHM : Merge Sort
WORST CASE => {
PERFORMANCE: O(n log(n))
SPACE: O(n)
}
"""
def merge_sort(arr):
size = len(arr)
if size == 1:
return arr
elif size == 2:
if arr[1] > arr[0]:
return [arr[0], arr[1]]
mid = len(arr) // 2
left = merge_sort(arr[:mid]... |
# Time: O(|V| + |E|)
# Space: O(|V|)
# """
# This is HtmlParser's API interface.
# You should not implement it, or speculate about its implementation
# """
class HtmlParser(object):
def getUrls(self, url):
"""
:type url: str
:rtype List[str]
"""
pass
class Solution(object):
... | class Htmlparser(object):
def get_urls(self, url):
"""
:type url: str
:rtype List[str]
"""
pass
class Solution(object):
def crawl(self, startUrl, htmlParser):
"""
:type startUrl: str
:type htmlParser: HtmlParser
:rtype: List[str]
""... |
class UniErrors(Exception):
pass
class SetupErrors(UniErrors):
pass
class SettingErrors(UniErrors):
pass
class ConfigureSyntaxErrors(UniErrors):
pass
class NoLocationErrors(UniErrors):
pass
class ImportedErrors(UniErrors):
pass
class KernelWaresSettingsErrors(UniErrors):
pass
c... | class Unierrors(Exception):
pass
class Setuperrors(UniErrors):
pass
class Settingerrors(UniErrors):
pass
class Configuresyntaxerrors(UniErrors):
pass
class Nolocationerrors(UniErrors):
pass
class Importederrors(UniErrors):
pass
class Kernelwaressettingserrors(UniErrors):
pass
class Re... |
"""Values for controlled vocabularies from ENA.
Taken from
- https://ena-docs.readthedocs.io/en/latest/submit/reads/webin-cli.html
"""
# Constants for platform definitions.
LS454 = "LS454"
ILLUMINA = "ILLUMINA"
PACBIO_SMRT = "PACBIO_SMRT"
IONTORRENT = "ION_TORRENT"
CAPILLARY = "CAPILLARY"
ONT = "OXFOR... | """Values for controlled vocabularies from ENA.
Taken from
- https://ena-docs.readthedocs.io/en/latest/submit/reads/webin-cli.html
"""
ls454 = 'LS454'
illumina = 'ILLUMINA'
pacbio_smrt = 'PACBIO_SMRT'
iontorrent = 'ION_TORRENT'
capillary = 'CAPILLARY'
ont = 'OXFORD_NANOPORE'
bgiseq = 'BGISEQ'
dnbseq = 'DNBSEQ'
platfo... |
"""
Copyright 2012 Numan Sachwani <numan@7Geese.com>
This file is provided to you 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... | """
Copyright 2012 Numan Sachwani <numan@7Geese.com>
This file is provided to you 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... |
def string_to_list(string,array):
x=input(string)
i=1
while x[i]!=']':
if x[i]!=',':
j=i
temp=''
while x[j]!=',':
if x[j]==']':
break
temp+=x[j]
j+=1
i=j
array.append(i... | def string_to_list(string, array):
x = input(string)
i = 1
while x[i] != ']':
if x[i] != ',':
j = i
temp = ''
while x[j] != ',':
if x[j] == ']':
break
temp += x[j]
j += 1
i = j
... |
# You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N.
#... | def find_outlier(integers):
l = list(filter(lambda x: x % 2 == 0, integers))
return list(filter(lambda x: x % 2, integers))[0] if len(l) > 1 else l[0] |
"""
A student is taking a cryptography class and has found anagrams to be very useful.
Two strings are anagrams of each other if the first string's letters can be
rearranged to form the second string. In other words, both strings must
contain the same exact letters in the same exact frequency. For example,
bacdc an... | """
A student is taking a cryptography class and has found anagrams to be very useful.
Two strings are anagrams of each other if the first string's letters can be
rearranged to form the second string. In other words, both strings must
contain the same exact letters in the same exact frequency. For example,
bacdc an... |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PR... | class Bootpriority:
def get_boot_priority(aName=None, aType=None, aWriteOnly=0):
return 1 |
#Assignment 9.4
#print('Hello World')
fname = input('Enter name: ')
if len(fname) < 1 : fname = 'mbox-short.txt'
handle = open(fname)
di = {} #create an empty dictionary
for line in handle:
line = line.rstrip()
wds = line.split()
#the second for-loop to print each word in the list
for w in wds :
... | fname = input('Enter name: ')
if len(fname) < 1:
fname = 'mbox-short.txt'
handle = open(fname)
di = {}
for line in handle:
line = line.rstrip()
wds = line.split()
for w in wds:
di[w] = di.get(w, 0) + 1
largest = -1
theword = None
for (k, v) in di.items():
print(k, v)
if v > largest:
... |
class TypeRef:
'''Represents temporary type references by an integer; to be resolved
to actual types later
'''
def __init__(self, type_ref: int):
self.type_ref = type_ref
def __hash__(self):
return hash(self.type_ref)
def __eq__(self, other):
return isinstance(other,... | class Typeref:
"""Represents temporary type references by an integer; to be resolved
to actual types later
"""
def __init__(self, type_ref: int):
self.type_ref = type_ref
def __hash__(self):
return hash(self.type_ref)
def __eq__(self, other):
return isinstance(other... |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_file(pluginname, "doc/page/login.asp", "Hikvision")
| def run(whatweb, pluginname):
whatweb.recog_from_file(pluginname, 'doc/page/login.asp', 'Hikvision') |
"""In this module we provide a list paths, urls and other usefull settings."""
GITHUB_URL = "https://github.com/MarcSkovMadsen/awesome-panel/"
GITHUB_BLOB_MASTER_URL = "https://github.com/MarcSkovMadsen/awesome-panel/blob/master/"
GITHUB_RAW_URL = "https://raw.githubusercontent.com/MarcSkovMadsen/awesome-panel/maste... | """In this module we provide a list paths, urls and other usefull settings."""
github_url = 'https://github.com/MarcSkovMadsen/awesome-panel/'
github_blob_master_url = 'https://github.com/MarcSkovMadsen/awesome-panel/blob/master/'
github_raw_url = 'https://raw.githubusercontent.com/MarcSkovMadsen/awesome-panel/master/'... |
wt1_10_10 = {'192.168.122.110': [5.5754, 5.5952, 9.2422, 8.5338, 9.0058, 8.4025, 8.7557, 8.4405, 8.1397, 8.1318, 8.0657, 7.8501, 8.1701, 8.0757, 7.8899, 7.7329, 7.6153, 7.9967, 7.9363, 7.838, 8.7936, 8.6351, 8.5151, 8.6381, 8.7262, 8.816, 8.8984, 8.7799, 8.8584, 8.9543, 8.8833, 8.794, 8.6935, 8.735, 8.635, 8.5429, 8.6... | wt1_10_10 = {'192.168.122.110': [5.5754, 5.5952, 9.2422, 8.5338, 9.0058, 8.4025, 8.7557, 8.4405, 8.1397, 8.1318, 8.0657, 7.8501, 8.1701, 8.0757, 7.8899, 7.7329, 7.6153, 7.9967, 7.9363, 7.838, 8.7936, 8.6351, 8.5151, 8.6381, 8.7262, 8.816, 8.8984, 8.7799, 8.8584, 8.9543, 8.8833, 8.794, 8.6935, 8.735, 8.635, 8.5429, 8.61... |
"""
How to find only the duplicates
"""
some_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n']
duplicates = [] # o noua lista unde adaugam duplicatele
for value in some_list:
if some_list.count(value) > 1: # cand in lista numaram fiecare valoarea si se gaseste mai mult de o data
if value not in duplicates... | """
How to find only the duplicates
"""
some_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n']
duplicates = []
for value in some_list:
if some_list.count(value) > 1:
if value not in duplicates:
duplicates.append(value)
print(duplicates)
some_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n']
duplicat... |
"""
flopz.
Low Level Assembler and Firmware Instrumentation Toolkit
"""
__version__ = "0.2.0"
__author__ = "Noelscher Consulting GmbH"
| """
flopz.
Low Level Assembler and Firmware Instrumentation Toolkit
"""
__version__ = '0.2.0'
__author__ = 'Noelscher Consulting GmbH' |
'''
Created on 18.03.2020
@author: LK
'''
class TMC_EvalShield(object):
"""
Arguments:
connection:
Type: connection interface
The connection interface used for this module.
shield:
Type: class
The EvalShield class used for every axis on this mod... | """
Created on 18.03.2020
@author: LK
"""
class Tmc_Evalshield(object):
"""
Arguments:
connection:
Type: connection interface
The connection interface used for this module.
shield:
Type: class
The EvalShield class used for every axis on this modu... |
RRNN_SEMIRING = """
extern "C" {
__global__ void rrnn_semiring_fwd(
const float * __restrict__ u,
const float * __restrict__ eps,
const float * __restrict__ c1_init,
const float * __restrict__ c2_init,
const int len,
... | rrnn_semiring = '\n\nextern "C" {\n __global__ void rrnn_semiring_fwd(\n const float * __restrict__ u, \n const float * __restrict__ eps, \n const float * __restrict__ c1_init,\n const float * __restrict__ c2_init,\n const int len, \n ... |
"""Provide meta-models for Asset Administration Shell information model."""
__version__ = "2021.11.20a2"
__author__ = (
"Nico Braunisch, Marko Ristin, Robert Lehmann, Marcin Sadurski, Manuel Sauer"
)
__license__ = "License :: OSI Approved :: MIT License"
__status__ = "Alpha"
| """Provide meta-models for Asset Administration Shell information model."""
__version__ = '2021.11.20a2'
__author__ = 'Nico Braunisch, Marko Ristin, Robert Lehmann, Marcin Sadurski, Manuel Sauer'
__license__ = 'License :: OSI Approved :: MIT License'
__status__ = 'Alpha' |
#!/usr/bin/env python3
def simulate(reg_0, find_non_loop):
seen = set()
c = 0
last_unique_c = -1
while True:
a = c | 65536
c = reg_0
while True:
c = (((c + (a & 255)) & 16777215) * 65899) & 16777215
if a < 256:
if find_non_loop:
... | def simulate(reg_0, find_non_loop):
seen = set()
c = 0
last_unique_c = -1
while True:
a = c | 65536
c = reg_0
while True:
c = (c + (a & 255) & 16777215) * 65899 & 16777215
if a < 256:
if find_non_loop:
return c
... |
# Directions
UP = 'UP'
DOWN = 'DOWN'
LEFT = 'LEFT'
RIGHT = 'RIGHT'
# Colors
RED = (255, 0, 0)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
WHITE = (255, 255, 255)
| up = 'UP'
down = 'DOWN'
left = 'LEFT'
right = 'RIGHT'
red = (255, 0, 0)
black = (0, 0, 0)
green = (0, 255, 0)
white = (255, 255, 255) |
#!/usr/bin/env python3
flags = ['QCTF{2a5576bc51a5c3feb82c96fe80d3a520}', 'QCTF{eb2ddbf0e318812ede843e8ecec6144f}', 'QCTF{5cdf65c6069a6b815352c3f1b4d09a56}', 'QCTF{69d7b7deb23746b8bd18b22f3eb92b50}', 'QCTF{44e37938c0bc05393b5b33a70c5a70db}', 'QCTF{3b37a953391e38ce0b8e168e9eaa6ec5}', 'QCTF{ee2848cb73236007d36cb5ae75c4... | flags = ['QCTF{2a5576bc51a5c3feb82c96fe80d3a520}', 'QCTF{eb2ddbf0e318812ede843e8ecec6144f}', 'QCTF{5cdf65c6069a6b815352c3f1b4d09a56}', 'QCTF{69d7b7deb23746b8bd18b22f3eb92b50}', 'QCTF{44e37938c0bc05393b5b33a70c5a70db}', 'QCTF{3b37a953391e38ce0b8e168e9eaa6ec5}', 'QCTF{ee2848cb73236007d36cb5ae75c4d2bf}', 'QCTF{8dceee7e583... |
def transaccion(retiro, saldo):
if retiro % 5 != 0:
return(saldo)
elif (saldo - retiro) < 0:
return(saldo)
elif saldo == retiro:
return(saldo)
else:
return(saldo - retiro - 0.5)
def main():
entrada = open("input.txt","r")
salida = open("output.txt","w")
T = ... | def transaccion(retiro, saldo):
if retiro % 5 != 0:
return saldo
elif saldo - retiro < 0:
return saldo
elif saldo == retiro:
return saldo
else:
return saldo - retiro - 0.5
def main():
entrada = open('input.txt', 'r')
salida = open('output.txt', 'w')
t = int(e... |
_base_config_ = ["base.py"]
generator = dict(
input_cse=True,
use_cse=True
)
discriminator=dict(
pred_only_cse=False,
pred_only_semantic=True
)
loss = dict(
gan_criterion=dict(type="segmentation", seg_weight=.1)
)
| _base_config_ = ['base.py']
generator = dict(input_cse=True, use_cse=True)
discriminator = dict(pred_only_cse=False, pred_only_semantic=True)
loss = dict(gan_criterion=dict(type='segmentation', seg_weight=0.1)) |
"""
Function
def function_name(arg1, arg2, ...) :
<op 1>
<op 2>
...
Function with undefined amount of input
def fn_name(*args) --> args' elements make tuple.
kwargs = Keyword Parameter
>>> def print_kwargs(**kwargs):
... print(kwargs)
...
>>> print_kwargs(a=1)
{... | """
Function
def function_name(arg1, arg2, ...) :
<op 1>
<op 2>
...
Function with undefined amount of input
def fn_name(*args) --> args' elements make tuple.
kwargs = Keyword Parameter
>>> def print_kwargs(**kwargs):
... print(kwargs)
...
>>> print_kwargs(a=1)
{... |
# Python - 3.4.3
Test.it('Basic Tests')
Test.assert_equals(invert([1, 2, 3, 4, 5]), [-1, -2, -3, -4, -5])
Test.assert_equals(invert([1, -2, 3, -4, 5]), [-1, 2, -3, 4, -5])
Test.assert_equals(invert([]), [])
| Test.it('Basic Tests')
Test.assert_equals(invert([1, 2, 3, 4, 5]), [-1, -2, -3, -4, -5])
Test.assert_equals(invert([1, -2, 3, -4, 5]), [-1, 2, -3, 4, -5])
Test.assert_equals(invert([]), []) |
__title__ = 'logxs'
__description__ = 'Replacing with build-in `print` with nice formatting.'
__url__ = 'https://github.com/minlaxz/logxs'
__version__ = '0.3.2'
__author__ = 'Min Latt'
__author_email__ = 'minminlaxz@gmail.com'
__license__ = 'MIT' | __title__ = 'logxs'
__description__ = 'Replacing with build-in `print` with nice formatting.'
__url__ = 'https://github.com/minlaxz/logxs'
__version__ = '0.3.2'
__author__ = 'Min Latt'
__author_email__ = 'minminlaxz@gmail.com'
__license__ = 'MIT' |
num = input()
lucky = 0
for i in num:
if i == '4' or i == '7':
lucky += 1
counter = 0
for c in str(lucky):
if c == '4' or c == '7':
counter += 1
if counter == len(str(lucky)):
print("YES")
else:
print("NO")
| num = input()
lucky = 0
for i in num:
if i == '4' or i == '7':
lucky += 1
counter = 0
for c in str(lucky):
if c == '4' or c == '7':
counter += 1
if counter == len(str(lucky)):
print('YES')
else:
print('NO') |
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
I=lambda:map(int,input().split())
f=abs
n,_,a,b,k=I()
while k:
p,q,u,v=I()
P=[a,b]
if a<=q<=b:P+=[q]
if a<=v<=b:P+=[v]
print([min(f(q-x)+f(v-x)for x in P)+f(p-u),f(q-v)][p==u])
k-=1 | """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
i = lambda : map(int, input().split())
f = abs
(n, _, a, b, k) = i()
while k:
(p, q, u, v) = i()
p = [a, b]
if a <= q <= b:
p += [q]
if a <= v <= b:
p += [v]
print([min((f(q - x) + f(v - x) for x... |
s=str(input())
a=[]
for i in range(len(s)):
si=s[i]
a.append(si)
b=[]
n=str(input())
for j in range(len(n)):
sj=n[j]
b.append(sj)
p={}
for pi in range(len(s)):
key=s[pi]
p[key]=0
j1=0
for i in range(0,len(a)):
key=a[i]
while j1<len(b):
bj=b[0]
if key in p:
p[k... | s = str(input())
a = []
for i in range(len(s)):
si = s[i]
a.append(si)
b = []
n = str(input())
for j in range(len(n)):
sj = n[j]
b.append(sj)
p = {}
for pi in range(len(s)):
key = s[pi]
p[key] = 0
j1 = 0
for i in range(0, len(a)):
key = a[i]
while j1 < len(b):
bj = b[0]
i... |
"""This module implements backtracking algorithm to solve sudoku."""
class Board:
"""
Class for sudoku board representation.
"""
NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8, 9]
def __init__(self, board):
"""
Create a new board.
"""
self.board = board
def __str__(self) ... | """This module implements backtracking algorithm to solve sudoku."""
class Board:
"""
Class for sudoku board representation.
"""
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
def __init__(self, board):
"""
Create a new board.
"""
self.board = board
def __str__(self) ->... |
N, *A = map(int, open(0).read().split())
A.sort()
for i in range(N):
if i == A[i] - 1:
continue
print('No')
break
else:
print('Yes')
| (n, *a) = map(int, open(0).read().split())
A.sort()
for i in range(N):
if i == A[i] - 1:
continue
print('No')
break
else:
print('Yes') |
class status(Exception):
def __init__(self, code=200, response=None):
super().__init__("season.core.CLASS.RESPONSE.STATUS")
self.code = code
self.response = response
def get_response(self):
return self.response, self.code | class Status(Exception):
def __init__(self, code=200, response=None):
super().__init__('season.core.CLASS.RESPONSE.STATUS')
self.code = code
self.response = response
def get_response(self):
return (self.response, self.code) |
#!/usr/bin/env python3
def calculate():
ans = sum(1
for i in range(1, 10000000)
if get_terminal(i) == 89)
return str(ans)
TERMINALS = (1, 89)
def get_terminal(n):
while n not in TERMINALS:
n = square_digit_sum(n)
return n
def square_digit_sum(n):
result = 0
... | def calculate():
ans = sum((1 for i in range(1, 10000000) if get_terminal(i) == 89))
return str(ans)
terminals = (1, 89)
def get_terminal(n):
while n not in TERMINALS:
n = square_digit_sum(n)
return n
def square_digit_sum(n):
result = 0
while n > 0:
result += sq_sum[n % 1000]
... |
def gen_doc_html(version, api_list):
doc_html = f'''
<!DOCTYPE html>
<html>
<head><meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body{{margin:40px auto;
max-width:650px; line-height:1.6;
font... | def gen_doc_html(version, api_list):
doc_html = f"""\n <!DOCTYPE html>\n <html>\n <head><meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <style type="text/css">\n body{{margin:40px auto;\n max-width:650px; line-height:1.6;\n ... |
countries = {'Russia' : 'Europe', 'Germany' : 'Europe', 'Australia' : 'Australia'}
sqrs = {}
sqrs[1] = 1
sqrs[2] = 4
sqrs[10] = 100
print(sqrs)
myDict = dict([['key1', 'value1'], ('key2', 'value2')])
print(myDict)
phones = {'police' : 102, 'ambulance' : 103, 'firefighters' : 101}
print(phones['police'])
phones = {'... | countries = {'Russia': 'Europe', 'Germany': 'Europe', 'Australia': 'Australia'}
sqrs = {}
sqrs[1] = 1
sqrs[2] = 4
sqrs[10] = 100
print(sqrs)
my_dict = dict([['key1', 'value1'], ('key2', 'value2')])
print(myDict)
phones = {'police': 102, 'ambulance': 103, 'firefighters': 101}
print(phones['police'])
phones = {'police': ... |
def f(x):
'''Does nothing.
:type x: a.C
'''
pass
| def f(x):
"""Does nothing.
:type x: a.C
"""
pass |
# this should accept a command as a string, and raturn a string detailing the issue
# if <command> is not a valid vanilla minecraft command. None otherwise.
def check(command):
return None
| def check(command):
return None |
print("One")
print("Two")
print("Three")
| print('One')
print('Two')
print('Three') |
# encoding: utf-8
# module Autodesk.Revit.UI.Plumbing calls itself Plumbing
# from RevitAPIUI,Version=17.0.0.0,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class IPipeFittingAndAccessoryPressureDropUIServer(IExternalServer):
""" Interface for exte... | class Ipipefittingandaccessorypressuredropuiserver(IExternalServer):
""" Interface for external servers providing optional UI for pipe fitting and pipe accessory coefficient calculation. """
def get_db_server_id(self):
"""
GetDBServerId(self: IPipeFittingAndAccessoryPressureDropUIServer) -> Guid
... |
'''
Created on Jul 19, 2012
@author: Chris
'''
class Command(object):
def validate(self, game):
pass
def execute(self, game):
pass | """
Created on Jul 19, 2012
@author: Chris
"""
class Command(object):
def validate(self, game):
pass
def execute(self, game):
pass |
# menu_text.py
#
# simple python menu
# https://stackoverflow.com/questions/19964603/creating-a-menu-in-python
#
city_menu = { '1': 'Chicago',
'2': 'New York',
'3': 'Washington',
'x': 'Exit'}
month_menu = {'0': 'All',
'1': 'January',
'2': 'February... | city_menu = {'1': 'Chicago', '2': 'New York', '3': 'Washington', 'x': 'Exit'}
month_menu = {'0': 'All', '1': 'January', '2': 'February', '3': 'March', '4': 'April', '5': 'May', '6': 'June', 'x': 'Exit'}
weekday_menu = {'0': 'All', '1': 'Monday', '2': 'Tuesday', '3': 'Wednesday', '4': 'Thursday', '5': 'Friday', '6': 'Sa... |
"""
Log multiple instances to same file.
"""
def log(msg):
f = open('error.log', 'a')
f.write(msg+'\n')
f.close()
def clear():
f = open('error.log', 'w')
f.write('')
f.close()
| """
Log multiple instances to same file.
"""
def log(msg):
f = open('error.log', 'a')
f.write(msg + '\n')
f.close()
def clear():
f = open('error.log', 'w')
f.write('')
f.close() |
hex_strings = [
"FF 81 BD A5 A5 BD 81 FF",
"AA 55 AA 55 AA 55 AA 55",
"3E 7F FC F8 F8 FC 7F 3E",
"93 93 93 F3 F3 93 93 93",
]
def hex_data_to_image(hex_data):
for hex_pair in hex_data:
for divisor in reversed(range(len(hex_data))):
print("X" if (int(hex_pair, 16) >> divisor & 1) == 1 else " ", end=... | hex_strings = ['FF 81 BD A5 A5 BD 81 FF', 'AA 55 AA 55 AA 55 AA 55', '3E 7F FC F8 F8 FC 7F 3E', '93 93 93 F3 F3 93 93 93']
def hex_data_to_image(hex_data):
for hex_pair in hex_data:
for divisor in reversed(range(len(hex_data))):
print('X' if int(hex_pair, 16) >> divisor & 1 == 1 else ' ', end='... |
# -*- coding: utf-8 -*-
# Copy this file and renamed it settings.py and change the values for your own project
# The csv file containing the information about the member.
# There is three columns: The name, the email and the member type: 0 regular, 1 life time
CSV_FILE = "path to csv file"
# The svg file for regular... | csv_file = 'path to csv file'
svg_file_regular = 'path to svg regular member file'
svg_file_life_time = 'path to svg life time member file'
dest_generated_folder = 'path to folder that will contain the generated files'
msg_file = '/Users/pierre/Documents/LPA/CA/carte_membre_msg'
smpt_host = 'myserver.com'
smpt_port = 5... |
i = 0
while (i<119):
print(i)
i+=10
| i = 0
while i < 119:
print(i)
i += 10 |
# The shape of the numbers for the dice
dice = { 1: [[None, None, None], [None, "", None], [None, None, None]],
2: [["", None, None], [None, None, None], [None, None, ""]],
3: [["", None, None], [None, "", None], [None, None, ""]],
4: [["", None, ""], [None, None, None], ["", None, ""]],
... | dice = {1: [[None, None, None], [None, '', None], [None, None, None]], 2: [['', None, None], [None, None, None], [None, None, '']], 3: [['', None, None], [None, '', None], [None, None, '']], 4: [['', None, ''], [None, None, None], ['', None, '']], 5: [['', None, ''], [None, '', None], ['', None, '']], 6: [['', None, ''... |
# __init__.py
# Copyright 2017 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Miscellaneous modules for applications available at solentware.co.uk.
These do not belong in the solentware_base or solentware_grid packages,
siblings of solentware_misc.
"""
| """Miscellaneous modules for applications available at solentware.co.uk.
These do not belong in the solentware_base or solentware_grid packages,
siblings of solentware_misc.
""" |
__author__ = "Music"
# MNIST For ML Beginners
# https://www.tensorflow.org/versions/r0.9/tutorials/mnist/beginners/index.html
| __author__ = 'Music' |
# -*- coding: utf-8 -*-
"""
1556. Thousand Separator
Given an integer n, add a dot (".") as the thousands separator and return it in string format.
Constraints:
0 <= n < 2^31
"""
class Solution:
def thousandSeparator(self, n: int) -> str:
res = ""
str_n = str(n)
count = 0
ind = ... | """
1556. Thousand Separator
Given an integer n, add a dot (".") as the thousands separator and return it in string format.
Constraints:
0 <= n < 2^31
"""
class Solution:
def thousand_separator(self, n: int) -> str:
res = ''
str_n = str(n)
count = 0
ind = len(str_n) - 1
... |
# -*- coding: utf-8 -*-
CHECKLIST_MAPPING = {
'checklist_retrieve': {
'resource': '/checklists/{id}',
'docs': (
'https://developers.trello.com/v1.0/reference'
'#checklistsid'
),
'methods': ['GET'],
},
'checklist_field_retrieve': {
'resource': ... | checklist_mapping = {'checklist_retrieve': {'resource': '/checklists/{id}', 'docs': 'https://developers.trello.com/v1.0/reference#checklistsid', 'methods': ['GET']}, 'checklist_field_retrieve': {'resource': '/checklists/{id}/{field}', 'docs': 'https://developers.trello.com/v1.0/reference#checklistsidfield', 'methods': ... |
days = int(input())
sladkar = int(input())
cake = int(input())
gofreta = int(input())
pancake = int(input())
cake_price = cake*45
gofreta_price = gofreta*5.8
pancake_price = pancake*3.2
day_price = (cake_price + gofreta_price + pancake_price)*sladkar
total_price = days*day_price
campaign = total_price - (total_price/8)... | days = int(input())
sladkar = int(input())
cake = int(input())
gofreta = int(input())
pancake = int(input())
cake_price = cake * 45
gofreta_price = gofreta * 5.8
pancake_price = pancake * 3.2
day_price = (cake_price + gofreta_price + pancake_price) * sladkar
total_price = days * day_price
campaign = total_price - total... |
n = int(input())
lst = list(map(int, input().split()))
def sort1(arr):
l = len(arr)
for i in range(1, n):
cur = arr[i]
pos = i
check = False
while pos > 0:
if arr[pos - 1] > cur:
check = True
arr[pos] = arr[pos - 1]
e... | n = int(input())
lst = list(map(int, input().split()))
def sort1(arr):
l = len(arr)
for i in range(1, n):
cur = arr[i]
pos = i
check = False
while pos > 0:
if arr[pos - 1] > cur:
check = True
arr[pos] = arr[pos - 1]
else:
... |
radiobutton_style = '''
QRadioButton:disabled {
background: transparent;
}
QRadioButton::indicator {
background: palette(dark);
width: 8px;
height: 8px;
border: 3px solid palette(dark);
border-radius: 7px;
}
QRadioButton::indicator:checked {
background: palette(highlight);
}
QRadioButton:... | radiobutton_style = '\nQRadioButton:disabled {\n background: transparent;\n}\n\nQRadioButton::indicator {\n background: palette(dark);\n width: 8px;\n height: 8px;\n border: 3px solid palette(dark);\n border-radius: 7px;\n}\n\nQRadioButton::indicator:checked {\n background: palette(highlight);\n}\n... |
#
# PySNMP MIB module ERI-DNX-STS1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ERI-DNX-STS1-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:51:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
expected_output = {
"location": {
"R0 R1": {
"auto_abort_timer": "inactive",
"pkg_state": {
1: {
"filename_version": "17.08.01.0.149429",
"state": "U",
"type": "IMG",
}
},
... | expected_output = {'location': {'R0 R1': {'auto_abort_timer': 'inactive', 'pkg_state': {1: {'filename_version': '17.08.01.0.149429', 'state': 'U', 'type': 'IMG'}}}}} |
def selection_sort(my_list):
for i in range(len(my_list)):
min_index=i
for j in range(i+1 , len(my_list)):
if my_list[min_index]>my_list[j]:
min_index= j
my_list[i],my_list[min_index]= my_list[min_index] ,my_list[i]
print(my_list)
cus_list=[8,4,23,42,16,... | def selection_sort(my_list):
for i in range(len(my_list)):
min_index = i
for j in range(i + 1, len(my_list)):
if my_list[min_index] > my_list[j]:
min_index = j
(my_list[i], my_list[min_index]) = (my_list[min_index], my_list[i])
print(my_list)
cus_list = [8, 4,... |
class Person:
number_of_people = 0
def __init__(self, name):
print("__init__ initiated")
self.name = name
print("calling add_person()")
Person.add_person()
@classmethod
def num_of_people(cls):
print("initiating num_of_person()")
return cls.number_of_peo... | class Person:
number_of_people = 0
def __init__(self, name):
print('__init__ initiated')
self.name = name
print('calling add_person()')
Person.add_person()
@classmethod
def num_of_people(cls):
print('initiating num_of_person()')
return cls.number_of_peop... |
SEPARATOR: list = [':', ',', '*', ';', '#', '|', '+', '%', '>', '?', '&', '=', '!']
def word_splitter(string: str) -> list:
for i in string:
if i in SEPARATOR:
string = string.replace(i, ' ')
return string.split()
| separator: list = [':', ',', '*', ';', '#', '|', '+', '%', '>', '?', '&', '=', '!']
def word_splitter(string: str) -> list:
for i in string:
if i in SEPARATOR:
string = string.replace(i, ' ')
return string.split() |
# POKEMING - GON'NA CATCH 'EM ALL
# -- A simple hack 'n slash game in console
# -- This class is handles all utility related things
class Utility:
# This allows to see important message of the game
def pause(message):
print(message)
input('Press any key to continue.') | class Utility:
def pause(message):
print(message)
input('Press any key to continue.') |
str1 = "Python"
str2 = "Python"
print("\nMemory location of str1 =", hex(id(str1)))
print("Memory location of str2 =", hex(id(str2)))
print() | str1 = 'Python'
str2 = 'Python'
print('\nMemory location of str1 =', hex(id(str1)))
print('Memory location of str2 =', hex(id(str2)))
print() |
config = dict()
config['fixed_cpu_frequency'] = "@ 3700 MHz"
config['frequency'] = 3.7e9
config['maxflops_sisd'] = 2
config['maxflops_sisd_fma'] = 4
config['maxflops_simd'] = 16
config['maxflops_simd_fma'] = 32
config['roofline_beta'] = 64 # According to WikiChip (Skylake)
config['figure_size'] = (20,9)
config... | config = dict()
config['fixed_cpu_frequency'] = '@ 3700 MHz'
config['frequency'] = 3700000000.0
config['maxflops_sisd'] = 2
config['maxflops_sisd_fma'] = 4
config['maxflops_simd'] = 16
config['maxflops_simd_fma'] = 32
config['roofline_beta'] = 64
config['figure_size'] = (20, 9)
config['save_folder'] = '../all_plots/' |
class Location:
def __init__(self, location_id, borough, zone, lat, lng):
self.location_id = location_id
self.borough = borough
self.zone = zone
self.lat = lat
self.lng = lng
@property
def json(self):
return {
"location_id": self.location_id,
... | class Location:
def __init__(self, location_id, borough, zone, lat, lng):
self.location_id = location_id
self.borough = borough
self.zone = zone
self.lat = lat
self.lng = lng
@property
def json(self):
return {'location_id': self.location_id, 'borough': self.... |
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
#
# What is the 10 001st prime number?
primes = []
for i in range(2, 100):
if len(primes) == 10001:
break
x = list(map(lambda y: i % y == 0, range(2,i)))
if sum(x) == False:
primes.a... | primes = []
for i in range(2, 100):
if len(primes) == 10001:
break
x = list(map(lambda y: i % y == 0, range(2, i)))
if sum(x) == False:
primes.append(i)
print(i)
print(primes[-1], 'Len: ', len(primes)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.