content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# The observer pattern is a software design pattern in which an object, called the subject,
# maintains a list of its dependents, called observers, and notifies them automatically of
# any state changes, usually by calling one of their methods.
# See more in wiki: https://en.wikipedia.org/wiki/Observer_pattern
#
# We w... | class Observer(object):
def __init__(self, id):
self._id = id
def update(self, message):
print('Observer %d get the update : %s' % (self._id, message))
class Subject(object):
def __init__(self):
self._observer_list = []
self._message = ''
def add_observer(self, obser... |
DEBUG = True
ADMINS = frozenset([
"yourname@yourdomain.com"
])
| debug = True
admins = frozenset(['yourname@yourdomain.com']) |
magic_square = [
[8, 3, 4],
[1, 5, 9],
[6, 7, 2]
]
print("Row")
print(magic_square[0][0]+magic_square[0][1]+magic_square[0][2])
print(magic_square[1][0]+magic_square[1][1]+magic_square[1][2])
print(magic_square[2][0]+magic_square[2][1]+magic_square[2][2])
print("colume")
print(magic_square[0][0]+magic_squa... | magic_square = [[8, 3, 4], [1, 5, 9], [6, 7, 2]]
print('Row')
print(magic_square[0][0] + magic_square[0][1] + magic_square[0][2])
print(magic_square[1][0] + magic_square[1][1] + magic_square[1][2])
print(magic_square[2][0] + magic_square[2][1] + magic_square[2][2])
print('colume')
print(magic_square[0][0] + magic_squar... |
class UserImporter:
def __init__(self, api):
self.api = api
self.users = {}
def run(self):
users = self.api.GetPersons()
def save_site_privs(self, user):
# update site roles
pass
def save_slice_privs(self, user):
# update slice roles
pass
... | class Userimporter:
def __init__(self, api):
self.api = api
self.users = {}
def run(self):
users = self.api.GetPersons()
def save_site_privs(self, user):
pass
def save_slice_privs(self, user):
pass |
def I(d,i,v):d[i]=d.setdefault(i,0)+v
L=open("inputday14").readlines();t,d,p=L[0],dict([l.strip().split(' -> ')for l in L[2:]]),{};[I(p,t[i:i+2],1)for i in range(len(t)-2)]
def E(P):o=dict(P);[(I(P,p,-o[p]),I(P,p[0]+n,o[p]),I(P,n+p[1],o[p]))for p,n in d.items()if p in o.keys()];return P
def C(P):e={};[I(e,c,v)for p,v i... | def i(d, i, v):
d[i] = d.setdefault(i, 0) + v
l = open('inputday14').readlines()
(t, d, p) = (L[0], dict([l.strip().split(' -> ') for l in L[2:]]), {})
[i(p, t[i:i + 2], 1) for i in range(len(t) - 2)]
def e(P):
o = dict(P)
[(i(P, p, -o[p]), i(P, p[0] + n, o[p]), i(P, n + p[1], o[p])) for (p, n) in d.items(... |
N,M=map(int,input().split())
edges=[list(map(int,input().split())) for i in range(M)]
ans=0
for x in edges:
l=list(range(N))
for y in edges:
if y!=x:l=[l[y[0]-1] if l[i]==l[y[1]-1] else l[i] for i in range(N)]
if len(set(l))!=1:ans+=1
print(ans) | (n, m) = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(M)]
ans = 0
for x in edges:
l = list(range(N))
for y in edges:
if y != x:
l = [l[y[0] - 1] if l[i] == l[y[1] - 1] else l[i] for i in range(N)]
if len(set(l)) != 1:
ans += 1
print(ans) |
def initialize_weights_normal(network):
pass
def initialize_weights_xavier(network):
pass
| def initialize_weights_normal(network):
pass
def initialize_weights_xavier(network):
pass |
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
def kSum(nums: List[int], target: int, k: int) -> List[List[int]]:
res = []
# If we have run out of numbers to add, return res.
if not nums:
return res
... | class Solution:
def four_sum(self, nums: List[int], target: int) -> List[List[int]]:
def k_sum(nums: List[int], target: int, k: int) -> List[List[int]]:
res = []
if not nums:
return res
average_value = target // k
if average_value < nums[0] o... |
class Employee:
def __init__(self, first, last, sex):
self.first = first
self.last = last
self.sex = sex
self.email = first + '.' + last + '@company.com'
def fullname(self):
return "{} {}".format(self.first, self.last)
def main():
emp_1 = Employee('prajesh', 'anant... | class Employee:
def __init__(self, first, last, sex):
self.first = first
self.last = last
self.sex = sex
self.email = first + '.' + last + '@company.com'
def fullname(self):
return '{} {}'.format(self.first, self.last)
def main():
emp_1 = employee('prajesh', 'anant... |
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', nodes: 'List[TreeNode]') -> 'TreeNode':
nodes = set(nodes)
return self._lca(root, nodes)
def _lca(self, root, nodes):
if not root or root in nodes:
return root
l = self._lca(root.left, nodes)
... | class Solution:
def lowest_common_ancestor(self, root: 'TreeNode', nodes: 'List[TreeNode]') -> 'TreeNode':
nodes = set(nodes)
return self._lca(root, nodes)
def _lca(self, root, nodes):
if not root or root in nodes:
return root
l = self._lca(root.left, nodes)
... |
#
# PySNMP MIB module EMC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EMC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:02:38 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_range_constraint, constraints_union, value_size_constraint) ... |
class IrisAbstract(metaclass=ABCMeta):
@abstractmethod
def mean(self) -> float:
...
@abstractmethod
def sum(self) -> float:
...
@abstractmethod
def len(self) -> int:
...
| class Irisabstract(metaclass=ABCMeta):
@abstractmethod
def mean(self) -> float:
...
@abstractmethod
def sum(self) -> float:
...
@abstractmethod
def len(self) -> int:
... |
class Solution:
def rob(self, nums: List[int]) -> int:
def recur(arr):
memo = {}
def dfs(i):
if i in memo:
return memo[i]
if i >= len(arr):
return 0
... | class Solution:
def rob(self, nums: List[int]) -> int:
def recur(arr):
memo = {}
def dfs(i):
if i in memo:
return memo[i]
if i >= len(arr):
return 0
cur = max(arr[i] + dfs(i + 2), dfs(i + 1))
... |
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
dp = [[0]*(len(text2)+1) for _ in range(len(text1)+1)]
m, n = len(text1), len(text2)
for i in range(1, m+1):
for j in range(1, n+1):
if text1[i-1] == text2[j-1]:
... | class Solution:
def longest_common_subsequence(self, text1: str, text2: str) -> int:
dp = [[0] * (len(text2) + 1) for _ in range(len(text1) + 1)]
(m, n) = (len(text1), len(text2))
for i in range(1, m + 1):
for j in range(1, n + 1):
if text1[i - 1] == text2[j - 1]... |
tail = input()
body = input()
head = input()
animal = [head, body, tail]
print(animal)
| tail = input()
body = input()
head = input()
animal = [head, body, tail]
print(animal) |
ngroups = int(input())
for i in range(ngroups):
bef = '0.0'
while True:
act = input()
if act == '0':
break
if act.find('.') == -1:
act += '.0'
nDecAct = len(act) - act.find('.') - 1
nDecBef = len(bef) - bef.find('.') - 1
decima... | ngroups = int(input())
for i in range(ngroups):
bef = '0.0'
while True:
act = input()
if act == '0':
break
if act.find('.') == -1:
act += '.0'
n_dec_act = len(act) - act.find('.') - 1
n_dec_bef = len(bef) - bef.find('.') - 1
decimals_after ... |
def part1():
Input = [int(x) for x in open("input.txt").read().split("\n")]
Start = 0
Jumps = {}
while len(Input) != 0:
Smallest = float("inf")
for x in Input:
Smallest = min(Smallest, x-Start)
if Smallest not in Jumps:
Jumps[Smallest] = 1
else:... | def part1():
input = [int(x) for x in open('input.txt').read().split('\n')]
start = 0
jumps = {}
while len(Input) != 0:
smallest = float('inf')
for x in Input:
smallest = min(Smallest, x - Start)
if Smallest not in Jumps:
Jumps[Smallest] = 1
else:
... |
# Adapted from: http://jared.geek.nz/2013/feb/linear-led-pwm
INPUT_SIZE = 255 # Input integer size
OUTPUT_SIZE = 255 # Output integer size
INT_TYPE = 'uint8_t'
TABLE_NAME = 'cie';
def cie1931(L):
L = L*100.0
if L <= 8:
return (L/902.3)
else:
return ((L+16.0)/116.0)**3
x = range... | input_size = 255
output_size = 255
int_type = 'uint8_t'
table_name = 'cie'
def cie1931(L):
l = L * 100.0
if L <= 8:
return L / 902.3
else:
return ((L + 16.0) / 116.0) ** 3
x = range(0, int(INPUT_SIZE + 1))
brightness = [cie1931(float(L) / INPUT_SIZE) for l in x]
numerator = 1
denominator = ... |
#
# PySNMP MIB module HPN-ICF-NVGRE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-NVGRE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:40:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ... |
image = []
with open('conv0.bb','rb') as f:
pixels = f.read(320 * 160 * 4 * 2)
print(type(pixels))
for pixel in pixels:
image.append(pixel)
print(len(image))
print(max(image))
print(min(image)) | image = []
with open('conv0.bb', 'rb') as f:
pixels = f.read(320 * 160 * 4 * 2)
print(type(pixels))
for pixel in pixels:
image.append(pixel)
print(len(image))
print(max(image))
print(min(image)) |
print ("Hello world ....! Hi")
count = 10
print("I am at break-point ",count);
count=10*2
print("end ",count)
print ("Hello world")
pr = input("enter your name .!!")
print ("Hello world",pr)
for hooray_counter in range(1, 10):
for hip_counter in range(1, 3):
print ("Hip")
print ("Hooray!!")
while Tr... | print('Hello world ....! Hi')
count = 10
print('I am at break-point ', count)
count = 10 * 2
print('end ', count)
print('Hello world')
pr = input('enter your name .!!')
print('Hello world', pr)
for hooray_counter in range(1, 10):
for hip_counter in range(1, 3):
print('Hip')
print('Hooray!!')
while True:... |
ofd1 = open('D:\\MyGit\\ML\Data\\x_y_seqindex.csv','r')
ofd2 = open('D:\\MyGit\\ML\Data\\OrderSeq.csv','r')
nfd = open('D:\\MyGit\\ML\Data\\OrderClassificationCheck.txt','w')
orders = []
for i in ofd2:
t = i.strip().split(',')
order,design,classification,seq = t
orders.append(t)
dic = {}
dic[0]='Complex'... | ofd1 = open('D:\\MyGit\\ML\\Data\\x_y_seqindex.csv', 'r')
ofd2 = open('D:\\MyGit\\ML\\Data\\OrderSeq.csv', 'r')
nfd = open('D:\\MyGit\\ML\\Data\\OrderClassificationCheck.txt', 'w')
orders = []
for i in ofd2:
t = i.strip().split(',')
(order, design, classification, seq) = t
orders.append(t)
dic = {}
dic[0] =... |
# from flask import Blueprint, request
# from app.api.utils import good_json_response, bad_json_response
# import requests
# blueprint.route('/add', methods=['POST'])
def test_register():
pass
# url = 'http://localhost:5000/json'
# resp = requests.get(url)
# assert resp.status_code == 200
# assert... | def test_register():
pass
def test_delete():
pass
def f():
return 4
def test_function():
assert f() == 4
__all__ = 'blueprint' |
# -*- coding: utf-8 -*-
class AgendamentoExistenteError(Exception):
def __init__(self, *args, **kwargs):
super(AgendamentoExistenteError, self).__init__(*args, **kwargs)
| class Agendamentoexistenteerror(Exception):
def __init__(self, *args, **kwargs):
super(AgendamentoExistenteError, self).__init__(*args, **kwargs) |
class Slot:
def __init__(self, x, y, paint=False):
self.x = x
self.y = y
self.paint = paint
self.painted = False
self.neigh = set()
self.neigh_count = 0
def __str__(self):
return "%d %d" % (self.x, self.y)
class Grid:
def __init__(self, n_rows, n_col... | class Slot:
def __init__(self, x, y, paint=False):
self.x = x
self.y = y
self.paint = paint
self.painted = False
self.neigh = set()
self.neigh_count = 0
def __str__(self):
return '%d %d' % (self.x, self.y)
class Grid:
def __init__(self, n_rows, n_c... |
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
dp = [[0]*(len(text1)+1) for _ in range(len(text2)+1)]
for i in range(1, len(text2)+1):
for j in range(1, len(text1)+1):
if text2[i - 1] == text1[j - 1]:
dp[i][j] = 1 +... | class Solution:
def longest_common_subsequence(self, text1: str, text2: str) -> int:
dp = [[0] * (len(text1) + 1) for _ in range(len(text2) + 1)]
for i in range(1, len(text2) + 1):
for j in range(1, len(text1) + 1):
if text2[i - 1] == text1[j - 1]:
dp... |
#test for primality
def IsPrime(x):
x = abs(int(x))
if x < 2:
return False
if x == 2:
return True
if not x & 1:
return False
for y in range(3, int(x**0.5)+1, 2):
if x % y == 0:
return False
return True
def QuadatricAnswer(a, b, n):
return n**2 + a... | def is_prime(x):
x = abs(int(x))
if x < 2:
return False
if x == 2:
return True
if not x & 1:
return False
for y in range(3, int(x ** 0.5) + 1, 2):
if x % y == 0:
return False
return True
def quadatric_answer(a, b, n):
return n ** 2 + a * n + b
de... |
class NoRecordsFoundError(Exception):
pass
class J2XException(Exception):
pass
| class Norecordsfounderror(Exception):
pass
class J2Xexception(Exception):
pass |
n = int(input())
tl = list(map(int, input().split()))
m = int(input())
sum_time = sum(tl)
for _ in range(m):
p, x = map(int, input().split())
print(sum_time - tl[p-1] + x)
| n = int(input())
tl = list(map(int, input().split()))
m = int(input())
sum_time = sum(tl)
for _ in range(m):
(p, x) = map(int, input().split())
print(sum_time - tl[p - 1] + x) |
class Solution:
def reverseWords(self, s: str) -> str:
list_s = s.split(' ')
for i in range(len(list_s)):
list_s[i] = list_s[i][::-1]
return ' '.join(list_s)
print(Solution().reverseWords("Let's take LeetCode contest"))
| class Solution:
def reverse_words(self, s: str) -> str:
list_s = s.split(' ')
for i in range(len(list_s)):
list_s[i] = list_s[i][::-1]
return ' '.join(list_s)
print(solution().reverseWords("Let's take LeetCode contest")) |
class XmlConverter:
def __init__(self, prefix, method, params):
self.text = ''
self.prefix = prefix
self.method = method
self.params = params
def create_tag(self, parent, elem):
if isinstance(elem, dict):
for key, value in elem.items():
self.t... | class Xmlconverter:
def __init__(self, prefix, method, params):
self.text = ''
self.prefix = prefix
self.method = method
self.params = params
def create_tag(self, parent, elem):
if isinstance(elem, dict):
for (key, value) in elem.items():
sel... |
print('-------------------------------------------------------------------------')
family=['me','sis','Papa','Mummy','Chacha']
print('Now, we will copy family list to a another list')
for i in range(len(family)):
cpy_family=family[1:4]
print(family)
print('--------------------------------------')
print(cpy_fa... | print('-------------------------------------------------------------------------')
family = ['me', 'sis', 'Papa', 'Mummy', 'Chacha']
print('Now, we will copy family list to a another list')
for i in range(len(family)):
cpy_family = family[1:4]
print(family)
print('--------------------------------------')
print(cpy_... |
num = 1
num1 = 10
num2 = 20
num3 = 40
num3 = 30
num4 = 50
| num = 1
num1 = 10
num2 = 20
num3 = 40
num3 = 30
num4 = 50 |
# example_traceback.py
def loader(filename):
fin = open(filenam)
loader("data/result_ab.txt")
| def loader(filename):
fin = open(filenam)
loader('data/result_ab.txt') |
#%%
#https://leetcode.com/problems/divide-two-integers/
#%%
dividend = -2147483648
dividend = -10
divisor = -1
divisor = 3
def divideInt(dividend, divisor):
sign = -1 if dividend * divisor < 0 else 1
if dividend == 0:
return 0
dividend = abs(dividend)
divisor = abs(divisor)
if divisor == ... | dividend = -2147483648
dividend = -10
divisor = -1
divisor = 3
def divide_int(dividend, divisor):
sign = -1 if dividend * divisor < 0 else 1
if dividend == 0:
return 0
dividend = abs(dividend)
divisor = abs(divisor)
if divisor == 1:
return sign * dividend
remainder = dividend
... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class Counter(object):
''' Stores all the samples for a given counter.
'''
def __init__(self, parent, category, name):
self.parent = parent
sel... | class Counter(object):
""" Stores all the samples for a given counter.
"""
def __init__(self, parent, category, name):
self.parent = parent
self.full_name = category + '.' + name
self.category = category
self.name = name
self.samples = []
self.timestamps = []
... |
load("@com_github_reboot_dev_pyprotoc_plugin//:rules.bzl", "create_protoc_plugin_rule")
cc_eventuals_library = create_protoc_plugin_rule(
"@com_github_3rdparty_eventuals_grpc//protoc-gen-eventuals:protoc-gen-eventuals", extensions=(".eventuals.h", ".eventuals.cc")
)
| load('@com_github_reboot_dev_pyprotoc_plugin//:rules.bzl', 'create_protoc_plugin_rule')
cc_eventuals_library = create_protoc_plugin_rule('@com_github_3rdparty_eventuals_grpc//protoc-gen-eventuals:protoc-gen-eventuals', extensions=('.eventuals.h', '.eventuals.cc')) |
class GUIComponent:
def get_surface(self):
return None
def get_position(self):
return None
def initialize(self):
pass | class Guicomponent:
def get_surface(self):
return None
def get_position(self):
return None
def initialize(self):
pass |
__author__ = 'Chirag'
'''iter(<iterable>) = iterator converts
iterable object into in 'iterator' so that
we use can use the next(<iterator>)'''
string = "Hello"
for letter in string:
print(letter)
string_iter = iter(string)
print(next(string_iter))
| __author__ = 'Chirag'
"iter(<iterable>) = iterator converts \niterable object into in 'iterator' so that \nwe use can use the next(<iterator>)"
string = 'Hello'
for letter in string:
print(letter)
string_iter = iter(string)
print(next(string_iter)) |
x = int (input('Digite um numero :'))
for x in range (0,x):
print (x)
if x % 4 == 0:
print ('[{}]'.format(x)) | x = int(input('Digite um numero :'))
for x in range(0, x):
print(x)
if x % 4 == 0:
print('[{}]'.format(x)) |
#try out file I/O
myfile=open("example.txt", "a+")
secondfile=open("python.txt", "r")
for _ in range(4):
print(secondfile.read())
| myfile = open('example.txt', 'a+')
secondfile = open('python.txt', 'r')
for _ in range(4):
print(secondfile.read()) |
def nth_sevenish_number(n):
answer, bit_place = 0, 0
while n > 0:
if n & 1 == 1:
answer += 7 ** bit_place
n >>= 1
bit_place += 1
return answer
# n = 1
# print(nth_sevenish_number(n))
for n in range(1, 10):
print(nth_sevenish_number(n))
| def nth_sevenish_number(n):
(answer, bit_place) = (0, 0)
while n > 0:
if n & 1 == 1:
answer += 7 ** bit_place
n >>= 1
bit_place += 1
return answer
for n in range(1, 10):
print(nth_sevenish_number(n)) |
'''
Find missing no. in array.
'''
def missingNo(arr):
n = len(arr)
sumOfArr = 0
for num in range(0,n):
sumOfArr = sumOfArr + arr[num]
sumOfNno = (n * (n+1)) // 2
missNumber = sumOfNno - sumOfArr
print(missNumber)
arr = [3,0,1]
missingNo(arr)
| """
Find missing no. in array.
"""
def missing_no(arr):
n = len(arr)
sum_of_arr = 0
for num in range(0, n):
sum_of_arr = sumOfArr + arr[num]
sum_of_nno = n * (n + 1) // 2
miss_number = sumOfNno - sumOfArr
print(missNumber)
arr = [3, 0, 1]
missing_no(arr) |
a = "python"
b = "is"
c = "excellent"
d = a[0] + c[0] + a[len(a)-1] + b
print(d)
| a = 'python'
b = 'is'
c = 'excellent'
d = a[0] + c[0] + a[len(a) - 1] + b
print(d) |
# weekdays buttons
WEEKDAY_BUTTON = 'timetable_%(weekday)s_button'
TIMETABLE_BUTTON = 'timetable_%(attendance)s_%(week_parity)s_%(weekday)s_button'
# parameters buttons
NAME = 'name_button'
MAILING = 'mailing_parameters_button'
ATTENDANCE = 'attendance_button'
COURSES = 'courses_parameters_button'
PARAMETERS_RETURN = ... | weekday_button = 'timetable_%(weekday)s_button'
timetable_button = 'timetable_%(attendance)s_%(week_parity)s_%(weekday)s_button'
name = 'name_button'
mailing = 'mailing_parameters_button'
attendance = 'attendance_button'
courses = 'courses_parameters_button'
parameters_return = 'return_parameters_button'
exit_parameter... |
class SearchParams(object):
def __init__(self):
self.maxTweets = 0
def set_username(self, username):
self.username = username
return self
def set_since(self, since):
self.since = since
return self
def set_until(self, until):
self.until = until
r... | class Searchparams(object):
def __init__(self):
self.maxTweets = 0
def set_username(self, username):
self.username = username
return self
def set_since(self, since):
self.since = since
return self
def set_until(self, until):
self.until = until
... |
x = int(input("Please enter any number!"))
if x >= 0:
print( "Positive")
else:
print( "Negative") | x = int(input('Please enter any number!'))
if x >= 0:
print('Positive')
else:
print('Negative') |
# IF
# In this program, we check if the number is positive or negative or zero and
# display an appropriate message
# Flow Control
x=7
if x>10:
print("x is big.")
elif x > 0:
print("x is small.")
else:
print("x is not positive.")
# Array
# Variabel array
genap = [14,24,56,80]
ganjil = ... | x = 7
if x > 10:
print('x is big.')
elif x > 0:
print('x is small.')
else:
print('x is not positive.')
genap = [14, 24, 56, 80]
ganjil = [13, 55, 73, 23]
nap = 0
jil = 0
for val in genap:
nap = nap + val
for val in ganjil:
jil = jil + val
print('Ini adalah bilangan Genap', nap)
print('Ini ad... |
# Remember that everything in python is
# pass by reference
if __name__ == '__main__':
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
print('First four: ', a[:4]) # same as a[0:4]
# -ve list index starts at position 1
print('Last four: ', a[-4:])
print('Middle two: ', a[3:-3])
# when used in... | if __name__ == '__main__':
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
print('First four: ', a[:4])
print('Last four: ', a[-4:])
print('Middle two: ', a[3:-3])
print('Before : ', a)
a[2:7] = [99, 22, 14]
print('After : ', a)
b = a[:]
assert b is not a
b = a
a[:] = [100, 101,... |
## This script contains useful functions to generate a html page given a
## blog post txt file. It also creates meta data for the blog posts to be
## used to make summaries.
## Input should be a txt file of specific format
def read_file(infile):
metadata = []
post = []
with open(infile, 'r') as f:
... | def read_file(infile):
metadata = []
post = []
with open(infile, 'r') as f:
for line in f:
if line[0] == '#':
metadata.append(line.strip('\n'))
else:
post.append(line)
return {'metadata': metadata, 'post': post}
def get_title(metadata):
... |
#!/usr/bin/env python3
#chmod +x hello.py
#It will insert space and newline in preset
print ("Hello", "World!")
| print('Hello', 'World!') |
def final_pos():
x = y = 0
with open("input.txt") as inp:
while True:
instr = inp.readline()
try:
cmd, val = instr.split()
except ValueError:
break
else:
if cmd == "forward":
x += int(val... | def final_pos():
x = y = 0
with open('input.txt') as inp:
while True:
instr = inp.readline()
try:
(cmd, val) = instr.split()
except ValueError:
break
else:
if cmd == 'forward':
x += int(va... |
class zoo:
def __init__(self,stock,cuidadores,animales):
pass
class cuidador:
def __init__(self,animales,vacaciones):
pass
class animal:
def __init__(self,dieta):
pass
class vacaciones:
def __init__(self):
pass
class comida:
def __init__(self,dieta):
pass
clas... | class Zoo:
def __init__(self, stock, cuidadores, animales):
pass
class Cuidador:
def __init__(self, animales, vacaciones):
pass
class Animal:
def __init__(self, dieta):
pass
class Vacaciones:
def __init__(self):
pass
class Comida:
def __init__(self, dieta):
... |
PROLOGUE = '''module smcauth(clk, rst, g_input, e_input, o);
input clk;
input [255:0] e_input;
input [255:0] g_input;
output o;
input rst;
'''
EPILOGUE = 'endmodule\n'
OR_CIRCUIT = '''
OR {} (
.A({}),
.B({}),
.Z({})
);
'''
AND_CIRCUIT = '''
ANDN {} (
.A({}),
.B({}),
.Z({})
)... | prologue = 'module smcauth(clk, rst, g_input, e_input, o);\n input clk;\n input [255:0] e_input;\n input [255:0] g_input;\n output o;\n input rst;\n'
epilogue = 'endmodule\n'
or_circuit = '\n OR {} (\n .A({}),\n .B({}),\n .Z({})\n );\n'
and_circuit = '\n ANDN {} (\n .A({}),\n .B({}),\n .Z({})\... |
class Base(object):
def __init__(self, *args, **kwargs):
pass
def dispose(self, *args, **kwargs):
pass
def prepare(self, *args, **kwargs):
pass
def prepare_page(self, *args, **kwargs):
pass
def cleanup(self, *args, **kwargs):
pass
| class Base(object):
def __init__(self, *args, **kwargs):
pass
def dispose(self, *args, **kwargs):
pass
def prepare(self, *args, **kwargs):
pass
def prepare_page(self, *args, **kwargs):
pass
def cleanup(self, *args, **kwargs):
pass |
n1 = float(input("Write the average of the first student "))
n2 = float(input("Write the average of the second student "))
m = (n1+n2)/2
print("The average of the two students is {}".format(m))
| n1 = float(input('Write the average of the first student '))
n2 = float(input('Write the average of the second student '))
m = (n1 + n2) / 2
print('The average of the two students is {}'.format(m)) |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Elvis Tombini <elvis@mapom.me>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDE... | wlconf = 'wlister.conf'
wlprefix = 'wlister.log_prefix'
wlaction = 'wlister.default_action'
wlmaxpost = 'wlister.max_post_read'
wlmaxpost_value = 2048
class Wlconfig(object):
def __init__(self, request, log):
options = request.get_options()
self.log = log
if WLCONF in options:
... |
# This programs aasks for your name and says hello
print('Hello world!')
print('What is your name?') #Ask for their name
myName = input()
print('It is good to meet you, ' + myName)
print('The lenght of your name is : ')
print(len(myName))
print('What is your age?') #Ask for their age
yourAge = input()
print('You wil... | print('Hello world!')
print('What is your name?')
my_name = input()
print('It is good to meet you, ' + myName)
print('The lenght of your name is : ')
print(len(myName))
print('What is your age?')
your_age = input()
print('You will be ' + str(int(yourAge) + 1) + ' in a year.') |
# project/tests/test_ping.py
def test_ping(test_app):
response = test_app.get("/ping")
assert response.status_code == 200
assert response.json() == {"environment": "dev", "ping": "pong!", "testing": True}
| def test_ping(test_app):
response = test_app.get('/ping')
assert response.status_code == 200
assert response.json() == {'environment': 'dev', 'ping': 'pong!', 'testing': True} |
#!/usr/bin/env python
# coding=utf-8
__version__ = "2.1.4"
| __version__ = '2.1.4' |
label_name = []
with open("label_name.txt",encoding='utf-8') as file:
for line in file.readlines():
line = line.strip()
name = (line.split('-')[-1])
if name.count('|') > 0:
name = name.split('|')[-1]
print(name)
label_name.append((name))
for item in label_name:... | label_name = []
with open('label_name.txt', encoding='utf-8') as file:
for line in file.readlines():
line = line.strip()
name = line.split('-')[-1]
if name.count('|') > 0:
name = name.split('|')[-1]
print(name)
label_name.append(name)
for item in label_name:
w... |
class Library(object):
def __init__(self):
self.dictionary = {
"Micah": ["Judgement on Samaria and Judah", "Reason for the judgement", "Judgement on wicked leaders",
"Messianic Kingdom", "Birth of the Messiah", "Indictment 1, 2", "Promise of salvation"]
}
def get(self, b... | class Library(object):
def __init__(self):
self.dictionary = {'Micah': ['Judgement on Samaria and Judah', 'Reason for the judgement', 'Judgement on wicked leaders', 'Messianic Kingdom', 'Birth of the Messiah', 'Indictment 1, 2', 'Promise of salvation']}
def get(self, book):
return self.diction... |
AESEncryptParam = "Key (32 Hex characters)"
S_BOX = (
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0... | aes_encrypt_param = 'Key (32 Hex characters)'
s_box = (99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 1... |
### Sherlock and The Beast - Solution
def findDecentNumber(n):
temp = n
while temp > 0:
if temp%3 == 0:
break
else:
temp -= 5
if temp < 0:
return -1
final_str = ""
rep_count = temp // 3
while rep_count:
final_str += "555"
rep_count... | def find_decent_number(n):
temp = n
while temp > 0:
if temp % 3 == 0:
break
else:
temp -= 5
if temp < 0:
return -1
final_str = ''
rep_count = temp // 3
while rep_count:
final_str += '555'
rep_count -= 1
rep_count = (n - temp) //... |
#!/bin/env python3
class Car:
''' A car description '''
NUMBER_OF_WHEELS = 4 # Class variable.
def __init__(self, name):
self.name = name
self.distance = 0
def drive(self, distance):
''' incrises distance '''
self.distance += distance
def reverse(distance):
... | class Car:
""" A car description """
number_of_wheels = 4
def __init__(self, name):
self.name = name
self.distance = 0
def drive(self, distance):
""" incrises distance """
self.distance += distance
def reverse(distance):
""" Class method """
print('... |
# LeetCode 953. Verifying an Alien Dictionary `E`
# 1sk | 97% | 22'
# A~0v21
class Solution:
def isAlienSorted(self, words: List[str], order: str) -> bool:
dic = {c: i for i, c in enumerate(order)}
def cmp(s1, s2):
for i in range(min(len(s1), len(s2))):
if s1[i] != s2[i... | class Solution:
def is_alien_sorted(self, words: List[str], order: str) -> bool:
dic = {c: i for (i, c) in enumerate(order)}
def cmp(s1, s2):
for i in range(min(len(s1), len(s2))):
if s1[i] != s2[i]:
return dic[s1[i]] <= dic[s2[i]]
return... |
def beautifulTriplets(d, arr):
t = 0
for i in range(len(arr)):
if arr[i] + d in arr and arr[i] + 2*d in arr:
t += 1
return t | def beautiful_triplets(d, arr):
t = 0
for i in range(len(arr)):
if arr[i] + d in arr and arr[i] + 2 * d in arr:
t += 1
return t |
prime_numbers = [True for x in range(1001)]
prime_numbers[1] = False
for i in range(2, 1001):
for j in range(2*i, 1001, i):
prime_numbers[j] = False
input()
count = 0
for i in map(int, input().split()):
if prime_numbers[i] is True:
count += 1
print(count)
| prime_numbers = [True for x in range(1001)]
prime_numbers[1] = False
for i in range(2, 1001):
for j in range(2 * i, 1001, i):
prime_numbers[j] = False
input()
count = 0
for i in map(int, input().split()):
if prime_numbers[i] is True:
count += 1
print(count) |
def intersection(right=[], left=[]):
return list(set(right).intersection(set(left)))
def union(right=[], left=[]):
return list(set(right).union(set(left)))
def union(right=[], left=[]):
return list(set(right).difference(set(left))) # not have in left
| def intersection(right=[], left=[]):
return list(set(right).intersection(set(left)))
def union(right=[], left=[]):
return list(set(right).union(set(left)))
def union(right=[], left=[]):
return list(set(right).difference(set(left))) |
{
"target_defaults":
{
"cflags" : ["-Wall", "-Wextra", "-Wno-unused-parameter"],
"include_dirs": ["<!(node -e \"require('..')\")", "<!(node -e \"require('nan')\")",]
},
"targets": [
{
"target_name" : "primeNumbers",
"sources" : [ "cpp/primeNumbers.cpp" ],
"target_conditions": [
... | {'target_defaults': {'cflags': ['-Wall', '-Wextra', '-Wno-unused-parameter'], 'include_dirs': ['<!(node -e "require(\'..\')")', '<!(node -e "require(\'nan\')")']}, 'targets': [{'target_name': 'primeNumbers', 'sources': ['cpp/primeNumbers.cpp'], 'target_conditions': [['OS=="mac"', {'xcode_settings': {'GCC_ENABLE_CPP_EXC... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
def main():
print(add(5,10))
print(add(5))
print(add(5,6))
print(add(x=5, y=2))
# print(add(x=5, 2)) # Error we need to use the both with name if you use the first one as named argument
print(add(5,y=2))
print(1,2,3,4,5, sep=" - ")
def add(x, y=3):
total = ... | def main():
print(add(5, 10))
print(add(5))
print(add(5, 6))
print(add(x=5, y=2))
print(add(5, y=2))
print(1, 2, 3, 4, 5, sep=' - ')
def add(x, y=3):
total = x + y
return total
if __name__ == '__main__':
main() |
#!/usr/bin/python3
class VectorFeeder:
def __init__(self, vectors, words, cursor=0):
self.data = vectors
self.cursor = cursor
self.words = words
print('len words', len(self.words), 'len data', len(self.data))
def get_next_batch(self, size):
batch = self.data[self.cursor:... | class Vectorfeeder:
def __init__(self, vectors, words, cursor=0):
self.data = vectors
self.cursor = cursor
self.words = words
print('len words', len(self.words), 'len data', len(self.data))
def get_next_batch(self, size):
batch = self.data[self.cursor:self.cursor + size... |
expected_output = {
"instance": {
"default": {
"vrf": {
"VRF1": {
"address_family": {
"vpnv4 unicast RD 100:100": {
"default_vrf": "VRF1",
"prefixes": {
... | expected_output = {'instance': {'default': {'vrf': {'VRF1': {'address_family': {'vpnv4 unicast RD 100:100': {'default_vrf': 'VRF1', 'prefixes': {'10.229.11.11/32': {'available_path': '1', 'best_path': '1', 'index': {1: {'gateway': '0.0.0.0', 'inaccessible': False, 'localpref': 100, 'metric': 0, 'next_hop': '0.0.0.0', '... |
n=6
x=1
for i in range(1,n+1):
for j in range(i,0,-1):
ch=chr(ord('Z')-j+1)
print(ch,end="")
x=x+1
print()
for i in range(n,0,-1):
for j in range(i,0,-1):
ch=chr(ord('Z')-j+1)
print(ch,end="")
x=x+1
print()
| n = 6
x = 1
for i in range(1, n + 1):
for j in range(i, 0, -1):
ch = chr(ord('Z') - j + 1)
print(ch, end='')
x = x + 1
print()
for i in range(n, 0, -1):
for j in range(i, 0, -1):
ch = chr(ord('Z') - j + 1)
print(ch, end='')
x = x + 1
print() |
name1_1_0_0_0_0_0 = None
name1_1_0_0_0_0_1 = None
name1_1_0_0_0_0_2 = None
name1_1_0_0_0_0_3 = None
name1_1_0_0_0_0_4 = None | name1_1_0_0_0_0_0 = None
name1_1_0_0_0_0_1 = None
name1_1_0_0_0_0_2 = None
name1_1_0_0_0_0_3 = None
name1_1_0_0_0_0_4 = None |
def soma(*args):
total = 0
for n in args:
total += n
return total
print(__name__)
print(soma())
print(soma(1))
print(soma(1, 2))
print(soma(1, 2, 5)) | def soma(*args):
total = 0
for n in args:
total += n
return total
print(__name__)
print(soma())
print(soma(1))
print(soma(1, 2))
print(soma(1, 2, 5)) |
infty = 999999
def whitespace(words, i, j):
return (L-(j-i)-sum([len(word) for word in words[i:j+1]]))
def cost(words,i,j):
total_char_length = sum([len(word) for word in words[i:j+1]])
if total_char_length > L-(j-i):
return infty
if j==len(words)-1:
return 0
return whitespace(w... | infty = 999999
def whitespace(words, i, j):
return L - (j - i) - sum([len(word) for word in words[i:j + 1]])
def cost(words, i, j):
total_char_length = sum([len(word) for word in words[i:j + 1]])
if total_char_length > L - (j - i):
return infty
if j == len(words) - 1:
return 0
retu... |
class MinStack:
# Update Min every pop (Accepted), O(1) push, pop, top, min
def __init__(self):
self.stack = []
self.min = None
def push(self, val: int) -> None:
if self.stack:
self.min = min(self.min, val)
self.stack.append((val, self.min))
else:
... | class Minstack:
def __init__(self):
self.stack = []
self.min = None
def push(self, val: int) -> None:
if self.stack:
self.min = min(self.min, val)
self.stack.append((val, self.min))
else:
self.min = val
self.stack.append((val, sel... |
def main():
try:
with open('cat_200_300.jpg', 'rb') as fs1:
data = fs1.read()
print(type(data))
with open('cat1.jpg', 'wb') as fs2:
fs2.write(data)
except FileNotFoundError as e:
print(e)
if __name__ == '__main__':
main() | def main():
try:
with open('cat_200_300.jpg', 'rb') as fs1:
data = fs1.read()
print(type(data))
with open('cat1.jpg', 'wb') as fs2:
fs2.write(data)
except FileNotFoundError as e:
print(e)
if __name__ == '__main__':
main() |
while True:
a = input()
if a == '-1':
break
L = list(map(int, a.split()))[:-1]
cnt = 0
for i in L:
if i*2 in L:
cnt += 1
print(cnt)
| while True:
a = input()
if a == '-1':
break
l = list(map(int, a.split()))[:-1]
cnt = 0
for i in L:
if i * 2 in L:
cnt += 1
print(cnt) |
# -*- coding: utf-8 -*-
__all__=['glottal', 'phonation', 'articulation', 'prosody', 'replearning'] | __all__ = ['glottal', 'phonation', 'articulation', 'prosody', 'replearning'] |
# creating a function to calculate the density.
def calc_density(mass, volume):
# arithmetic calculation to determine the density.
density = mass / volume
density = round(density, 2)
# returning the value of the density.
return density
# receiving input from the user regarding the mass ... | def calc_density(mass, volume):
density = mass / volume
density = round(density, 2)
return density
mass = float(input('Enter the mass of the substance in grams please: '))
volume = float(input('Enter the volume of the substance please: '))
print('The density of the object is:', calc_density(mass, volume), '... |
class documentmodel:
def getDocuments(self):
document_tokens1 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy."
document_tokens2 = "At last, China seems serious about confronting an endemic problem: domestic violence and corr... | class Documentmodel:
def get_documents(self):
document_tokens1 = 'China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy.'
document_tokens2 = 'At last, China seems serious about confronting an endemic problem: domestic violence and cor... |
# For internal use. Please do not modify this file.
def setup():
return
def extra_make_option():
return ""
| def setup():
return
def extra_make_option():
return '' |
def collatz(number):
if number%2==0:
number=number//2
else:
number=3*number+1
print(number)
return number
print('enter an integer')
num=int(input())
a=0
a=collatz(num)
while a!=1:
a=collatz(a)
| def collatz(number):
if number % 2 == 0:
number = number // 2
else:
number = 3 * number + 1
print(number)
return number
print('enter an integer')
num = int(input())
a = 0
a = collatz(num)
while a != 1:
a = collatz(a) |
# CONVERSION OF UNITS
# Python 3
# Using Jupyter Notebook
# If using Visual Studio then change .ipynb to .py
# This program aims to convert units from miles to km and from km to ft.
# 1 inch = 2.54 cm, 1 km = 1000m, 1 m = 100 cm, 12 inches = 1 ft, 1 mile = 5280 ft
# ------- Start -------
# Known Standard Units of Co... | in_to_cm = 2.54
km_to_m = 1000
m_to_cm = 100
in_to_ft = 1 / 12
mi_to_ft = 5280
num = float(input('Enter your number (in miles): '))
mi_to_ft = num * miToFt
in_to_ft = miToFt * (1 / inToFt)
in_to_cm = inToFt * inToCm
m_to_cm = inToCm * (1 / mToCm)
km_to_m = mToCm * (1 / kmToM)
print()
print(num, ' mile(s) is', miToFt, '... |
'''constants.py
Various constants that are utilized in different modules across the whole program'''
#Unicode characters for suits
SUITS = [
'\u2660',
'\u2663',
'\u2665',
'\u2666'
]
#A calculation value and a face value for the cards
VALUE_PAIRS = [
(1, 'A'),
(2, '2'),
(3, '3'),
(4, '4... | """constants.py
Various constants that are utilized in different modules across the whole program"""
suits = ['♠', '♣', '♥', '♦']
value_pairs = [(1, 'A'), (2, '2'), (3, '3'), (4, '4'), (5, '5'), (6, '6'), (7, '7'), (8, '8'), (9, '9'), (10, '10'), (11, 'J'), (12, 'Q'), (13, 'K')]
black = (0, 0, 0)
white = (255, 255, 255... |
def is_overlap(arr1, arr2):
if arr2[0] <= arr1[0] <= arr2[1]:
return True
if arr2[0] <= arr1[1] <= arr2[1]:
return True
if arr1[0] <= arr2[0] <= arr1[1]:
return True
if arr1[0] <= arr2[1] <= arr1[1]:
return True
return False
def merge_2_arrays(arr1, arr2):
l = ... | def is_overlap(arr1, arr2):
if arr2[0] <= arr1[0] <= arr2[1]:
return True
if arr2[0] <= arr1[1] <= arr2[1]:
return True
if arr1[0] <= arr2[0] <= arr1[1]:
return True
if arr1[0] <= arr2[1] <= arr1[1]:
return True
return False
def merge_2_arrays(arr1, arr2):
l = mi... |
def fib(n):
if n == 1 or n == 2:
return 1
else:
return fib(n - 1) + fib(n - 2)
def fib3(n):
if n == 1 or n == 2 or n == 3:
return 1
else:
return fib3(n - 1) + fib3(n - 2) + fib3(n - 3)
def fib_mult(n):
if n == 1:
return 1
if n == 2:
return 2
... | def fib(n):
if n == 1 or n == 2:
return 1
else:
return fib(n - 1) + fib(n - 2)
def fib3(n):
if n == 1 or n == 2 or n == 3:
return 1
else:
return fib3(n - 1) + fib3(n - 2) + fib3(n - 3)
def fib_mult(n):
if n == 1:
return 1
if n == 2:
return 2
... |
__author__ = 'Dmitriy Korsakov'
def main():
pass
| __author__ = 'Dmitriy Korsakov'
def main():
pass |
# Python - 3.4.3
def problem(a):
try:
return float(a) * 50 + 6
except:
return 'Error'
| def problem(a):
try:
return float(a) * 50 + 6
except:
return 'Error' |
# current = -4.036304473876953
def convert(time):
pos = True if time >= 0 else False
time = abs(time)
time_hours = time/3600
time_h = int(time_hours)
time_remaining = time_hours - time_h
time_m = int(time_remaining*60)
time_sec = time_remaining - time_m/60
time_s = int(time_se... | def convert(time):
pos = True if time >= 0 else False
time = abs(time)
time_hours = time / 3600
time_h = int(time_hours)
time_remaining = time_hours - time_h
time_m = int(time_remaining * 60)
time_sec = time_remaining - time_m / 60
time_s = int(time_sec * 3600)
time_format = f'{time_... |
def composite_value(value):
if ';' in value:
items = []
first = True
for tmp in value.split(';'):
if not first and tmp.startswith(' '):
tmp = tmp[1:]
items.append(tmp)
first = False
else:
items = [value]
return items
| def composite_value(value):
if ';' in value:
items = []
first = True
for tmp in value.split(';'):
if not first and tmp.startswith(' '):
tmp = tmp[1:]
items.append(tmp)
first = False
else:
items = [value]
return items |
#!/usr/bin/env python
# iGoBot - a GO game playing robot
#
# ##############################
# # GO stone board coordinates #
# ##############################
#
# Project website: http://www.springwald.de/hi/igobot
#
# Licensed under MIT License (MIT)
#
# Copyright (c) 2018 Daniel Springwald... | class Board:
_released = False
empty = 0
black = 1
white = 2
_board_size = 0
_fields = []
_13x13_x_min = 735
_13x13_x_max = 3350
_13x13_y_min = 100
_13x13_y_max = 2890
_9x9_x_min = 1120
_9x9_x_max = 2940
_9x9_y_min = 560
_9x9_y_max = 2400
stepper_min_x = 0
... |
def compare(a: int, b: int):
printNums(a, b)
if a > b:
msg = "a > b"
a += 1
elif a < b:
msg = "a < b"
b += 1
else:
msg = "a == b"
a += 1
b += 1
print(msg)
printNums(a, b)
print()
def printNums(a, b):
print(f"{a = }, {b = }")
def main():
for a in range(1, 4):
for b in range(1, 4):
compare... | def compare(a: int, b: int):
print_nums(a, b)
if a > b:
msg = 'a > b'
a += 1
elif a < b:
msg = 'a < b'
b += 1
else:
msg = 'a == b'
a += 1
b += 1
print(msg)
print_nums(a, b)
print()
def print_nums(a, b):
print(f'a = {a!r}, b = {b!r}... |
latest_block_redis_key = "latest_block_from_chain"
latest_block_hash_redis_key = "latest_blockhash_from_chain"
most_recent_indexed_block_redis_key = "most_recently_indexed_block_from_db"
most_recent_indexed_block_hash_redis_key = "most_recently_indexed_block_hash_from_db"
most_recent_indexed_ipld_block_redis_key = "mos... | latest_block_redis_key = 'latest_block_from_chain'
latest_block_hash_redis_key = 'latest_blockhash_from_chain'
most_recent_indexed_block_redis_key = 'most_recently_indexed_block_from_db'
most_recent_indexed_block_hash_redis_key = 'most_recently_indexed_block_hash_from_db'
most_recent_indexed_ipld_block_redis_key = 'mos... |
a = 'abcdefghijklmnopqrstuvwxyz'
b = 'pvwdgazxubqfsnrhocitlkeymj'
trans = str.maketrans(b, a)
src = 'Wxgcg txgcg ui p ixgff, txgcg ui p epm. I gyhgwt mrl lig txg ixgff wrsspnd tr irfkg txui hcrvfgs, nre, hfgpig tcm liunz txg crt13 ra "ixgff" tr gntgc ngyt fgkgf.'
print(src.translate(trans))
| a = 'abcdefghijklmnopqrstuvwxyz'
b = 'pvwdgazxubqfsnrhocitlkeymj'
trans = str.maketrans(b, a)
src = 'Wxgcg txgcg ui p ixgff, txgcg ui p epm. I gyhgwt mrl lig txg ixgff wrsspnd tr irfkg txui hcrvfgs, nre, hfgpig tcm liunz txg crt13 ra "ixgff" tr gntgc ngyt fgkgf.'
print(src.translate(trans)) |
def get_level_1_news():
news1 = 'Stars Wars movie filming is canceled due to high electrical energy used. Turns out' \
'those lasers don\'t power themselves'
news2 = 'Pink Floyd Tour canceled after first show used up the whole energy city had for' \
'the whole month. The band says they\... | def get_level_1_news():
news1 = "Stars Wars movie filming is canceled due to high electrical energy used. Turns outthose lasers don't power themselves"
news2 = "Pink Floyd Tour canceled after first show used up the whole energy city had forthe whole month. The band says they'll be happy to play on the dark side... |
user_num = int(input("which number would you like to check?"))
def devisible_by_both():
if user_num %3 == 0 and user_num %5 == 0:
print("your number is divisible by both")
else:
print("your number is not divisible by both") | user_num = int(input('which number would you like to check?'))
def devisible_by_both():
if user_num % 3 == 0 and user_num % 5 == 0:
print('your number is divisible by both')
else:
print('your number is not divisible by both') |
class PyQtSociusError(Exception):
pass
class WrongInputFileTypeError(PyQtSociusError):
__module__ = 'pyqtsocius'
def __init__(self, input_file: str, expected_file_extension: str, extra_message: str = None):
self.file = input_file
self.file_ext = '.' + input_file.split('.')[-1]
s... | class Pyqtsociuserror(Exception):
pass
class Wronginputfiletypeerror(PyQtSociusError):
__module__ = 'pyqtsocius'
def __init__(self, input_file: str, expected_file_extension: str, extra_message: str=None):
self.file = input_file
self.file_ext = '.' + input_file.split('.')[-1]
self.e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.