content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
string = '<option value="1" >Malda</option><option value="2" >Hooghly</option><option value="3" >Calcutta</option><option value="4" >Jalpaiguri</option><option value="6" >Coochbehar</option><option value="7" >Paschim Medinpur</option><option value="8" >Birbhum</option><option value="9" >Purba Medinipur</option><option ... | string = '<option value="1" >Malda</option><option value="2" >Hooghly</option><option value="3" >Calcutta</option><option value="4" >Jalpaiguri</option><option value="6" >Coochbehar</option><option value="7" >Paschim Medinpur</option><option value="8" >Birbhum</option><option value="9" >Purba Medinipur</option><option ... |
class Calls(object):
def __init__(self):
self.calls = []
def addCall(self, call):
self.calls.append(call)
def endCall(self, call):
for c in self.calls:
if call.ID == c.ID:
self.calls.remove(call)
def searchCall(self, call_id):
for c in self.... | class Calls(object):
def __init__(self):
self.calls = []
def add_call(self, call):
self.calls.append(call)
def end_call(self, call):
for c in self.calls:
if call.ID == c.ID:
self.calls.remove(call)
def search_call(self, call_id):
for c in s... |
# Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite
# restaurants represented by strings.
# You need to help them find out their common interest with the least list index sum. If there is a
# choice tie between answers, output all of them with no order requirement. Yo... | class Solution:
def find_restaurant(self, list1: 'list[str]', list2: 'list[str]') -> 'list[str]':
places_map = {}
min_sum = float('inf')
res = []
for (i, cur) in enumerate(list1):
placesMap[cur] = i
for (i, cur) in enumerate(list2):
if cur in placesMa... |
def gcd(a,b):
if a < b:
a, b = b, a
if b == 0:
return a
return gcd(b, a %b)
def gcdlist(l):
if len(l) == 2:
return gcd(l[0], l[1])
f = l.pop()
s = l.pop()
m = gcd(f, s)
l.append(m)
return gcdlist(l)
def main():
n, x = map(int, input().split())
a = [... | def gcd(a, b):
if a < b:
(a, b) = (b, a)
if b == 0:
return a
return gcd(b, a % b)
def gcdlist(l):
if len(l) == 2:
return gcd(l[0], l[1])
f = l.pop()
s = l.pop()
m = gcd(f, s)
l.append(m)
return gcdlist(l)
def main():
(n, x) = map(int, input().split())
... |
#! /bin/env python3
''' Class that represents a bit mask.
It has methods representing all
the bitwise operations plus some
additional features. The methods
return a new BitMask object or
a boolean result. See the bits
module for more on the operations
provided.
'''
class BitMask(int):
def AND(self,bm):
r... | """ Class that represents a bit mask.
It has methods representing all
the bitwise operations plus some
additional features. The methods
return a new BitMask object or
a boolean result. See the bits
module for more on the operations
provided.
"""
class Bitmask(int):
def and(self, bm):
return bit_mask(... |
n,reqsum=map(int,input().split())
a=list(map(int,input().split()))
arr=[]
for i in range(1,n+1):
arr.append([i,a[i-1]])
arr=sorted(arr,key=lambda x:x[1])
#print(arr)
i=0
j=n-1
while(i<=j and i!=j):
#print("{}+{}={}".format(arr[i][1],arr[j][1],arr[i][1]+arr[j][1]))
if(arr[i][1]+arr[j][1]==reqsum):
pr... | (n, reqsum) = map(int, input().split())
a = list(map(int, input().split()))
arr = []
for i in range(1, n + 1):
arr.append([i, a[i - 1]])
arr = sorted(arr, key=lambda x: x[1])
i = 0
j = n - 1
while i <= j and i != j:
if arr[i][1] + arr[j][1] == reqsum:
print('{} {}'.format(arr[i][0], arr[j][0]))
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def flatten(self, root: TreeNode) -> None:
preorderList = list()
def preorderTraversal(root... | class Solution:
def flatten(self, root: TreeNode) -> None:
preorder_list = list()
def preorder_traversal(root: TreeNode):
if root:
preorderList.append(root)
preorder_traversal(root.left)
preorder_traversal(root.right)
preorder_tra... |
str = "Python Program"
print(str[0])
print(str[1])
print(str[2])
print(str[3])
print(str[4])
print(str[5])
print(str[0:8])
print(str[::-1]) #to reverse the string | str = 'Python Program'
print(str[0])
print(str[1])
print(str[2])
print(str[3])
print(str[4])
print(str[5])
print(str[0:8])
print(str[::-1]) |
vid_parttern = r''
class Video:
def __init__(self):
pass
| vid_parttern = ''
class Video:
def __init__(self):
pass |
expected_output = {
'Node number is ': '1',
'Node status is ': 'NODE_STATUS_UP',
'Tunnel status is ': 'NODE_TUNNEL_UP',
'Node Sudi is ': '11 FDO25390VQP',
'Node Name is ': '4 Node',
'Node type is ': 'CLUSTER_NODE_TYPE_MASTER',
'Node role is ': 'CLUSTER_NODE_ROLE_LEADER'
}
| expected_output = {'Node number is ': '1', 'Node status is ': 'NODE_STATUS_UP', 'Tunnel status is ': 'NODE_TUNNEL_UP', 'Node Sudi is ': '11 FDO25390VQP', 'Node Name is ': '4 Node', 'Node type is ': 'CLUSTER_NODE_TYPE_MASTER', 'Node role is ': 'CLUSTER_NODE_ROLE_LEADER'} |
class Service:
def __init__(self):
self.base = 7
def set_val(self, val):
self.func_val = val
def get_val(self):
return self.func_val
class Service2(Service):
def __init__(self): # pragma: no cover
self.base = 8
| class Service:
def __init__(self):
self.base = 7
def set_val(self, val):
self.func_val = val
def get_val(self):
return self.func_val
class Service2(Service):
def __init__(self):
self.base = 8 |
vowels = "aeiou"
#user input
word = input("Enter a word ('quit' to quit): ")
word = word.lower()
if word == 'quit':
quit()
#mainloop
while word != 'quit':
if word[0] in vowels:
word = word + "way"
#if word is one letter consonant
elif word[0] not in vowels and len(word) == 1:
word =... | vowels = 'aeiou'
word = input("Enter a word ('quit' to quit): ")
word = word.lower()
if word == 'quit':
quit()
while word != 'quit':
if word[0] in vowels:
word = word + 'way'
elif word[0] not in vowels and len(word) == 1:
word = word + 'ay'
else:
for (i, ch) in enumerate(word):
... |
class Event:
def __init__(self, event_date, event_type, machine_name, user):
self.date = event_date
self.type = event_type
self.machine = machine_name
self.user = user
| class Event:
def __init__(self, event_date, event_type, machine_name, user):
self.date = event_date
self.type = event_type
self.machine = machine_name
self.user = user |
pkgname = "python-urllib3"
pkgver = "1.26.9"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools"]
depends = ["python-six"]
pkgdesc = "HTTP library with thread-safe connection pooling"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://urllib3.readthedocs.io"
source = f... | pkgname = 'python-urllib3'
pkgver = '1.26.9'
pkgrel = 0
build_style = 'python_module'
hostmakedepends = ['python-setuptools']
depends = ['python-six']
pkgdesc = 'HTTP library with thread-safe connection pooling'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'MIT'
url = 'https://urllib3.readthedocs.io'
source = f... |
___assertEqual(0**17, 0)
___assertEqual(17**0, 1)
___assertEqual(0**0, 1)
___assertEqual(17**1, 17)
___assertEqual(2**10, 1024)
___assertEqual(2**-2, 0.25)
| ___assert_equal(0 ** 17, 0)
___assert_equal(17 ** 0, 1)
___assert_equal(0 ** 0, 1)
___assert_equal(17 ** 1, 17)
___assert_equal(2 ** 10, 1024)
___assert_equal(2 ** (-2), 0.25) |
record4 = [[({'t4.103.114.0': {'wcet': 1, 'period': 10, 'deadline': 9}, 't3.103.114.0': {'wcet': 2, 'period': 10, 'deadline': 8}, 't5.103.114.0': {'wcet': 3, 'period': 15, 'deadline': 12}}, {'t4.103.114.0': [0.559, 10.0], 't3.103.114.0': [0.733, 5.0], 't5.103.114.0': [0.413, 5.0]}), 'newmec-3'], [({'t5.103.114.1': {'w... | record4 = [[({'t4.103.114.0': {'wcet': 1, 'period': 10, 'deadline': 9}, 't3.103.114.0': {'wcet': 2, 'period': 10, 'deadline': 8}, 't5.103.114.0': {'wcet': 3, 'period': 15, 'deadline': 12}}, {'t4.103.114.0': [0.559, 10.0], 't3.103.114.0': [0.733, 5.0], 't5.103.114.0': [0.413, 5.0]}), 'newmec-3'], [({'t5.103.114.1': {'wc... |
# Initialize step_end
step_end = 10
# Loop for step_end steps
for step in range(step_end):
# Compute value of t
t = step * dt
# Compute value of i at this time step
i = i_mean * (1 + np.sin((t * 2 * np.pi) / 0.01))
# Print value of t and i
print(f'{t:.3f} {i:.4e}') | step_end = 10
for step in range(step_end):
t = step * dt
i = i_mean * (1 + np.sin(t * 2 * np.pi / 0.01))
print(f'{t:.3f} {i:.4e}') |
# OpenWeatherMap API Key
weather_api_key = "229c3f533e63b8b69792de2ba65d3645"
# Google API Key
g_key = "AIzaSyCv1BWR1Jm0cxoY8oqWxYHWU2g6Aq91SvE"
| weather_api_key = '229c3f533e63b8b69792de2ba65d3645'
g_key = 'AIzaSyCv1BWR1Jm0cxoY8oqWxYHWU2g6Aq91SvE' |
# get stem leaf plot in dictionary
def stemleaf(data):
stem_leaf = {}
for x in data:
x_str = str(x)
if (len(x_str) == 1):
x_str = "0" + x_str
stem = int(x_str[:-1])
leaf = int(x_str[-1])
if (stem not in stem_leaf):
stem_leaf[stem] = [leaf]
else:
stem_leaf[stem] = stem_leaf[stem] + [leaf]
ret... | def stemleaf(data):
stem_leaf = {}
for x in data:
x_str = str(x)
if len(x_str) == 1:
x_str = '0' + x_str
stem = int(x_str[:-1])
leaf = int(x_str[-1])
if stem not in stem_leaf:
stem_leaf[stem] = [leaf]
else:
stem_leaf[stem] = ste... |
f1 = 'bully_and_attack_mode'
f2 = 'happy_child_mode'
f3 = 'punishing_parent_mode'
f4 = 'vulnerable_child_mode'
f5 = 'demanding_parent_mode'
f6 = 'compliand_surrender_mode'
f7 = 'self_aggrandizer_mode'
f8 = 'impulsive_child_mode'
f9 = 'undiscilined_child_mode'
f10 = 'engraed_child_mode'
f11 = 'healthyy_adult_mode'
f12 ... | f1 = 'bully_and_attack_mode'
f2 = 'happy_child_mode'
f3 = 'punishing_parent_mode'
f4 = 'vulnerable_child_mode'
f5 = 'demanding_parent_mode'
f6 = 'compliand_surrender_mode'
f7 = 'self_aggrandizer_mode'
f8 = 'impulsive_child_mode'
f9 = 'undiscilined_child_mode'
f10 = 'engraed_child_mode'
f11 = 'healthyy_adult_mode'
f12 =... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'target_defaults': {
'variables': {
'chromium_code': 1,
'enable_wexit_time_destructors': 1,
},
'include_dirs': [
'<(DEPT... | {'target_defaults': {'variables': {'chromium_code': 1, 'enable_wexit_time_destructors': 1}, 'include_dirs': ['<(DEPTH)', '<(SHARED_INTERMEDIATE_DIR)'], 'defines': ['COMPILE_CONTENT_STATICALLY', 'SECURITY_WIN32', 'STRICT', '_ATL_APARTMENT_THREADED', '_ATL_CSTRING_EXPLICIT_CONSTRUCTORS', '_ATL_NO_COM_SUPPORT', '_ATL_NO_A... |
'''all custom exceptions should go here'''
class EmptyP2THDirectory(Exception):
'''no transactions on this P2TH directory'''
class P2THImportFailed(Exception):
'''Importing of PeerAssets P2TH privkeys failed.'''
class InvalidDeckIssueModeCombo(Exception):
'''When verfiying deck issue_mode combinations... | """all custom exceptions should go here"""
class Emptyp2Thdirectory(Exception):
"""no transactions on this P2TH directory"""
class P2Thimportfailed(Exception):
"""Importing of PeerAssets P2TH privkeys failed."""
class Invaliddeckissuemodecombo(Exception):
"""When verfiying deck issue_mode combinations.""... |
class Sack:
def __init__(self, wt, val):
self.wt = wt
self.val = val
self.cost = val // wt
def __lt__(self, other):
return self.cost < other.cost
def knapsack(wt, val, W):
item = []
for i in range(len(wt)):
item.append(Sack(wt[i], val[i]))
i... | class Sack:
def __init__(self, wt, val):
self.wt = wt
self.val = val
self.cost = val // wt
def __lt__(self, other):
return self.cost < other.cost
def knapsack(wt, val, W):
item = []
for i in range(len(wt)):
item.append(sack(wt[i], val[i]))
item.sort(reverse... |
'''
It is time now to piece together everything you have learned so far into a pipeline for classification! Your job in this exercise is to build a pipeline that includes scaling and hyperparameter tuning to classify wine quality.
You'll return to using the SVM classifier you were briefly introduced to earlier in this... | """
It is time now to piece together everything you have learned so far into a pipeline for classification! Your job in this exercise is to build a pipeline that includes scaling and hyperparameter tuning to classify wine quality.
You'll return to using the SVM classifier you were briefly introduced to earlier in this... |
m: int; n: int
m = int(input("Quantas linhas vai ter cada matriz? "))
n = int(input("Quantas colunas vai ter cada matriz? "))
a: [[int]] = [[0 for x in range(n)] for x in range(m)]
b: [[int]] = [[0 for x in range(n)] for x in range(m)]
c: [[int]] = [[0 for x in range(n)] for x in range(m)]
print("Digite os valores d... | m: int
n: int
m = int(input('Quantas linhas vai ter cada matriz? '))
n = int(input('Quantas colunas vai ter cada matriz? '))
a: [[int]] = [[0 for x in range(n)] for x in range(m)]
b: [[int]] = [[0 for x in range(n)] for x in range(m)]
c: [[int]] = [[0 for x in range(n)] for x in range(m)]
print('Digite os valores da ma... |
objetivo = int(input('Escoge un numero: '))
epsilon = 0.0001
paso = epsilon**2
respuesta = 0.0
while abs(respuesta**2 - objetivo) >= epsilon and respuesta <= objetivo:
print(abs(respuesta**2 - objetivo), respuesta)
respuesta += paso
if abs(respuesta**2 - objetivo) >= epsilon:
print(f'No se encontro la ra... | objetivo = int(input('Escoge un numero: '))
epsilon = 0.0001
paso = epsilon ** 2
respuesta = 0.0
while abs(respuesta ** 2 - objetivo) >= epsilon and respuesta <= objetivo:
print(abs(respuesta ** 2 - objetivo), respuesta)
respuesta += paso
if abs(respuesta ** 2 - objetivo) >= epsilon:
print(f'No se encontro ... |
# -*- coding: utf-8 -*-
class ImdbScraperPipeline(object):
def process_item(self, item, spider):
return item
| class Imdbscraperpipeline(object):
def process_item(self, item, spider):
return item |
high_income = True
low_income = False
if high_income == True and low_income == False:
print("u little bitch ")
#above code is noob kind of code
#bettter way
if high_income and low_income:
print("u little bitch")
#high_income and low_income are already boolean so we don't need to compare it with == True and ==... | high_income = True
low_income = False
if high_income == True and low_income == False:
print('u little bitch ')
if high_income and low_income:
print('u little bitch')
age = 45
if age > 10 and age < 65:
print('Eligible')
message = 'Eligible' if age > 18 and age < 65 else 'Not Eligible'
print(message)
if 18 <=... |
def print_artist(album):
print(album['Artist_Name'])
def change_list(list_from_user):
list_from_user[2] = 5
def print_name(album):
print(album["Album_Title"])
def make_album(name, title, numSongs=10):
album = {'Artist_Name': name, 'Album_Title': title}
if numSongs:
album["Song_Count"] = n... | def print_artist(album):
print(album['Artist_Name'])
def change_list(list_from_user):
list_from_user[2] = 5
def print_name(album):
print(album['Album_Title'])
def make_album(name, title, numSongs=10):
album = {'Artist_Name': name, 'Album_Title': title}
if numSongs:
album['Song_Count'] = n... |
class Block:
def __init__(self, block_id, alignment):
self.id = block_id
self.alignment = alignment
self.toroot = self # parent in find-union tree
self.shift = 0 # order relative to parent
self.reorder_shift = 0 # modification caused by edges inserted within group
sel... | class Block:
def __init__(self, block_id, alignment):
self.id = block_id
self.alignment = alignment
self.toroot = self
self.shift = 0
self.reorder_shift = 0
self.orient = 1
self.flanks = {-1: 0, 1: 0}
def find(self):
if self.toroot is self:
... |
result = []
for line in DATA.splitlines():
d, t, lvl, msg = line.strip().split(', ', maxsplit=3)
d = date.fromisoformat(d)
t = time.fromisoformat(t)
dt = datetime.combine(d, t)
result.append({'when': dt, 'level': lvl, 'message': msg})
| result = []
for line in DATA.splitlines():
(d, t, lvl, msg) = line.strip().split(', ', maxsplit=3)
d = date.fromisoformat(d)
t = time.fromisoformat(t)
dt = datetime.combine(d, t)
result.append({'when': dt, 'level': lvl, 'message': msg}) |
#!/usr/bin/env python
#####################################
# Installation module for ike-scan
#####################################
# AUTHOR OF MODULE NAME
AUTHOR="Jason Ashton (ninewires)"
# DESCRIPTION OF THE MODULE
DESCRIPTION="This module will install/update ike-scan - a command-line tool for discovering, finger... | author = 'Jason Ashton (ninewires)'
description = 'This module will install/update ike-scan - a command-line tool for discovering, fingerprinting and testing IPsec VPN systems'
install_type = 'GIT'
repository_location = 'https://github.com/royhills/ike-scan.git'
install_location = 'ike-scan'
debian = 'git,gcc,make'
fed... |
nr=int(input())
for i in range(1,nr+1):
print("*"*i)
| nr = int(input())
for i in range(1, nr + 1):
print('*' * i) |
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# 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... | all_preflight_checks_dag_name = 'preflight'
armada_build_dag_name = 'armada_build'
destroy_server_dag_name = 'destroy_server'
drydock_build_dag_name = 'drydock_build'
validate_site_design_dag_name = 'validate_site_design'
relabel_nodes_dag_name = 'relabel_nodes'
action_xcom = 'action_xcom'
armada_test_releases = 'armad... |
name = 'geo5038801mod'
apical_dendriteEnd = 79
total_user5 = 70
f = open(name + '.hoc','r')
new_ls = ''
for line in f:
if 'user5[' in line and 'create' not in line and 'append' not in line:
parts = line.split('user5[')
#sdfs
if '{user5[51] connect user5[52](0),... | name = 'geo5038801mod'
apical_dendrite_end = 79
total_user5 = 70
f = open(name + '.hoc', 'r')
new_ls = ''
for line in f:
if 'user5[' in line and 'create' not in line and ('append' not in line):
parts = line.split('user5[')
if '{user5[51] connect user5[52](0), 1}' in line:
pass
... |
#!/usr/bin/env python
command += maketx("../common/textures/mandrill.tif --wrap clamp -o mandrill.tx")
command += testshade("-g 64 64 --center -od uint8 -o Cblack black.tif -o Cclamp clamp.tif -o Cperiodic periodic.tif -o Cmirror mirror.tif -o Cdefault default.tif test")
outputs = [ "out.txt", "black.tif", "clamp.tif... | command += maketx('../common/textures/mandrill.tif --wrap clamp -o mandrill.tx')
command += testshade('-g 64 64 --center -od uint8 -o Cblack black.tif -o Cclamp clamp.tif -o Cperiodic periodic.tif -o Cmirror mirror.tif -o Cdefault default.tif test')
outputs = ['out.txt', 'black.tif', 'clamp.tif', 'periodic.tif', 'mirro... |
# You are given two non-empty linked lists representing two non-negative integers.
# The digits are stored in reverse order and each of their nodes contain a single digit.
# Add the two numbers and return it as a linked list.
# You may assume the two numbers do not contain any leading zero, except the number 0 itself.... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode:
(num1, num2) = (0, 0)
(i, j) = (0, 0)
while l1:
num1 += l1.val * 10 ** i
i += 1
l... |
source_data = 'day17/input.txt'
with open(source_data, 'r') as f:
input = [x.replace('\n', '') for x in f.readlines()]
target = [[int(y) for y in x.split('=')[1].split('..')] for x in input[0].split(',')]
x = target[0]
y = target[1]
options = {}
testing_velocities = range(-200, 200)
for x_test in testing_veloci... | source_data = 'day17/input.txt'
with open(source_data, 'r') as f:
input = [x.replace('\n', '') for x in f.readlines()]
target = [[int(y) for y in x.split('=')[1].split('..')] for x in input[0].split(',')]
x = target[0]
y = target[1]
options = {}
testing_velocities = range(-200, 200)
for x_test in testing_velocities... |
atributes = [
{"name":"color", "value":{'amarillo': 0, 'morado': 1, 'azul': 2, 'verde': 3, 'naranja': 4, 'rojo': 5}},
{"name":"size", "value":{'m': 2, 's': 1, 'xxl': 5, 'xs': 0, 'l': 3, 'xl': 4}},
{"name":"brand", "value":{'blue': 0, 'polo': 1, 'adidas': 2, 'zara': 3, 'nike': 4}},
{"name": "precio", "value": {2... | atributes = [{'name': 'color', 'value': {'amarillo': 0, 'morado': 1, 'azul': 2, 'verde': 3, 'naranja': 4, 'rojo': 5}}, {'name': 'size', 'value': {'m': 2, 's': 1, 'xxl': 5, 'xs': 0, 'l': 3, 'xl': 4}}, {'name': 'brand', 'value': {'blue': 0, 'polo': 1, 'adidas': 2, 'zara': 3, 'nike': 4}}, {'name': 'precio', 'value': {2333... |
def repeated(words):
distance = float('inf')
d = {}
for i, word in enumerate(words):
if word in d:
temp = abs(d[word] - i)
if temp < distance:
distance = temp
d[word] = i
return distance
| def repeated(words):
distance = float('inf')
d = {}
for (i, word) in enumerate(words):
if word in d:
temp = abs(d[word] - i)
if temp < distance:
distance = temp
d[word] = i
return distance |
class Skin(object):
menu_positions = ["left", "right"]
height_decrement = 150
def get_base_template(self, module):
t = self.base_template
if module and module.has_local_nav():
t = self.local_nav_template
return t
def initialize(self, appshell):
pass
| class Skin(object):
menu_positions = ['left', 'right']
height_decrement = 150
def get_base_template(self, module):
t = self.base_template
if module and module.has_local_nav():
t = self.local_nav_template
return t
def initialize(self, appshell):
pass |
# Day5 of my 100DaysOfCode Challenge
# Program to learn is and in
# use of is
number = None
if (number is None):
print("Yes")
else:
print("No")
# use of in
list = [45, 34, 67, 99]
print(34 in list) | number = None
if number is None:
print('Yes')
else:
print('No')
list = [45, 34, 67, 99]
print(34 in list) |
def multiplication(factor, multiplier):
product = factor * multiplier
if (product % 1) == 0:
return int(product)
else:
return product
| def multiplication(factor, multiplier):
product = factor * multiplier
if product % 1 == 0:
return int(product)
else:
return product |
[ ## this file was manually modified by jt
{
'functor' : {
'description' : ['returns a scalar integer value composed by the highiest bits.',
'of each vector element'],
'module' : 'boost',
'arity' : '1',
'call_types' : [],
'ret_arity' : '0',... | [{'functor': {'description': ['returns a scalar integer value composed by the highiest bits.', 'of each vector element'], 'module': 'boost', 'arity': '1', 'call_types': [], 'ret_arity': '0', 'rturn': {'default': 'T'}, 'special': ['reduction'], 'type_defs': [], 'types': ['real_', 'signed_int_', 'unsigned_int_']}, 'info'... |
class Source:
source_list = []
def __init__(self, id, description, url, category):
self.id = id
self.description = description
self.url = url
self.category = category
class Articles:
def __init__(self, id,author, title, urlToImage, url):
self.id = id
s... | class Source:
source_list = []
def __init__(self, id, description, url, category):
self.id = id
self.description = description
self.url = url
self.category = category
class Articles:
def __init__(self, id, author, title, urlToImage, url):
self.id = id
self.... |
#! /usr/bin/python
def _zeros(size):
out = [[0 for _ in range(size)] for _ in range(size)]
return out
def _enforce_self_dist(dist_matrix, scale):
longest = max((max(row) for row in dist_matrix))
longest *= scale
for i in range(len(dist_matrix)):
dist_matrix[i][i] = longest
return di... | def _zeros(size):
out = [[0 for _ in range(size)] for _ in range(size)]
return out
def _enforce_self_dist(dist_matrix, scale):
longest = max((max(row) for row in dist_matrix))
longest *= scale
for i in range(len(dist_matrix)):
dist_matrix[i][i] = longest
return dist_matrix
def build_di... |
# Parameters template.
#
# This should agree with the current params.ini with the exception of the
# fields we wish to modify.
#
# This template is called by run_sample.py for producing many outputs that are
# needed to run a convergence study.
finess_data_template = '''
; Parameters common to FINESS applications
[fi... | finess_data_template = '\n; Parameters common to FINESS applications\n[finess]\nndims = 2 ; 1, 2, or 3\nnout = 1 ; number of output times to print results\ntfinal = 1.0 ; final time\ninitial_dt = 1.0 ; initial dt\nmax_dt = 1.0 ; max allowable dt \nmax_cfl ... |
class AST:
def __init__(self, root_symbol, rule, *children):
self.root_symbol = root_symbol
self.rule = rule
self.children = children
def __str__(self):
return str(self.root_symbol)
class Leaf(AST):
def __init__(self, root_symbol, actual_input):
super(L... | class Ast:
def __init__(self, root_symbol, rule, *children):
self.root_symbol = root_symbol
self.rule = rule
self.children = children
def __str__(self):
return str(self.root_symbol)
class Leaf(AST):
def __init__(self, root_symbol, actual_input):
super(Leaf, self).... |
product = 1
i = 1
while product > 0.5:
product *= (365.0 - i) / 365.0
i += 1
print(product, i)
| product = 1
i = 1
while product > 0.5:
product *= (365.0 - i) / 365.0
i += 1
print(product, i) |
class Direcao:
def __init__(self):
self.posicoes = ("Norte", "Leste", "Sul", "Oeste")
self.direcao_atual = 0
def girar_a_direita(self):
self.direcao_atual += 1
self.direcao_atual = min(3, self.direcao_atual)
#if self.direcao_atual > 3:
#self.direcao_atual = ... | class Direcao:
def __init__(self):
self.posicoes = ('Norte', 'Leste', 'Sul', 'Oeste')
self.direcao_atual = 0
def girar_a_direita(self):
self.direcao_atual += 1
self.direcao_atual = min(3, self.direcao_atual)
def girar_a_esquerda(self):
self.direcao_atual -= 1
... |
br, bc = map(int, input().split())
dr, dc = map(int, input().split())
jr, jc = map(int, input().split())
bessie = max(abs(br - jr), abs(bc - jc))
daisy = abs(dr - jr) + abs(dc - jc)
if bessie == daisy:
print('tie')
elif bessie < daisy:
print('bessie')
else:
print('daisy')
| (br, bc) = map(int, input().split())
(dr, dc) = map(int, input().split())
(jr, jc) = map(int, input().split())
bessie = max(abs(br - jr), abs(bc - jc))
daisy = abs(dr - jr) + abs(dc - jc)
if bessie == daisy:
print('tie')
elif bessie < daisy:
print('bessie')
else:
print('daisy') |
# we write a function that computes x factorial recursively
def recursiveFactorial(x):
# we check that x is positive
if x < 0:
raise exception("factorials of non-negative numbers only")
# we check if x is either 0 or 1
if x <= 1:
# we return the asnwer 1
return 1
else:
# we recurse
return x * recurs... | def recursive_factorial(x):
if x < 0:
raise exception('factorials of non-negative numbers only')
if x <= 1:
return 1
else:
return x * recursive_factorial(x - 1) |
#!/bin/python3
def hackerrankInString(s):
find = "hackerrank"
i = 0
for c in s:
if find[i] == c:
i += 1
if i >= len(find):
return("YES")
return("NO")
if __name__ == "__main__":
q = int(input().strip())
for a0 in range(q):
s = input().... | def hackerrank_in_string(s):
find = 'hackerrank'
i = 0
for c in s:
if find[i] == c:
i += 1
if i >= len(find):
return 'YES'
return 'NO'
if __name__ == '__main__':
q = int(input().strip())
for a0 in range(q):
s = input().strip()
resul... |
filein = input('Input an email log txt file please: ')
emaillog = open(filein)
days = dict()
for x in emaillog:
if 'From ' in x:
array = x.split()
day = array[1]
day = day.split('@')
day = day[1]
days[day] = days.get(day, 0)+1
else:
continue
print(days)
# most = ... | filein = input('Input an email log txt file please: ')
emaillog = open(filein)
days = dict()
for x in emaillog:
if 'From ' in x:
array = x.split()
day = array[1]
day = day.split('@')
day = day[1]
days[day] = days.get(day, 0) + 1
else:
continue
print(days) |
# 21303 - [Job Adv] (Lv.60) Aran
sm.setSpeakerID(1203001)
sm.sendNext("*Sob sob* #p1203001# is sad. #p1203001# is mad. #p1203001# cries. *Sob sob*")
sm.setPlayerAsSpeaker()
sm.sendNext("Wh...What's wrong?")
sm.setSpeakerID(1203001)
sm.sendNext("#p1203001# made gem. #bGem as red as apple#k. But #rthief#k stole gem. #p... | sm.setSpeakerID(1203001)
sm.sendNext('*Sob sob* #p1203001# is sad. #p1203001# is mad. #p1203001# cries. *Sob sob*')
sm.setPlayerAsSpeaker()
sm.sendNext("Wh...What's wrong?")
sm.setSpeakerID(1203001)
sm.sendNext('#p1203001# made gem. #bGem as red as apple#k. But #rthief#k stole gem. #p1203001# no longer has gem. #p12030... |
pkgname = "efl"
pkgver = "1.26.1"
pkgrel = 0
build_style = "meson"
configure_args = [
"-Dbuild-tests=false",
"-Dbuild-examples=false",
"-Dembedded-lz4=false",
"-Dcrypto=openssl",
"-Decore-imf-loaders-disabler=scim",
# rlottie (json) is pretty useless and unstable so keep that off
"-Devas-loa... | pkgname = 'efl'
pkgver = '1.26.1'
pkgrel = 0
build_style = 'meson'
configure_args = ['-Dbuild-tests=false', '-Dbuild-examples=false', '-Dembedded-lz4=false', '-Dcrypto=openssl', '-Decore-imf-loaders-disabler=scim', '-Devas-loaders-disabler=json', '-Dlua-interpreter=lua', '-Dbindings=cxx', '-Dopengl=es-egl', '-Dphysics=... |
description = 'FOV linear axis for the large box (300 x 300)'
group = 'optional'
excludes = ['fov_100x100', 'fov_190x190']
includes = ['frr']
devices = dict(
fov_300_mot = device('nicos.devices.generic.VirtualReferenceMotor',
description = 'FOV motor',
visibility = (),
abslimits = (275, 9... | description = 'FOV linear axis for the large box (300 x 300)'
group = 'optional'
excludes = ['fov_100x100', 'fov_190x190']
includes = ['frr']
devices = dict(fov_300_mot=device('nicos.devices.generic.VirtualReferenceMotor', description='FOV motor', visibility=(), abslimits=(275, 950), userlimits=(276, 949), refswitch='l... |
'''
.remove(x)
This operation removes element from the set.
If element does not exist, it raises a KeyError.
The .remove(x) operation returns None.
Example
>>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> s.remove(5)
>>> print s
set([1, 2, 3, 4, 6, 7, 8, 9])
>>> print s.remove(4)
None
>>> print s
set([1, 2, 3, 6, 7, 8, ... | """
.remove(x)
This operation removes element from the set.
If element does not exist, it raises a KeyError.
The .remove(x) operation returns None.
Example
>>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> s.remove(5)
>>> print s
set([1, 2, 3, 4, 6, 7, 8, 9])
>>> print s.remove(4)
None
>>> print s
set([1, 2, 3, 6, 7, 8, ... |
class Article():
def __init__(self, title, authors, link, date):
self.title = title
self.authors = authors
self.link = link
self.date = date
| class Article:
def __init__(self, title, authors, link, date):
self.title = title
self.authors = authors
self.link = link
self.date = date |
# A part of pdfrw (https://github.com/pmaupin/pdfrw)
# Copyright (C) 2006-2015 Patrick Maupin, Austin, Texas
# MIT license -- See LICENSE.txt for details
class _NotLoaded(object):
pass
class PdfIndirect(tuple):
''' A placeholder for an object that hasn't been read in yet.
The object itself is the (o... | class _Notloaded(object):
pass
class Pdfindirect(tuple):
""" A placeholder for an object that hasn't been read in yet.
The object itself is the (object number, generation number) tuple.
The attributes include information about where the object is
referenced from and the file object to r... |
'''Write a program that returns a list that contains common
elements between two input lists without duplicates. Ensure
it works for lists of two different sizes.'''
# list of random numbers
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
# newlist:
# sets ensure unique v... | """Write a program that returns a list that contains common
elements between two input lists without duplicates. Ensure
it works for lists of two different sizes."""
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
newlist = list(set([i for i in a if i in b]))
print(newlist) |
class StrategyStateMachine :
def discovery() :
pass
def composition() :
pass
def usage() :
pass
def end() :
pass
| class Strategystatemachine:
def discovery():
pass
def composition():
pass
def usage():
pass
def end():
pass |
# This file is generated by sync-deps, do not edit!
load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@rules_jvm_external//:specs.bzl", "maven")
def default_install(artifacts, repositories, excluded_artifacts = []):
maven_install(
artifacts = artifacts,
fetch_sources = True,
rep... | load('@rules_jvm_external//:defs.bzl', 'maven_install')
load('@rules_jvm_external//:specs.bzl', 'maven')
def default_install(artifacts, repositories, excluded_artifacts=[]):
maven_install(artifacts=artifacts, fetch_sources=True, repositories=repositories, excluded_artifacts=excluded_artifacts, maven_install_json='... |
skill = input()
command = input()
while command != "For Azeroth":
command = command.split(" ")
command = command[0]
if command == "GladiatorStance":
skill = skill.upper()
print(skill)
break
elif command == "DefensiveStance":
skill = skill.lower()
print(skill)
... | skill = input()
command = input()
while command != 'For Azeroth':
command = command.split(' ')
command = command[0]
if command == 'GladiatorStance':
skill = skill.upper()
print(skill)
break
elif command == 'DefensiveStance':
skill = skill.lower()
print(skill)
... |
{
"targets": [
{
"target_name": "waznutilities",
"sources": [
"src/main.cc",
"src/cryptonote_core/cryptonote_format_utils.cpp",
"src/crypto/tree-hash.c",
"src/crypto/crypto.cpp",
"src/crypto/crypto-ops.c"... | {'targets': [{'target_name': 'waznutilities', 'sources': ['src/main.cc', 'src/cryptonote_core/cryptonote_format_utils.cpp', 'src/crypto/tree-hash.c', 'src/crypto/crypto.cpp', 'src/crypto/crypto-ops.c', 'src/crypto/crypto-ops-data.c', 'src/crypto/hash.c', 'src/crypto/keccak.c', 'src/common/base58.cpp'], 'include_dirs': ... |
# We must set a certain amount of money
my_money = 13
# We make a decision
if my_money > 20:
print("I'm going to the cinema and buy popcorn!")
elif my_money > 10:
print("I'm going to the cinema, but not buy popcorn!")
else:
print("I'm staying home!")
| my_money = 13
if my_money > 20:
print("I'm going to the cinema and buy popcorn!")
elif my_money > 10:
print("I'm going to the cinema, but not buy popcorn!")
else:
print("I'm staying home!") |
ix.enable_command_history()
app = ix.application
clarisse_win = app.get_event_window()
app.open_rename_item_window(clarisse_win)
ix.disable_command_history() | ix.enable_command_history()
app = ix.application
clarisse_win = app.get_event_window()
app.open_rename_item_window(clarisse_win)
ix.disable_command_history() |
# Input: 2D array of "map"
# Output: Shortest distance to exit from cell
# Revision 2 with help from my python book and some documentation
class deque(object):
# A custom implementation of collections.deque that is about 0.4s faster
def __init__(self, iterable=(), maxsize=-1):
if not hasattr(self, 'data'... | class Deque(object):
def __init__(self, iterable=(), maxsize=-1):
if not hasattr(self, 'data'):
self.left = self.right = 0
self.data = {}
self.maxsize = maxsize
self.extend(iterable)
def append(self, x):
self.data[self.right] = x
self.right += 1
... |
# encoding=utf-8
class Expression(object):
pass
| class Expression(object):
pass |
# -*- coding: utf-8 -*-
'''Snippets for combination.
'''
# Usage:
# combination = Combination(max_value=10 ** 5 + 100)
# combination.count_nCr(n, r)
class Combination:
''' Count the total number of combinations.
nCr % mod.
nHr % mod = (n + r - 1)Cr % mod.
Args:
... | """Snippets for combination.
"""
class Combination:
""" Count the total number of combinations.
nCr % mod.
nHr % mod = (n + r - 1)Cr % mod.
Args:
max_value: Max size of list. The default is 500,050
mod : Modulo. The default is 10 ** 9 + 7.
Landau notat... |
# -*- coding: utf-8 -*-
class Student(object):
def __init__(self, name, score):
self.__name = name
self.__score = score
def print_score(self):
print('%s: %s' % (self.__name, self.__score))
def get_name(self):
return self.__name
def get_score(self):
return sel... | class Student(object):
def __init__(self, name, score):
self.__name = name
self.__score = score
def print_score(self):
print('%s: %s' % (self.__name, self.__score))
def get_name(self):
return self.__name
def get_score(self):
return self.__score
def set_sc... |
# import simplejson as json
# import pandas as pd
# import numpy as np
# import psycopg2
# from itertools import repeat
# from psycopg2.extras import RealDictCursor, DictCursor
def execSql(cursor):
out = None
sqlString = '''
set search_path to demounit1;
-- GstInputAll (ExtGstTranD only) based on "isIn... | def exec_sql(cursor):
out = None
sql_string = '\n set search_path to demounit1;\n -- GstInputAll (ExtGstTranD only) based on "isInput"\n with cte1 as (\n\tselect "tranDate", "autoRefNo", "userRefNo", "tranType", "gstin", d."amount" - "cgst" - "sgst" - "igst" as "aggregate", "cgst", "sgst", "igst", d."... |
class ListenKeyExpired:
def __init__(self):
self.eventType = ''
self.eventTime = 0
@staticmethod
def json_parse(json_data):
result = ListenKeyExpired()
result.eventType = json_data.get_string('e')
result.eventTime = json_data.get_int('E')
return r... | class Listenkeyexpired:
def __init__(self):
self.eventType = ''
self.eventTime = 0
@staticmethod
def json_parse(json_data):
result = listen_key_expired()
result.eventType = json_data.get_string('e')
result.eventTime = json_data.get_int('E')
return result |
self.description = "Remove a package with a modified file marked for backup and has existing pacsaves"
self.filesystem = ["etc/dummy.conf.pacsave",
"etc/dummy.conf.pacsave.1",
"etc/dummy.conf.pacsave.2"]
p1 = pmpkg("dummy")
p1.files = ["etc/dummy.conf*"]
p1.backup = ["etc/dummy.c... | self.description = 'Remove a package with a modified file marked for backup and has existing pacsaves'
self.filesystem = ['etc/dummy.conf.pacsave', 'etc/dummy.conf.pacsave.1', 'etc/dummy.conf.pacsave.2']
p1 = pmpkg('dummy')
p1.files = ['etc/dummy.conf*']
p1.backup = ['etc/dummy.conf']
self.addpkg2db('local', p1)
self.a... |
def quote():
# TODO store to indexes.json
indexes = [
{ source : 'BOVESPA', ticker:'IBOV'},
{ source : 'CRYPTO', ticker:'BTCBRL'}
]
return indexes | def quote():
indexes = [{source: 'BOVESPA', ticker: 'IBOV'}, {source: 'CRYPTO', ticker: 'BTCBRL'}]
return indexes |
'''
Filippo Aleotti
filippo.aleotti2@unibo.it
29 November 2019
I PROFESSIONAL MASTER'S PROGRAM, II LEVEL "SIMUR", Imola 2019
Modify the function realised in the previous exercise to return (inside the dict, using the key min) also the value with minimum frequency.
If more values have the same minimum frequency, then... | """
Filippo Aleotti
filippo.aleotti2@unibo.it
29 November 2019
I PROFESSIONAL MASTER'S PROGRAM, II LEVEL "SIMUR", Imola 2019
Modify the function realised in the previous exercise to return (inside the dict, using the key min) also the value with minimum frequency.
If more values have the same minimum frequency, then... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"say_hello": "test_example.ipynb",
"say_goodbye": "00_core.ipynb"}
modules = ["core.py",
"test_example.py"]
doc_url = "https://daviderzmann.github.io/designkit_test/"
git_url = "https:/... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'say_hello': 'test_example.ipynb', 'say_goodbye': '00_core.ipynb'}
modules = ['core.py', 'test_example.py']
doc_url = 'https://daviderzmann.github.io/designkit_test/'
git_url = 'https://github.com/daviderzmann/designkit_test/tree/master/'
def custo... |
n=int(input())
S=input()
k=int(input())
i=S[k-1]
for s in S:print(s if s==i else "*",end="") | n = int(input())
s = input()
k = int(input())
i = S[k - 1]
for s in S:
print(s if s == i else '*', end='') |
class Solution:
def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:
if len(timeSeries) == 0:
return 0
total_poisoned = 0
for i in range(len(timeSeries)-1):
total_poisoned += min(duration, timeSeries[i+1] - timeSeries[i])
total_poisoned... | class Solution:
def find_poisoned_duration(self, timeSeries: List[int], duration: int) -> int:
if len(timeSeries) == 0:
return 0
total_poisoned = 0
for i in range(len(timeSeries) - 1):
total_poisoned += min(duration, timeSeries[i + 1] - timeSeries[i])
total_p... |
#
# PySNMP MIB module CISCO-LWAPP-RF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-RF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:06:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection) ... |
def bubble_sort(array):
for i in range(len(array)):
for j in range(len(array) - 1):
if array[j] > array[j + 1]:
array[j], array[j + 1] = array[j + 1], array[j]
| def bubble_sort(array):
for i in range(len(array)):
for j in range(len(array) - 1):
if array[j] > array[j + 1]:
(array[j], array[j + 1]) = (array[j + 1], array[j]) |
n=int(input())
if n<3:
print("NO")
else:
a=[]
b=[]
asum=0
bsum=0
for i in range(n,0,-1):
if asum<bsum:
asum+=i
a.append(i)
else:
bsum+=i
b.append(i)
if asum==bsum:
print("YES")
print(len(a))
print(' '.joi... | n = int(input())
if n < 3:
print('NO')
else:
a = []
b = []
asum = 0
bsum = 0
for i in range(n, 0, -1):
if asum < bsum:
asum += i
a.append(i)
else:
bsum += i
b.append(i)
if asum == bsum:
print('YES')
print(len(a))... |
DESCRIPTION = "sets a variable for the current module"
def autocomplete(shell, line, text, state):
# todo, here we can provide some defaults for bools/enums? i.e. True/False
if len(line.split(" ")) >= 3:
return None
env = shell.plugins[shell.state]
options = [x.name + " " for x in env.options... | description = 'sets a variable for the current module'
def autocomplete(shell, line, text, state):
if len(line.split(' ')) >= 3:
return None
env = shell.plugins[shell.state]
options = [x.name + ' ' for x in env.options.options if x.name.upper().startswith(text.upper()) and (not x.hidden)]
optio... |
class When_we_have_a_test:
def when_things_happen(self):
pass
def it_should_do_this_test(self):
assert 1 == 1
def test_we_still_run_regular_pytest_scripts():
assert 2 == 2
| class When_We_Have_A_Test:
def when_things_happen(self):
pass
def it_should_do_this_test(self):
assert 1 == 1
def test_we_still_run_regular_pytest_scripts():
assert 2 == 2 |
######################## Errors ##########################
PAYLOAD_NOT_FOUND_ERROR = 'Payload can not be found.'
KEYWORD_NOT_FOUND_ERROR = "Keywords can to be empty."
TYPE_NOT_CORRECT_ERROR = 'Payload type is incorrect, please upload text.'
MODEL_NOT_FOUND_ERROR = 'The ML model not found. (default name: en_core_web_sm)... | payload_not_found_error = 'Payload can not be found.'
keyword_not_found_error = 'Keywords can to be empty.'
type_not_correct_error = 'Payload type is incorrect, please upload text.'
model_not_found_error = 'The ML model not found. (default name: en_core_web_sm)'
data_model_error = 'Data model, text or source ML model h... |
class Solution:
def findLengthOfLCIS(self, nums: List[int]) -> int:
if not nums:
return 0
dp = [1] * len(nums)
if len(nums) < 2:
return 1
result = 1
for i in range(1, len(nums)):
if nums[i] > nums[i - 1]:
dp[i] = dp... | class Solution:
def find_length_of_lcis(self, nums: List[int]) -> int:
if not nums:
return 0
dp = [1] * len(nums)
if len(nums) < 2:
return 1
result = 1
for i in range(1, len(nums)):
if nums[i] > nums[i - 1]:
dp[i] = dp[i - ... |
class Symbol:
key = '#'
author = '@'
goto = '>'
condition = '?'
action = '!'
comment = '%'
left = '{'
right = '}'
def prefixcount(string, prefix):
i = 0
while string[i] == prefix:
i += 1
return i
def extract(string, startsymbol, endsymbol):
if not startsymbol in string and endsymbol in string:
return... | class Symbol:
key = '#'
author = '@'
goto = '>'
condition = '?'
action = '!'
comment = '%'
left = '{'
right = '}'
def prefixcount(string, prefix):
i = 0
while string[i] == prefix:
i += 1
return i
def extract(string, startsymbol, endsymbol):
if not startsymbol in... |
#value=input().split()
#B,G=value
#B=int(B) #B=ball
#G=int(G) #G=need
B=int(input())
G=int(input())
result = G//2
also_need=result-B
if (result<=B):
print("Amelia tem todas bolinhas!")
else:
print("Faltam",also_need,"bolinha(s)") | b = int(input())
g = int(input())
result = G // 2
also_need = result - B
if result <= B:
print('Amelia tem todas bolinhas!')
else:
print('Faltam', also_need, 'bolinha(s)') |
def GenerateCombination(N, ObjectNumber):
# initiate the object B and C positions
# Get all permutations of length 2
combinlist = []
for i in range(N):
if i < N-1:
j = i + 1
else:
j = 0
combin = [ObjectNumber, i, j]
combinlist.append(combin)
r... | def generate_combination(N, ObjectNumber):
combinlist = []
for i in range(N):
if i < N - 1:
j = i + 1
else:
j = 0
combin = [ObjectNumber, i, j]
combinlist.append(combin)
return combinlist |
class OTBDeepConfig:
fhog_params = {'fname': 'fhog',
'num_orients': 9,
'cell_size': 4,
'compressed_dim': 10,
# 'nDim': 9 * 3 + 5 -1
}
#cn_params = {"fname": 'cn',
# "table_name": "CNnorm",
... | class Otbdeepconfig:
fhog_params = {'fname': 'fhog', 'num_orients': 9, 'cell_size': 4, 'compressed_dim': 10}
cnn_params = {'fname': 'cnn-resnet50', 'compressed_dim': [16, 64]}
features = [fhog_params, cnn_params]
normalize_power = 2
normalize_size = True
normalize_dim = True
square_root_norm... |
DECOY_PREFIX = 'decoy_'
HEADER_SPECFILE = '#SpecFile'
HEADER_SCANNR = 'ScanNum'
HEADER_SPECSCANID = 'SpecID'
HEADER_CHARGE = 'Charge'
HEADER_PEPTIDE = 'Peptide'
HEADER_PROTEIN = 'Protein'
HEADER_GENE = 'Gene ID'
HEADER_SYMBOL = 'Gene Name'
HEADER_DESCRIPTION = 'Description'
HEADER_PRECURSOR_MZ = 'Precursor'
HEADER_PRE... | decoy_prefix = 'decoy_'
header_specfile = '#SpecFile'
header_scannr = 'ScanNum'
header_specscanid = 'SpecID'
header_charge = 'Charge'
header_peptide = 'Peptide'
header_protein = 'Protein'
header_gene = 'Gene ID'
header_symbol = 'Gene Name'
header_description = 'Description'
header_precursor_mz = 'Precursor'
header_prec... |
# The path to the ROM file to load:
# SpaceInvaders starts to render visible pixels when
# the cpu halfClkCount reaches about 11000
#romFile = 'roms/SpaceInvaders.bin'
#romFile = 'roms/Pitfall.bin'
romFile = 'roms/DonkeyKong.bin'
# 8kb ROM, spins reading 0x282 switches
#romFile = 'roms/Asteroids.bin'
# 2kb ROM
#... | rom_file = 'roms/DonkeyKong.bin'
image_output_dir = 'outFrames'
chip6502_file = 'chips/net_6502.pkl'
chip_tia_file = 'chips/net_TIA.pkl'
num_tia_half_clocks_per_render = 128
mos6502_wire_init = [['A', 737, 1234, 978, 162, 727, 858, 1136, 1653], ['X', 1216, 98, 1, 1648, 85, 589, 448, 777], ['Y', 64, 1148, 573, 305, 989,... |
class RegionModel:
def __init__(self, dbRow):
self.ID = dbRow["ID"]
self.RegionName = dbRow["RegionName"]
self.RegionCode = dbRow["RegionCode"]
self.RegionChat = dbRow["RegionChat"] | class Regionmodel:
def __init__(self, dbRow):
self.ID = dbRow['ID']
self.RegionName = dbRow['RegionName']
self.RegionCode = dbRow['RegionCode']
self.RegionChat = dbRow['RegionChat'] |
def primera_letra(lista_de_palabras):
primeras_letras = []
for palabra in lista_de_palabras:
assert type(palabra) == str, f'{palabra} no es str'
assert len(palabra) > 0, 'No se permiten str vacios'
primeras_letras.append(palabra[0])
return primeras_letras | def primera_letra(lista_de_palabras):
primeras_letras = []
for palabra in lista_de_palabras:
assert type(palabra) == str, f'{palabra} no es str'
assert len(palabra) > 0, 'No se permiten str vacios'
primeras_letras.append(palabra[0])
return primeras_letras |
load("@bazel_skylib//lib:paths.bzl", "paths")
load(":common.bzl", "declare_caches", "write_cache_manifest")
load("//dotnet/private:context.bzl", "dotnet_exec_context", "make_builder_cmd")
load("//dotnet/private:providers.bzl", "DotnetPublishInfo")
def pack(ctx):
info = ctx.attr.target[DotnetPublishInfo]
restor... | load('@bazel_skylib//lib:paths.bzl', 'paths')
load(':common.bzl', 'declare_caches', 'write_cache_manifest')
load('//dotnet/private:context.bzl', 'dotnet_exec_context', 'make_builder_cmd')
load('//dotnet/private:providers.bzl', 'DotnetPublishInfo')
def pack(ctx):
info = ctx.attr.target[DotnetPublishInfo]
restor... |
#===============================================================
# DMXIS Macro (c) 2010 db audioware limited
#===============================================================
RgbColour(255,127,80)
| rgb_colour(255, 127, 80) |
def remote_pip_install_simple(name, silent):
return remote_pip_install(name, True, 'python3', 'pip3', silent)
def remote_pip_install(name, usermode, py, pip, silent):
return lib_install(name, usermode=usermode, py=py, pip=pip, silent=silent)
| def remote_pip_install_simple(name, silent):
return remote_pip_install(name, True, 'python3', 'pip3', silent)
def remote_pip_install(name, usermode, py, pip, silent):
return lib_install(name, usermode=usermode, py=py, pip=pip, silent=silent) |
def pytest_addoption(parser):
selenium_class_names = ("Android", "Chrome", "Firefox", "Ie", "Opera", "PhantomJS", "Remote", "Safari")
parser.addoption("--webdriver", action="store", choices=selenium_class_names,
default="PhantomJS",
help="Selenium WebDriver interface t... | def pytest_addoption(parser):
selenium_class_names = ('Android', 'Chrome', 'Firefox', 'Ie', 'Opera', 'PhantomJS', 'Remote', 'Safari')
parser.addoption('--webdriver', action='store', choices=selenium_class_names, default='PhantomJS', help='Selenium WebDriver interface to use for running the test. Default: Phanto... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Simone Persiani <iosonopersia@gmail.com>
#
# Permission to use, copy, modify, and/or 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 copie... | meta_csv_output_dir = '<path>/meta_folder/csv_output/'
citations_csv_dir = '<path>/converter_folder/citations/'
converter_citations_csv_output_dir = '<path>/citations_folder/csv_output/'
converter_citations_rdf_output_dir = '<path>/citations_folder/rdf_output/'
base_iri = 'https://w3id.org/oc/meta/'
triplestore_url = '... |
dpi = 400
dpcm = dpi / 2.54
INFTY = float('inf')
PAPER = {
'letter': {
'qr_left': (0.0, 0.882, 0.152, 1.0),
'qr_right': (0.848, 0.882, 1.0, 1.0),
'tick': (0.17, 0.88, 0.91, 1.0),
'uin': (0.49, 0.11, 0.964, 0.54)
}
}
| dpi = 400
dpcm = dpi / 2.54
infty = float('inf')
paper = {'letter': {'qr_left': (0.0, 0.882, 0.152, 1.0), 'qr_right': (0.848, 0.882, 1.0, 1.0), 'tick': (0.17, 0.88, 0.91, 1.0), 'uin': (0.49, 0.11, 0.964, 0.54)}} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.