content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
Python example of
http://rosettacode.org/wiki/Sorting_algorithms/Cocktail_sort_with_shifting_bounds
based on
http://rosettacode.org/wiki/Sorting_algorithms/Cocktail_sort#Python
"""
def cocktailshiftingbounds(A):
beginIdx = 0
endIdx = len(A) - 1
while beginIdx <= endIdx:
n... | """
Python example of
http://rosettacode.org/wiki/Sorting_algorithms/Cocktail_sort_with_shifting_bounds
based on
http://rosettacode.org/wiki/Sorting_algorithms/Cocktail_sort#Python
"""
def cocktailshiftingbounds(A):
begin_idx = 0
end_idx = len(A) - 1
while beginIdx <= endIdx:
new_begin_idx = ... |
# @jxvtrl #
arq = open('B:\FACULDADE\Programacao\G2\P2\Q1\paciente.txt','r')
lista = {}
for contaPacientesMedicos in arq:
pos = contaPacientesMedicos[0:-1].split(',')
c,e = pos[0],pos[2]
controle = 0
if e not in lista:
lista[e] = []
if c not in lista[e]:
lista[e].append(c)
... | arq = open('B:\\FACULDADE\\Programacao\\G2\\P2\\Q1\\paciente.txt', 'r')
lista = {}
for conta_pacientes_medicos in arq:
pos = contaPacientesMedicos[0:-1].split(',')
(c, e) = (pos[0], pos[2])
controle = 0
if e not in lista:
lista[e] = []
if c not in lista[e]:
lista[e].append(c)
for i i... |
time = raw_input().strip()
hh = time[0:2]
period = time[-2:]
if period=='AM':
if hh=='12':
newtime='00'+time[2:len(time)-2]
else:
newtime=time[0:len(time)-2]
elif period=='PM':
if hh=='12':
newtime=time[0:len(time)-2]
else:
newtime=str(int(hh) + 12)+ time[2:len(time)-2]
... | time = raw_input().strip()
hh = time[0:2]
period = time[-2:]
if period == 'AM':
if hh == '12':
newtime = '00' + time[2:len(time) - 2]
else:
newtime = time[0:len(time) - 2]
elif period == 'PM':
if hh == '12':
newtime = time[0:len(time) - 2]
else:
newtime = str(int(hh) + 12... |
# Author: @Iresharma
# https://leetcode.com/problems/maximum-subarray/
"""
Runtime: 60 ms, faster than 90.50% of Python3 online submissions for Maximum Subarray.
Memory Usage: 15 MB, less than 36.41% of Python3 online submissions for Maximum Subarray.
"""
class Solution:
def maxSubArray(self, nums: List[int]) -> ... | """
Runtime: 60 ms, faster than 90.50% of Python3 online submissions for Maximum Subarray.
Memory Usage: 15 MB, less than 36.41% of Python3 online submissions for Maximum Subarray.
"""
class Solution:
def max_sub_array(self, nums: List[int]) -> int:
if len(nums) == 0:
return None
tmpsu... |
# -*- coding: utf-8 -*-
class Solution:
def __str__(self):
return "SpeedCamera Codility Challenge"
| class Solution:
def __str__(self):
return 'SpeedCamera Codility Challenge' |
"""
filename: minutes_response.py
description: Response messages for members module.
created by: Omar De La Hoz (oed7416@rit.edu)
created on: 10/11/17
"""
class Response():
# General Responses
InvalidData = {"error": "Input data is not correct."}
PermError = {"error": "User doesn't have permissions to com... | """
filename: minutes_response.py
description: Response messages for members module.
created by: Omar De La Hoz (oed7416@rit.edu)
created on: 10/11/17
"""
class Response:
invalid_data = {'error': 'Input data is not correct.'}
perm_error = {'error': "User doesn't have permissions to complete this action."}
... |
class MockRDD:
def __init__(self, df):
self.df = df
def __iter__(self):
for index, row in self.df.iterrows():
yield row
class MockAccumulator:
def __init__(self):
self.cnt = 0
def add(self, x):
self.cnt += x | class Mockrdd:
def __init__(self, df):
self.df = df
def __iter__(self):
for (index, row) in self.df.iterrows():
yield row
class Mockaccumulator:
def __init__(self):
self.cnt = 0
def add(self, x):
self.cnt += x |
# Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.md file.
{
'targets': [
{
'target_name': 'dartino-vm',
'type': 'none',
'dependencies':... | {'targets': [{'target_name': 'dartino-vm', 'type': 'none', 'dependencies': ['src/vm/vm.gyp:dartino-vm']}, {'target_name': 'dartino-flashify', 'type': 'none', 'dependencies': ['src/vm/vm.gyp:dartino-flashify']}, {'target_name': 'c_test_library', 'type': 'none', 'dependencies': ['src/vm/vm.gyp:ffi_test_library', 'src/vm/... |
class EngineBase:
def begin(self):
return self.engine.begin()
| class Enginebase:
def begin(self):
return self.engine.begin() |
def get_deepest(courses, num=20, faculty='', existing=False):
if faculty == '':
choice = [x for x in courses.values()]
else:
choice = [x for x in courses.values() if x.faculty == faculty]
if existing:
choice = [x for x in choice if x.is_given == True]
deepest = sorted(choice... | def get_deepest(courses, num=20, faculty='', existing=False):
if faculty == '':
choice = [x for x in courses.values()]
else:
choice = [x for x in courses.values() if x.faculty == faculty]
if existing:
choice = [x for x in choice if x.is_given == True]
deepest = sorted(choice, key... |
class Mammals : #super class
def walk(self):
print("!!!!!!!!!!Can WAlk!!!!!!!!!!!!!!!")
class Dog (Mammals) : #sub class of Mammals
def Bark(self):
print("!!!!!!!!!!!!Can Bark!!!!!!!!!!!!!!")
def walk(self):
print("Dog can Walk")
class Cat (Mammals) : #sub class of Mammals
... | class Mammals:
def walk(self):
print('!!!!!!!!!!Can WAlk!!!!!!!!!!!!!!!')
class Dog(Mammals):
def bark(self):
print('!!!!!!!!!!!!Can Bark!!!!!!!!!!!!!!')
def walk(self):
print('Dog can Walk')
class Cat(Mammals):
pass
mammal = mammals()
Mammal.walk()
do = dog()
Do.walk()
Do.B... |
#!python
def linear_search(array, item):
"""return the first index of item in array or None if item is not found"""
# implement linear_search_iterative and linear_search_recursive below, then
# change this to call your implementation to verify it passes all tests
return linear_search_recursive(array, ... | def linear_search(array, item):
"""return the first index of item in array or None if item is not found"""
return linear_search_recursive(array, item)
def linear_search_iterative(array: [str], item: str):
"""
Iterative linear search function -> O(n) runtime
"""
for (index, value) in enumera... |
def media(valores):
return sum(valores) / len(valores)
def gerar_registro(linha):
registro = linha.split(';')
return {"nome": registro[0],
"cidade": registro[1],
"idade": int(registro[2]),
"renda": float(registro[3])}
if __name__ == '__main__':
assert med... | def media(valores):
return sum(valores) / len(valores)
def gerar_registro(linha):
registro = linha.split(';')
return {'nome': registro[0], 'cidade': registro[1], 'idade': int(registro[2]), 'renda': float(registro[3])}
if __name__ == '__main__':
assert media([1, 2, 3, 4, 5]) == 3.0
print(media([1, 2... |
#https://www.hackerrank.com/challenges/caesar-cipher-1/problem
n_s=input()
s=input()
n=int(input())
s1=''
for i in s:
if 65<=ord(i)<=90:
s1+=chr((ord(i)-65)+n%26+65)
elif 97<=ord(i)<=122:
s1+=chr((ord(i)-97+n)%26+97)
else:
s1+=i
print(s1) | n_s = input()
s = input()
n = int(input())
s1 = ''
for i in s:
if 65 <= ord(i) <= 90:
s1 += chr(ord(i) - 65 + n % 26 + 65)
elif 97 <= ord(i) <= 122:
s1 += chr((ord(i) - 97 + n) % 26 + 97)
else:
s1 += i
print(s1) |
class Solution:
def maxDepth(self, s: str) -> int:
"""String.
Running time: O(n) where n == len(s).
"""
res = 0
n = 0
for i in s:
if i == '(':
n += 1
res = max(res, n)
elif i == ')':
n -= 1
... | class Solution:
def max_depth(self, s: str) -> int:
"""String.
Running time: O(n) where n == len(s).
"""
res = 0
n = 0
for i in s:
if i == '(':
n += 1
res = max(res, n)
elif i == ')':
n -= 1
... |
#
# PySNMP MIB module CYCLADES-ACS-PM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CYCLADES-ACS-PM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:34:21 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
def print_pyramid(num):
"""
>>> print_pyramid(5)
o
oo
ooo
oooo
ooooo
>>> print_pyramid(3)
o
oo
ooo
"""
for num in range(num):
line = 'o'
for num in range(num):
line += 'o'
print(line)
| def print_pyramid(num):
"""
>>> print_pyramid(5)
o
oo
ooo
oooo
ooooo
>>> print_pyramid(3)
o
oo
ooo
"""
for num in range(num):
line = 'o'
for num in range(num):
line += 'o'
print(line) |
MASTER = {
"role": "master",
"labels": {
"monitor": "true", "memsql": "true", "postgres": "true", "sw-volume": 'true', "seaweedfs-postgres": "true"
}
}
NODE = {
"role": "node"
} | master = {'role': 'master', 'labels': {'monitor': 'true', 'memsql': 'true', 'postgres': 'true', 'sw-volume': 'true', 'seaweedfs-postgres': 'true'}}
node = {'role': 'node'} |
# (n/2)(2a+(n-1)d)
def gcd(num1, num2):
res = 0
while True:
remainder = num1 % num2
if remainder != 0:
num1 = num2
num2 = remainder
else:
res = num2
break
return res
def lcm(num1, num2):
mul = num1*num2
return mul/gcd(num1, nu... | def gcd(num1, num2):
res = 0
while True:
remainder = num1 % num2
if remainder != 0:
num1 = num2
num2 = remainder
else:
res = num2
break
return res
def lcm(num1, num2):
mul = num1 * num2
return mul / gcd(num1, num2)
def find_su... |
# -*- coding:utf-8 -*-
# https://leetcode.com/problems/add-binary/description/
class Solution(object):
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
a = map(int, a[::-1])
b = map(int, b[::-1])
if len(a) < len(b):
... | class Solution(object):
def add_binary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
a = map(int, a[::-1])
b = map(int, b[::-1])
if len(a) < len(b):
(a, b) = (b, a)
(len_a, len_b) = (len(a), len(b))
for i in ra... |
# List slicing
friends = ["Harry", "Tom", "Rohan", "Sam", "Divya", 45]
print(friends[0:4])
print(friends[-4:])
| friends = ['Harry', 'Tom', 'Rohan', 'Sam', 'Divya', 45]
print(friends[0:4])
print(friends[-4:]) |
__author__ = 'ruddra'
'''
Dummy configuration, so change it with your own
'''
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'test@gmail.com'
SERVER_EMAIL = 'test@gmail.com'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'test@gmail.com'
EMAIL_HOST_PASSWORD = 'test'
EMAIL_BACKEND = 'django.core.mail.backe... | __author__ = 'ruddra'
'\nDummy configuration, so change it with your own\n'
email_use_tls = True
default_from_email = 'test@gmail.com'
server_email = 'test@gmail.com'
email_host = 'smtp.gmail.com'
email_port = 587
email_host_user = 'test@gmail.com'
email_host_password = 'test'
email_backend = 'django.core.mail.backends... |
def fib(a=0, b=1):
a, b = b, a + b
if a % 2 == 0:
return fib(a, b) + a
if b >= 40_00_000:
return 0
return fib(a, b)
print(fib())
| def fib(a=0, b=1):
(a, b) = (b, a + b)
if a % 2 == 0:
return fib(a, b) + a
if b >= 4000000:
return 0
return fib(a, b)
print(fib()) |
class Solution:
def selfDividingNumbers(self, left: int, right: int) -> List[int]:
array = []
for num in range(left, right+1):
temp = num
flag = True
while temp > 0:
r = temp % 10
if r != 0 and num%r == 0:
temp /... | class Solution:
def self_dividing_numbers(self, left: int, right: int) -> List[int]:
array = []
for num in range(left, right + 1):
temp = num
flag = True
while temp > 0:
r = temp % 10
if r != 0 and num % r == 0:
... |
def separate_first_degree(equ):
split_equ = equ.split(' ')
a = b = 0
if len(split_equ) == 2:
n1 = split_equ[0]
n2 = split_equ[1]
pos = n1.find('x')
if pos == 0 or n1[pos - 1] == '+': # +1 is implied
a = 1
elif n1[pos - 1] == '-': # -1 is implied
... | def separate_first_degree(equ):
split_equ = equ.split(' ')
a = b = 0
if len(split_equ) == 2:
n1 = split_equ[0]
n2 = split_equ[1]
pos = n1.find('x')
if pos == 0 or n1[pos - 1] == '+':
a = 1
elif n1[pos - 1] == '-':
a = -1
else:
... |
"""
A collection of helper functions for the DataGenerator classes
"""
| """
A collection of helper functions for the DataGenerator classes
""" |
CLUB_NAME = "UWA Ethical Hacking Club"
CURRENT_YEAR = 2019
COLOR_INFO = 5347285
COLOR_SUCCESS = 2664261
COLOR_DANGER = 14431557
COLOR_WARNING = 16761095
WEDNESDAY = 2
DEFAULT_LOCATION = "G01 at CSSE" | club_name = 'UWA Ethical Hacking Club'
current_year = 2019
color_info = 5347285
color_success = 2664261
color_danger = 14431557
color_warning = 16761095
wednesday = 2
default_location = 'G01 at CSSE' |
"""
Entradas
salario=>int=>s
ventas departamento 1-->int-->vd1
ventas departamento 2-->int-->vd2
ventas departamento 3-->int-->vd3
salidas
venta total mes departamentos-->int-->ventotal
"""
s=int(input("ingrese salario "))
vd1=int(input("ingrese ventas echas "))
vd2=int(input("ingrese ventas echas "))
vd3=int(input("in... | """
Entradas
salario=>int=>s
ventas departamento 1-->int-->vd1
ventas departamento 2-->int-->vd2
ventas departamento 3-->int-->vd3
salidas
venta total mes departamentos-->int-->ventotal
"""
s = int(input('ingrese salario '))
vd1 = int(input('ingrese ventas echas '))
vd2 = int(input('ingrese ventas echas '))
vd3 = int(i... |
SECRET_KEY = '4w9hda)ra9drvx^+y(eohk_59-35jejud^b_#9^vajx*+h^m-l'
EMAIL_HOST = 'mailsrv-01.va.mk'
EMAIL_HOST_USER='no-reply@va.mk'
EMAIL_HOST_PASSWORD='vZ5KDjmB2n'
DEFAULT_FROM_EMAIL = 'VapourApps Notification <no-reply@va.mk>'
SERVER_EMAIL = 'no-reply@va.mk'
| secret_key = '4w9hda)ra9drvx^+y(eohk_59-35jejud^b_#9^vajx*+h^m-l'
email_host = 'mailsrv-01.va.mk'
email_host_user = 'no-reply@va.mk'
email_host_password = 'vZ5KDjmB2n'
default_from_email = 'VapourApps Notification <no-reply@va.mk>'
server_email = 'no-reply@va.mk' |
# automatically generated by setup.py:get_scm_config()
__version__ = "0.0.3"
__git_revision__ = "2196f14"
| __version__ = '0.0.3'
__git_revision__ = '2196f14' |
class Event():
def __init__(self, uuid: str, date: str, time: str, event_type: str):
self._uuid = uuid
self._date = date
self._time = time
self._event_type = event_type
def __str__(self):
return ' '.join([str(self.uuid), str(self.date), str(self.time),
... | class Event:
def __init__(self, uuid: str, date: str, time: str, event_type: str):
self._uuid = uuid
self._date = date
self._time = time
self._event_type = event_type
def __str__(self):
return ' '.join([str(self.uuid), str(self.date), str(self.time), str(self.event_type... |
IMG_GROUP_TEST_BLURB = {
"label_hash": "5fbba385-4918-4eee-85a8-8b7a2e71dd16",
"data_title": "image-group-f5ef4",
"data_type": "img_group",
"data_units": {
"76888dd3-1160-4ba9-a638-dacb92e54e3c": {
"data_hash": "76888dd3-1160-4ba9-a638-dacb92e54e3c",
"data_title": "apple1... | img_group_test_blurb = {'label_hash': '5fbba385-4918-4eee-85a8-8b7a2e71dd16', 'data_title': 'image-group-f5ef4', 'data_type': 'img_group', 'data_units': {'76888dd3-1160-4ba9-a638-dacb92e54e3c': {'data_hash': '76888dd3-1160-4ba9-a638-dacb92e54e3c', 'data_title': 'apple10.jpg', 'data_link': '', 'data_type': 'image/jpg', ... |
"""
find unique element from an array.
abuse recursion.
"""
global st
def unique(s,start,stop, st):
# base case
st = 0
if stop - start <= 1:
return True
elif not unique(s, start, stop-1, st+1):
return False
elif not unique(s, start+1, stop, st+1):
return False
else:
... | """
find unique element from an array.
abuse recursion.
"""
global st
def unique(s, start, stop, st):
st = 0
if stop - start <= 1:
return True
elif not unique(s, start, stop - 1, st + 1):
return False
elif not unique(s, start + 1, stop, st + 1):
return False
else:
re... |
"""permissions exceptions"""
class ImproperlyConfigured(Exception):
pass
class ParentNotFound(Exception):
pass
class RoleNotFound(Exception):
pass
class InvalidRoleAssignment(Exception):
pass
class InvalidPermissionAssignment(Exception):
pass
class NotAllowed(Exception):
pass
| """permissions exceptions"""
class Improperlyconfigured(Exception):
pass
class Parentnotfound(Exception):
pass
class Rolenotfound(Exception):
pass
class Invalidroleassignment(Exception):
pass
class Invalidpermissionassignment(Exception):
pass
class Notallowed(Exception):
pass |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def scrabbleWords():
http_archive(
name="scrabble_words" ,
build_file="//bazel/deps/scrabble_words:build.BUILD" ,
... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def scrabble_words():
http_archive(name='scrabble_words', build_file='//bazel/deps/scrabble_words:build.BUILD', sha256='42514a4e7d409e8ed45fbfb13539a7d1d87693e4e1d78c92531e4f24766c42c4', strip_prefix='scrabble_words-28a758a38c44baa5cd299d857dc395... |
project = "asyncache"
version = "0.1.1"
release = version
extensions = ["sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.doctest"]
exclude_patterns = ["_build"]
master_doc = "index"
html_theme = "sphinx_rtd_theme"
| project = 'asyncache'
version = '0.1.1'
release = version
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.doctest']
exclude_patterns = ['_build']
master_doc = 'index'
html_theme = 'sphinx_rtd_theme' |
R, G, B, N = map(int, input().split())
cnt = 0
for r in range(N + 1):
for g in range(N + 1):
b = N - (r * R + g * G)
if b >= 0 and b % B == 0:
cnt += 1
print(cnt)
| (r, g, b, n) = map(int, input().split())
cnt = 0
for r in range(N + 1):
for g in range(N + 1):
b = N - (r * R + g * G)
if b >= 0 and b % B == 0:
cnt += 1
print(cnt) |
class PredictPower(BaseTransformer):
'''
Predict freezer power usage from ambient temperature, humidity & hour of day V7
'''
def __init__(self, temperature, humidity, hourofday, predictedpower = 'predictedpower'):
self.temperature = temperature
self.humidity = humidity
self.... | class Predictpower(BaseTransformer):
"""
Predict freezer power usage from ambient temperature, humidity & hour of day V7
"""
def __init__(self, temperature, humidity, hourofday, predictedpower='predictedpower'):
self.temperature = temperature
self.humidity = humidity
self.hourof... |
def leap_year(year):
try:
year = int(year)
if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")
except ValueError:
print("Year should be in numbers")
# Example
leap_year(20... | def leap_year(year):
try:
year = int(year)
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
print(f'{year} is a leap year.')
else:
print(f'{year} is not a leap year.')
except ValueError:
print('Year should be in numbers')
leap_year(2000) |
class Solution:
def hasPathSum(self, root: Optional[TreeNode], target: int) -> bool:
def dfs (node ,cur) :
if not node : return False
cur += node.val
if not node.left and not node.right :
return cur == target
return dfs(node.left , cur) or ... | class Solution:
def has_path_sum(self, root: Optional[TreeNode], target: int) -> bool:
def dfs(node, cur):
if not node:
return False
cur += node.val
if not node.left and (not node.right):
return cur == target
return dfs(node.l... |
class Solution(object):
def shortestDistance(self, maze, start, destination):
"""
:type maze: List[List[int]]
:type start: List[int]
:type destination: List[int]
:rtype: int
"""
n = len(maze)
m = len(maze[0])
distance = [[float('inf')]*m for _ ... | class Solution(object):
def shortest_distance(self, maze, start, destination):
"""
:type maze: List[List[int]]
:type start: List[int]
:type destination: List[int]
:rtype: int
"""
n = len(maze)
m = len(maze[0])
distance = [[float('inf')] * m fo... |
class Extension:
'''
Returns filename with corresponding extensions
'''
# file lists
hdfs_files_list = ['hdfs', 'core', 'yarn', 'mapred', 'ssl_client', 'ssl_server']
hbase_files_list = ['hbase']
zookeeper_files_list = ['zoo']
spark_files_list = ['spark_defaults', 'spark_env']
es_fil... | class Extension:
"""
Returns filename with corresponding extensions
"""
hdfs_files_list = ['hdfs', 'core', 'yarn', 'mapred', 'ssl_client', 'ssl_server']
hbase_files_list = ['hbase']
zookeeper_files_list = ['zoo']
spark_files_list = ['spark_defaults', 'spark_env']
es_files_list = ['elasti... |
print(type(True))
# <class 'bool'>
print(type(False))
# <class 'bool'>
print(issubclass(bool, int))
# True
print(True == 1)
# True
print(False == 0)
# True
print(True + True)
# 2
print(True * 10)
# 10
print(sum([True, False, True]))
# 2
l = [0, 1, 2, 3, 4]
print([i > 2 for i in l])
# [False, False, False, True... | print(type(True))
print(type(False))
print(issubclass(bool, int))
print(True == 1)
print(False == 0)
print(True + True)
print(True * 10)
print(sum([True, False, True]))
l = [0, 1, 2, 3, 4]
print([i > 2 for i in l])
print(sum((i > 2 for i in l)))
if 'abc':
print('True!')
print(int(True))
print(int(False))
print(floa... |
address=input()
with open(address,'rb') as f:
l=len(address)-1
while True:
if address[l]=='.':break
elif l==0:
print("file name error")
break
l-=1
with open(address[:l]+' - copy'+address[l:len(address)],'wb') as goalfile:
goalfile.write(f.read())
print... | address = input()
with open(address, 'rb') as f:
l = len(address) - 1
while True:
if address[l] == '.':
break
elif l == 0:
print('file name error')
break
l -= 1
with open(address[:l] + ' - copy' + address[l:len(address)], 'wb') as goalfile:
... |
# -*- coding: utf-8 -*- #?????
'Copyright (c) 2019 Jacob Colin Stucki III, All Rights Reserved.'
class Dictionary(object):
"""yes"""
def __init__(self, name = None, type = None, fileList = None):
self.name = name
self.type = type #JSON, \n file, text file, etc. MySQL
self.fileList = fil... | """Copyright (c) 2019 Jacob Colin Stucki III, All Rights Reserved."""
class Dictionary(object):
"""yes"""
def __init__(self, name=None, type=None, fileList=None):
self.name = name
self.type = type
self.fileList = fileList
def get_name(self):
got_name = self.name
re... |
class BaseAgent:
def __init__(self, name=""):
"""Abstract class which represents the agent.
Args:
name: the name of the agent
Attributes:
name: the name of the agent
"""
self.name = name
def set_player_id(self, player_id):
"""Set player'... | class Baseagent:
def __init__(self, name=''):
"""Abstract class which represents the agent.
Args:
name: the name of the agent
Attributes:
name: the name of the agent
"""
self.name = name
def set_player_id(self, player_id):
"""Set player... |
"""
Write a function that accepts a string and a character.
The function should remove all occurrences of the given character from the input string and return the string.
Example:
input_string = 'technique'
char = 'e'
Expected output = 'tchniqu'
"""
def remove_char(input_string, char):
new_str = ""
for i ... | """
Write a function that accepts a string and a character.
The function should remove all occurrences of the given character from the input string and return the string.
Example:
input_string = 'technique'
char = 'e'
Expected output = 'tchniqu'
"""
def remove_char(input_string, char):
new_str = ''
for i ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 13 21:14:18 2020
"""
class Country:
def __init__(self, cName, continent, life_m, life_f):
self.__country = cName
self.__continent = continent
self.__life_male = life_m
self.__life_female = life_f
def getC... | """
Created on Sun Dec 13 21:14:18 2020
"""
class Country:
def __init__(self, cName, continent, life_m, life_f):
self.__country = cName
self.__continent = continent
self.__life_male = life_m
self.__life_female = life_f
def get_country(self):
return self.__country
... |
class Validator:
@staticmethod
def validate_request(req_message):
if Validator.check_if_all_keys_in(req_message, 'id', 'message'):
if type(req_message['id']) is str and type(req_message['message']) is str:
if len(req_message['id']) > 0 and len(req_message['message']) > 0:
... | class Validator:
@staticmethod
def validate_request(req_message):
if Validator.check_if_all_keys_in(req_message, 'id', 'message'):
if type(req_message['id']) is str and type(req_message['message']) is str:
if len(req_message['id']) > 0 and len(req_message['message']) > 0:
... |
"""Errors and Warnings."""
class S2ReaderIOError(IOError):
"""Raised if an expected file cannot be found."""
class S2ReaderMetadataError(Exception):
"""Raised if metadata structure is not as expected."""
| """Errors and Warnings."""
class S2Readerioerror(IOError):
"""Raised if an expected file cannot be found."""
class S2Readermetadataerror(Exception):
"""Raised if metadata structure is not as expected.""" |
'''class student:
pass
s1 = student()
print(id(s1)) #id func is used to get the address of the object.'''
class student:
def __init__(self):
self.name = "Navin"
self.age = 28
def compare(self,s2): #here self points to s1
if self.age == s2.age:
return True
... | """class student:
pass
s1 = student()
print(id(s1)) #id func is used to get the address of the object."""
class Student:
def __init__(self):
self.name = 'Navin'
self.age = 28
def compare(self, s2):
if self.age == s2.age:
return True
else:
return ... |
# Produce command matching code fragment optimized for reduced instruction count - output to stdout
commands = [
('LRS', 'Long Range Scan'),
('MOV', 'Micro Jump Drive in sector'),
('JMP', 'JuMP to a nearby sector'),
('PAC', 'Fire Particle Cannon'),
('AMM', 'Fire AntiMatter Missiles'),
('SDN', '... | commands = [('LRS', 'Long Range Scan'), ('MOV', 'Micro Jump Drive in sector'), ('JMP', 'JuMP to a nearby sector'), ('PAC', 'Fire Particle Cannon'), ('AMM', 'Fire AntiMatter Missiles'), ('SDN', 'Shields DowN'), ('SUP', 'Shields UP'), ('RPR', 'RePaiR damage'), ('RSP', 'ReSuPply'), ('STA', 'STAtus report'), ('YLO', 'Cheat... |
def main():
number = input('Give an integer: ')
number = int(number)
if (number)<0:
print('The absolute value of %i is %i' %(number, number*-1))
else:
print('The absolute value of %i is %i' %(number, number*1))
if __name__=="__main__":
main()
| def main():
number = input('Give an integer: ')
number = int(number)
if number < 0:
print('The absolute value of %i is %i' % (number, number * -1))
else:
print('The absolute value of %i is %i' % (number, number * 1))
if __name__ == '__main__':
main() |
class Config:
def __init__(self):
"""
Flaskerk configuration
"""
self.name = 'docs'
#: url path for docs
self.endpoint = '/docs/'
self.url_prefix = None
self.template_folder = 'templates'
#: openapi spec file name
self.filename = 'opena... | class Config:
def __init__(self):
"""
Flaskerk configuration
"""
self.name = 'docs'
self.endpoint = '/docs/'
self.url_prefix = None
self.template_folder = 'templates'
self.filename = 'openapi.json'
self.openapi_veresion = '3.0.2'
self.... |
minhaVar = 'ana'
minha_var = 'aninha'
_minhavar = 'anusa'
minhavar = 'cesio'
MINHAVAR = 'austin'
minhavar2 = ' belmiro'
print (minhaVar)
print (minha_var)
print (_minhavar )
print (minhavar)
print (MINHAVAR)
print (minhavar2) | minha_var = 'ana'
minha_var = 'aninha'
_minhavar = 'anusa'
minhavar = 'cesio'
minhavar = 'austin'
minhavar2 = ' belmiro'
print(minhaVar)
print(minha_var)
print(_minhavar)
print(minhavar)
print(MINHAVAR)
print(minhavar2) |
class add:
x = 5 + 5 +5 *6
ob = add()
print(ob.x)
| class Add:
x = 5 + 5 + 5 * 6
ob = add()
print(ob.x) |
list=[2,5,9,6,8,4,1]
val= 7
def insertShiftArray(arr,val):
new_array=[0 for i in range (len(arr)+1)]
for i in range (len(arr)+1):
if i == len(arr)//2:
new_array[i]=val
elif i > len(arr)//2:
new_array[i]=arr[i-1]
else:
new_array[i]=arr[i]
print(new_array)
in... | list = [2, 5, 9, 6, 8, 4, 1]
val = 7
def insert_shift_array(arr, val):
new_array = [0 for i in range(len(arr) + 1)]
for i in range(len(arr) + 1):
if i == len(arr) // 2:
new_array[i] = val
elif i > len(arr) // 2:
new_array[i] = arr[i - 1]
else:
new_arr... |
ERRORS = {
'AudioFormatNotAcceptableError': {
'message': 'Cannot transcode to audio format requested in Accept header',
'status': 406
}
}
class AudioFormatNotAcceptableError(Exception):
'''Exception raised when the Accept headers of a request for an
audio file stream do not match any ... | errors = {'AudioFormatNotAcceptableError': {'message': 'Cannot transcode to audio format requested in Accept header', 'status': 406}}
class Audioformatnotacceptableerror(Exception):
"""Exception raised when the Accept headers of a request for an
audio file stream do not match any type we can convert to"""
... |
platsannons_mappings = {
"settings": {
"analysis": {
"analyzer": {
"simple_word_splitter": {
"type": "custom",
"tokenizer": "whitespace",
"filter": ["lowercase"],
"char_filter": ["punctuation_filter"]... | platsannons_mappings = {'settings': {'analysis': {'analyzer': {'simple_word_splitter': {'type': 'custom', 'tokenizer': 'whitespace', 'filter': ['lowercase'], 'char_filter': ['punctuation_filter']}, 'wildcard_prefix': {'type': 'custom', 'tokenizer': 'whitespace', 'filter': ['lowercase', 'edgengram_filter'], 'char_filter... |
def generate_n_chars(n, c):
result = ''
for i in range(n):
result += c
return result
print(generate_n_chars(3, 'c')) | def generate_n_chars(n, c):
result = ''
for i in range(n):
result += c
return result
print(generate_n_chars(3, 'c')) |
"""
Memory module
"""
MEMORY_SIZE = 4096
PROGRAM_COUNTER_START: int = 0x200
# Emulator variables
FONTSET = [
0xF0, 0x90, 0x90, 0x90, 0xF0, # 0
0x20, 0x60, 0x20, 0x20, 0x70, # 1
0xF0, 0x10, 0xF0, 0x80, 0xF0, # 2
0xF0, 0x10, 0xF0, 0x10, 0xF0, # 3
0x90, 0x90, 0xF0, 0x10, 0x10, # 4
0xF0, 0x8... | """
Memory module
"""
memory_size = 4096
program_counter_start: int = 512
fontset = [240, 144, 144, 144, 240, 32, 96, 32, 32, 112, 240, 16, 240, 128, 240, 240, 16, 240, 16, 240, 144, 144, 240, 16, 16, 240, 128, 240, 16, 240, 240, 128, 240, 144, 240, 240, 16, 32, 64, 64, 240, 144, 240, 144, 240, 240, 144, 240, 16, 240, ... |
def pytest_addoption(parser):
parser.addoption('--gulp_path', default='')
def pytest_generate_tests(metafunc):
if 'gulp_path' in metafunc.fixturenames:
gulp_path = metafunc.config.getoption('gulp_path')
metafunc.parametrize('gulp_path', [gulp_path])
| def pytest_addoption(parser):
parser.addoption('--gulp_path', default='')
def pytest_generate_tests(metafunc):
if 'gulp_path' in metafunc.fixturenames:
gulp_path = metafunc.config.getoption('gulp_path')
metafunc.parametrize('gulp_path', [gulp_path]) |
APARTMENT_ABOUT = ["Hey there I'm looking for roomates!",
"Best apartment in the city!",
"Looking for female roomates!",
"Relevant only for 30+ years old!",
"We love CATS!",
"Pizza it's a must!",
"Maccabi o... | apartment_about = ["Hey there I'm looking for roomates!", 'Best apartment in the city!', 'Looking for female roomates!', 'Relevant only for 30+ years old!', 'We love CATS!', "Pizza it's a must!", 'Maccabi or nothing', 'We are geeks!', 'Student zone', 'Lets go! JOIN US', 'Unicorn lovers', 'Hey thereWe are looking for yo... |
class Phase:
def __init__(self, previous_phase=None, next_phase=None):
self._previous_phase = previous_phase
self._next_phase = next_phase
@property
def previous_phase(self):
return self._previous_phase
@previous_phase.setter
def previous_phase(self, value):
if val... | class Phase:
def __init__(self, previous_phase=None, next_phase=None):
self._previous_phase = previous_phase
self._next_phase = next_phase
@property
def previous_phase(self):
return self._previous_phase
@previous_phase.setter
def previous_phase(self, value):
if val... |
def factors(n):
results = []
for k in range(1, n+1):
if n % k == 0:
results.append(k)
return results
if __name__ == "__main__":
print(factors(100)) | def factors(n):
results = []
for k in range(1, n + 1):
if n % k == 0:
results.append(k)
return results
if __name__ == '__main__':
print(factors(100)) |
#%%
"""
- Multiply Strings
- https://leetcode.com/problems/multiply-strings/
- Medium
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Example 1:
Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:
Input: num1 = "123", num2 = "... | """
- Multiply Strings
- https://leetcode.com/problems/multiply-strings/
- Medium
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Example 1:
Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:
Input: num1 = "123", num2 = "456"... |
# /$$$$$$$ /$$ /$$ /$$
# | $$__ $$ | $$ | $$ /$ | $$
# | $$ \ $$ /$$$$$$ /$$$$$$$| $$ /$$ /$$$$$$ /$$$$$$ | $$ /$$$| $$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$
# | $$ | $$ /$$__ $$ /$$_____/| $... | version = (1, 3, 5)
__version__ = '.'.join(map(str, VERSION)) |
#!/usr/bin/env python
texVariableTypeNames =\
[
"RWTexture1D",
"RWTexture1DArray",
"RWTexture2D",
"RWTexture2DArray",
"RWTextureCube",
"RWTextureCubeArray",
"RWTexture3D",
"RWTexture2DMS",
"RWTexture2DMSArray"
]
pixelFormatTypes =\
[
"unorm float",
"unorm float2",
"unorm float3",
"unorm float4",
"snorm... | tex_variable_type_names = ['RWTexture1D', 'RWTexture1DArray', 'RWTexture2D', 'RWTexture2DArray', 'RWTextureCube', 'RWTextureCubeArray', 'RWTexture3D', 'RWTexture2DMS', 'RWTexture2DMSArray']
pixel_format_types = ['unorm float', 'unorm float2', 'unorm float3', 'unorm float4', 'snorm float', 'snorm float2', 'snorm float4'... |
# common settings for results analysis
AMT_FILE = 'batch_results/100_sentence_9_error_detection.csv'
AMT_SENTENCE_BATCH = 'batch_input/amt_sentence_batch.csv'
AMT_FCE_M2 = 'experiment_output_m2/fce_amt.experiment_two.max.rasp.m2'
TRAINING_DATA_FILE = 'fce_data_sets/fce_train.gold.max.rasp.old_cat.m2'
RESPONSE_COUNT = 9... | amt_file = 'batch_results/100_sentence_9_error_detection.csv'
amt_sentence_batch = 'batch_input/amt_sentence_batch.csv'
amt_fce_m2 = 'experiment_output_m2/fce_amt.experiment_two.max.rasp.m2'
training_data_file = 'fce_data_sets/fce_train.gold.max.rasp.old_cat.m2'
response_count = 9
accuracy_labels = {'xlabel': 'number o... |
'''
n=int(input("N= "))
x=range(2,n+1)
total=0
for item in x:
total=total+item
print(total)
'''
a=int(input("A= "))
b=int(input("B= "))
x=range(a,b+1,1)
total=0
for item in x:
print(item,end=",")
total=total+item
print(total)
| """
n=int(input("N= "))
x=range(2,n+1)
total=0
for item in x:
total=total+item
print(total)
"""
a = int(input('A= '))
b = int(input('B= '))
x = range(a, b + 1, 1)
total = 0
for item in x:
print(item, end=',')
total = total + item
print(total) |
# -*- coding: utf-8 -*-
class BaseTopology(object):
def deploy_first_steps(self):
raise NotImplementedError()
def deploy_last_steps(self):
raise NotImplementedError()
def monitoring_steps(self):
return (
'workflow.steps.util.deploy.create_zabbix.CreateZabbix',
... | class Basetopology(object):
def deploy_first_steps(self):
raise not_implemented_error()
def deploy_last_steps(self):
raise not_implemented_error()
def monitoring_steps(self):
return ('workflow.steps.util.deploy.create_zabbix.CreateZabbix', 'workflow.steps.util.deploy.create_dbmoni... |
""" Package summary:
Modules:
database_setup - Set up restaurantmenu database.
lots_of_farms - Populate the database with dummy data.
"""
| """ Package summary:
Modules:
database_setup - Set up restaurantmenu database.
lots_of_farms - Populate the database with dummy data.
""" |
def permute_chunks(chunks: list) -> list:
"""
Permute all words inside a list to create all possible combinations
:param chunks: list with words to permute
:return: all permuted results
:raise Exception: when chunks is an empty list
"""
if len(chunks) == 0:
raise Exception('chunks ... | def permute_chunks(chunks: list) -> list:
"""
Permute all words inside a list to create all possible combinations
:param chunks: list with words to permute
:return: all permuted results
:raise Exception: when chunks is an empty list
"""
if len(chunks) == 0:
raise exception('chunks ... |
config.load_autoconfig(True)
config.unbind("+")
config.unbind("-")
config.unbind("=")
config.bind("z+", "zoom-in")
config.bind("z-", "zoom-out")
config.bind("zz", "zoom")
config.unbind("O")
config.unbind("T")
config.unbind("th")
config.unbind("tl")
config.bind("O", "set-cmd-text :open {url:pretty}")
config.bind("T", ... | config.load_autoconfig(True)
config.unbind('+')
config.unbind('-')
config.unbind('=')
config.bind('z+', 'zoom-in')
config.bind('z-', 'zoom-out')
config.bind('zz', 'zoom')
config.unbind('O')
config.unbind('T')
config.unbind('th')
config.unbind('tl')
config.bind('O', 'set-cmd-text :open {url:pretty}')
config.bind('T', 's... |
# Start and end date
gw_start_date = '2010-01-01'
gw_end_date = '2014-01-01'
# Bounds
gw_lower_lat = AutoParam(36)
gw_upper_lat = AutoParam(37)
gw_left_lon = AutoParam(-121)
gw_right_lon = AutoParam(-117)
# Metadata
gw_metadata = WDF.getStationMetadata()
# Create data fetcher
wdf = WDF([gw_lower_lat, gw_upper_lat... | gw_start_date = '2010-01-01'
gw_end_date = '2014-01-01'
gw_lower_lat = auto_param(36)
gw_upper_lat = auto_param(37)
gw_left_lon = auto_param(-121)
gw_right_lon = auto_param(-117)
gw_metadata = WDF.getStationMetadata()
wdf = wdf([gw_lower_lat, gw_upper_lat, gw_left_lon, gw_right_lon], gw_start_date, gw_end_date) |
# Name : Exercise8-4.py
# Author : Ryan Carr
# Date : 02/03/19
# Purpose : Open a file, add unique words to list
# Sort list and display results to user
# Text files are stored in the data folder one level up
filename = input('Enter a filename: ')
if filename == 'romeo.txt':
filename = '../data/ro... | filename = input('Enter a filename: ')
if filename == 'romeo.txt':
filename = '../data/romeo.txt'
else:
print('File cannot be opened:', filename)
quit()
fh = open(filename, 'r')
words = []
for line in fh:
for word in line.strip().split():
if word not in words:
words.append(word)
... |
"""
https://www.hackerrank.com/contests/linguagens-de-programacao-para-ciencia-de-dados/challenges/find-second-maximum-number-in-a-list
"""
n = int(input())
arr = map(int, input().split())
lista = list(set(arr))
lista.sort()
print(lista[-2])
| """
https://www.hackerrank.com/contests/linguagens-de-programacao-para-ciencia-de-dados/challenges/find-second-maximum-number-in-a-list
"""
n = int(input())
arr = map(int, input().split())
lista = list(set(arr))
lista.sort()
print(lista[-2]) |
"""Constant for AWS component."""
DOMAIN = "aws"
DATA_KEY = DOMAIN
DATA_CONFIG = "aws_config"
DATA_HASS_CONFIG = "aws_hass_config"
DATA_SESSIONS = "aws_sessions"
CONF_REGION = "region_name"
CONF_ACCESS_KEY_ID = "aws_access_key_id"
CONF_SECRET_ACCESS_KEY = "aws_secret_access_key"
CONF_PROFILE_NAME = "profile_name"
CONF... | """Constant for AWS component."""
domain = 'aws'
data_key = DOMAIN
data_config = 'aws_config'
data_hass_config = 'aws_hass_config'
data_sessions = 'aws_sessions'
conf_region = 'region_name'
conf_access_key_id = 'aws_access_key_id'
conf_secret_access_key = 'aws_secret_access_key'
conf_profile_name = 'profile_name'
conf_... |
class living:
def __init__(self,n,res):
self.name=n
self.res=res
def displayliv(self):
print("name:",self.name)
print("growth:",self.res)
class plant(living):
##super().__init__("flowerplant","carbondioxide")
def __init__(self,mv,sou):
super().__init__("flowerplan... | class Living:
def __init__(self, n, res):
self.name = n
self.res = res
def displayliv(self):
print('name:', self.name)
print('growth:', self.res)
class Plant(living):
def __init__(self, mv, sou):
super().__init__('flowerplant', 'carbondioxide')
self.moveme... |
# WAP that lets the competitor know which of these prizes they won based on the number of points they scored
'''
Points Prize
1 - 50 wooden rabbit
51 - 150 no prize
151 - 180 wafer-thin mint
181 - 200 penguin
'''
points = int(input("Enter your team points"))
if points <= 50:
result = "... | """
Points Prize
1 - 50 wooden rabbit
51 - 150 no prize
151 - 180 wafer-thin mint
181 - 200 penguin
"""
points = int(input('Enter your team points'))
if points <= 50:
result = 'Congratulations! You won a wooden rabbit!'
elif points <= 150:
result = 'Oh dear, no prize this time.'
elif points <= 1... |
# @date 2018-08-07
# @author Frederic Scherma, All rights reserved without prejudices.
# @license Copyright (c) 2018 Dream Overflow
# @brief Author model
class Author(object):
def __init__(self, watcher, author_id, trader_name):
self._watcher = watcher
self._id = author_id
self._name = trader_name
self._succ... | class Author(object):
def __init__(self, watcher, author_id, trader_name):
self._watcher = watcher
self._id = author_id
self._name = trader_name
self._success_rate = 0
self._last_trades = []
self._risk_score = None
@property
def watcher(self):
return... |
# python3
#DEBUG = False
DEBUG = True
LOG = True
#LOG = False
if DEBUG: test = open("tests\\01x", "r")
EPS = 1e-6
PRECISION = 20
class Equation:
def __init__(self, a, b):
self.a = a
self.b = b
class Position:
def __init__(self, column, row):
self.column = column
self.row = ro... | debug = True
log = True
if DEBUG:
test = open('tests\\01x', 'r')
eps = 1e-06
precision = 20
class Equation:
def __init__(self, a, b):
self.a = a
self.b = b
class Position:
def __init__(self, column, row):
self.column = column
self.row = row
def read_equation():
if DE... |
"""
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you
climb to the top?
"""
class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
if n<0:
... | """
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you
climb to the top?
"""
class Solution(object):
def climb_stairs(self, n):
"""
:type n: int
:rtype: int
"""
if n < 0:
... |
def currency(p):
"""
-> Formats price.
:p: price.
"""
return f'U${p:.2f}'
def increase(p, r, f):
"""
-> Increases a price in percentage.
:p: price to be increased.
:r: percentage to increase the price.
:f: format as US$...
:return: p*(1+r/100)
"""
p *= (1 + r/100)
... | def currency(p):
"""
-> Formats price.
:p: price.
"""
return f'U${p:.2f}'
def increase(p, r, f):
"""
-> Increases a price in percentage.
:p: price to be increased.
:r: percentage to increase the price.
:f: format as US$...
:return: p*(1+r/100)
"""
p *= 1 + r / 100
... |
# this file was generated by "mksmat.py"
table = {
('CC',2,1): {
'nodes': [0.0,
1.0],
'matrix': [
[0.5,
0.5],
] },
('CC',3,1): {
'nodes': [0.0,
0.5,
1.0],
'matrix': [
[0.2083333... | table = {('CC', 2, 1): {'nodes': [0.0, 1.0], 'matrix': [[0.5, 0.5]]}, ('CC', 3, 1): {'nodes': [0.0, 0.5, 1.0], 'matrix': [[0.20833333333333334, 0.3333333333333333, -0.041666666666666664], [-0.041666666666666664, 0.3333333333333333, 0.20833333333333334]]}, ('CC', 3, 2): {'nodes': [0.0, 1.0], 'matrix': [[0.5, 0.5]]}, ('C... |
A, B, C, D = input().split()
A = int(A)
B = int(B)
C = int(C)
D = int(D)
if B > C and D > A and (C + D) > (A + B) and C >= 0 and D >= 0 and A % 2 == 0:
print('Valores aceitos')
else:
print('Valores nao aceitos')
| (a, b, c, d) = input().split()
a = int(A)
b = int(B)
c = int(C)
d = int(D)
if B > C and D > A and (C + D > A + B) and (C >= 0) and (D >= 0) and (A % 2 == 0):
print('Valores aceitos')
else:
print('Valores nao aceitos') |
def mergesort(arr):
if len(arr)>1:
mid=len(arr)//2
l=arr[:mid]
r=arr[mid:]
mergesort(l)
mergesort(r)
i=j=k=0
while i<len(l) and j <len(r):
if l[i]<r[j]:
arr[k]=l[i]
i+=1
else:
arr[k]=r[j]
... | def mergesort(arr):
if len(arr) > 1:
mid = len(arr) // 2
l = arr[:mid]
r = arr[mid:]
mergesort(l)
mergesort(r)
i = j = k = 0
while i < len(l) and j < len(r):
if l[i] < r[j]:
arr[k] = l[i]
i += 1
else:
... |
# coding=utf-8
class CommonDisambiguationError(Exception):
def __init__(self, options):
self.options = options
def __str__(self):
return "There are more than one articles for that query"
| class Commondisambiguationerror(Exception):
def __init__(self, options):
self.options = options
def __str__(self):
return 'There are more than one articles for that query' |
settings = {
"DEFAULT_WIDTH": 850,
"DEFAULT_HEIGHT": 400,
"letter_size": 16,
"side_bar_in_pixels": 250,
"active_file_lang": "py"
}
| settings = {'DEFAULT_WIDTH': 850, 'DEFAULT_HEIGHT': 400, 'letter_size': 16, 'side_bar_in_pixels': 250, 'active_file_lang': 'py'} |
def assay_transpose(assay_df):
"""
assay_t_df = assay_transpose(assay_df)
Parameters
----------------
assay_df: dataframe of assay data with genes as rows and patients as columns
Returns
----------------
dataframe transposed with patients as rows and genes as columns
"""
assay... | def assay_transpose(assay_df):
"""
assay_t_df = assay_transpose(assay_df)
Parameters
----------------
assay_df: dataframe of assay data with genes as rows and patients as columns
Returns
----------------
dataframe transposed with patients as rows and genes as columns
"""
assay... |
def hexstr(name):
output = ''
for n in name:
output += hex(ord(n))[2:]
return output
| def hexstr(name):
output = ''
for n in name:
output += hex(ord(n))[2:]
return output |
character_checks = {
"Celes" : [
"Magitek Factory Trash",
"Magitek Factory Guard",
"Magitek Factory Finish",
"Opera House Disruption",
"South Figaro Prisoner",
],
"Cyan" : [
"Doma Siege",
"Doma Dream Door",
"Doma Dream Awaken",
"Doma Dr... | character_checks = {'Celes': ['Magitek Factory Trash', 'Magitek Factory Guard', 'Magitek Factory Finish', 'Opera House Disruption', 'South Figaro Prisoner'], 'Cyan': ['Doma Siege', 'Doma Dream Door', 'Doma Dream Awaken', 'Doma Dream Throne', 'Mt. Zozo', 'Mt. Zozo Dragon'], 'Edgar': ['Ancient Castle', 'Ancient Castle Dr... |
# Settings
class Settings():
MONGO_URI = "localhost:27017"
MONGO_DB = "news"
ES_URI = "localhost:9200"
ES_INDEX_NAME = "all_news"
GENERAL_CRAWL_WAIT_TIME = 30*60
SEBENARNYA_CRAWL_WAIT_TIME = 30*60 #in seconds
SEBENARNYA_RAW_MONGO_COLLECTION = "sebenarnya_raw"
THESTAR... | class Settings:
mongo_uri = 'localhost:27017'
mongo_db = 'news'
es_uri = 'localhost:9200'
es_index_name = 'all_news'
general_crawl_wait_time = 30 * 60
sebenarnya_crawl_wait_time = 30 * 60
sebenarnya_raw_mongo_collection = 'sebenarnya_raw'
thestar_raw_mongo_collection = 'thestar_raw'
... |
S, T = [input() for _ in range(2)]
ans = False
for _ in range(len(S)):
S = S[-1] + S[:-1]
if S == T:
ans = True
print("Yes" if ans else "No")
| (s, t) = [input() for _ in range(2)]
ans = False
for _ in range(len(S)):
s = S[-1] + S[:-1]
if S == T:
ans = True
print('Yes' if ans else 'No') |
N,H=map(int,input().split())
A,B,C,D,E=map(int,input().split())
ans=C*N
for i in range(N+1):
cost=(H+B*i+D*(N-i)-1)//(D+E)
ans=min(ans,A*i+C*max(0,N-i-cost))
print(ans) | (n, h) = map(int, input().split())
(a, b, c, d, e) = map(int, input().split())
ans = C * N
for i in range(N + 1):
cost = (H + B * i + D * (N - i) - 1) // (D + E)
ans = min(ans, A * i + C * max(0, N - i - cost))
print(ans) |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 24 11:02:45 2019
@author: LENOVO
"""
name = "Dr. Sarvjeet Herald"
print(type(name))
for i in range (0,len(name)):
print(name[i], "=", id(name[i]))
| """
Created on Thu Oct 24 11:02:45 2019
@author: LENOVO
"""
name = 'Dr. Sarvjeet Herald'
print(type(name))
for i in range(0, len(name)):
print(name[i], '=', id(name[i])) |
def TextStyle(Color="#000000",Margin="0px",FontSize="100%", Background="transparent",Weight="400",LetterSpacing="1"):
return f"""
color:{Color};
font-size: {FontSize};
background: {Background};
font-weight: {Weight};
letter-spacing: {LetterSpacing};
margin: {Margin};
"""
| def text_style(Color='#000000', Margin='0px', FontSize='100%', Background='transparent', Weight='400', LetterSpacing='1'):
return f'\n color:{Color};\n font-size: {FontSize};\n background: {Background};\n font-weight: {Weight};\n letter-spacing: {LetterSpacing};\n margin: {Margin};\n ' |
# ------------------------------------------------------------------------------
#
# Author:
# Armin Hasitzka (enhancitizer@hasitzka.com)
#
# Licensed under the MIT license.
# See LICENSE in the project root for license information.
#
# -----------------------------------------------------------------------... | __all__ = ['file', 'options', 'skeleton', 'utils'] |
side = input('Enter the corresponding value next to a square: ')
side = int(side)
perimeter = side * 4
area = side ** 2
print('Perimeter:', perimeter, 'Area:', area) | side = input('Enter the corresponding value next to a square: ')
side = int(side)
perimeter = side * 4
area = side ** 2
print('Perimeter:', perimeter, 'Area:', area) |
# https://codeforces.com/problemset/problem/69/A
n = int(input())
coordinates = [list(map(int, input().split())) for _ in range(n)]
x, y, z = 0, 0, 0
for c in coordinates:
x += c[0]
y += c[1]
z += c[2]
if x == 0 and y == 0 and z ==0:
print('YES')
else:
print('NO') | n = int(input())
coordinates = [list(map(int, input().split())) for _ in range(n)]
(x, y, z) = (0, 0, 0)
for c in coordinates:
x += c[0]
y += c[1]
z += c[2]
if x == 0 and y == 0 and (z == 0):
print('YES')
else:
print('NO') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.