content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def fun1(str1):
fun1(str1)
print("This is " + str1)
fun1("Issue")
| def fun1(str1):
fun1(str1)
print('This is ' + str1)
fun1('Issue') |
# URI Online Judge 1149
Entrada = input()
Entrada = list(map(int, Entrada.split()))
A = Entrada[0]
A_copy = A
sum = 0
for i in Entrada[1:]:
if i > 0:
N = i
for j in range(0,N):
sum += A_copy + j
print(sum) | entrada = input()
entrada = list(map(int, Entrada.split()))
a = Entrada[0]
a_copy = A
sum = 0
for i in Entrada[1:]:
if i > 0:
n = i
for j in range(0, N):
sum += A_copy + j
print(sum) |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | def correct_answers(answers):
answers['NY'] = 'Correct!' if answers['NY'].lower() == 'albany' else 'Incorrect.'
answers['CA'] = 'Correct!' if answers['CA'].lower() == 'sacramento' else 'Incorrect.'
answers['TX'] = 'Correct!' if answers['TX'].lower() == 'austin' else 'Incorrect.'
answers['FL'] = 'Correct... |
# http://python.coderz.ir/
list=[1,2,3,4,5]
list.append(6)
print(list)
tuple=(1,2,3)
dic={'key1':'A','key2':'B'}
print(dic['key1'])
class Human():
print("human class")
def walking(self):
print("human is walking")
class contact(Human):
print("contact is creating")
def __init__(self,name,f... | list = [1, 2, 3, 4, 5]
list.append(6)
print(list)
tuple = (1, 2, 3)
dic = {'key1': 'A', 'key2': 'B'}
print(dic['key1'])
class Human:
print('human class')
def walking(self):
print('human is walking')
class Contact(Human):
print('contact is creating')
def __init__(self, name, family, address):... |
DEFAULT_METADATA_TABLE = 'data'
DEFAULT_USER_TABLE = 'user'
DEFAULT_NAME_COLUMN = 'dataset'
DEFAULT_UPDATE_COLUMN = 'updated_at'
DEFAULT_RESTRICTED_TABLES = [DEFAULT_METADATA_TABLE, DEFAULT_USER_TABLE]
DEFAULT_METADATA_COLUMNS = [
dict(name='id', type_='Integer', primary_key=True),
dict(name='dataset', type_='S... | default_metadata_table = 'data'
default_user_table = 'user'
default_name_column = 'dataset'
default_update_column = 'updated_at'
default_restricted_tables = [DEFAULT_METADATA_TABLE, DEFAULT_USER_TABLE]
default_metadata_columns = [dict(name='id', type_='Integer', primary_key=True), dict(name='dataset', type_='String', u... |
#!/usr/bin/env python
# coding: utf-8
# This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# # Solution Notebook
# ## Problem: Implement common bit manipulation operations: get_bit, set_bi... | def validate_index(func):
def validate_index_wrapper(self, *args, **kwargs):
for arg in args:
if arg < 0:
raise index_error('Invalid index')
return func(self, *args, **kwargs)
return validate_index_wrapper
class Bit(object):
def __init__(self, number):
... |
def lz78(charstream, verbose=False):
dict = {}
p = ""
code = []
i = 0
while True:
c = charstream[i]
try:
dict[p + c]
p = p + c
except (KeyError):
if p == "":
o = 0
else:
o = dict[p... | def lz78(charstream, verbose=False):
dict = {}
p = ''
code = []
i = 0
while True:
c = charstream[i]
try:
dict[p + c]
p = p + c
except KeyError:
if p == '':
o = 0
else:
o = dict[p]
code... |
for number in range(1001):
string=list(str(number))
sum_of_each_digit=0
for j in range(len(string)):
int_number=int(string[j])
power_of_digit = int_number ** len(string)
sum_of_each_digit += power_of_digit
if number == sum_of_each_digit:
print (number, "Is amstrong Number")
| for number in range(1001):
string = list(str(number))
sum_of_each_digit = 0
for j in range(len(string)):
int_number = int(string[j])
power_of_digit = int_number ** len(string)
sum_of_each_digit += power_of_digit
if number == sum_of_each_digit:
print(number, 'Is amstrong N... |
spells = {
'levitate': 'Levioso',
'make fire': 'Incendio',
'open locked door': 'Alohomora'
}
# dictionary operators
print(spells['open locked door'])
print(spells['levitate'])
print(spells.keys())
print(dir(spells))
| spells = {'levitate': 'Levioso', 'make fire': 'Incendio', 'open locked door': 'Alohomora'}
print(spells['open locked door'])
print(spells['levitate'])
print(spells.keys())
print(dir(spells)) |
def insertion_sort(array):
for i in range(1, len(array)):
currentValue = array[i]
currentPosition = i
while currentPosition > 0 and array[currentPosition - 1] > currentValue:
array[currentPosition] = array[currentPosition -1]
currentPosition -= 1
array[currentPosition] = currentValue
return array
#... | def insertion_sort(array):
for i in range(1, len(array)):
current_value = array[i]
current_position = i
while currentPosition > 0 and array[currentPosition - 1] > currentValue:
array[currentPosition] = array[currentPosition - 1]
current_position -= 1
array[cur... |
class EbWrapper:
def set_eb_raw_json_data(self, eb_raw_json_data: dict):
if not type(eb_raw_json_data).__name__ == 'dict':
raise TypeError('The entered data must be of type dict')
self.eb_raw_json_data = eb_raw_json_data
return self
def get_environment_name(self):
... | class Ebwrapper:
def set_eb_raw_json_data(self, eb_raw_json_data: dict):
if not type(eb_raw_json_data).__name__ == 'dict':
raise type_error('The entered data must be of type dict')
self.eb_raw_json_data = eb_raw_json_data
return self
def get_environment_name(self):
... |
name = data.get('name', 'world')
logger.info("Hello Robin {}".format(name))
hass.bus.fire(name, { "wow": "from a Python script!" })
state = hass.states.get('sensor.next_train_status')
train_status = state.state
if train_status == 'ON TIME':
hass.services.call('light', 'turn_on', { "entity_id" : 'light.lamp', 'co... | name = data.get('name', 'world')
logger.info('Hello Robin {}'.format(name))
hass.bus.fire(name, {'wow': 'from a Python script!'})
state = hass.states.get('sensor.next_train_status')
train_status = state.state
if train_status == 'ON TIME':
hass.services.call('light', 'turn_on', {'entity_id': 'light.lamp', 'color_nam... |
inputString = str(input())
tool = len(inputString)
count_3 = inputString.count('3')
count_2 = inputString.count('2')
count_1 = inputString.count('1')
regularWordage = '1' * count_1 + '2' * count_2 + '3' * count_3
for i in range(0,tool-1) :
if i%2 == 0:
pass
else:
regularWordage = regularWordage... | input_string = str(input())
tool = len(inputString)
count_3 = inputString.count('3')
count_2 = inputString.count('2')
count_1 = inputString.count('1')
regular_wordage = '1' * count_1 + '2' * count_2 + '3' * count_3
for i in range(0, tool - 1):
if i % 2 == 0:
pass
else:
regular_wordage = regularW... |
oddcompnumlist = []
for i in range(2,10000):
if i%2!=0:
if 2**(i-1)%i!=1:
oddcompnumlist.append(i)
primlist = []
randlist = []
complist = []
for j in range(2,142):
boolist = []
for k in range(2,j):
if j%k != 0:
boolist.append('false')
elif j%k == 0:
... | oddcompnumlist = []
for i in range(2, 10000):
if i % 2 != 0:
if 2 ** (i - 1) % i != 1:
oddcompnumlist.append(i)
primlist = []
randlist = []
complist = []
for j in range(2, 142):
boolist = []
for k in range(2, j):
if j % k != 0:
boolist.append('false')
elif j %... |
#
# PySNMP MIB module VERILINK-ENTERPRISE-NCMJAPISDN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VERILINK-ENTERPRISE-NCMJAPISDN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:26:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint, constraints_union) ... |
__all__ = ["WindowOperator"]
class WindowOperator(Operator):
pass
| __all__ = ['WindowOperator']
class Windowoperator(Operator):
pass |
# Read from the file words.txt and output the word frequency list to stdout.
with open('words.txt', 'r') as f:
line = f.readline()
word_occ_dict = {}
while line:
tokens = list( line.split() )
for t in tokens:
word_occ_dict[t] = word_occ_dict.get(t, ... | with open('words.txt', 'r') as f:
line = f.readline()
word_occ_dict = {}
while line:
tokens = list(line.split())
for t in tokens:
word_occ_dict[t] = word_occ_dict.get(t, 0) + 1
line = f.readline()
for word in sorted(word_occ_dict, key=word_occ_dict.get, reverse=True):... |
# imports
def fifty_ml_heights(init_vol, steps, vol_dec):
vols = []
heights = []
# these values originate from Excel spreadsheet "Exp803..."
print (init_vol)
b = 0
m = 0.0024
if init_vol > 51000:
offset = 14 # model out of range; see sheet
else:
offset = 7 # mm Need ... | def fifty_ml_heights(init_vol, steps, vol_dec):
vols = []
heights = []
print(init_vol)
b = 0
m = 0.0024
if init_vol > 51000:
offset = 14
else:
offset = 7
print(offset)
for i in range(steps):
x = init_vol - vol_dec * i
vols.append(x)
h = m * x +... |
class Config:
# AWS Information
ec2_region = "eu-west-2" # London # Same as environment variable EC2_REGION
ec2_amis = ['ami-09c4a4b013e66b291']
ec2_keypair = 'OnDemandMinecraft'
ec2_secgroups = ['sg-0441198b7b0617d3a']
ec2_instancetype = 't3.small'
| class Config:
ec2_region = 'eu-west-2'
ec2_amis = ['ami-09c4a4b013e66b291']
ec2_keypair = 'OnDemandMinecraft'
ec2_secgroups = ['sg-0441198b7b0617d3a']
ec2_instancetype = 't3.small' |
with open('payload.bin', 'rb') as stringFile:
with open('payload.s', 'w') as f:
for byte in stringFile.read():
print('byte %s' % hex(byte), file=f)
| with open('payload.bin', 'rb') as string_file:
with open('payload.s', 'w') as f:
for byte in stringFile.read():
print('byte %s' % hex(byte), file=f) |
def fast_scan_ms(name = 'test', tilt_stage=True):
print("in bens routine")
yield from expert_reflection_scan_full(md={'sample_name': name}, detector=lambda_det, tilt_stage=tilt_stage)
def ms_align():
yield from bps.mv(geo.det_mode,1)
yield from bps.mv(abs2,3)
yield from nab(-0.1,-0.1)
y... | def fast_scan_ms(name='test', tilt_stage=True):
print('in bens routine')
yield from expert_reflection_scan_full(md={'sample_name': name}, detector=lambda_det, tilt_stage=tilt_stage)
def ms_align():
yield from bps.mv(geo.det_mode, 1)
yield from bps.mv(abs2, 3)
yield from nab(-0.1, -0.1)
yield fr... |
# Insert a Node at the Tail of a Linked List
# Developer: Murillo Grubler
# https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list/problem
class SinglyLinkedListNode:
def __init__(self, data):
self.data = data
self.next = None
class SinglyLinkedList:
def __init__(self... | class Singlylinkedlistnode:
def __init__(self, data):
self.data = data
self.next = None
class Singlylinkedlist:
def __init__(self):
self.head = None
self.tail = None
def print_singly_linked_list(head):
while head:
print(head.data)
head = head.next
def ins... |
tempClasses = []
tempStudents = []
def student(_, info, id):
for s in tempStudents:
if s['id'] == id:
return s
return None
def students(_, info):
return {
'success': True,
'errors': [],
'students': tempStudents}
def classes(_, info, id):
for c in tempCla... | temp_classes = []
temp_students = []
def student(_, info, id):
for s in tempStudents:
if s['id'] == id:
return s
return None
def students(_, info):
return {'success': True, 'errors': [], 'students': tempStudents}
def classes(_, info, id):
for c in tempClasses:
if c['id'] =... |
class WechatPayError(Exception):
pass
class APIError(WechatPayError):
pass
class ValidationError(APIError):
pass
class AuthenticationError(APIError):
pass
class RequestFailed(APIError):
pass
| class Wechatpayerror(Exception):
pass
class Apierror(WechatPayError):
pass
class Validationerror(APIError):
pass
class Authenticationerror(APIError):
pass
class Requestfailed(APIError):
pass |
# #1
# def count_red_beads(n):
# return 0 if n < 2 else (n - 1) * 2
def count_red_beads(n): # 2
return max(0, 2 * (n-1))
| def count_red_beads(n):
return max(0, 2 * (n - 1)) |
class StringViewIter:
__slots__ = ("inp", "position")
def __init__(self, inp: str):
self.inp = inp
self.position = 0
def __iter__(self):
return self
def __next__(self):
if self.position >= len(self.inp):
raise StopIteration
self.position += 1
... | class Stringviewiter:
__slots__ = ('inp', 'position')
def __init__(self, inp: str):
self.inp = inp
self.position = 0
def __iter__(self):
return self
def __next__(self):
if self.position >= len(self.inp):
raise StopIteration
self.position += 1
... |
def check_fabs(matrix):
print(matrix)
s = set()
i = 0
while i < len(matrix):
if matrix[i][1] in s:
matrix[i][1] += 1
if matrix[i][1] == len(matrix):
matrix[i][1] = 0
else:
s.add(matrix[i][1])
i += 1
print(matrix)
pri... | def check_fabs(matrix):
print(matrix)
s = set()
i = 0
while i < len(matrix):
if matrix[i][1] in s:
matrix[i][1] += 1
if matrix[i][1] == len(matrix):
matrix[i][1] = 0
else:
s.add(matrix[i][1])
i += 1
print(matrix)
pri... |
#Entering Input
n = int(input("Enter the no of elements in List: "))
print(f"Enter the List of {n} numbers: ")
myList = []
for num in range (n):
myList.append(int(input()))
print (myList)
#Finding the largest Number
larNo = myList[0]
for num in range(0,n-1):
if larNo < myList[num+1]:
larNo = myLi... | n = int(input('Enter the no of elements in List: '))
print(f'Enter the List of {n} numbers: ')
my_list = []
for num in range(n):
myList.append(int(input()))
print(myList)
lar_no = myList[0]
for num in range(0, n - 1):
if larNo < myList[num + 1]:
lar_no = myList[num + 1]
print('The Largest Number: ', lar... |
resultado=""
K=int(input())
if K>0 and K<=1000:
while K!=0:
N,M=list(map(int, input().split()))
if N>-10000 or M<10000:
for x in range(K):
X,Y=list(map(int, input().split()))
if X>=-10000 or Y<=10000:
if X<N and Y>M:
resultado += "NO\n"
elif X>N and Y>M:
resultado += "NE\n"
el... | resultado = ''
k = int(input())
if K > 0 and K <= 1000:
while K != 0:
(n, m) = list(map(int, input().split()))
if N > -10000 or M < 10000:
for x in range(K):
(x, y) = list(map(int, input().split()))
if X >= -10000 or Y <= 10000:
if X < ... |
print("Welcome to the tip calculator.")
bill = float(input("What was your total? $"))
tip = int(input("What percentage tip would you like to give? 10, 12 or 15? "))
people = int(input("How many people to split the bill? "))
bill_with_tip = ((tip /100 ) * bill + bill) / people
final_bill = round(bill_with_tip,2)
# print... | print('Welcome to the tip calculator.')
bill = float(input('What was your total? $'))
tip = int(input('What percentage tip would you like to give? 10, 12 or 15? '))
people = int(input('How many people to split the bill? '))
bill_with_tip = (tip / 100 * bill + bill) / people
final_bill = round(bill_with_tip, 2)
print(f'... |
# Initial state.
a = 1
b = c = d = e = f = g = h = 0
b = 67
c = b
# if a != 0 goto ANZ # jnz a 2
# When a was 0, this would skip the next 4 lines
# jnz 1 5
# ANZ
b = b * 100 # (6700) # mul b 100 #1
b -= -100000 # sub b -100000 # 2
c = b # set c b # 3
c -= -17000 # sub c -17000 # 4
# b = 106700
# c = 123700
# -23... | a = 1
b = c = d = e = f = g = h = 0
b = 67
c = b
b = b * 100
b -= -100000
c = b
c -= -17000
while True:
f = 1
d = 2
while True:
e = 2
if b % d == 0:
f = 0
e = b
d += 1
g = d
g -= b
if d == b:
break
if f == 0:
h -= -1... |
#Embedded file name: ACEStream\__init__.pyo
LIBRARYNAME = 'ACEStream'
DEFAULT_I2I_LISTENPORT = 0
DEFAULT_SESSION_LISTENPORT = 8621
DEFAULT_HTTP_LISTENPORT = 6878
| libraryname = 'ACEStream'
default_i2_i_listenport = 0
default_session_listenport = 8621
default_http_listenport = 6878 |
list1 = list()
list2 = ['a', 25, 'string', 14.03]
list3 = list((1,2,3,4)) # list(tuple)
print (list1)
print (list2)
print (list3)
# List Comprehension
list4 = [x for x in range(10)]
print (list4)
list5 = [x**2 for x in range(10) if x > 4]
print (list5)
# del(): delete list item or list itself
list6 = ['sugar', 'rice... | list1 = list()
list2 = ['a', 25, 'string', 14.03]
list3 = list((1, 2, 3, 4))
print(list1)
print(list2)
print(list3)
list4 = [x for x in range(10)]
print(list4)
list5 = [x ** 2 for x in range(10) if x > 4]
print(list5)
list6 = ['sugar', 'rice', 'tea', 'cup']
del list6[1]
print(list6)
del list6
list7 = ['sugar', 'tea', '... |
project='pbdcex'
version='0.1.1'
debug = 1 #0/1
defs = []
verbose = 'on' #on/off
extra_c_flags = '-wno-unused-parameter'
extra_cxx_flags = '--std=c++11 -lpthread -lrt -ldl'
env = {
'protoi':'/usr/local/include',
'protoc':'protoc',
'protoi':'/usr/local/include',
}
units = [
{
'name':'pbdcexer',... | project = 'pbdcex'
version = '0.1.1'
debug = 1
defs = []
verbose = 'on'
extra_c_flags = '-wno-unused-parameter'
extra_cxx_flags = '--std=c++11 -lpthread -lrt -ldl'
env = {'protoi': '/usr/local/include', 'protoc': 'protoc', 'protoi': '/usr/local/include'}
units = [{'name': 'pbdcexer', 'type': 'exe', 'subdir': 'src', 'in... |
#
# PySNMP MIB module NRC-HUB1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NRC-HUB1-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:24:24 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint, constraints_union) ... |
# Animate plot as a wire-frame
plotter = pv.Plotter(window_size=(800, 600))
plotter.add_mesh(grid, scalars=d[:, 1],
scalar_bar_args={'title': 'Y Displacement'},
show_edges=True,
rng=[-d.max(), d.max()], interpolate_before_map=True,
style='wireframe')
p... | plotter = pv.Plotter(window_size=(800, 600))
plotter.add_mesh(grid, scalars=d[:, 1], scalar_bar_args={'title': 'Y Displacement'}, show_edges=True, rng=[-d.max(), d.max()], interpolate_before_map=True, style='wireframe')
plotter.add_axes()
plotter.camera_position = cpos
plotter.open_gif('beam_wireframe.gif')
for phase i... |
def display():
def message():
return "Hello "
return message
fun=display()
print(fun())
| def display():
def message():
return 'Hello '
return message
fun = display()
print(fun()) |
def sku_lookup(sku):
price_table = [
{
'item': 'A',
'price': 50,
'offers': [
'3A for 130',
],
},
{
'item': 'B',
'price': 30,
'offers': [
'2B for 45',
... | def sku_lookup(sku):
price_table = [{'item': 'A', 'price': 50, 'offers': ['3A for 130']}, {'item': 'B', 'price': 30, 'offers': ['2B for 45']}, {'item': 'C', 'price': 20, 'offers': []}, {'item': 'D', 'price': 15, 'offers': []}]
for item in price_table:
if sku == item.get('item'):
return item
... |
class One:
def __init__(self):
super().__init__()
print("This is init method of class One")
self.i=5
class Two(One):
def __init__(self):
super().__init__()
print("This is init method of class Two")
self.j=10
class Three(Two):
def __init__(self):... | class One:
def __init__(self):
super().__init__()
print('This is init method of class One')
self.i = 5
class Two(One):
def __init__(self):
super().__init__()
print('This is init method of class Two')
self.j = 10
class Three(Two):
def __init__(self):
... |
{
"targets": [
{
"target_name": "mmap",
"sources": ["mmap.cc" ],
"include_dirs": [
"<!(node -e \"require('nan')\")",
],
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"MACOSX_DEPLOYMENT_TARGET": "10.12",
"OTHER_CPLUSPLUSFLAGS": [ "-std=c++11",... | {'targets': [{'target_name': 'mmap', 'sources': ['mmap.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'xcode_settings': {'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'MACOSX_DEPLOYMENT_TARGET': '10.12', 'OTHER_CPLUSPLUSFLAGS': ['-std=c++11', '-stdlib=libc++'], 'OTHER_LDFLAGS': ['-stdlib=libc++']}, 'libraries': []}]} |
#!/usr/local/bin/python3.3
L = [1, 2, 3, 4]
print(L[-1000:100])
L[3:1] = ['?']
print(L)
| l = [1, 2, 3, 4]
print(L[-1000:100])
L[3:1] = ['?']
print(L) |
def bissexto(ano):
if(ano % 4 == 0 and (ano % 400 == 0 or ano % 100 != 0)):
return True
return False
def dias_mes(ano):
if(len(ano)=='fev'):
return ValueError("Nao tem 3 caracteres")
return
mes=str(input("Mes: "))
print(dias_mes(mes)) | def bissexto(ano):
if ano % 4 == 0 and (ano % 400 == 0 or ano % 100 != 0):
return True
return False
def dias_mes(ano):
if len(ano) == 'fev':
return value_error('Nao tem 3 caracteres')
return
mes = str(input('Mes: '))
print(dias_mes(mes)) |
n = int(input())
f = {}
ans = set()
for i in range(n):
tmp = input().split()
if tmp[0] not in f.values():
ans.add(tmp[0])
f[tmp[0]] = tmp[1]
print(len(ans))
for old in ans:
new = old
while new in f.keys():
new = f[new]
print(old, new)
| n = int(input())
f = {}
ans = set()
for i in range(n):
tmp = input().split()
if tmp[0] not in f.values():
ans.add(tmp[0])
f[tmp[0]] = tmp[1]
print(len(ans))
for old in ans:
new = old
while new in f.keys():
new = f[new]
print(old, new) |
x1 = 0
x2 = 1
s = 0
while True:
fib = x1 + x2
x1 = x2
x2 = fib
if fib % 2 == 0:
s += fib
if fib >= 4e6: break
print(s) | x1 = 0
x2 = 1
s = 0
while True:
fib = x1 + x2
x1 = x2
x2 = fib
if fib % 2 == 0:
s += fib
if fib >= 4000000.0:
break
print(s) |
class Sprite():
''' The Sprite class manipulates the imported sprite and is utilized for texture mapping
Attributes:
matrix (array): the color encoded 2d matrix of the sprite
width (int): width of the 2d sprite matrix
height (int): heigth of the 2d sprite matrix
... | class Sprite:
""" The Sprite class manipulates the imported sprite and is utilized for texture mapping
Attributes:
matrix (array): the color encoded 2d matrix of the sprite
width (int): width of the 2d sprite matrix
height (int): heigth of the 2d sprite matrix
... |
#menjalankan python
a=10
b=2
c=a/b
print(c)
print("-------------------------")
#penulisan variabel
Nama="Fazlur"
_nama="Fazlur"
nama="Zul"
print(Nama)
print(_nama)
print(nama)
print("-------------------------")
#mengenal nilai dan tipe data dalam python
a=1
makanan ="ayam"
print(type(makanan))
pri... | a = 10
b = 2
c = a / b
print(c)
print('-------------------------')
nama = 'Fazlur'
_nama = 'Fazlur'
nama = 'Zul'
print(Nama)
print(_nama)
print(nama)
print('-------------------------')
a = 1
makanan = 'ayam'
print(type(makanan))
print(type(a))
print('-------------------------')
tanya = input('masukan nama?')
print(tany... |
PATH={ "amass":"../amass/amass",
"subfinder":"../subfinder",
"fierce":"../fierce/fierce/fierce.py",
"dirsearch":"../dirsearch/dirsearch.py"
}
| path = {'amass': '../amass/amass', 'subfinder': '../subfinder', 'fierce': '../fierce/fierce/fierce.py', 'dirsearch': '../dirsearch/dirsearch.py'} |
def get_input():
total_cows = int(input(""))
cow_str = input("")
return total_cows, cow_str
def calc_lonely_cow(total_cows, cow_str):
total_lonely_cow = 0
#for offset in range(3, total_cows + 1):
for offset in range(3, 60):
for start_pos in range(0, total_cows):
total_count... | def get_input():
total_cows = int(input(''))
cow_str = input('')
return (total_cows, cow_str)
def calc_lonely_cow(total_cows, cow_str):
total_lonely_cow = 0
for offset in range(3, 60):
for start_pos in range(0, total_cows):
total_count_g = total_count_h = 0
if start_... |
# -*- coding: utf-8 -*-
class InvalidTodoFile(Exception):
pass
class InvalidTodoStatus(Exception):
pass
| class Invalidtodofile(Exception):
pass
class Invalidtodostatus(Exception):
pass |
num=int(input("Enter a number: "))
sum=0
for i in range(len(str(num))):
sum=sum+(num%10)
num=num//10
print("The sum of the digits in the number entered is: ",sum) | num = int(input('Enter a number: '))
sum = 0
for i in range(len(str(num))):
sum = sum + num % 10
num = num // 10
print('The sum of the digits in the number entered is: ', sum) |
words_count = int(input())
english_persian_dict = {}
france_persian_dict = {}
german_persian_dict = {}
for i in range(words_count):
words = input().split()
english_persian_dict[words[1]] = words[0]
france_persian_dict[words[2]] = words[0]
german_persian_dict[words[3]] = words[0]
sentence = input()
... | words_count = int(input())
english_persian_dict = {}
france_persian_dict = {}
german_persian_dict = {}
for i in range(words_count):
words = input().split()
english_persian_dict[words[1]] = words[0]
france_persian_dict[words[2]] = words[0]
german_persian_dict[words[3]] = words[0]
sentence = input()
trans... |
class tiger:
def __init__(self, name: str):
self._name = name
def name(self) -> str:
return self._name
@staticmethod
def greet() -> str:
return "Mijau!"
@staticmethod
def menu() -> str:
return "mlako mlijeko"
| class Tiger:
def __init__(self, name: str):
self._name = name
def name(self) -> str:
return self._name
@staticmethod
def greet() -> str:
return 'Mijau!'
@staticmethod
def menu() -> str:
return 'mlako mlijeko' |
#!/usr/bin/env/python
class ABcd:
_types_map = {
"Child1": {"type": int, "subtype": None},
"Child2": {"type": str, "subtype": None},
}
_formats_map = {}
def __init__(self, Child1=None, Child2=None):
pass
self.__Child1 = Child1
self.__Child2 = Child2
def _... | class Abcd:
_types_map = {'Child1': {'type': int, 'subtype': None}, 'Child2': {'type': str, 'subtype': None}}
_formats_map = {}
def __init__(self, Child1=None, Child2=None):
pass
self.__Child1 = Child1
self.__Child2 = Child2
def _get__child1(self):
return self.__Child1
... |
cities = [
'Rome',
'Milan',
'Naples',
'Turin',
'Palermo',
'Genoa',
'Bologna',
'Florence',
'Catania',
'Bari',
'Messina',
'Verona',
'Padova',
'Trieste',
'Brescia',
'Prato',
'Taranto',
'Reggio Calabria',
'Modena',
'Livorno',
'Cagliari',
... | cities = ['Rome', 'Milan', 'Naples', 'Turin', 'Palermo', 'Genoa', 'Bologna', 'Florence', 'Catania', 'Bari', 'Messina', 'Verona', 'Padova', 'Trieste', 'Brescia', 'Prato', 'Taranto', 'Reggio Calabria', 'Modena', 'Livorno', 'Cagliari', 'Mestre', 'Parma', 'Foggia', "Reggio nell'Emilia", 'Acilia-Castel Fusano-Ostia Antica',... |
def check(func):
def inner(a, b):
if b == 0:
return "Can't divide by 0"
elif b > a:
return b/a
return func(a, b)
return inner
@check
def div(a, b):
return a/b
print(div(10, 0)) | def check(func):
def inner(a, b):
if b == 0:
return "Can't divide by 0"
elif b > a:
return b / a
return func(a, b)
return inner
@check
def div(a, b):
return a / b
print(div(10, 0)) |
# NameID Formats from the SAML Core 2.0 spec (8.3 Name Identifier Format Identifiers)
UNSPECIFIED = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
EMAIL = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
PERSISTENT = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
TRANSIENT = "urn:oasis:names:tc... | unspecified = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
email = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
persistent = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
transient = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
x509_subject = 'urn:oasis:names:tc:SAML:1.1:nameid-... |
Sweep_width_List = {
'Person':{
'150':{
'6':0.7,
'9':0.7,
'19':0.9,
'28':0.9,
'37':0.9
},
'300':{
'6':0.7,
'9':0.7,
'19':0.9,
'28':0.9,
'37':0.9
},
'450':(... | sweep_width__list = {'Person': {'150': {'6': 0.7, '9': 0.7, '19': 0.9, '28': 0.9, '37': 0.9}, '300': {'6': 0.7, '9': 0.7, '19': 0.9, '28': 0.9, '37': 0.9}, '450': (), '600': ()}, 'Vehicle': {'150': {'6': 1.7, '9': 2.4, '19': 2.4, '28': 2.4, '37': 2.4}, '300': {'6': 2.6, '9': 2.6, '19': 2.8, '28': 2.8, '37': 2.8}, '450'... |
num = int(input())
n = int((num - 1) / 2)
for l in range(n+1):
space = ' ' * (n - l)
nums = [str(i) for i in range(n-l+1, n-l+1+3)]
left = space + ''.join(nums) + ' ' * l
right = left[::-1].rstrip()
middle = (str(num) if l == 0 else ' ')
print(left+middle+right)
for l in range(n, -1, -1):
sp... | num = int(input())
n = int((num - 1) / 2)
for l in range(n + 1):
space = ' ' * (n - l)
nums = [str(i) for i in range(n - l + 1, n - l + 1 + 3)]
left = space + ''.join(nums) + ' ' * l
right = left[::-1].rstrip()
middle = str(num) if l == 0 else ' '
print(left + middle + right)
for l in range(n, -... |
# coding: utf-8
# Copyright 2020, Oracle Corporation and/or its affiliates.
FILTER_ERR = 'Some of the chosen filters were not found, we cannot continue.'
| filter_err = 'Some of the chosen filters were not found, we cannot continue.' |
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/
LANGUAGE_CODE = 'ru-RU'
TIME_ZONE = 'Asia/Yekaterinburg'
USE_I18N = True
USE_L10N = True
USE_TZ = True
| language_code = 'ru-RU'
time_zone = 'Asia/Yekaterinburg'
use_i18_n = True
use_l10_n = True
use_tz = True |
# Copyright (c) 2012, Tom Hendrikx
# All rights reserved.
#
# See LICENSE for the license.
VERSION = 'GIT'
| version = 'GIT' |
class RequestHeaderMiddleware(object):
def __init__(self, headers):
self._headers = headers
@classmethod
def from_crawler(cls, crawler):
headers = {
'Referer': 'http://www.fundsupermart.com.hk/hk/main/home/index.svdo',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel M... | class Requestheadermiddleware(object):
def __init__(self, headers):
self._headers = headers
@classmethod
def from_crawler(cls, crawler):
headers = {'Referer': 'http://www.fundsupermart.com.hk/hk/main/home/index.svdo', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebK... |
# -*- coding: utf-8 -*-
class Solution:
def projectionArea(self, grid):
result = 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j]:
result += 1
for i in range(len(grid)):
partial = 0
for j in r... | class Solution:
def projection_area(self, grid):
result = 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j]:
result += 1
for i in range(len(grid)):
partial = 0
for j in range(len(grid[0])):
... |
user_db = ''
password_db = ''
def register(username,password,repeat_password):
if password == repeat_password:
user_db = username
password_db = password
return user_db,password_db
else:
return 'Paroli ne sovpadaut!'
print(register('zarina','123456','1234567'))
| user_db = ''
password_db = ''
def register(username, password, repeat_password):
if password == repeat_password:
user_db = username
password_db = password
return (user_db, password_db)
else:
return 'Paroli ne sovpadaut!'
print(register('zarina', '123456', '1234567')) |
stats_default_config = {
"retention_size": 1024,
"retention_time": 365,
"wal_compression": "false",
"storage_path": '"./stats_data"',
"prometheus_auth_enabled": "true",
"log_level": '"debug"',
"max_block_duration": 25,
"scrape_interval": 10,
"scrape_timeout": 10,
"snapshot_timeou... | stats_default_config = {'retention_size': 1024, 'retention_time': 365, 'wal_compression': 'false', 'storage_path': '"./stats_data"', 'prometheus_auth_enabled': 'true', 'log_level': '"debug"', 'max_block_duration': 25, 'scrape_interval': 10, 'scrape_timeout': 10, 'snapshot_timeout_msecs': 30000, 'token_file': 'prometheu... |
#returns the quotient and remainder of the number
#retturns two arguements
#first arguement gives the quotient
#second arguement gives the remainder
print(divmod(9,2))
print(divmod(9.6,2.5))
| print(divmod(9, 2))
print(divmod(9.6, 2.5)) |
class FormatInput():
def add_low_quality_SNV_info(self,CNV_information,total_read, alt_read,total_read_cut,mutant_read_cut):
New_CNV_information={}
for tumor in CNV_information:
CNVinfo=CNV_information[tumor]
TotRead=total_read[tumor]
AltRead=alt_read[tumor] ... | class Formatinput:
def add_low_quality_snv_info(self, CNV_information, total_read, alt_read, total_read_cut, mutant_read_cut):
new_cnv_information = {}
for tumor in CNV_information:
cn_vinfo = CNV_information[tumor]
tot_read = total_read[tumor]
alt_read = alt_rea... |
'''
URL: https://leetcode.com/problems/island-perimeter/
Difficulty: Easy
Description: Island Perimeter
You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water.
Grid cells are connected horizontally/vertically (not diagonally). The grid is completely ... | """
URL: https://leetcode.com/problems/island-perimeter/
Difficulty: Easy
Description: Island Perimeter
You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water.
Grid cells are connected horizontally/vertically (not diagonally). The grid is completely ... |
#
# PySNMP MIB module CISCO-BULK-FILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-BULK-FILE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:51:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
# -*- coding: utf-8 -*-
def doinput(self):
dtuid = ('log', 9)
rhouid = ('log', 15)
parentuid = ('well', 0)
dtlog = self._OM.get(dtuid)
rholog = self._OM.get(rhouid)
dtdata = dtlog.data
rhodata = rholog.data
self.input = dict(dtdata=dtdata, rhodata=rhodata, parentuid=parentuid)
re... | def doinput(self):
dtuid = ('log', 9)
rhouid = ('log', 15)
parentuid = ('well', 0)
dtlog = self._OM.get(dtuid)
rholog = self._OM.get(rhouid)
dtdata = dtlog.data
rhodata = rholog.data
self.input = dict(dtdata=dtdata, rhodata=rhodata, parentuid=parentuid)
return True
def dojob(self, d... |
MADHUSUDANA_MASA = 0
TRIVIKRAMA_MASA = 1
VAMANA_MASA = 2
SRIDHARA_MASA = 3
HRSIKESA_MASA = 4
PADMANABHA_MASA = 5
DAMODARA_MASA = 6
KESAVA_MASA = 7
NARAYANA_MASA = 8
MADHAVA_MASA = 9
GOVINDA_MASA = 10
VISNU_MASA = 11
ADHIKA_MASA = 12
| madhusudana_masa = 0
trivikrama_masa = 1
vamana_masa = 2
sridhara_masa = 3
hrsikesa_masa = 4
padmanabha_masa = 5
damodara_masa = 6
kesava_masa = 7
narayana_masa = 8
madhava_masa = 9
govinda_masa = 10
visnu_masa = 11
adhika_masa = 12 |
# Define an initial dictionary
my_dict = {
'one': 1,
'two': 2,
'three': 3,
}
# Add a new number to the end of the dictionary
my_dict['four'] = 4
# Print out the dictionary
print(my_dict)
# Print the value 'one' of the dictionary
print(my_dict['one'])
# Change a value on the dictionary
my_dict['one'] = 5
# Pr... | my_dict = {'one': 1, 'two': 2, 'three': 3}
my_dict['four'] = 4
print(my_dict)
print(my_dict['one'])
my_dict['one'] = 5
print(my_dict) |
'''
Created on Jan 1, 2019
@author: Winterberger
'''
#Write your function here
def middle_element(lst):
#print(len(lst))
#print(len(lst) % 2)
if 0 == len(lst) % 2:
ind1 = int(len(lst)/2-1)
ind2 = int(len(lst)/2)
item1 = lst[int(len(lst)/2-1)]
item2 = lst[int(len(lst)/2)]
print(i... | """
Created on Jan 1, 2019
@author: Winterberger
"""
def middle_element(lst):
if 0 == len(lst) % 2:
ind1 = int(len(lst) / 2 - 1)
ind2 = int(len(lst) / 2)
item1 = lst[int(len(lst) / 2 - 1)]
item2 = lst[int(len(lst) / 2)]
print(ind1)
print(ind2)
print(item1)
... |
class MissingValue:
def __init__(self, required_value: str, headers: list[str]):
super().__init__()
self.__current_row = 0
self.__required_value = required_value
self.__headers = headers
self.__failures = {}
if required_value in headers:
self.__required_v... | class Missingvalue:
def __init__(self, required_value: str, headers: list[str]):
super().__init__()
self.__current_row = 0
self.__required_value = required_value
self.__headers = headers
self.__failures = {}
if required_value in headers:
self.__required_v... |
class Ability:
cost = None
exhaustible = True
constant = False
def __init__(self, cost, context):
self.cost = cost
def get_context(self):
return self.cost.context
def is_valid(self, cost):
return cost.context == self.get_context() and cost == self.cost
| class Ability:
cost = None
exhaustible = True
constant = False
def __init__(self, cost, context):
self.cost = cost
def get_context(self):
return self.cost.context
def is_valid(self, cost):
return cost.context == self.get_context() and cost == self.cost |
# -*- coding: utf-8 -*-
def main():
q, h, s, d = list(map(int, input().split()))
n = int(input())
# See:
# https://www.youtube.com/watch?v=9OiB8ot3a0w
x = min(4 * q, h * 2, s)
print(min(n * x, d * (n // 2) + n % 2 * x))
if __name__ == '__main__':
main()
| def main():
(q, h, s, d) = list(map(int, input().split()))
n = int(input())
x = min(4 * q, h * 2, s)
print(min(n * x, d * (n // 2) + n % 2 * x))
if __name__ == '__main__':
main() |
# -*- coding: utf-8 -*-
__author__ = 'alsbi'
HOST_LOCAL_VIRSH = 'libvirt_local or remote host'
HOST_REMOTE_VIRSH = 'libvirt remote host'
SASL_USER = "libvirt sasl user"
SASL_PASS = "libvirt sasl pass"
SECRET_KEY_APP = 'random'
LOGINS = {'admin': 'admin'} | __author__ = 'alsbi'
host_local_virsh = 'libvirt_local or remote host'
host_remote_virsh = 'libvirt remote host'
sasl_user = 'libvirt sasl user'
sasl_pass = 'libvirt sasl pass'
secret_key_app = 'random'
logins = {'admin': 'admin'} |
print(1)
print(1 + 1)
print(3 * 1 + 2)
print(3 * (1 + 2))
if 2 > 1:
print("One is the loneliest number")
else:
print('Two is the lonliest number?')
| print(1)
print(1 + 1)
print(3 * 1 + 2)
print(3 * (1 + 2))
if 2 > 1:
print('One is the loneliest number')
else:
print('Two is the lonliest number?') |
# https://dmoj.ca/problem/ccc07j1
# https://dmoj.ca/submission/1744054
a = int(input())
b = int(input())
c = int(input())
if (a>c and a<b) or (a<c and a>b): print(a)
elif (b>c and b<a) or (b<c and b>a): print(b)
else: print(c)
| a = int(input())
b = int(input())
c = int(input())
if a > c and a < b or (a < c and a > b):
print(a)
elif b > c and b < a or (b < c and b > a):
print(b)
else:
print(c) |
# HARD
# 1. check length + counts of word + current word with maxWidth
# 2. round robin
# maxWidth - lenght = number of spaces
# loop through number of spaces times
# each time assign a space to a word[0] -word[len]
# Time O(N) Space O(N)
class Solution:
def fullJustify(self, words: List[str],... | class Solution:
def full_justify(self, words: List[str], maxWidth: int) -> List[str]:
line = []
length = 0
result = []
for word in words:
if length + len(line) + len(word) > maxWidth:
for i in range(maxWidth - length):
line[i % (len(li... |
class Solution:
def matrixReshape(self, nums: List[List[int]], r: int, c: int) -> List[List[int]]:
new_matrix=[[0 for _ in range (c)] for _ in range (r)]
if r*c!=len(nums)*len(nums[0]):
return nums
i1=0
j1=0
for j in range(0,len(nums)):
for i i... | class Solution:
def matrix_reshape(self, nums: List[List[int]], r: int, c: int) -> List[List[int]]:
new_matrix = [[0 for _ in range(c)] for _ in range(r)]
if r * c != len(nums) * len(nums[0]):
return nums
i1 = 0
j1 = 0
for j in range(0, len(nums)):
fo... |
for k in model.state_dict():
print(k)
for name,parameters in net.named_parameters():
print(name,':',parameters.size())
| for k in model.state_dict():
print(k)
for (name, parameters) in net.named_parameters():
print(name, ':', parameters.size()) |
# Solution to Project Euler Problem 2
def sol():
ans = 0
x = 1
y = 2
while x <= 4000000:
if x % 2 == 0:
ans += x
x, y = y, x + y
return str(ans)
if __name__ == "__main__":
print(sol())
| def sol():
ans = 0
x = 1
y = 2
while x <= 4000000:
if x % 2 == 0:
ans += x
(x, y) = (y, x + y)
return str(ans)
if __name__ == '__main__':
print(sol()) |
class GameState(object):
def __init__(self, player, action, card_name):
self.action = action
self.player = player
self.card_name = card_name
| class Gamestate(object):
def __init__(self, player, action, card_name):
self.action = action
self.player = player
self.card_name = card_name |
try:
trigger_ver += 1
except:
trigger_ver = 1
print(f"dep file version {trigger_ver}: Even if you save this file, this script won't re-execute. Instead, create the trigger file.") | try:
trigger_ver += 1
except:
trigger_ver = 1
print(f"dep file version {trigger_ver}: Even if you save this file, this script won't re-execute. Instead, create the trigger file.") |
class Solution:
# @param A a list of integers
# @param elem an integer, value need to be removed
# @return an integer
def removeElement(self, A, elem):
if not A:
return 0
lens = 0
for i in xrange(0, len(A)):
p = A.pop(0)
... | class Solution:
def remove_element(self, A, elem):
if not A:
return 0
lens = 0
for i in xrange(0, len(A)):
p = A.pop(0)
if p != elem:
A.append(p)
lens += 1
return lens |
# Pay calculator from exercise 02.03 rewritten to give the employee 1.5 times
# the hourly rate for hours worked above 40 hours.
# Define constants
MAX_NORMAL_HOURS = 40
OVERTIME_RATE_MULTIPLIER = 1.5
# Prompt user for hours worked and hourly rate of pay.
hours = input('Enter Hours: ')
rate = input('Enter rate: ')
#... | max_normal_hours = 40
overtime_rate_multiplier = 1.5
hours = input('Enter Hours: ')
rate = input('Enter rate: ')
hours = float(hours)
normal_rate = float(rate)
overtime_rate = normal_rate * OVERTIME_RATE_MULTIPLIER
if hours <= MAX_NORMAL_HOURS:
normal_hours = hours
overtime_hours = 0
else:
normal_hours = MA... |
'''THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT... | """THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT... |
for i in range(2):
for j in range(4):
if i == 0 and j == 1: break;
print(i, j)
| for i in range(2):
for j in range(4):
if i == 0 and j == 1:
break
print(i, j) |
class FinalValue(Exception):
"Force a value and break the handler chain"
def __init__(self, value):
self.value = value
| class Finalvalue(Exception):
"""Force a value and break the handler chain"""
def __init__(self, value):
self.value = value |
# ann, rets = self.anns[0], []
# for entID, ent, stim in ents:
# annID = hash(entID) % self.nANN
# unpacked = unpackStim(ent, stim)
# self.anns[annID].recv(unpacked, ent, stim, entID)
#
# #Ret order matters
# for logits, val, ent, stim, atn, entID in ann.... | class Cosinenet(nn.Module):
def __init__(self, xdim, h, ydim):
super().__init__()
self.feats = feat_net(xdim, h, ydim)
self.fc1 = torch.nn.Linear(h, h)
self.ent1 = torch.nn.Linear(5, h)
def forward(self, stim, conv, flat, ents, ent, actions):
x = self.feats(conv, flat, ... |
nome = input('Nome: ')
print('Nome digitado: ', nome)
print('Primeiro caractere: ', nome[0])
print('Ultimo caractere: ', nome[-1])
print('Tres primeiros caracteres: ', nome[0:3])
print('Quarto caractere: ', nome[3])
print('Todos menos o primeiro: ', nome[1:])
print('Os dois ultimos: ', nome[-2:]) | nome = input('Nome: ')
print('Nome digitado: ', nome)
print('Primeiro caractere: ', nome[0])
print('Ultimo caractere: ', nome[-1])
print('Tres primeiros caracteres: ', nome[0:3])
print('Quarto caractere: ', nome[3])
print('Todos menos o primeiro: ', nome[1:])
print('Os dois ultimos: ', nome[-2:]) |
a = [[3,5]]
a[0] = [7]
a[1] = [0]
a[2] = null
| a = [[3, 5]]
a[0] = [7]
a[1] = [0]
a[2] = null |
# Copyright (c) 2018-2022 curoky(cccuroky@gmail.com).
#
# This file is part of my-own-x.
# See https://github.com/curoky/my-own-x for further info.
#
# 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 Licens... | load('@bazel_gazelle//:deps.bzl', 'go_repository')
def go_repositories():
go_repository(name='co_honnef_go_tools', importpath='honnef.co/go/tools', sum='h1:qTakTkI6ni6LFD5sBwwsdSO+AQqbSIxOauHTTQKZ/7o=', version='v0.1.3')
go_repository(name='com_github_afex_hystrix_go', importpath='github.com/afex/hystrix-go', ... |
# Leo colorizer control file for pseudoplain mode.
# This file is in the public domain.
# import leo.core.leoGlobals as g
# Properties for plain mode.
properties = {}
# Attributes dict for pseudoplain_main ruleset.
pseudoplain_main_attributes_dict = {
"default": "null",
"digit_re": "",
"escap... | properties = {}
pseudoplain_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '\\', 'highlight_digits': 'false', 'ignore_case': 'true', 'no_word_sep': ''}
pseudoplain_interior_main_attributes_dict = {'default': 'comment1', 'digit_re': '', 'escape': '\\', 'highlight_digits': 'false', 'ignore_case': 't... |
champName = ["Aatrox","Ahri","Akali","Alistar","Amumu","Anivia",
"Annie","Ashe","AurelionSol","Azir","Bard","Blitzcrank",
"Brand","Braum","Caitlyn","Camille","Cassiopeia","ChoGath",
"Corki","Darius","Diana","DrMundo","Draven","Ekko",
"Elise","Evelynn","Ezreal","Fiddle... | champ_name = ['Aatrox', 'Ahri', 'Akali', 'Alistar', 'Amumu', 'Anivia', 'Annie', 'Ashe', 'AurelionSol', 'Azir', 'Bard', 'Blitzcrank', 'Brand', 'Braum', 'Caitlyn', 'Camille', 'Cassiopeia', 'ChoGath', 'Corki', 'Darius', 'Diana', 'DrMundo', 'Draven', 'Ekko', 'Elise', 'Evelynn', 'Ezreal', 'Fiddlesticks', 'Fiora', 'Fizz', 'G... |
def xml_body_p_parse(soup, abstract, keep_abstract):
# we'll save each paragraph to a holding list then join at the end
p_text = []
# keeping the abstract at the begining depending on the input
if keep_abstract == True:
if abstract != '' and abstract != None and abstract == abstract:
... | def xml_body_p_parse(soup, abstract, keep_abstract):
p_text = []
if keep_abstract == True:
if abstract != '' and abstract != None and (abstract == abstract):
p_text.append(abstract)
else:
pass
body = soup.find('body')
if body:
main = body.find_all(['article', 'com... |
num_pl = int(input())
pl_list = input()
gift_list = []
mius_list = []
i = 0
times = 0
while True:
if(not(pl_list[i]==' ')):
times += 1
if (times > num_pl):
pl_list += pl_list[times-num_pl-1]
if (i == 0 and times <= num_pl):
gift_list.append(1)
... | num_pl = int(input())
pl_list = input()
gift_list = []
mius_list = []
i = 0
times = 0
while True:
if not pl_list[i] == ' ':
times += 1
if times > num_pl:
pl_list += pl_list[times - num_pl - 1]
if i == 0 and times <= num_pl:
gift_list.append(1)
elif pl_list[i] ... |
# Create variable a
_____
# Create variable b
_____
# Print out the sum of a and b
_____________ | _____
_____
_____________ |
coreimage = ximport("coreimage")
canvas = coreimage.canvas(150, 150)
def fractal(x, y, depth=64):
z = complex(x, y)
o = complex(0, 0)
for i in range(depth):
if abs(o) <= 2: o = o*o + z
else:
return i
return 0 #default, black
pixels = []
w = h = 150
for i in range(w):
... | coreimage = ximport('coreimage')
canvas = coreimage.canvas(150, 150)
def fractal(x, y, depth=64):
z = complex(x, y)
o = complex(0, 0)
for i in range(depth):
if abs(o) <= 2:
o = o * o + z
else:
return i
return 0
pixels = []
w = h = 150
for i in range(w):
for j... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.