content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
array([[ -8.71756106, -1.36180276],
[ -8.58324975, -1.6198254 ],
[ -8.44660752, -1.87329902],
[ -8.30694854, -2.12042891],
[ -8.16366778, -2.35941504],
[ -8.01626074, -2.58846783],
[ -7.8643173 , -2.80576865],
[ -7.70752251, -3.0094502 ],
[ -7.5458139 , -... | array([[-8.71756106, -1.36180276], [-8.58324975, -1.6198254], [-8.44660752, -1.87329902], [-8.30694854, -2.12042891], [-8.16366778, -2.35941504], [-8.01626074, -2.58846783], [-7.8643173, -2.80576865], [-7.70752251, -3.0094502], [-7.5458139, -3.19806094], [-7.37912158, -3.3697834], [-7.20747945, -3.5226388], [-7.0311328... |
class Solution:
"""
@param numbersbers : Give an array numbersbers of n integer
@return : Find all unique triplets in the array which gives the sum of zero.
"""
def threeSum(self, numbers):
if not numbers or len(numbers) < 3:
return set()
numbers.sort()
triplets =... | class Solution:
"""
@param numbersbers : Give an array numbersbers of n integer
@return : Find all unique triplets in the array which gives the sum of zero.
"""
def three_sum(self, numbers):
if not numbers or len(numbers) < 3:
return set()
numbers.sort()
triplets... |
"""Module containing scheduling algorithms.
Each scheduling algorithm receives a specific set of inputs.
They output partial mappings when requested using the query method.
Implemented scheduling methods: OpenMPStatic, LPT.
Methods with interfaces but no implementation: OpenMPDynamic, OpenMPGuided,
RecursiveBipartiti... | """Module containing scheduling algorithms.
Each scheduling algorithm receives a specific set of inputs.
They output partial mappings when requested using the query method.
Implemented scheduling methods: OpenMPStatic, LPT.
Methods with interfaces but no implementation: OpenMPDynamic, OpenMPGuided,
RecursiveBipartiti... |
NAME = 'comic.py'
ORIGINAL_AUTHORS = [
'Miguel Boekhold'
]
ABOUT = '''
Returns a random comic from xkcd
'''
COMMANDS = '''
>>> .comic
returns a url of a random comic
'''
WEBSITE = ''
| name = 'comic.py'
original_authors = ['Miguel Boekhold']
about = '\nReturns a random comic from xkcd\n'
commands = '\n>>> .comic\nreturns a url of a random comic\n'
website = '' |
def printMyName(myName):
print('My name is' + myName)
print('Who are you ?')
myName = input()
printMyName(myName)
| def print_my_name(myName):
print('My name is' + myName)
print('Who are you ?')
my_name = input()
print_my_name(myName) |
def get_version_from_win32_pe(file):
# http://windowssdk.msdn.microsoft.com/en-us/library/ms646997.aspx
sig = struct.pack("32s", u"VS_VERSION_INFO".encode("utf-16-le"))
# This pulls the whole file into memory, so not very feasible for
# large binaries.
try:
filedata = open(file).read()
e... | def get_version_from_win32_pe(file):
sig = struct.pack('32s', u'VS_VERSION_INFO'.encode('utf-16-le'))
try:
filedata = open(file).read()
except IOError:
return 'Unknown'
offset = filedata.find(sig)
if offset == -1:
return 'Unknown'
filedata = filedata[offset + 32:offset + ... |
class NodeConfig:
def __init__(self, node_name: str, ws_url: str) -> None:
self.node_name = node_name
self.ws_url = ws_url
| class Nodeconfig:
def __init__(self, node_name: str, ws_url: str) -> None:
self.node_name = node_name
self.ws_url = ws_url |
#always put a repr in place to explicitly differentiate str from repr
class Car:
def __init__(self, color, mileage):
self.color = color
self.mileage = mileage
def __repr__(self):
return '{self.__class__.__name__}({self.color}, {self.mileage})'.format(self=self)
def __str__(self):
... | class Car:
def __init__(self, color, mileage):
self.color = color
self.mileage = mileage
def __repr__(self):
return '{self.__class__.__name__}({self.color}, {self.mileage})'.format(self=self)
def __str__(self):
return 'a {self.color} car'.format(self=self) |
BROKER_URL = "mongodb://arbor/celery"
CELERY_RESULT_BACKEND = "mongodb"
CELERY_MONGODB_BACKEND_SETTINGS = {
"host": "arbor",
"database": "celery"
}
| broker_url = 'mongodb://arbor/celery'
celery_result_backend = 'mongodb'
celery_mongodb_backend_settings = {'host': 'arbor', 'database': 'celery'} |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 13 21:31:02 2021
@author: eliphat
"""
class BaseConstraint:
def cause_vars(self):
raise NotImplementedError()
def effect_vars(self):
raise NotImplementedError()
def fix(self, ts):
raise NotImplementedError()
def is_resolved(self... | """
Created on Sat Mar 13 21:31:02 2021
@author: eliphat
"""
class Baseconstraint:
def cause_vars(self):
raise not_implemented_error()
def effect_vars(self):
raise not_implemented_error()
def fix(self, ts):
raise not_implemented_error()
def is_resolved(self):
raise ... |
def fun():
a=89
str="adar"
return[a,str];
print(fun())
| def fun():
a = 89
str = 'adar'
return [a, str]
print(fun()) |
"""The version number is based on semantic versioning.
References
- https://semver.org/
- https://www.python.org/dev/peps/pep-0440/
This file is autogenerated, do not modify by hand.
"""
__version__ = "0.0.0"
COMMIT = "ed3301fdf82f5608a53a19a4aa0961c14c323421"
MAJOR = 0
MINOR = 0
PATCH = 0
| """The version number is based on semantic versioning.
References
- https://semver.org/
- https://www.python.org/dev/peps/pep-0440/
This file is autogenerated, do not modify by hand.
"""
__version__ = '0.0.0'
commit = 'ed3301fdf82f5608a53a19a4aa0961c14c323421'
major = 0
minor = 0
patch = 0 |
# input
N, X, Y = map(int, input().split())
As = [*map(int, input().split())]
Bs = [*map(int, input().split())]
# compute
# output
print(sum(i not in As and i not in Bs for i in range(1, N+1)))
| (n, x, y) = map(int, input().split())
as = [*map(int, input().split())]
bs = [*map(int, input().split())]
print(sum((i not in As and i not in Bs for i in range(1, N + 1)))) |
names = ["duanzijie","zhaokeer","lijiaxi","zhuzi","wangwenbo","gongyijun"]
print(names)
print(names[0])
print(names[1])
print(names[2])
print(names[3])
print(names[4])
print(names[5])
hi = "hi" + " " + name[1]
print(hi) | names = ['duanzijie', 'zhaokeer', 'lijiaxi', 'zhuzi', 'wangwenbo', 'gongyijun']
print(names)
print(names[0])
print(names[1])
print(names[2])
print(names[3])
print(names[4])
print(names[5])
hi = 'hi' + ' ' + name[1]
print(hi) |
"""
User defined here are allowed to use privileged bot commands
"""
regulars = [
965146, #Shree
4946380, #Mithrandir
5067311, #Andras Deak
397817, #Stephen Kennedy
6707985, #geisterfurz007
]
| """
User defined here are allowed to use privileged bot commands
"""
regulars = [965146, 4946380, 5067311, 397817, 6707985] |
n = int(input())
s = input()
c=0
for i in range(n-1):
if s[i]==s[i+1]:
c +=1
print(c)
| n = int(input())
s = input()
c = 0
for i in range(n - 1):
if s[i] == s[i + 1]:
c += 1
print(c) |
# practice of anna
class TestClass:
def __init__(self, name):
# __init__ is the rule first creator made so every time we have to foloow
self.name = name
if __name__ == '__main__':
obj1 = TestClass()
print(obj1)
obj2 = TestClass()
print(obj2) | class Testclass:
def __init__(self, name):
self.name = name
if __name__ == '__main__':
obj1 = test_class()
print(obj1)
obj2 = test_class()
print(obj2) |
class SpiderpigError(Exception):
pass
class ValidationError(SpiderpigError):
pass
class NotInitialized(SpiderpigError):
pass
class CyclicExecution(SpiderpigError):
pass
class TooManyDependencies(SpiderpigError):
pass
| class Spiderpigerror(Exception):
pass
class Validationerror(SpiderpigError):
pass
class Notinitialized(SpiderpigError):
pass
class Cyclicexecution(SpiderpigError):
pass
class Toomanydependencies(SpiderpigError):
pass |
## bisenetv2
cfg = dict(
model_type='bisenetv2',
num_aux_heads=4,
lr_start = 5e-2,
weight_decay=5e-4,
warmup_iters = 1000,
max_iter = 150000,
im_root='./datasets/coco',
train_im_anns='./datasets/coco/train.txt',
val_im_anns='./datasets/coco/val.txt',
scales=[0.5, 1.5],
crops... | cfg = dict(model_type='bisenetv2', num_aux_heads=4, lr_start=0.05, weight_decay=0.0005, warmup_iters=1000, max_iter=150000, im_root='./datasets/coco', train_im_anns='./datasets/coco/train.txt', val_im_anns='./datasets/coco/val.txt', scales=[0.5, 1.5], cropsize=[512, 512], ims_per_gpu=8, use_fp16=True, use_sync_bn=False... |
class PorterStemmer:
def __init__(self):
self.vowels = ('a', 'e', 'i', 'o', 'u')
def is_consonant(self, s: str, i: int):
return not self.is_vowel(s, i)
def is_vowel(self, s: str, i: int):
if s[i].lower() in self.vowels:
return True
elif s[i].lower() == 'y':
... | class Porterstemmer:
def __init__(self):
self.vowels = ('a', 'e', 'i', 'o', 'u')
def is_consonant(self, s: str, i: int):
return not self.is_vowel(s, i)
def is_vowel(self, s: str, i: int):
if s[i].lower() in self.vowels:
return True
elif s[i].lower() == 'y':
... |
def bubble_sort(L):
swap = False
while not swap:
swap = True
for j in range(1, len(L)):
if L[j-1] > L[j]:
swap = False
temp = L[j]
L[j] = L[j-1]
L[j-1] = temp
| def bubble_sort(L):
swap = False
while not swap:
swap = True
for j in range(1, len(L)):
if L[j - 1] > L[j]:
swap = False
temp = L[j]
L[j] = L[j - 1]
L[j - 1] = temp |
#
# PySNMP MIB module CRESCENDO-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CRESCENDO-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:12:29 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, constraints_union, value_size_constraint) ... |
la_liga_goals = 43
champions_league_goals = 10
copa_del_rey_goals = 5
total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals | la_liga_goals = 43
champions_league_goals = 10
copa_del_rey_goals = 5
total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals |
"""
Too Long
Print and remove all elements with length
greater than 4 in a given list of strings.
"""
the_list = ["dragon", "cab", "science", "dove", "lime", "river", "pop"]
to_remove = []
for x in the_list: # iterates through every element in the list
if len(x) > 4: # if the element length is greater than 4
... | """
Too Long
Print and remove all elements with length
greater than 4 in a given list of strings.
"""
the_list = ['dragon', 'cab', 'science', 'dove', 'lime', 'river', 'pop']
to_remove = []
for x in the_list:
if len(x) > 4:
print(x)
to_remove.append(x)
for y in to_remove:
the_list.remove(y) |
class NoUserIdOrSessionKeyError(Exception):
pass
class NoProductToDelete(Exception):
pass
class NoCart(Exception):
pass
class BadConfigError(Exception):
pass
| class Nouseridorsessionkeyerror(Exception):
pass
class Noproducttodelete(Exception):
pass
class Nocart(Exception):
pass
class Badconfigerror(Exception):
pass |
"""WizCoin
By Al Sweigart test@gmail.com
A basic Python project."""
__version__ = '0.1.0'
| """WizCoin
By Al Sweigart test@gmail.com
A basic Python project."""
__version__ = '0.1.0' |
def main():
*t, n = map(int, input().split())
t=list(t)
for i in range(2, n):
t.append(t[i-2] + t[i-1]*t[i-1])
print(t[-1])
if __name__ == '__main__':
main()
| def main():
(*t, n) = map(int, input().split())
t = list(t)
for i in range(2, n):
t.append(t[i - 2] + t[i - 1] * t[i - 1])
print(t[-1])
if __name__ == '__main__':
main() |
'''
Created on Oct 2, 2012
@author: vadim
Todo: need to learn string algorithms.
'''
f = open('data/keylog.txt')
mx = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, ... | """
Created on Oct 2, 2012
@author: vadim
Todo: need to learn string algorithms.
"""
f = open('data/keylog.txt')
mx = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, ... |
""" CSCI 204, Stack lab """
""" Tongyu Yang CSCI204 Lab06 """
class MyStack:
""" Implement this Stack ADT using a Python list to hold elements.
Do NOT use the len() feature of lists.
"""
CAPACITY = 10
def __init__( self ):
""" Initialize an empty stack. """
self._capac... | """ CSCI 204, Stack lab """
' Tongyu Yang CSCI204 Lab06 '
class Mystack:
""" Implement this Stack ADT using a Python list to hold elements.
Do NOT use the len() feature of lists.
"""
capacity = 10
def __init__(self):
""" Initialize an empty stack. """
self._capacity =... |
#
# Copyright (c) 2019 Opticks Team. All Rights Reserved.
#
# This file is part of Opticks
# (see https://bitbucket.org/simoncblyth/opticks).
#
# 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 a... | class Mxd(object):
def __init__(self, ab, key, cut, erc, shortname):
"""
:param ab:
:param key: property name which returns a dict with numerical values
:param cut: warn/error/fatal maximum permissable deviations, exceeding error level yields non-zero RC
:param erc: intege... |
# Swap assign variables
print("Enter 3 no.s:")
a = float(input("a: "))
b = float(input("b: "))
c = float(input("c: "))
a, b = a+b, b+c
print("Variables are: ")
print("a:", a)
print("b:", b)
print("c:", c)
| print('Enter 3 no.s:')
a = float(input('a: '))
b = float(input('b: '))
c = float(input('c: '))
(a, b) = (a + b, b + c)
print('Variables are: ')
print('a:', a)
print('b:', b)
print('c:', c) |
class A:
def __setitem__(self, e, f):
print(e + f)
a = A()
a[2] = 8
| class A:
def __setitem__(self, e, f):
print(e + f)
a = a()
a[2] = 8 |
"""
for i in range(1,101,2):
if(i%7==0):
continue
print(i)
"""
c=0
while c<=100:
if(c%2!=0 and c%7!=0):
print(c)
c=c+1 | """
for i in range(1,101,2):
if(i%7==0):
continue
print(i)
"""
c = 0
while c <= 100:
if c % 2 != 0 and c % 7 != 0:
print(c)
c = c + 1 |
cpp_config = [
'query-lib/official/cpp/codeql-suites/cpp-security-and-quality.qls',
'query-lib/official/cpp/codeql-suites/cpp-security-extended.qls',
]
js_config = []
# exported
lang_configs = {
'cpp' : cpp_config,
'javascript' : js_config
}
need_compile = ['cpp', 'java'] | cpp_config = ['query-lib/official/cpp/codeql-suites/cpp-security-and-quality.qls', 'query-lib/official/cpp/codeql-suites/cpp-security-extended.qls']
js_config = []
lang_configs = {'cpp': cpp_config, 'javascript': js_config}
need_compile = ['cpp', 'java'] |
# Push (temp, idx) in a stack. Pop element when a bigger elem is seen and update arr[idx] with (new_idx-idx).
# class Solution:
# def dailyTemperatures(self, T: List[int]) -> List[int]:
# S = []
# res = [0]*len(T)
# for i in range(len(T)-1, -1, -1):
# while S and T[S[-1... | class Solution:
def daily_temperatures(self, T: List[int]) -> List[int]:
res = [0] * len(T)
stack = []
for (i, t1) in enumerate(T):
while stack and t1 > stack[-1][1]:
(j, t2) = stack.pop()
res[j] = i - j
stack.append((i, t1))
r... |
class OrderBook:
"""
Implements data structure to append messages one at a time
"""
def __init__(self):
# bids, asks
self.book = (dict(), dict())
def bestBid(self):
if not self.book[0].keys():
return (float('nan'), float('nan'))
price = max(self.book[... | class Orderbook:
"""
Implements data structure to append messages one at a time
"""
def __init__(self):
self.book = (dict(), dict())
def best_bid(self):
if not self.book[0].keys():
return (float('nan'), float('nan'))
price = max(self.book[0].keys())
retu... |
class BaseType:
def __init__(self, db_type: str, python_type: type):
self.db_type = db_type
self.python_type = python_type
Float = BaseType("REAL", float)
Int = BaseType("INTEGER", int)
String = BaseType("TEXT", str)
TypeMap = {
float: Float,
int: Int,
str: String
}
| class Basetype:
def __init__(self, db_type: str, python_type: type):
self.db_type = db_type
self.python_type = python_type
float = base_type('REAL', float)
int = base_type('INTEGER', int)
string = base_type('TEXT', str)
type_map = {float: Float, int: Int, str: String} |
album_info = {
'Arrival - ABBA': {
'image': 'arrival.jpg',
'spotify_link_a': '1M4anG49aEs4YimBdj96Oy',
},
}
| album_info = {'Arrival - ABBA': {'image': 'arrival.jpg', 'spotify_link_a': '1M4anG49aEs4YimBdj96Oy'}} |
print('Hello, world.')
print('Hello, Python!')
print(2 + 3)
print('2' * 3)
print(f'2 + 3 = {2 + 3}')
print('1', '2', '3', sep=' + ', end=' ')
print('=', 1 + 2 + 3, end='')
print('!')
| print('Hello, world.')
print('Hello, Python!')
print(2 + 3)
print('2' * 3)
print(f'2 + 3 = {2 + 3}')
print('1', '2', '3', sep=' + ', end=' ')
print('=', 1 + 2 + 3, end='')
print('!') |
#!/usr/bin/env python
#coding: utf-8
class Solution:
# @param A, a list of integers
# @return an integer
def firstMissingPositive(self, A):
if not A: return 1
la = len(A)
i = 0
while i < la:
if i + 1 == A[i]:
i += 1
continue
... | class Solution:
def first_missing_positive(self, A):
if not A:
return 1
la = len(A)
i = 0
while i < la:
if i + 1 == A[i]:
i += 1
continue
if A[i] <= 0:
i += 1
continue
j =... |
def xor(a, b):
return (a or b) and not (a and b)
def collapse_polymer(polymer):
pos = 0
while pos + 1 < len(polymer):
first = polymer[pos]
second = polymer[pos + 1]
if first.lower() == second.lower() and xor(first.isupper(), second.isupper()):
if pos + 2 >= len(polymer)... | def xor(a, b):
return (a or b) and (not (a and b))
def collapse_polymer(polymer):
pos = 0
while pos + 1 < len(polymer):
first = polymer[pos]
second = polymer[pos + 1]
if first.lower() == second.lower() and xor(first.isupper(), second.isupper()):
if pos + 2 >= len(polymer... |
class Aula:
def __init__(self, id, numero, titulo):
self._id = id
self._numero = numero
self._titulo = titulo
def get_id(self):
return self._id
def get_numero(self):
return self._numero
def get_titulo(self):
return self._titulo | class Aula:
def __init__(self, id, numero, titulo):
self._id = id
self._numero = numero
self._titulo = titulo
def get_id(self):
return self._id
def get_numero(self):
return self._numero
def get_titulo(self):
return self._titulo |
class Queue(object):
def __init__(self):
self.q = []
def push(self, value):
self.q.insert(0, value)
def pop(self):
return self.q.pop()
def is_empty(self):
return self.q == []
def size(self):
return len(self.q)
# Example
q = Queue()
q.push(1... | class Queue(object):
def __init__(self):
self.q = []
def push(self, value):
self.q.insert(0, value)
def pop(self):
return self.q.pop()
def is_empty(self):
return self.q == []
def size(self):
return len(self.q)
q = queue()
q.push(1)
q.push(2)
q.push(3)
pri... |
file = open("day 04/Toon - Python/input", "r")
lines = file.readlines()
numbers = [int(x) for x in lines[0][:-1].split(',')]
boards = [[int(x) for x in line[:-1].split(' ') if x != '' ] for line in lines[2:]]
boards = [boards[i*6:i*6+5] for i in range(100)]
def contains_bingo(board):
return -5 in [sum(line) for li... | file = open('day 04/Toon - Python/input', 'r')
lines = file.readlines()
numbers = [int(x) for x in lines[0][:-1].split(',')]
boards = [[int(x) for x in line[:-1].split(' ') if x != ''] for line in lines[2:]]
boards = [boards[i * 6:i * 6 + 5] for i in range(100)]
def contains_bingo(board):
return -5 in [sum(line) f... |
listOriginPath = [
{
"header": "test.example.com",
"httpPort": 80,
"mappingUniqueId": "993419389425697",
"origin": "10.10.10.1",
"originType": "HOST_SERVER",
"path": "/example",
"status": "RUNNING"
},
{
"header": "test.example.com",
"ht... | list_origin_path = [{'header': 'test.example.com', 'httpPort': 80, 'mappingUniqueId': '993419389425697', 'origin': '10.10.10.1', 'originType': 'HOST_SERVER', 'path': '/example', 'status': 'RUNNING'}, {'header': 'test.example.com', 'httpPort': 80, 'mappingUniqueId': '993419389425697', 'origin': '10.10.10.1', 'originType... |
@jit(nopython=True)
def pressure_poisson(p, b, l2_target):
J, I = b.shape
iter_diff = l2_target + 1
n = 0
while iter_diff > l2_target and n <= 500:
pn = p.copy()
for i in range(1, I - 1):
for j in range(1, J - 1):
p[j, i] = (.25 * (pn[j, i + 1] +
... | @jit(nopython=True)
def pressure_poisson(p, b, l2_target):
(j, i) = b.shape
iter_diff = l2_target + 1
n = 0
while iter_diff > l2_target and n <= 500:
pn = p.copy()
for i in range(1, I - 1):
for j in range(1, J - 1):
p[j, i] = 0.25 * (pn[j, i + 1] + pn[j, i - 1... |
a = [int(x) for x in input().split()]
time = None
# a[0] initial hour
# a[1] initial min
# a[2] final hour
# a[3] final min
start = 60 * a[0] + a[1]
finish = 60 * a[2] + a[3]
if finish <= start:
finish += 1440 # 24 * 60
time = finish - start
print(f"O JOGO DUROU {int(time / 60)} HORA(S) E {int(time % 60)} MI... | a = [int(x) for x in input().split()]
time = None
start = 60 * a[0] + a[1]
finish = 60 * a[2] + a[3]
if finish <= start:
finish += 1440
time = finish - start
print(f'O JOGO DUROU {int(time / 60)} HORA(S) E {int(time % 60)} MINUTO(S)') |
def Compute_kmeans_inertia(resultsDict, FSWRITE = False, gpu_available = False):
# Measure inertia of kmeans model for a variety of values of cluster number n
km_list = list()
data = resultsDict['PCA_fit_transform']
#data = resultsDict['NP_images_STD']
N_clusters = len(resultsDict['imagesFilenameList'])... | def compute_kmeans_inertia(resultsDict, FSWRITE=False, gpu_available=False):
km_list = list()
data = resultsDict['PCA_fit_transform']
n_clusters = len(resultsDict['imagesFilenameList'])
if gpu_available:
print('Running Compute_kmeans_inertia on GPU: ')
with gpu_context():
for... |
n_students = int(input())
skills = list(input().split(" "))
skills = [int(skill) for skill in skills]
skills = sorted(skills)
n_problems = 0
ptr1 = n_students - 1
ptr2 = n_students - 2
while ptr2 >= 0:
if (skills[ptr1] == skills[ptr2]):
ptr1 -= 2
ptr2 -= 2
else:
n_problems += 1
... | n_students = int(input())
skills = list(input().split(' '))
skills = [int(skill) for skill in skills]
skills = sorted(skills)
n_problems = 0
ptr1 = n_students - 1
ptr2 = n_students - 2
while ptr2 >= 0:
if skills[ptr1] == skills[ptr2]:
ptr1 -= 2
ptr2 -= 2
else:
n_problems += 1
ski... |
"""
0011. Container With Most Water
Medium
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the... | """
0011. Container With Most Water
Medium
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the... |
teste = [0, 2, 3, 4, 5]
print(teste)
teste.insert(0, teste[3])
print(teste)
teste.pop(4)
print(teste) | teste = [0, 2, 3, 4, 5]
print(teste)
teste.insert(0, teste[3])
print(teste)
teste.pop(4)
print(teste) |
# -*- coding: utf-8 -*-
"""Top-level package for ePages Client."""
__author__ = """Pekka Piispanen, Tero Kotti"""
__email__ = 'pekka@vilkas.fi, tero@vilkas.fi'
__version__ = '0.2.0'
| """Top-level package for ePages Client."""
__author__ = 'Pekka Piispanen, Tero Kotti'
__email__ = 'pekka@vilkas.fi, tero@vilkas.fi'
__version__ = '0.2.0' |
arr = [1, 2, 3, 4, 4, 4, 5, 6, 6, 7, 8, 9]
arr.sort()
my_dict = {i:arr.count(i) for i in arr}
# sorting the dictionary based on value
my_dict = {k: v for k, v in sorted(my_dict.items(), key=lambda item: item[1])}
print(len(my_dict))
print(my_dict)
list = list(my_dict.keys())
print(list[-1])
| arr = [1, 2, 3, 4, 4, 4, 5, 6, 6, 7, 8, 9]
arr.sort()
my_dict = {i: arr.count(i) for i in arr}
my_dict = {k: v for (k, v) in sorted(my_dict.items(), key=lambda item: item[1])}
print(len(my_dict))
print(my_dict)
list = list(my_dict.keys())
print(list[-1]) |
# Model parameters
model_hidden_size = 768
model_embedding_size = 256
model_num_layers = 1
# Training parameters
n_steps = 2e4
learning_rate_init = 1e-3
speakers_per_batch = 16
utterances_per_speaker = 32
## Tensor-train parameters for last linear layer.
compression = 'tt'
n_cores = 2
rank = 2
# Evaluation and Test... | model_hidden_size = 768
model_embedding_size = 256
model_num_layers = 1
n_steps = 20000.0
learning_rate_init = 0.001
speakers_per_batch = 16
utterances_per_speaker = 32
compression = 'tt'
n_cores = 2
rank = 2
val_speakers_per_batch = 40
val_utterances_per_speaker = 32
test_speakers_per_batch = 40
test_utterances_per_sp... |
"""*******************************************************
This module has functions converting energies
*****************************************************
"""
#print __doc__
def convert_energy(Energy, Input_unit, Output_unit):#converts distance modulus to distance in parsec
"""Description: ocnverts energy from... | """*******************************************************
This module has functions converting energies
*****************************************************
"""
def convert_energy(Energy, Input_unit, Output_unit):
"""Description: ocnverts energy from Input_unit to Output_unit.
Input :- Energy to be converte... |
BRIGHTID_NODE = 'http://node.brightid.org/brightid/v5'
VERIFICATIONS_URL = BRIGHTID_NODE + '/verifications/idchain/'
OPERATION_URL = BRIGHTID_NODE + '/operations/'
CONTEXT = 'idchain'
RPC_URL = 'wss://idchain.one/ws/'
RELAYER_ADDRESS = '0x0df7eDDd60D613362ca2b44659F56fEbafFA9bFB'
DISTRIBUTION_ADDRESS = '0x6E39d7540c2a... | brightid_node = 'http://node.brightid.org/brightid/v5'
verifications_url = BRIGHTID_NODE + '/verifications/idchain/'
operation_url = BRIGHTID_NODE + '/operations/'
context = 'idchain'
rpc_url = 'wss://idchain.one/ws/'
relayer_address = '0x0df7eDDd60D613362ca2b44659F56fEbafFA9bFB'
distribution_address = '0x6E39d7540c2ad... |
# Time: O(n log n); Space: O(n)
def target_indices(nums, target):
nums.sort()
ans = []
for i, n in enumerate(nums):
if n == target:
ans.append(i)
return ans
# Time: O(n + k); Space(n + k)
def target_indices2(nums, target):
count = [0] * (max(nums) + 1)
for n in nums:
... | def target_indices(nums, target):
nums.sort()
ans = []
for (i, n) in enumerate(nums):
if n == target:
ans.append(i)
return ans
def target_indices2(nums, target):
count = [0] * (max(nums) + 1)
for n in nums:
count[n] += 1
sorted_nums = []
for (i, n) in enumera... |
class Browser(object):
def __init__(self):
form = {}
def open(self, url):
pass
def set_handle_robots(self, status):
pass
def set_cookiejar(self, cj):
pass
def forms(self):
forms = [{'session[username_or_email]':'', 'session[password]':''}]
return f... | class Browser(object):
def __init__(self):
form = {}
def open(self, url):
pass
def set_handle_robots(self, status):
pass
def set_cookiejar(self, cj):
pass
def forms(self):
forms = [{'session[username_or_email]': '', 'session[password]': ''}]
retur... |
class Dataset():
def __init__(self, data,feature=None):
self.len = data.shape[0]
if (feature is not None):
self.data = data[:,:feature]
self.label = data[:,feature:]
else:
feature = data.shape[1]
self.data = data[:,:feature]
self.label = None
def __getitem__(self, index):... | class Dataset:
def __init__(self, data, feature=None):
self.len = data.shape[0]
if feature is not None:
self.data = data[:, :feature]
self.label = data[:, feature:]
else:
feature = data.shape[1]
self.data = data[:, :feature]
self.l... |
class UnbundledTradeIndicatorEnum:
UNBUNDLED_TRADE_NONE = 0
FIRST_SUB_TRADE_OF_UNBUNDLED_TRADE = 1
LAST_SUB_TRADE_OF_UNBUNDLED_TRADE = 2
| class Unbundledtradeindicatorenum:
unbundled_trade_none = 0
first_sub_trade_of_unbundled_trade = 1
last_sub_trade_of_unbundled_trade = 2 |
# -*- coding: UTF-8 -*
def input_data2():
return None
| def input_data2():
return None |
def longest_possible_word_length():
return 189819
class iterlines(object):
def __init__(self, filehandle):
self._filehandle = filehandle
def __iter__(self):
self._filehandle.seek(0)
return self
def __next__(self):
line = self._filehandle.readline()
if line == '... | def longest_possible_word_length():
return 189819
class Iterlines(object):
def __init__(self, filehandle):
self._filehandle = filehandle
def __iter__(self):
self._filehandle.seek(0)
return self
def __next__(self):
line = self._filehandle.readline()
if line == ... |
"""
Two ways for checking model architectures:
1. Use torchsummary.
2. Define your model classes as a BaseModel (instead of a nn.Module),
which specifies a __str__() function.
"""
# from __future__ import print_function
# import torch
# import torchsummary
# device = torch.device("cuda" if torch.cuda.is_availabl... | """
Two ways for checking model architectures:
1. Use torchsummary.
2. Define your model classes as a BaseModel (instead of a nn.Module),
which specifies a __str__() function.
""" |
class DependencyResolutionError(RuntimeError):
"""Raised when task dependencies cannot be resolved.
This may be raised by :meth:`.Queue.submit` (if it is possible to detect at
that time), or by :meth:`.Task.result` later.
"""
class PatternMissingError(RuntimeError):
"""Raised by :meth:`.Task... | class Dependencyresolutionerror(RuntimeError):
"""Raised when task dependencies cannot be resolved.
This may be raised by :meth:`.Queue.submit` (if it is possible to detect at
that time), or by :meth:`.Task.result` later.
"""
class Patternmissingerror(RuntimeError):
"""Raised by :meth:`.Task.... |
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
if type(self.data) != 'str':
return str(self.data)
return self.data
def _height(root):
if root is None:
return 0
return max(_heig... | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
if type(self.data) != 'str':
return str(self.data)
return self.data
def _height(root):
if root is None:
return 0
return max(_height... |
def most_frequent(arr):
ret = None
counter = {}
max_count = -1
for n in arr:
counter.setdefault(n, 0)
counter[n] += 1
if counter[n] > max_count:
max_count = counter[n]
ret = n
return ret
| def most_frequent(arr):
ret = None
counter = {}
max_count = -1
for n in arr:
counter.setdefault(n, 0)
counter[n] += 1
if counter[n] > max_count:
max_count = counter[n]
ret = n
return ret |
# Created by MechAviv
# Kinesis Introduction
# Map ID :: 331003200
# Subway :: Subway Car #3
JAY = 1531001
GIRL = 1531067
sm.spawnNpc(GIRL, 699, 47)
sm.showNpcSpecialActionByTemplateId(GIRL, "summon")
sm.spawnMob(2700303, 250, 57, False)
sm.spawnMob(2700303, 250, 57, False)
sm.spawnMob(2700303, 250, 57, False)
sm.spa... | jay = 1531001
girl = 1531067
sm.spawnNpc(GIRL, 699, 47)
sm.showNpcSpecialActionByTemplateId(GIRL, 'summon')
sm.spawnMob(2700303, 250, 57, False)
sm.spawnMob(2700303, 250, 57, False)
sm.spawnMob(2700303, 250, 57, False)
sm.spawnMob(2700303, 250, 57, False)
sm.spawnMob(2700303, 250, 57, False)
sm.spawnMob(2700304, 300, 5... |
# https://www.hackerrank.com/challenges/30-review-loop/
T = int(input())
S = list()
for i in range(T):
S.append(str(input()))
for i in range(len(S)):
print(S[i][0] + S[i][2::2] + ' ' + S[i][1::2])
| t = int(input())
s = list()
for i in range(T):
S.append(str(input()))
for i in range(len(S)):
print(S[i][0] + S[i][2::2] + ' ' + S[i][1::2]) |
#
# PySNMP MIB module A3COM0420-SWITCH-EXTENSIONS (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM0420-SWITCH-EXTENSIONS
# Produced by pysmi-0.3.4 at Mon Apr 29 16:54:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... | (brasica2,) = mibBuilder.importSymbols('A3COM0004-GENERIC', 'brasica2')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constrain... |
L = int(input())
R = int(input())
xor = L ^ R
max_xor = 1
while xor:
xor >>= 1
max_xor <<= 1
print (max_xor-1)
| l = int(input())
r = int(input())
xor = L ^ R
max_xor = 1
while xor:
xor >>= 1
max_xor <<= 1
print(max_xor - 1) |
# microbit-module: shared_config@0.1.0
RADIO_CHANNEL = 17
MSG_DEYLAY = 50
| radio_channel = 17
msg_deylay = 50 |
# Invert a binary tree.
# Input:
# 4
# / \
# 2 7
# / \ / \
# 1 3 6 9
#
# Output:
# 4
# / \
# 7 2
# / \ / \
# 9 6 3 1
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
class Solution:
def invertTree... | class Treenode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
class Solution:
def invert_tree(self, node: TreeNode) -> TreeNode:
if not node:
return None
(node.left, node.right) = (self.invertTree(node.right), self.invertTree(no... |
def roundUp(number:float)->int:
split = [int(i) for i in str(number).split(".")]
if split[1] >0:
return split[0]+1
return split[0]
## Program Start ##
n, k = [int(i) for i in input().strip().split(" ")][-2:]
scores = sorted([int(i) for i in input().strip().split(" ")])
min_days = roundUp(n/k)
ou... | def round_up(number: float) -> int:
split = [int(i) for i in str(number).split('.')]
if split[1] > 0:
return split[0] + 1
return split[0]
(n, k) = [int(i) for i in input().strip().split(' ')][-2:]
scores = sorted([int(i) for i in input().strip().split(' ')])
min_days = round_up(n / k)
output = 0
for... |
class StackOfPlates(object):
def __init__(self):
self.stack = []
self.capacity = 10
def push(self, item):
if self.stack and self.stack[-1].length() < 10:
self.stack[-1].push(item)
else:
new_stack = Stack()
new_stack.push(item)
sel... | class Stackofplates(object):
def __init__(self):
self.stack = []
self.capacity = 10
def push(self, item):
if self.stack and self.stack[-1].length() < 10:
self.stack[-1].push(item)
else:
new_stack = stack()
new_stack.push(item)
sel... |
"""
This module will be transformed... into something far greater.
"""
a = "Hello"
msg = f"{a} World"
msg2 = f"Finally, {a} World"
print(msg)
| """
This module will be transformed... into something far greater.
"""
a = 'Hello'
msg = f'{a} World'
msg2 = f'Finally, {a} World'
print(msg) |
def skipVowels(word):
novowels = ''
for ch in word:
if ch.lower() in 'aeiou':
continue
novowels += ch
novowels+=ch
return novowels
print(skipVowels('hello'))
print(skipVowels('awaited'))
| def skip_vowels(word):
novowels = ''
for ch in word:
if ch.lower() in 'aeiou':
continue
novowels += ch
novowels += ch
return novowels
print(skip_vowels('hello'))
print(skip_vowels('awaited')) |
# -*- coding: utf-8 -*-
"""
----------Phenix Labs----------
Created on Sat Jan 23 22:41:46 2021
@author: Gyan Krishna
Topic: HCF andf LCM of tow numbers
"""
a = int(input("enter first number "))
b = int(input("enter second number "))
hcf = 1
small = min(a,b)
for i in range(1,small+1):
if(a%i == 0 and b%i == 0):... | """
----------Phenix Labs----------
Created on Sat Jan 23 22:41:46 2021
@author: Gyan Krishna
Topic: HCF andf LCM of tow numbers
"""
a = int(input('enter first number '))
b = int(input('enter second number '))
hcf = 1
small = min(a, b)
for i in range(1, small + 1):
if a % i == 0 and b % i == 0:
hcf = i
lcm... |
class orf(object):
""" Class that represents and Open Reading Frame
Attributes:
start (int): Start codon coordinate of the ORF in the parent sequence
stop (int): Stop codon coordinate of the ORF in the parent sequence
length (int): Number of aminoacids in the ORF
translation (str... | class Orf(object):
""" Class that represents and Open Reading Frame
Attributes:
start (int): Start codon coordinate of the ORF in the parent sequence
stop (int): Stop codon coordinate of the ORF in the parent sequence
length (int): Number of aminoacids in the ORF
translation (str... |
"""
Test cases for 7.py found in the LeetCode folder.
Answer by @VGZELDA
"""
# function to be tested
def reverse(x):
x=int(x)
if(x>=0):
x=str(x)
x=x[::-1]
x=int(x)
if(x<-1*(2**31))or(x>=2**31):
return 0
else:
ret... | """
Test cases for 7.py found in the LeetCode folder.
Answer by @VGZELDA
"""
def reverse(x):
x = int(x)
if x >= 0:
x = str(x)
x = x[::-1]
x = int(x)
if x < -1 * 2 ** 31 or x >= 2 ** 31:
return 0
else:
return x
else:
x = x * -1
... |
DosTags = {
# System
33: "SYS_Input",
34: "SYS_Output",
35: "SYS_Asynch",
36: "SYS_UserShell",
37: "SYS_CustomShell",
# CreateNewProc
1001: "NP_SegList",
1002: "NP_FreeSegList",
1003: "NP_Entry",
1004: "NP_Input",
1005: "NP_Output",
1006: "NP_CloseInput",
1007: "N... | dos_tags = {33: 'SYS_Input', 34: 'SYS_Output', 35: 'SYS_Asynch', 36: 'SYS_UserShell', 37: 'SYS_CustomShell', 1001: 'NP_SegList', 1002: 'NP_FreeSegList', 1003: 'NP_Entry', 1004: 'NP_Input', 1005: 'NP_Output', 1006: 'NP_CloseInput', 1007: 'NP_CloseOutput', 1008: 'NP_Error', 1009: 'NP_CloseError', 1010: 'NP_CurrentDir', 1... |
# 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 findBottomLeftValue(self, root: TreeNode) -> int:
current = [root]
while True:
... | class Solution:
def find_bottom_left_value(self, root: TreeNode) -> int:
current = [root]
while True:
children = []
for node in current:
if node.left:
children.append(node.left)
if node.right:
children.a... |
#
# PySNMP MIB module CXMLPPP-IP-NCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXMLPPP-IP-NCP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:33:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_size_constraint, value_range_constraint) ... |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: Level order in a list of lists of integers
"""
def levelOrder(self, root):
# wr... | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: Level order in a list of lists of integers
"""
def level_order(self, root):
if r... |
def B():
n = int(input())
a = [int(x) for x in input().split()]
d = {i:[] for i in range(1,n+1)}
d[0]= [0,0]
for i in range(2*n):
d[a[i]].append(i)
ans = 0
for i in range(n):
a , b = d[i] , d[i+1]
ans+= min(abs(b[0]-a[0])+abs(b[1]-a[1]) , abs(b[0]-a[1])+abs(b[1]-a[0])... | def b():
n = int(input())
a = [int(x) for x in input().split()]
d = {i: [] for i in range(1, n + 1)}
d[0] = [0, 0]
for i in range(2 * n):
d[a[i]].append(i)
ans = 0
for i in range(n):
(a, b) = (d[i], d[i + 1])
ans += min(abs(b[0] - a[0]) + abs(b[1] - a[1]), abs(b[0] - ... |
# Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
# To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list.
# Note:... | class Solution(object):
def detect_cycle(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
seen = set()
cur = head
while cur:
if cur in seen:
return cur
seen.add(cur)
cur = cur.next
return N... |
line_items = [{
"invNumber": 100,
"lineNumber": 1,
"partNumber": "TU100",
"description": "TacUmbrella",
"price": 9.99
},
{
"invNumber": 100,
"lineNumber": 2,
"partNumber": "TLB9000",
"description": "TacLunch... | line_items = [{'invNumber': 100, 'lineNumber': 1, 'partNumber': 'TU100', 'description': 'TacUmbrella', 'price': 9.99}, {'invNumber': 100, 'lineNumber': 2, 'partNumber': 'TLB9000', 'description': 'TacLunchbox 9000', 'price': 19.99}, {'invNumber': 101, 'lineNumber': 1, 'partNumber': 'TPJ5', 'description': 'TacPajamas', '... |
class ResizeError(Exception):
pass
def codelengths_from_frequencies(freqs):
freqs = sorted(freqs.items(),
key=lambda item: (item[1], -item[0]), reverse=True)
nodes = [Node(char=key, weight=value) for (key, value) in freqs]
while len(nodes) > 1:
right, left = nodes.pop(), nodes.pop()
... | class Resizeerror(Exception):
pass
def codelengths_from_frequencies(freqs):
freqs = sorted(freqs.items(), key=lambda item: (item[1], -item[0]), reverse=True)
nodes = [node(char=key, weight=value) for (key, value) in freqs]
while len(nodes) > 1:
(right, left) = (nodes.pop(), nodes.pop())
... |
class ContentTransformer:
def transform(content):
raise NotImplementedError()
@classmethod
def from_siteinfo(cls, siteinfo, *args, **kwargs):
raise NotImplementedError()
| class Contenttransformer:
def transform(content):
raise not_implemented_error()
@classmethod
def from_siteinfo(cls, siteinfo, *args, **kwargs):
raise not_implemented_error() |
ports_assignment = { "rs1_rs2" : 6004, "rs1_receive_bgp_messages" : 6000 , "rs1_send_mpc_output" : 6001 , "worker_port" : 7760, "rs2_receive_bgp_messages" : 6002, "rs2_send_mpc_output" : 6003, "rs1-preference-channel" : 6005, "rs2-preference-channel" : 6006}
#process_assignement = {"rs1" : '192.168.102.2',"rs2" : '192... | ports_assignment = {'rs1_rs2': 6004, 'rs1_receive_bgp_messages': 6000, 'rs1_send_mpc_output': 6001, 'worker_port': 7760, 'rs2_receive_bgp_messages': 6002, 'rs2_send_mpc_output': 6003, 'rs1-preference-channel': 6005, 'rs2-preference-channel': 6006}
process_assignement = {'rs1': 'localhost', 'rs2': 'localhost'} |
# DAN KABAGAMBE
# TUMUSIIME FRANCIS
# NAKUYA SHAKIRAH HADIJJAH
total = 0
count = 0
smallest = None
largest = None
# Finding the largest and smallest
while True:
a = input('Enter a number:')
try:
a = int(a)
count = count + 1
total = total + a
if smallest is None:
... | total = 0
count = 0
smallest = None
largest = None
while True:
a = input('Enter a number:')
try:
a = int(a)
count = count + 1
total = total + a
if smallest is None:
smallest = a
elif a < smallest:
smallest = a
if largest is None:
... |
DASHBOARD = 'mydashboard'
DISABLED = False
ADD_INSTALLED_APPS = [
'openstack_dashboard.dashboards.mydashboard',
] | dashboard = 'mydashboard'
disabled = False
add_installed_apps = ['openstack_dashboard.dashboards.mydashboard'] |
def test13(a, b):
"""Test for Docstring"""
a.b[1]
ziffern = "0123456789"
ziffern[a:b]
| def test13(a, b):
"""Test for Docstring"""
a.b[1]
ziffern = '0123456789'
ziffern[a:b] |
""""
Entradas
Valor_c--> float--> C
Salidas
Descuento --> float -->desc
"""
C=float(input("Digite el valor de la compra: "))
desc=(C*0.15)
#cajanegra
toaltal=(C-desc)
#Salida
print("El total a pagar es: "+str(toaltal)) | """"
Entradas
Valor_c--> float--> C
Salidas
Descuento --> float -->desc
"""
c = float(input('Digite el valor de la compra: '))
desc = C * 0.15
toaltal = C - desc
print('El total a pagar es: ' + str(toaltal)) |
class Status:
CANCELED = "CANCELED"
DECOMPRESSING = "DECOMPRESSING"
DELETED = "DELETED"
FAILED = "FAILED"
FREE = "FREE"
INITIAL_LOAD = "INITIAL_LOAD"
INVALID_FILE = "INVALID_FILE"
LOST = "LOST"
STAGE = "STAGE"
PROCESSING = "PROCESSING"
RUNNING = "RUNNING"
SUCCEEDED = "S... | class Status:
canceled = 'CANCELED'
decompressing = 'DECOMPRESSING'
deleted = 'DELETED'
failed = 'FAILED'
free = 'FREE'
initial_load = 'INITIAL_LOAD'
invalid_file = 'INVALID_FILE'
lost = 'LOST'
stage = 'STAGE'
processing = 'PROCESSING'
running = 'RUNNING'
succeeded = 'SUC... |
# -*- coding: utf-8 -*-
def test_del_first_contact(app):
app.session.login(username = "admin", password = "secret")
app.contact.delete_first_contact()
app.session.logout() | def test_del_first_contact(app):
app.session.login(username='admin', password='secret')
app.contact.delete_first_contact()
app.session.logout() |
class Person:
def __init__(self, params):
self.name = params.get('name')
self.birth_date = params.get('birth_date')
def params_str(self):
return "{{name: '{}', birth_date: '{}'}}".format(self.name, self.birth_date)
| class Person:
def __init__(self, params):
self.name = params.get('name')
self.birth_date = params.get('birth_date')
def params_str(self):
return "{{name: '{}', birth_date: '{}'}}".format(self.name, self.birth_date) |
def add_native_methods(clazz):
def getAll____(a0):
raise NotImplementedError()
def getByName0__java_lang_String__(a0, a1):
raise NotImplementedError()
def getByIndex0__int__(a0, a1):
raise NotImplementedError()
def getByInetAddress0__java_net_InetAddress__(a0, a1):
rai... | def add_native_methods(clazz):
def get_all____(a0):
raise not_implemented_error()
def get_by_name0__java_lang__string__(a0, a1):
raise not_implemented_error()
def get_by_index0__int__(a0, a1):
raise not_implemented_error()
def get_by_inet_address0__java_net__inet_address__(a0... |
'''
Description: Exercise 3 (for loop)
Version: 1.0.0.20210117
Author: Arvin Zhao
Date: 2021-01-17 17:46:34
Last Editors: Arvin Zhao
LastEditTime: 2021-01-18 10:40:04
'''
direction = input('Which direction do you want to count? (up/down)').strip().lower()
if direction == 'up':
top = int(input('Enter the top numbe... | """
Description: Exercise 3 (for loop)
Version: 1.0.0.20210117
Author: Arvin Zhao
Date: 2021-01-17 17:46:34
Last Editors: Arvin Zhao
LastEditTime: 2021-01-18 10:40:04
"""
direction = input('Which direction do you want to count? (up/down)').strip().lower()
if direction == 'up':
top = int(input('Enter the top number:... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def colorText(txt='', fgColor='', fgLine='', bgColor='', ):
txtColor = ''
if (fgLine != ''):
txtColor += '\033[4m'
if (fgColor == 'black'):
txtColor += '\033[30m'
elif (fgColor == 'red'):
txtColor += '\033[31m'
elif (fgCo... | def color_text(txt='', fgColor='', fgLine='', bgColor=''):
txt_color = ''
if fgLine != '':
txt_color += '\x1b[4m'
if fgColor == 'black':
txt_color += '\x1b[30m'
elif fgColor == 'red':
txt_color += '\x1b[31m'
elif fgColor == 'green':
txt_color += '\x1b[32m'
elif fg... |
type_dict = {
"[INFO]": "info",
"[WARNING]": "warning",
"[ERROR]": "error",
"[DEBUG]": "debug",
"START": "start",
"REPORT": "report",
"END": "end",
"DEBUG": "debug",
}
style_dict = {
"error": "bold red",
"start": "green",
"report": "dim yellow",
"debug": "bold blue",
... | type_dict = {'[INFO]': 'info', '[WARNING]': 'warning', '[ERROR]': 'error', '[DEBUG]': 'debug', 'START': 'start', 'REPORT': 'report', 'END': 'end', 'DEBUG': 'debug'}
style_dict = {'error': 'bold red', 'start': 'green', 'report': 'dim yellow', 'debug': 'bold blue', 'warning': 'yellow', 'info': 'yellow', 'end': 'cyan'}
ot... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.