content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def search(list, platform):
for i in range(len(list)):
if list[i] == platform:
return True
return False
fruit = ['banana', 'grape', 'apple', 'plam']
print(fruit)
frut = input('input to see if it exists: ')
if search(fruit, frut):
print("fruit is found")
else:
print("fruiit does no... | def search(list, platform):
for i in range(len(list)):
if list[i] == platform:
return True
return False
fruit = ['banana', 'grape', 'apple', 'plam']
print(fruit)
frut = input('input to see if it exists: ')
if search(fruit, frut):
print('fruit is found')
else:
print('fruiit does not f... |
# -*- coding: utf-8 -*-
def theaudiodb_albumdetails(data):
if data.get('album'):
item = data['album'][0]
albumdata = {}
albumdata['album'] = item['strAlbum']
if item.get('intYearReleased',''):
albumdata['year'] = item['intYearReleased']
if item.get('strStyle','')... | def theaudiodb_albumdetails(data):
if data.get('album'):
item = data['album'][0]
albumdata = {}
albumdata['album'] = item['strAlbum']
if item.get('intYearReleased', ''):
albumdata['year'] = item['intYearReleased']
if item.get('strStyle', ''):
albumdata... |
class State:
state = {}
@staticmethod
def init():
State.state = {
"lowres_frames": None,
"highres_frames": None,
"photopath": "",
"frame": 0,
"current_photo": None,
"share_code": "",
"preview_image_width": 0,
... | class State:
state = {}
@staticmethod
def init():
State.state = {'lowres_frames': None, 'highres_frames': None, 'photopath': '', 'frame': 0, 'current_photo': None, 'share_code': '', 'preview_image_width': 0, 'photo_countdown': 0, 'reset_time': 0, 'upload_url': '', 'photo_url': '', 'api_key': ''}
... |
expected_output = {
'tracker_name': {
'tcp-10001': {
'status': 'UP',
'rtt_in_msec': 2,
'probe_id': 2
},
'udp-10001': {
'status': 'UP',
'rtt_in_msec': 1,
'probe_id': 3
}
}
}
| expected_output = {'tracker_name': {'tcp-10001': {'status': 'UP', 'rtt_in_msec': 2, 'probe_id': 2}, 'udp-10001': {'status': 'UP', 'rtt_in_msec': 1, 'probe_id': 3}}} |
def is_funny(string):
data = list(zip(string, reversed(string)))
for i in range(len(string)-1):
if abs(ord(data[i+1][0]) - ord(data[i][0])) != \
abs(ord(data[i+1][1]) - ord(data[i][1])):
return "Not Funny"
return "Funny"
N = int(input())
for i in range(N):
print(is_fu... | def is_funny(string):
data = list(zip(string, reversed(string)))
for i in range(len(string) - 1):
if abs(ord(data[i + 1][0]) - ord(data[i][0])) != abs(ord(data[i + 1][1]) - ord(data[i][1])):
return 'Not Funny'
return 'Funny'
n = int(input())
for i in range(N):
print(is_funny(inpu... |
#!/usr/bin/env python
def mtx_pivot(mtx) -> list:
piv=[]
pivr=[[] for c in mtx[0]]
for r,row in enumerate(mtx):
for c,col in enumerate(row):
pivr[c]+=[col]
piv+=pivr
return piv | def mtx_pivot(mtx) -> list:
piv = []
pivr = [[] for c in mtx[0]]
for (r, row) in enumerate(mtx):
for (c, col) in enumerate(row):
pivr[c] += [col]
piv += pivr
return piv |
def add_native_methods(clazz):
def floatToRawIntBits__float__(a0):
raise NotImplementedError()
def intBitsToFloat__int__(a0):
raise NotImplementedError()
clazz.floatToRawIntBits__float__ = staticmethod(floatToRawIntBits__float__)
clazz.intBitsToFloat__int__ = staticmethod(intBitsToFloa... | def add_native_methods(clazz):
def float_to_raw_int_bits__float__(a0):
raise not_implemented_error()
def int_bits_to_float__int__(a0):
raise not_implemented_error()
clazz.floatToRawIntBits__float__ = staticmethod(floatToRawIntBits__float__)
clazz.intBitsToFloat__int__ = staticmethod(in... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 04_device.ipynb (unless otherwise specified).
__all__ = ['versions']
# Cell
def versions():
"Checks if GPU enabled and if so displays device details with cuda, pytorch, fastai versions"
print("GPU: ", torch.cuda.is_available())
if torch.cuda.is_available() == True:
... | __all__ = ['versions']
def versions():
"""Checks if GPU enabled and if so displays device details with cuda, pytorch, fastai versions"""
print('GPU: ', torch.cuda.is_available())
if torch.cuda.is_available() == True:
print('Device = ', torch.device(torch.cuda.current_device()))
print('Cuda ... |
class PDB_container:
'''
Use to read a pdb file from a cocrystal structure and parse
it for further use
Note this class cannot write any files and we do not want any
files to be added by this class
This is good for IO management although the code might be hard to
understand
'''
... | class Pdb_Container:
"""
Use to read a pdb file from a cocrystal structure and parse
it for further use
Note this class cannot write any files and we do not want any
files to be added by this class
This is good for IO management although the code might be hard to
understand
"""
... |
def method():
if True:
return 1
else:
return 2
def method2():
x = 2
if x:
y = 3
z = 1
| def method():
if True:
return 1
else:
return 2
def method2():
x = 2
if x:
y = 3
z = 1 |
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General P... | name = 'SINQ Double Monochromator'
includes = ['stdsystem']
description = 'Test setup for the SINQ double monochromator'
devices = dict(mth1=device('nicos.devices.generic.VirtualMotor', unit='degree', description='First blade rotation', abslimits=(-180, 180), precision=0.01), mth2=device('nicos.devices.generic.VirtualM... |
class Fluorescence:
def __init__(self, user_input, input_ceon):
self.user_input = user_input
self.input_ceons = [input_ceon]
self.number_trajectories = user_input.n_snapshots_ex
self.child_root = 'nasqm_fluorescence_'
self.job_suffix = 'fluorescence'
self.parent_rest... | class Fluorescence:
def __init__(self, user_input, input_ceon):
self.user_input = user_input
self.input_ceons = [input_ceon]
self.number_trajectories = user_input.n_snapshots_ex
self.child_root = 'nasqm_fluorescence_'
self.job_suffix = 'fluorescence'
self.parent_rest... |
#
# PySNMP MIB module COMPANY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/COMPANY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:26:32 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, 0... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
input_tokenizer = {}
input_tokenizer['en-bg'] = '-l en -a'
input_tokenizer['en-cs'] = '-l en -a'
input_tokenizer['en-de'] = '-l en -a'
input_tokenizer['en-el'] = '-l en -a'
input_tokenizer['en-hr'] = '-l en -a'
input_tokenizer['en-it'] = '-l en -a'
input_tokenizer['en-nl'] = '-l en -a'
input_tokenizer['en-pl'] = '-l en... | input_tokenizer = {}
input_tokenizer['en-bg'] = '-l en -a'
input_tokenizer['en-cs'] = '-l en -a'
input_tokenizer['en-de'] = '-l en -a'
input_tokenizer['en-el'] = '-l en -a'
input_tokenizer['en-hr'] = '-l en -a'
input_tokenizer['en-it'] = '-l en -a'
input_tokenizer['en-nl'] = '-l en -a'
input_tokenizer['en-pl'] = '-l en... |
#Task No. 3
def FindPath(graph,start,end,path=[]):
path = path + [start];
if (start == end):
return path
if (start not in graph):
return None
for node in graph[start]:
if node not in path:
path = FindPath(graph,node,end,path)
if path:
... | def find_path(graph, start, end, path=[]):
path = path + [start]
if start == end:
return path
if start not in graph:
return None
for node in graph[start]:
if node not in path:
path = find_path(graph, node, end, path)
if path:
return path
return... |
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
class linkedList:
def __init__(self):
self.head=None
self.tail=None
def __iter__ (self):
curNode = self.head
while curNode:
yield curNode
curN... | class Node:
def __init__(self, value=None):
self.value = value
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
self.tail = None
def __iter__(self):
cur_node = self.head
while curNode:
yield curNode
cur_node =... |
#!/usr/bin/python
def is_member(item_to_check, list_to_check):
'''
Checks if an item is in a list
'''
for list_item in list_to_check:
if item_to_check == list_item:
return(True)
return(False)
| def is_member(item_to_check, list_to_check):
"""
Checks if an item is in a list
"""
for list_item in list_to_check:
if item_to_check == list_item:
return True
return False |
def includeme(config):
# config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('hitori_boards', r'/hitori_boards')
config.add_route('hitori_board', r'/hitori_boards/{board_id:\d+}')
config.add_route('hitori_board_solve', r'/hitori_boards/{boar... | def includeme(config):
config.add_route('home', '/')
config.add_route('hitori_boards', '/hitori_boards')
config.add_route('hitori_board', '/hitori_boards/{board_id:\\d+}')
config.add_route('hitori_board_solve', '/hitori_boards/{board_id:\\d+}/solve')
config.add_route('hitori_board_clone', '/hitori_b... |
vetor = []
i = 1
while(i <= 100):
valor = int(input())
vetor.append(valor)
i = i + 1
print(max(vetor))
print(vetor.index(max(vetor)) + 1) | vetor = []
i = 1
while i <= 100:
valor = int(input())
vetor.append(valor)
i = i + 1
print(max(vetor))
print(vetor.index(max(vetor)) + 1) |
class BasePairType:
def __init__( self, nt1, nt2, Kd, match_lowercase = False ):
'''
Two sequence characters that get matched to base pair, e.g., 'C' and 'G';
and the dissociation constant K_d (in M) associated with initial pair formation.
match_lowercase means match 'x' to 'x', '... | class Basepairtype:
def __init__(self, nt1, nt2, Kd, match_lowercase=False):
"""
Two sequence characters that get matched to base pair, e.g., 'C' and 'G';
and the dissociation constant K_d (in M) associated with initial pair formation.
match_lowercase means match 'x' to 'x', 'y' ... |
#lista de cores para menu:
#cor da letra
limpa = '\033[m'
Lbranco = '\033[30m'
Lvermelho = '\033[31m'
Lverde = '\033[32m'
Lamarelo = '\033[33m'
Lazul = '\033[34m'
Lroxo = '\033[35m'
Lazulclaro = '\033[36'
Lcinza = '\033[37'
#Fundo
Fbranco = '\033[40m'
Fvermelho = '\033[41m'
Fverde = '\033[42m'
Famarelo = '\033[43m'
F... | limpa = '\x1b[m'
lbranco = '\x1b[30m'
lvermelho = '\x1b[31m'
lverde = '\x1b[32m'
lamarelo = '\x1b[33m'
lazul = '\x1b[34m'
lroxo = '\x1b[35m'
lazulclaro = '\x1b[36'
lcinza = '\x1b[37'
fbranco = '\x1b[40m'
fvermelho = '\x1b[41m'
fverde = '\x1b[42m'
famarelo = '\x1b[43m'
fazul = '\x1b[44m'
froxo = '\x1b[45m'
fazulclaro = ... |
def get_user_id(user_or_id):
if type(user_or_id) is str or type(user_or_id) is int:
return str(user_or_id)
elif hasattr(user_or_id, '__getitem__') and 'user_id' in user_or_id:
return str(user_or_id['user_id'])
elif hasattr(user_or_id, 'user_id'):
return str(user_or_id.user_id)
re... | def get_user_id(user_or_id):
if type(user_or_id) is str or type(user_or_id) is int:
return str(user_or_id)
elif hasattr(user_or_id, '__getitem__') and 'user_id' in user_or_id:
return str(user_or_id['user_id'])
elif hasattr(user_or_id, 'user_id'):
return str(user_or_id.user_id)
re... |
#
# PySNMP MIB module PROXY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PROXY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:33:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
def removcaract(cnpj):
documento = []
for x in cnpj:
if x.isnumeric():
documento.append(x)
documento = ''.join(documento)
return documento
| def removcaract(cnpj):
documento = []
for x in cnpj:
if x.isnumeric():
documento.append(x)
documento = ''.join(documento)
return documento |
class Solution:
def smallestDivisor(self, nums: List[int], threshold: int) -> int:
def condition(divisor) -> bool:
return sum((num - 1) // divisor + 1 for num in nums) <= threshold
lo, hi = 1, max(nums)
while lo < hi:
mid = lo + (hi - lo) // 2
if... | class Solution:
def smallest_divisor(self, nums: List[int], threshold: int) -> int:
def condition(divisor) -> bool:
return sum(((num - 1) // divisor + 1 for num in nums)) <= threshold
(lo, hi) = (1, max(nums))
while lo < hi:
mid = lo + (hi - lo) // 2
if ... |
def parse_eval_info(cur_eval_video_info):
length_eval_info = len(cur_eval_video_info)
cur_epoch = int(cur_eval_video_info[0].split(' ')[2].split('-')[1])
cur_video_auc = float(cur_eval_video_info[-1].split(' ')[-3].split('-')[1].split(',')[0])
return cur_epoch, cur_video_auc
file = '/home/mry/Desktop... | def parse_eval_info(cur_eval_video_info):
length_eval_info = len(cur_eval_video_info)
cur_epoch = int(cur_eval_video_info[0].split(' ')[2].split('-')[1])
cur_video_auc = float(cur_eval_video_info[-1].split(' ')[-3].split('-')[1].split(',')[0])
return (cur_epoch, cur_video_auc)
file = '/home/mry/Desktop/... |
class ExitMixin():
def do_exit(self, _):
'''
Exit the shell.
'''
print(self._exit_msg)
return True
def do_EOF(self, params):
print()
return self.do_exit(params)
| class Exitmixin:
def do_exit(self, _):
"""
Exit the shell.
"""
print(self._exit_msg)
return True
def do_eof(self, params):
print()
return self.do_exit(params) |
class Solution:
def calculateSum(self, N, A, B):
A_count = N//A
B_count = N//B
result = A*A_count*(1+A_count)//2 + B*B_count*(1+B_count)//2
a = min(A,B)
b = max(A,B)
while a > 0:
b, a= a, b%a
lcm = (A*B)//b
AB_count = (N - N%lcm)//lc... | class Solution:
def calculate_sum(self, N, A, B):
a_count = N // A
b_count = N // B
result = A * A_count * (1 + A_count) // 2 + B * B_count * (1 + B_count) // 2
a = min(A, B)
b = max(A, B)
while a > 0:
(b, a) = (a, b % a)
lcm = A * B // b
... |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Children, obj[8]: Education, obj[9]: Occupation, obj[10]: Income, obj[11]: Bar, obj[12]: Coffeehouse, obj[13]: Restaurant20to50, obj[14]: Direction_same, obj[15]: Dista... | def find_decision(obj):
if obj[8] <= 2:
if obj[6] <= 5:
if obj[0] <= 2:
if obj[9] <= 17:
if obj[11] <= 3.0:
if obj[2] <= 3:
if obj[4] <= 0:
if obj[3] <= 2:
... |
class Cup:
def __init__(self,size,quantity):
self.size = size
self.quantity = quantity
def status(self):
return self.size-self.quantity
def fill(self, quantity):
if self.quantity<=self.status():
self.quantity+=quantity
cup = Cup(100, 50)
print(cup.status())
... | class Cup:
def __init__(self, size, quantity):
self.size = size
self.quantity = quantity
def status(self):
return self.size - self.quantity
def fill(self, quantity):
if self.quantity <= self.status():
self.quantity += quantity
cup = cup(100, 50)
print(cup.statu... |
class BinaryConfusionMatrix:
def __init__(self, pos_tag="SPAM", neg_tag="OK"):
self.pos_tag = pos_tag
self.neg_tag = neg_tag
self.tp = 0
self.tn = 0
self.fp = 0
self.fn = 0
def as_dict(self):
return {"tp": self.tp, "tn": self.tn, "fp": self.fp, "fn": self... | class Binaryconfusionmatrix:
def __init__(self, pos_tag='SPAM', neg_tag='OK'):
self.pos_tag = pos_tag
self.neg_tag = neg_tag
self.tp = 0
self.tn = 0
self.fp = 0
self.fn = 0
def as_dict(self):
return {'tp': self.tp, 'tn': self.tn, 'fp': self.fp, 'fn': sel... |
def karp_rabin(text, word, n, m):
MOD = 257
A = random.randint(2, MOD - 1)
Am = pow(A, m, MOD)
def generate(t):
return sum(ord(c) * pow(A, i, MOD) for i, c in enumerate(t[::-1])) % MOD
text += '$'
hash_text, hash_word = generate(text[1:m + 1]), generate(word[1:])
for i in range(1, n - m + 2):
if h... | def karp_rabin(text, word, n, m):
mod = 257
a = random.randint(2, MOD - 1)
am = pow(A, m, MOD)
def generate(t):
return sum((ord(c) * pow(A, i, MOD) for (i, c) in enumerate(t[::-1]))) % MOD
text += '$'
(hash_text, hash_word) = (generate(text[1:m + 1]), generate(word[1:]))
for i in ra... |
n = 1000000
# n = 100
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
primes = []
for i in range(2,n+1):
if prime[i]:
primes.append(i)
count = 0
ans = 0
for index,elem in enumerate(prime... | n = 1000000
prime = [True for i in range(n + 1)]
p = 2
while p * p <= n:
if prime[p] == True:
for i in range(p * p, n + 1, p):
prime[i] = False
p += 1
primes = []
for i in range(2, n + 1):
if prime[i]:
primes.append(i)
count = 0
ans = 0
for (index, elem) in enumerate(primes):
... |
STARLARK_BINARY_PATH = {
"java": "external/io_bazel/src/main/java/net/starlark/java/cmd/Starlark",
"go": "external/net_starlark_go/cmd/starlark/*/starlark",
"rust": "external/starlark-rust/target/debug/starlark-repl",
}
STARLARK_TESTDATA_PATH = "test_suite/"
| starlark_binary_path = {'java': 'external/io_bazel/src/main/java/net/starlark/java/cmd/Starlark', 'go': 'external/net_starlark_go/cmd/starlark/*/starlark', 'rust': 'external/starlark-rust/target/debug/starlark-repl'}
starlark_testdata_path = 'test_suite/' |
#
# @lc app=leetcode id=868 lang=python3
#
# [868] Binary Gap
#
# @lc code=start
class Solution:
def binaryGap(self, N: int) -> int:
s = bin(N)
res = 0
i = float('inf')
for j, n in enumerate(s[2:]):
if n == '1':
res = max(res, j - i)
i = j... | class Solution:
def binary_gap(self, N: int) -> int:
s = bin(N)
res = 0
i = float('inf')
for (j, n) in enumerate(s[2:]):
if n == '1':
res = max(res, j - i)
i = j
return res |
class Solution:
def convertToBase7(self, num: int) -> str:
result = ''
n = abs(num)
while n:
n, curr = divmod(n, 7)
result = str(curr) + result
return '-' * (num < 0) + result or '0'
| class Solution:
def convert_to_base7(self, num: int) -> str:
result = ''
n = abs(num)
while n:
(n, curr) = divmod(n, 7)
result = str(curr) + result
return '-' * (num < 0) + result or '0' |
start = int(input())
stop = int(input())
result = ""
for number in range(start, stop + 1):
print(chr(number), end=" ")
| start = int(input())
stop = int(input())
result = ''
for number in range(start, stop + 1):
print(chr(number), end=' ') |
H, W = map(int, input().split())
field = [[str(i) for i in input()] for _ in range(H)]
count = 0
for x in range(W-1):
for y in range(H-1):
black_num = 0
for x1, y1 in [(x, y), (x+1, y), (x, y+1), (x+1, y+1)]:
if field[y1][x1] == '#':
black_num += 1
if black_num % ... | (h, w) = map(int, input().split())
field = [[str(i) for i in input()] for _ in range(H)]
count = 0
for x in range(W - 1):
for y in range(H - 1):
black_num = 0
for (x1, y1) in [(x, y), (x + 1, y), (x, y + 1), (x + 1, y + 1)]:
if field[y1][x1] == '#':
black_num += 1
... |
GET_REPOS = [
{
'name': 'sample_repo',
'nameWithOwner': 'example_org/sample_repo',
'primaryLanguage': {
'name': 'Python',
},
'url': 'https://github.com/example_org/sample_repo',
'sshUrl': 'git@github.com:example_org/sample_repo.git',
'createdAt': '... | get_repos = [{'name': 'sample_repo', 'nameWithOwner': 'example_org/sample_repo', 'primaryLanguage': {'name': 'Python'}, 'url': 'https://github.com/example_org/sample_repo', 'sshUrl': 'git@github.com:example_org/sample_repo.git', 'createdAt': '2011-02-15T18:40:15Z', 'description': 'My description', 'updatedAt': '2020-01... |
class Node():
def __init__(self, valor):
self.valor = valor
self.next = None
class Stack:
def __init__(self):
self.head = Node("head")
self.size = 0
def __str__(self):
actual = self.head.next
str1 = "["
while actual:
str1 += str(actual.valor) + ", "
actual = actual.next
s... | class Node:
def __init__(self, valor):
self.valor = valor
self.next = None
class Stack:
def __init__(self):
self.head = node('head')
self.size = 0
def __str__(self):
actual = self.head.next
str1 = '['
while actual:
str1 += str(actual.va... |
# Databricks notebook source
# MAGIC %run ./includes/utils
# COMMAND ----------
mountDataLake(clientId="64492359-3450-4f1e-be01-8717789fd01e",
clientSecret=dbutils.secrets.get(scope="dpdatalake",key="adappsecret"),
tokenEndPoint="https://login.microsoftonline.com/0b55e01a-573a-4060-b656-d... | mount_data_lake(clientId='64492359-3450-4f1e-be01-8717789fd01e', clientSecret=dbutils.secrets.get(scope='dpdatalake', key='adappsecret'), tokenEndPoint='https://login.microsoftonline.com/0b55e01a-573a-4060-b656-d1a3d5815791/oauth2/token', storageAccountName='dpdatalake', containerName='data') |
class Artist:
def __init__(self, artist_id, uri, title):
self.id = artist_id
self.uri = uri
self.title = title
def __str__(self):
return '{} (id={})'.format(self.title, self.id)
def to_tuple(self):
return (self.id, self.uri, self.title)
| class Artist:
def __init__(self, artist_id, uri, title):
self.id = artist_id
self.uri = uri
self.title = title
def __str__(self):
return '{} (id={})'.format(self.title, self.id)
def to_tuple(self):
return (self.id, self.uri, self.title) |
description = 'Actuators and feedback of the shutter, detector, and valves'
group = 'lowlevel'
excludes = ['IOcard']
devices = dict(
I1_pnCCD_Active = device('nicos.devices.generic.ManualSwitch',
description = 'high: Detector is turned on',
states = [0, 1],
),
I2_Shutter_safe = device('ni... | description = 'Actuators and feedback of the shutter, detector, and valves'
group = 'lowlevel'
excludes = ['IOcard']
devices = dict(I1_pnCCD_Active=device('nicos.devices.generic.ManualSwitch', description='high: Detector is turned on', states=[0, 1]), I2_Shutter_safe=device('nicos.devices.generic.ManualSwitch', descrip... |
def multiple_of(num, multiple):
return num % multiple == 0
def sum_of_multiples(limit):
return sum(x for x in range(limit) if multiple_of(x, 3) or multiple_of(x, 5))
if __name__ == "__main__":
print(sum_of_multiples(1000)) | def multiple_of(num, multiple):
return num % multiple == 0
def sum_of_multiples(limit):
return sum((x for x in range(limit) if multiple_of(x, 3) or multiple_of(x, 5)))
if __name__ == '__main__':
print(sum_of_multiples(1000)) |
# nobully.py
# Metadata
NAME = 'nobully'
ENABLE = True
PATTERN = r'^!nobully (?P<nick>[^\s]+)'
USAGE = '''Usage: !nobully <nick>
This informs the user identified by nick that they should no longer bully other (innocent) users.
'''
# Constants
NOBULLY_URL = 'https://www.stop-irc-bullying.info/'
# Command
asy... | name = 'nobully'
enable = True
pattern = '^!nobully (?P<nick>[^\\s]+)'
usage = 'Usage: !nobully <nick>\nThis informs the user identified by nick that they should no longer bully other (innocent) users.\n'
nobully_url = 'https://www.stop-irc-bullying.info/'
async def nobully(bot, message, nick):
if nick not in bot.... |
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | ns = {'d': 'http://maven.apache.org/POM/4.0.0'}
zip_file_extension = '.zip'
carbon_name = 'carbon.zip'
value_tag = '{http://maven.apache.org/POM/4.0.0}value'
surface_plugin_artifact_id = 'maven-surefire-plugin'
datasource_paths = {'product-iots': {'CORE': ['conf/datasources/master-datasources.xml', 'conf/datasources/cd... |
name = "Angela"
letters_list = [x for x in name]
print(letters_list)
doubled = [x * 2 for x in range(1, 5)]
print(doubled)
maybe_tripled = [x * 3 for x in range(1, 10) if x > 5]
print(maybe_tripled)
def foo(value):
if value > 5:
return True
return False
with_fn = [x * 3 for x in range(1, 10) if fo... | name = 'Angela'
letters_list = [x for x in name]
print(letters_list)
doubled = [x * 2 for x in range(1, 5)]
print(doubled)
maybe_tripled = [x * 3 for x in range(1, 10) if x > 5]
print(maybe_tripled)
def foo(value):
if value > 5:
return True
return False
with_fn = [x * 3 for x in range(1, 10) if foo(x)]... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseBetween(self, head: ListNode, left: int, right: int) -> ListNode:
left -= 1
right -= 1
newHead = ListNode(-1)
... | class Solution:
def reverse_between(self, head: ListNode, left: int, right: int) -> ListNode:
left -= 1
right -= 1
new_head = list_node(-1)
newHead.next = head
deque = collections.deque()
current = newHead.next
for index in range(right + 1):
if le... |
# entrada 3 float
A = float(input())
B = float(input())
C = float(input())
# variaveis (pesos)
P1 = 2
P2 = 3
P3 = 5
# calculo da media
MEDIA = ((A * P1) + (B*P2) + (C*P3)) / (P1+P2+P3)
print('MEDIA = {:.1f}'.format(MEDIA))
| a = float(input())
b = float(input())
c = float(input())
p1 = 2
p2 = 3
p3 = 5
media = (A * P1 + B * P2 + C * P3) / (P1 + P2 + P3)
print('MEDIA = {:.1f}'.format(MEDIA)) |
def get_CUDA(vectorSize = 10, func = "sin(2*pi*X/Lx)", px = "0.", py = "0.", pz = "0.", **kwargs):
return '''__global__ void initialize(dcmplx *QField, int* lattice, int* gpu_params){
int deviceNum = gpu_params[0];
int numGPUs = gpu_params[2];
int xSize = lattice[0]*numGPUs;
int ySize = lattice[2];
int zSize = l... | def get_cuda(vectorSize=10, func='sin(2*pi*X/Lx)', px='0.', py='0.', pz='0.', **kwargs):
return '__global__ void initialize(dcmplx *QField, int* lattice, int* gpu_params){\n\tint deviceNum = gpu_params[0];\n\tint numGPUs = gpu_params[2];\n\tint xSize = lattice[0]*numGPUs;\n\tint ySize = lattice[2];\n\tint zSize = l... |
answer1 = widget_inputs["radio1"]
answer2 = widget_inputs["radio2"]
answer3 = widget_inputs["radio3"]
answer4 = widget_inputs["radio4"]
is_correct = False
comments = []
def commentizer(new):
if new not in comments:
comments.append(new)
if answer2 == True:
is_correct = True
else:
is_correct = is_c... | answer1 = widget_inputs['radio1']
answer2 = widget_inputs['radio2']
answer3 = widget_inputs['radio3']
answer4 = widget_inputs['radio4']
is_correct = False
comments = []
def commentizer(new):
if new not in comments:
comments.append(new)
if answer2 == True:
is_correct = True
else:
is_correct = is_cor... |
#
# Copyright (c) 2016, Prometheus Research, LLC
#
__import__('pkg_resources').declare_namespace(__name__)
| __import__('pkg_resources').declare_namespace(__name__) |
#task1: print the \\ double backslash
print("This is \\\\ double backslash")
#task2: print the mountains
print ("this is /\\/\\/\\/\\/\\ mountain")
#task3:he is awesome(using escape sequence)
print ("he is \t awesome")
#task4: \" \n \t \'
print ("\\\" \\n \\t \\\'") | print('This is \\\\ double backslash')
print('this is /\\/\\/\\/\\/\\ mountain')
print('he is \t awesome')
print('\\" \\n \\t \\\'') |
class TaskError(Exception):
pass
class StrategyError(Exception):
pass
| class Taskerror(Exception):
pass
class Strategyerror(Exception):
pass |
class Controller:
def __init__(self, period, init_cores, st=0.8):
self.period = period
self.init_cores = init_cores
self.st = st
self.name = type(self).__name__
def setName(self, name):
self.name = name
def setSLA(self, sla):
self.sla = sla
self.setp... | class Controller:
def __init__(self, period, init_cores, st=0.8):
self.period = period
self.init_cores = init_cores
self.st = st
self.name = type(self).__name__
def set_name(self, name):
self.name = name
def set_sla(self, sla):
self.sla = sla
self.s... |
# ***************************************************************************************
# ***************************************************************************************
#
# Name : democodegenerator.py
# Author : Paul Robson (paul@robsons.org.uk)
# Date : 17th December 2018
# Purpose : Imaginary langu... | class Democodegenerator(object):
def __init__(self, optimise=False):
self.addr = 4096
self.memoryAddr = 12288
self.opNames = {}
for op in '+add;-sub;*mult;/div;%mod;∧|or;^xor'.split(';'):
self.opNames[op[0]] = op[1:]
self.jumpTypes = {'': 'jmp', '#': 'jnz', '... |
# Sphinx helper for Django-specific references
def setup(app):
app.add_crossref_type(
directivename = "label",
rolename = "djterm",
indextemplate = "pair: %s; label",
)
app.add_crossref_type(
directivename = "setting",
rolename = "setting",
indextemplate = "p... | def setup(app):
app.add_crossref_type(directivename='label', rolename='djterm', indextemplate='pair: %s; label')
app.add_crossref_type(directivename='setting', rolename='setting', indextemplate='pair: %s; setting')
app.add_crossref_type(directivename='templatetag', rolename='ttag', indextemplate='pair: %s; ... |
#
# PySNMP MIB module SMON2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SMON2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:59:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23... | (smon,) = mibBuilder.importSymbols('APPLIC-MIB', 'smon')
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints... |
delta_vector = [(1, 0), (0, -1), (-1, 0), (0, 1)]
current_east_pos = 0
current_north_pos = 0
current_delta = 0
for _ in range(747):
instruction = input()
movement = instruction[0]
value = int(instruction[1:])
if movement == 'N':
current_north_pos += value
if movement == 'S':
curre... | delta_vector = [(1, 0), (0, -1), (-1, 0), (0, 1)]
current_east_pos = 0
current_north_pos = 0
current_delta = 0
for _ in range(747):
instruction = input()
movement = instruction[0]
value = int(instruction[1:])
if movement == 'N':
current_north_pos += value
if movement == 'S':
current_... |
# input
n = int(input())
cont1 = int(input())
conttot = 1
# grafo
contador = 0
g = [[0 for i in range(n)] for j in range(n)]
lista = input().split()
for col in range(n):
for linha in range(n):
g[col][linha] = int(lista[contador])
contador += 1
if col == linha:
g[col][linha] = 0
... | n = int(input())
cont1 = int(input())
conttot = 1
contador = 0
g = [[0 for i in range(n)] for j in range(n)]
lista = input().split()
for col in range(n):
for linha in range(n):
g[col][linha] = int(lista[contador])
contador += 1
if col == linha:
g[col][linha] = 0
contaminados = []... |
with open("Actions.txt") as f:
print(f)
lines = f.readlines()
trim_list = list(map(lambda line: line.strip(), lines))
sig = "-- HERE --"
sig_indx = trim_list.index(sig)
pure_inst = trim_list[sig_indx:]
print(pure_inst)
res = []
for p in pure_inst:
split = p.split(" ", 1)
... | with open('Actions.txt') as f:
print(f)
lines = f.readlines()
trim_list = list(map(lambda line: line.strip(), lines))
sig = '-- HERE --'
sig_indx = trim_list.index(sig)
pure_inst = trim_list[sig_indx:]
print(pure_inst)
res = []
for p in pure_inst:
split = p.split(' ', 1)
... |
c = int()
def hanoi(discs, main, target, aux):
global c
if discs >= 1:
c = c + 1
hanoi(discs - 1, main, aux, target)
print("[{}] -> Move disc {} from {} to {}".format(c, discs, main, target))
hanoi(discs - 1, aux, target, main)
if __name__ == "__main__":
discs = int(input())
hanoi(discs, "mai... | c = int()
def hanoi(discs, main, target, aux):
global c
if discs >= 1:
c = c + 1
hanoi(discs - 1, main, aux, target)
print('[{}] -> Move disc {} from {} to {}'.format(c, discs, main, target))
hanoi(discs - 1, aux, target, main)
if __name__ == '__main__':
discs = int(input())... |
def f():
def g():
pass
if __name__ == '__main__':
g()
print(1)
f()
| def f():
def g():
pass
if __name__ == '__main__':
g()
print(1)
f() |
lst = [int(x) for x in input().split()]
k = int(input())
lst.sort()
print(lst[-k], end="") | lst = [int(x) for x in input().split()]
k = int(input())
lst.sort()
print(lst[-k], end='') |
n,k=map(int,input().split());a=[int(i) for i in input().split()];m=sum(a[:k]);s=m
for i in range(k,n):
s+=(a[i]-a[i-k])
if s>m:m=s
print(m)
| (n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
m = sum(a[:k])
s = m
for i in range(k, n):
s += a[i] - a[i - k]
if s > m:
m = s
print(m) |
with open("day-02/input.txt", "r") as file:
puzzle_input = [i.split() for i in file.readlines()]
def part_1(puzzle_input):
depth = 0
horizontal = 0
for command, value in puzzle_input:
value = int(value)
if command == "forward":
horizontal += value
elif command == ... | with open('day-02/input.txt', 'r') as file:
puzzle_input = [i.split() for i in file.readlines()]
def part_1(puzzle_input):
depth = 0
horizontal = 0
for (command, value) in puzzle_input:
value = int(value)
if command == 'forward':
horizontal += value
elif command == '... |
obj = {
'Profiles' : [ {
'Source' : 'sfmc_sg10004_programmes_genrelevel1fan548day_oc_uas_dae',
'Media': ['audio','video'],
'Preferences' : [ {
'Score' : 1,
'Label' : 'Religion & Ethics'
}, {
'Score' : 4,
'Label' : 'Entertainment'
}, {
'Score' : 5... | obj = {'Profiles': [{'Source': 'sfmc_sg10004_programmes_genrelevel1fan548day_oc_uas_dae', 'Media': ['audio', 'video'], 'Preferences': [{'Score': 1, 'Label': 'Religion & Ethics'}, {'Score': 4, 'Label': 'Entertainment'}, {'Score': 5, 'Label': 'Music'}, {'Score': 5, 'Label': 'Comedy'}, {'Score': 5, 'Label': 'News'}, {'Sco... |
'''
Created on 05.03.2018
@author: Alex
'''
class ImageSorterException(Exception):
pass
| """
Created on 05.03.2018
@author: Alex
"""
class Imagesorterexception(Exception):
pass |
# Copyright 2017 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | vnic_type_normal = 'normal'
vnic_type_direct = 'direct'
vnic_type_macvtap = 'macvtap'
vnic_type_direct_physical = 'direct-physical'
vnic_type_baremetal = 'baremetal'
vnic_type_virtio_forwarder = 'virtio-forwarder'
vnic_types_sriov = (VNIC_TYPE_DIRECT, VNIC_TYPE_MACVTAP, VNIC_TYPE_DIRECT_PHYSICAL, VNIC_TYPE_VIRTIO_FORWA... |
class Animal:
nombre: str
edad: int
nPatas: int
raza: str
ruido: str
color: str
def __init__(self, nombre, edad, nPatas, raza, ruido, color):
self.nombre = nombre
self.edad = edad
self.nPatas = nPatas
self.raza = raza
self.ruido = ruido
... | class Animal:
nombre: str
edad: int
n_patas: int
raza: str
ruido: str
color: str
def __init__(self, nombre, edad, nPatas, raza, ruido, color):
self.nombre = nombre
self.edad = edad
self.nPatas = nPatas
self.raza = raza
self.ruido = ruido
self.... |
#A function to show the list of trait with categorial data
def categorial_trait(dataframe):
numeric, categorial = classifying_column(dataframe)
print('Traits with categorial data : ','\n',categorial, '\n')
print('Total count : ' ,len(categorial) , 'Traits')
| def categorial_trait(dataframe):
(numeric, categorial) = classifying_column(dataframe)
print('Traits with categorial data : ', '\n', categorial, '\n')
print('Total count : ', len(categorial), 'Traits') |
ENDC = '\033[0m'
OKGREEN = '\033[92m'
def print_play_my_playlist(playlist_name, name_song, artist, total_time, prefix, bar, percent, suffix):
print("\033[F"*13)
print(
f'{playlist_name} | {name_song} | {artist} | {total_time[:7]}',
f'{prefix}|{OKGREEN}{bar}{ENDC}|{percent[:7]} {suffix}',
... | endc = '\x1b[0m'
okgreen = '\x1b[92m'
def print_play_my_playlist(playlist_name, name_song, artist, total_time, prefix, bar, percent, suffix):
print('\x1b[F' * 13)
print(f'{playlist_name} | {name_song} | {artist} | {total_time[:7]}', f'{prefix}|{OKGREEN}{bar}{ENDC}|{percent[:7]} {suffix}', f'', f'p : Pause', f'... |
class Stock():
def __init__(self,code,name,price):
self.code = code
self.name = name
self.price = price
def __str__(self):
return 'code{},name{},price{}'.format(self.code,self.name,self.price) | class Stock:
def __init__(self, code, name, price):
self.code = code
self.name = name
self.price = price
def __str__(self):
return 'code{},name{},price{}'.format(self.code, self.name, self.price) |
line = input().split()
a = int(line[0])
b = int(line[1])
hour = 0
total = a
burned = 0
while(total > 0):
total -= 1
burned += 1
if(burned % b == 0):
total += 1
hour += 1
print(str(hour))
| line = input().split()
a = int(line[0])
b = int(line[1])
hour = 0
total = a
burned = 0
while total > 0:
total -= 1
burned += 1
if burned % b == 0:
total += 1
hour += 1
print(str(hour)) |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | class Export:
def __init__(self, export: dict):
self.id = export.get('id')
self.display_name = export.get('displayName')
self.enabled = export.get('enabled')
self.source = export.get('source')
self.filter = export.get('filter')
self.destinations = export.get('destina... |
__package__ = 'tkgeom'
__title__ = 'tkgeom'
__description__ = '2D geometry module as an example for the TK workshop'
__copyright__ = '2019, Zs. Elter'
__version__ = '1.0.0'
| __package__ = 'tkgeom'
__title__ = 'tkgeom'
__description__ = '2D geometry module as an example for the TK workshop'
__copyright__ = '2019, Zs. Elter'
__version__ = '1.0.0' |
'''
Copyright (c) 2014, Aaron Westendorf All rights reserved.
https://github.com/agoragames/pluto/blob/master/LICENSE.txt
'''
| """
Copyright (c) 2014, Aaron Westendorf All rights reserved.
https://github.com/agoragames/pluto/blob/master/LICENSE.txt
""" |
def id(message):
# Define empty variables
fu_userid = False
rt_userid = False
rf_userid = False
gp_groupid = False
# the 'From User' data
fu_username = message.from_user.username
fu_userid = message.from_user.id
fu_fullname = message.from_user.first_name.encode("utf-8")
# check for 'Replied to' mess... | def id(message):
fu_userid = False
rt_userid = False
rf_userid = False
gp_groupid = False
fu_username = message.from_user.username
fu_userid = message.from_user.id
fu_fullname = message.from_user.first_name.encode('utf-8')
if message.reply_to_message:
rt_userid = message.reply_to... |
txt = "banana"
x = txt.ljust(20)
print(x, "is my favorite fruit.")
| txt = 'banana'
x = txt.ljust(20)
print(x, 'is my favorite fruit.') |
pkgname = "gnome-menus"
pkgver = "3.36.0"
pkgrel = 0
build_style = "gnu_configure"
configure_args = ["--disable-static"]
make_cmd = "gmake"
hostmakedepends = [
"gmake", "pkgconf", "gobject-introspection", "glib-devel", "gettext-tiny"
]
makedepends = ["libglib-devel"]
pkgdesc = "GNOME menu definitions"
maintainer = ... | pkgname = 'gnome-menus'
pkgver = '3.36.0'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--disable-static']
make_cmd = 'gmake'
hostmakedepends = ['gmake', 'pkgconf', 'gobject-introspection', 'glib-devel', 'gettext-tiny']
makedepends = ['libglib-devel']
pkgdesc = 'GNOME menu definitions'
maintainer = 'q66 <... |
#!/usr/bin/env python3
class BaseError(Exception):
def __init__(self, message):
self.message = message
class LoggedOutError(BaseError):
def __init__(self):
super(LoggedOutError, self).__init__("User is currently not logged In")
# self.message = "User is currently not logged In"
cla... | class Baseerror(Exception):
def __init__(self, message):
self.message = message
class Loggedouterror(BaseError):
def __init__(self):
super(LoggedOutError, self).__init__('User is currently not logged In')
class Loginexpirederror(BaseError):
def __init__(self):
super(LoginExpired... |
pkgname = "python-py"
pkgver = "1.11.0"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools_scm"]
checkdepends = ["python-pytest"]
depends = ["python"]
pkgdesc = "Python development support library"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://github.com/pytest-de... | pkgname = 'python-py'
pkgver = '1.11.0'
pkgrel = 0
build_style = 'python_module'
hostmakedepends = ['python-setuptools_scm']
checkdepends = ['python-pytest']
depends = ['python']
pkgdesc = 'Python development support library'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'MIT'
url = 'https://github.com/pytest-de... |
n = int(input())
nums = list(map(int, input().strip().split()))
print(min(nums) * max(nums))
| n = int(input())
nums = list(map(int, input().strip().split()))
print(min(nums) * max(nums)) |
line = Line()
line.xValues = [2, 1, 3, 4, 0]
line.yValues = [2, 1, 3, 4, 0]
plot = Plot()
plot.add(line)
plot.save("unordered.png")
| line = line()
line.xValues = [2, 1, 3, 4, 0]
line.yValues = [2, 1, 3, 4, 0]
plot = plot()
plot.add(line)
plot.save('unordered.png') |
'''
Created on Oct 31, 2013/.>"
@author: rgeorgi
'''
class TextParser(object):
'''
classdocs
'''
def parse(self):
pass
def __init__(self):
'''
Constructor
'''
class ParserException(Exception):
pass | """
Created on Oct 31, 2013/.>"
@author: rgeorgi
"""
class Textparser(object):
"""
classdocs
"""
def parse(self):
pass
def __init__(self):
"""
Constructor
"""
class Parserexception(Exception):
pass |
class UIColors:
"color indices for UI (c64 original) palette"
white = 2
lightgrey = 16
medgrey = 13
darkgrey = 12
black = 1
yellow = 8
red = 3
brightred = 11
| class Uicolors:
"""color indices for UI (c64 original) palette"""
white = 2
lightgrey = 16
medgrey = 13
darkgrey = 12
black = 1
yellow = 8
red = 3
brightred = 11 |
# Time: O (N ^ 2) | Space: O(N)
def arrayOfProducts(array):
output = []
for i in range(len(array)):
product = 1
for j in range(len(array)):
if i != j:
product = product * array[j]
output.append(product)
return output
# Time: O(N) | Space: O(N)
def array... | def array_of_products(array):
output = []
for i in range(len(array)):
product = 1
for j in range(len(array)):
if i != j:
product = product * array[j]
output.append(product)
return output
def array_of_products_n(array):
left = [1 for i in range(len(arr... |
# -*- coding = utf-8 -*-
# @Time:2021/2/2821:58
# @Author:Linyu
# @Software:PyCharm
def response(flow):
print(flow.request.url)
print(flow.response.text) | def response(flow):
print(flow.request.url)
print(flow.response.text) |
# example of how to display octal and hexa values
a = 0o25
b = 0x1af
print('Value of a in decimal is ', a)
c = 19
print('19 in octal is %o and in hex is %x' % (c, c))
d = oct(c)
e = hex(c)
print('19 in octal is', d, ' and in hex is ', e)
| a = 21
b = 431
print('Value of a in decimal is ', a)
c = 19
print('19 in octal is %o and in hex is %x' % (c, c))
d = oct(c)
e = hex(c)
print('19 in octal is', d, ' and in hex is ', e) |
states_in_order_of_founding = ("Delaware", "Pennsylvania", "New Jersey", "Georgia")
# You use parentheses instead of square brackets.
print(states_in_order_of_founding)
second_state_founded = states_in_order_of_founding[1]
print("The second state founded was " + second_state_founded) | states_in_order_of_founding = ('Delaware', 'Pennsylvania', 'New Jersey', 'Georgia')
print(states_in_order_of_founding)
second_state_founded = states_in_order_of_founding[1]
print('The second state founded was ' + second_state_founded) |
#!/usr/bin/python
# -*- coding: utf-8 -*-
nitram_micro_mono_CP437 = [
0, 0, 0, 0, 0,
10, 0, 4, 17, 14,
10, 0, 0, 14, 17,
27, 31, 31, 14, 4,
0, 0, 0, 0, 0,
0, 4, 10, 4, 14,
4, 14, 14, 4, 14,
0, 14, 14, 14, 0,
0, 0, 0, 0, 0,
0, 4, 10, 4, 0,
0, 0, 0, 0, 0,
30, 28, 31, 21, 7... | nitram_micro_mono_cp437 = [0, 0, 0, 0, 0, 10, 0, 4, 17, 14, 10, 0, 0, 14, 17, 27, 31, 31, 14, 4, 0, 0, 0, 0, 0, 0, 4, 10, 4, 14, 4, 14, 14, 4, 14, 0, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 4, 10, 4, 0, 0, 0, 0, 0, 0, 30, 28, 31, 21, 7, 5, 13, 31, 12, 4, 20, 22, 31, 6, 4, 15, 10, 10, 10, 5, 21, 14, 27, 14, 21, 4, 12, 28, 12, ... |
def is_same_string(string1, string2):
if len(string1) != len(string2):
return False
else:
for i in range(len(string1)):
if string1[i] != string2[i]:
return False
return True
def reverse_string(string):
gnirts = ''
for i in range(len(string)):... | def is_same_string(string1, string2):
if len(string1) != len(string2):
return False
else:
for i in range(len(string1)):
if string1[i] != string2[i]:
return False
return True
def reverse_string(string):
gnirts = ''
for i in range(len(string)):
gnir... |
class PretreatedQuery:
'''
DBpedia resultat
'''
def __init__(self, mentions_list, detected_ne):
'''
Constructor
'''
self.mentions_list=mentions_list
self.detected_ne=detected_ne
| class Pretreatedquery:
"""
DBpedia resultat
"""
def __init__(self, mentions_list, detected_ne):
"""
Constructor
"""
self.mentions_list = mentions_list
self.detected_ne = detected_ne |
def even_odd(*args):
if "even" in args:
return list(filter(lambda x: x % 2 == 0, [args[i] for i in range(len(args) - 1)]))
return list(filter(lambda x: x % 2 == 1, [args[i] for i in range(len(args) - 1)]))
# print(even_odd(1, 2, 3, 4, 5, 6, "even"))
# print(even_odd(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, "od... | def even_odd(*args):
if 'even' in args:
return list(filter(lambda x: x % 2 == 0, [args[i] for i in range(len(args) - 1)]))
return list(filter(lambda x: x % 2 == 1, [args[i] for i in range(len(args) - 1)])) |
pkgname = "python-sphinxcontrib-serializinghtml"
pkgver = "1.1.5"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools"]
checkdepends = ["python-sphinx"]
depends = ["python"]
pkgdesc = "Sphinx extension which outputs serialized HTML document"
maintainer = "q66 <q66@chimera-linux.org>"
license ... | pkgname = 'python-sphinxcontrib-serializinghtml'
pkgver = '1.1.5'
pkgrel = 0
build_style = 'python_module'
hostmakedepends = ['python-setuptools']
checkdepends = ['python-sphinx']
depends = ['python']
pkgdesc = 'Sphinx extension which outputs serialized HTML document'
maintainer = 'q66 <q66@chimera-linux.org>'
license ... |
lis = [1, 2, 3, 4, 2, 6, 7, 8, 9]
without_duplicates = []
ok = True
for i in range(0,len(lis)):
if lis[i] in without_duplicates:
ok = False
break
else:
without_duplicates.append(lis[i])
if ok:
print("There are no duplicates")
else:
print("Things are not ok") | lis = [1, 2, 3, 4, 2, 6, 7, 8, 9]
without_duplicates = []
ok = True
for i in range(0, len(lis)):
if lis[i] in without_duplicates:
ok = False
break
else:
without_duplicates.append(lis[i])
if ok:
print('There are no duplicates')
else:
print('Things are not ok') |
# model settings
model = dict(
type='CenterNet2',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch',
init_cfg=dict(... | model = dict(type='CenterNet2', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')), neck=dict(type='FPN', in_channels=[256, 5... |
aux = 0
num = int(input("Ingrese un numero entero positivo: "))
opc = int(input("1- Sumatoria, 2-Factorial: "))
if opc == 1:
for x in range(0,num+1):
aux = aux + x
print (aux)
elif opc == 2:
if num == 0:
print("1")
elif num > 0:
aux = 1
for x in range(1,num+1):
aux = aux*x
print (aux)
elif num < 0:
... | aux = 0
num = int(input('Ingrese un numero entero positivo: '))
opc = int(input('1- Sumatoria, 2-Factorial: '))
if opc == 1:
for x in range(0, num + 1):
aux = aux + x
print(aux)
elif opc == 2:
if num == 0:
print('1')
elif num > 0:
aux = 1
for x in range(1, num + 1):
... |
#Give a single command that computes the sum from Exercise R-1.6,relying
#on Python's comprehension syntax and the built-in sum function
n = int(input('please input an positive integer:'))
result = sum(i**2 for i in range(1,n) if i&1!=0)
print(result) | n = int(input('please input an positive integer:'))
result = sum((i ** 2 for i in range(1, n) if i & 1 != 0))
print(result) |
def twoSum(self, n: List[int], target: int) -> List[int]:
N = len(n)
l = 0
r = N-1
while l<r:
s = n[l] + n[r]
if s == target:
return [l+1,r+1]
elif s < target:
l += 1
else:
r -= 1
| def two_sum(self, n: List[int], target: int) -> List[int]:
n = len(n)
l = 0
r = N - 1
while l < r:
s = n[l] + n[r]
if s == target:
return [l + 1, r + 1]
elif s < target:
l += 1
else:
r -= 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.