content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Person:
id = None
name = None
def __init__(self, id=None, name=None):
self.id = id
self.name = name
| class Person:
id = None
name = None
def __init__(self, id=None, name=None):
self.id = id
self.name = name |
def sort_gift_code(code: str) -> str:
my_letter = []
for letter in code:
my_letter.append(letter)
return ''.join(sorted(my_letter)) | def sort_gift_code(code: str) -> str:
my_letter = []
for letter in code:
my_letter.append(letter)
return ''.join(sorted(my_letter)) |
n = int(input())
idx = [0]*(n+1)
arr = [int(i) for i in input().split()]
m = int(input())
quer = [int(i) for i in input().split()]
for i in range(n):
idx[arr[i]] = i+1
vasya = 0
petya = 0
for q in quer:
vasya += idx[q]
petya += n-idx[q]+1
print(vasya, petya)
# Time complexity of above code O(n+m)
# ... | n = int(input())
idx = [0] * (n + 1)
arr = [int(i) for i in input().split()]
m = int(input())
quer = [int(i) for i in input().split()]
for i in range(n):
idx[arr[i]] = i + 1
vasya = 0
petya = 0
for q in quer:
vasya += idx[q]
petya += n - idx[q] + 1
print(vasya, petya)
'\nn = int(input())\n\narr = [int(i) fo... |
#
# PySNMP MIB module PACKETEER-RTM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PACKETEER-RTM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:36:08 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint, constraints_union) ... |
i = 0 #defines an integer i
while(i<119): #while i is less than 119, do the following
print(i) #prints the current value of i
i += 10 #add 10 to i
| i = 0
while i < 119:
print(i)
i += 10 |
# print(111)
def main():
p = {
'a':1,
'b':2,
'c':3,
'd':4,
'e':5
}
print(p)
print('i' in p.keys())
if __name__ == '__main__':
main() | def main():
p = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
print(p)
print('i' in p.keys())
if __name__ == '__main__':
main() |
DEPRECATION_WARNING = (
"WARNING: We will end support of the ArcGIS interface by the 1st of May of 2019. This means that there will "
"not be anymore tutorials nor advice on how to use this interface. You could still use this interface on "
"your own. We invite all CEA users to get acquainted with the CEA D... | deprecation_warning = 'WARNING: We will end support of the ArcGIS interface by the 1st of May of 2019. This means that there will not be anymore tutorials nor advice on how to use this interface. You could still use this interface on your own. We invite all CEA users to get acquainted with the CEA Dashboard. The CEA da... |
# coding: utf-8
test_group = 'test_group'
test_event = 'test_event'
test_value_str = 'test_value'
test_value_int = 123
test_value_int_zero = 0
test_value_float = 123.0
test_value_float_zero = 0.0
test_value_none = None
test_label = 'test_label'
test_value_list = [
test_value_str, test_value_int, test_value_floa... | test_group = 'test_group'
test_event = 'test_event'
test_value_str = 'test_value'
test_value_int = 123
test_value_int_zero = 0
test_value_float = 123.0
test_value_float_zero = 0.0
test_value_none = None
test_label = 'test_label'
test_value_list = [test_value_str, test_value_int, test_value_float, test_value_int_zero, t... |
# This file is auto-generated. Do not edit!
DAQmx_Buf_Input_BufSize = 0x186C
DAQmx_Buf_Input_OnbrdBufSize = 0x230A
DAQmx_Buf_Output_BufSize = 0x186D
DAQmx_Buf_Output_OnbrdBufSize = 0x230B
DAQmx_SelfCal_Supported = 0x1860
DAQmx_SelfCal_LastTemp = 0x1864
DAQmx_ExtCal_RecommendedInterval = 0x1868
DAQmx_ExtCal_LastTemp = 0... | da_qmx__buf__input__buf_size = 6252
da_qmx__buf__input__onbrd_buf_size = 8970
da_qmx__buf__output__buf_size = 6253
da_qmx__buf__output__onbrd_buf_size = 8971
da_qmx__self_cal__supported = 6240
da_qmx__self_cal__last_temp = 6244
da_qmx__ext_cal__recommended_interval = 6248
da_qmx__ext_cal__last_temp = 6247
da_qmx__cal__... |
principal=int(input("Enter the Principal amount"))
year=int(input("Enter the no. of Years"))
rateofinterest=int(input("Enter the Rate of Interest. Just enter the number"))
amount=principal*((1+rateofinterest/100)**year)
compoundinterest = amount-principal
print(f"Compound Interest is {compoundinterest} Rupees")
p... | principal = int(input('Enter the Principal amount'))
year = int(input('Enter the no. of Years'))
rateofinterest = int(input('Enter the Rate of Interest. Just enter the number'))
amount = principal * (1 + rateofinterest / 100) ** year
compoundinterest = amount - principal
print(f'Compound Interest is {compoundinterest} ... |
def div42by(divideBy):
return 42 / divideBy
print (div42by(2))
print (div42by(12))
print (div42by(0))
print (div42by(1)) | def div42by(divideBy):
return 42 / divideBy
print(div42by(2))
print(div42by(12))
print(div42by(0))
print(div42by(1)) |
result = {title: str(i)
for i, titles in DATA.items()
for title in titles}
| result = {title: str(i) for (i, titles) in DATA.items() for title in titles} |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 8 16:55:35 2019
@author: Kelvin
"""
def spill(init,a,indices):
a[a>init['spillsize']]=0
# Finding indices of spill-over elements, up, down, right, left
row_centre=indices[0]
row_down=[x+1 for x in indices[0]]
row_up=[x-1 for x in indices[0]]
c... | """
Created on Tue Oct 8 16:55:35 2019
@author: Kelvin
"""
def spill(init, a, indices):
a[a > init['spillsize']] = 0
row_centre = indices[0]
row_down = [x + 1 for x in indices[0]]
row_up = [x - 1 for x in indices[0]]
col_centre = indices[1]
col_right = [y + 1 for y in indices[1]]
col_left... |
INCIDENTS_RESULT = [
{'ModuleName': 'InnerServicesModule', 'Brand': 'Builtin', 'Category': 'Builtin', 'ID': '', 'Version': 0, 'Type': 1,
'Contents': {
'ErrorsPrivateDoNotUse': None, 'data': [
{
'CustomFields': {'dbotpredictionprobability': 0,
... | incidents_result = [{'ModuleName': 'InnerServicesModule', 'Brand': 'Builtin', 'Category': 'Builtin', 'ID': '', 'Version': 0, 'Type': 1, 'Contents': {'ErrorsPrivateDoNotUse': None, 'data': [{'CustomFields': {'dbotpredictionprobability': 0, 'detectionsla': {'accumulatedPause': 0, 'breachTriggered': False, 'dueDate': '000... |
class Event:
def __init__(self, label=None, half=None, time=None, team=None, position= None, visibility=None):
self.label = label
self.half = half
self.time = time
self.team = team
self.position = position
self.visibility = visibility
def to_text(self):
return self.time + " || " + self.label + " - ... | class Event:
def __init__(self, label=None, half=None, time=None, team=None, position=None, visibility=None):
self.label = label
self.half = half
self.time = time
self.team = team
self.position = position
self.visibility = visibility
def to_text(self):
r... |
lower = int(input('Min: '))
upper = int(input('Max: '))
for num in range(lower, upper + 1):
sum = 0
n = len(str(num))
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** n
temp //= 10
if num == sum:
print(num)
| lower = int(input('Min: '))
upper = int(input('Max: '))
for num in range(lower, upper + 1):
sum = 0
n = len(str(num))
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** n
temp //= 10
if num == sum:
print(num) |
def test_home_page(client):
"""test home page"""
response = client.get("/")
assert b"Create Your Own Resolution" in response.data
assert b"Resolution List" in response.data
def test_statistic_page(client):
"""test statistic page"""
response = client.get("/statistic")
assert b"Create Yo... | def test_home_page(client):
"""test home page"""
response = client.get('/')
assert b'Create Your Own Resolution' in response.data
assert b'Resolution List' in response.data
def test_statistic_page(client):
"""test statistic page"""
response = client.get('/statistic')
assert b'Create Your Ow... |
def linearRegression(px,py):
sumx = 0
sumy = 0
sumxy = 0
sumxx = 0
n = len (px)
for i in range(n):
x = px[i]
y = py[i]
sumx += x
sumy += y
sumxx += x*x
sumxy += x*y
a=(sumxy-sumx*sumy/n)/(sumxx-(sumx**2)/n)
b=(sumy-a*sumx)/n
print(su... | def linear_regression(px, py):
sumx = 0
sumy = 0
sumxy = 0
sumxx = 0
n = len(px)
for i in range(n):
x = px[i]
y = py[i]
sumx += x
sumy += y
sumxx += x * x
sumxy += x * y
a = (sumxy - sumx * sumy / n) / (sumxx - sumx ** 2 / n)
b = (sumy - a ... |
expected_output = {
"vrf": {
"default": {
"interfaces": {
"GigabitEthernet1": {
"address_family": {
"ipv4": {
"dr_priority": 1,
"hello_interval": 30,
"n... | expected_output = {'vrf': {'default': {'interfaces': {'GigabitEthernet1': {'address_family': {'ipv4': {'dr_priority': 1, 'hello_interval': 30, 'neighbor_count': 1, 'version': 2, 'mode': 'sparse-mode', 'dr_address': '10.1.2.2', 'address': ['10.1.2.1']}}}, 'GigabitEthernet2': {'address_family': {'ipv4': {'dr_priority': 1... |
# Tic-Tac-Toe 3x3 game
game = [[" ", " ", " "],
[" ", " ", " "],
[" ", " ", " "]]
players = ["X", "O"]
current_player = 0
GAME_CONTINUES = -1
DRAW = -2
# if a player won, number of that player is returned
def print_state(game_state):
for line in range(3):
print(*game_state[line], sep=" |... | game = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']]
players = ['X', 'O']
current_player = 0
game_continues = -1
draw = -2
def print_state(game_state):
for line in range(3):
print(*game_state[line], sep=' | ')
if line != 2:
print('--+---+--')
def move():
try:
move = i... |
# OpenWeatherMap API Key
weather_api_key = "6006d361789a66a63d965d32098db97e"
# Google API Key
g_key = "AIzaSyBkES3rvs8W2Uv7OJXtnd7i86WvOSEJp7A"
| weather_api_key = '6006d361789a66a63d965d32098db97e'
g_key = 'AIzaSyBkES3rvs8W2Uv7OJXtnd7i86WvOSEJp7A' |
class GraphAlgos:
"""
Wrapper class which handle the graph algorithms
more efficiently, by abstracting repeating code.
"""
database = None # Static variable shared across objects.
def __init__(self, database, node_list, rel_list, orientation = "NATURAL"):
# Initialize the stati... | class Graphalgos:
"""
Wrapper class which handle the graph algorithms
more efficiently, by abstracting repeating code.
"""
database = None
def __init__(self, database, node_list, rel_list, orientation='NATURAL'):
if GraphAlgos.database is None:
GraphAlgos.database = databas... |
_4digit: grove.TM1637 = None
def on_forever():
global _4digit
if input.button_is_pressed(Button.A):
_4digit = grove.create_display(DigitalPin.C16, DigitalPin.C17)
_4digit.bit(1, 3)
basic.pause(1000)
_4digit.bit(2, 3)
basic.pause(1000)
_4digit.bit(3, 3)
... | _4digit: grove.TM1637 = None
def on_forever():
global _4digit
if input.button_is_pressed(Button.A):
_4digit = grove.create_display(DigitalPin.C16, DigitalPin.C17)
_4digit.bit(1, 3)
basic.pause(1000)
_4digit.bit(2, 3)
basic.pause(1000)
_4digit.bit(3, 3)
ba... |
class Solution:
def gardenNoAdj(self, N: int, paths: List[List[int]]) -> List[int]:
res = [0] * N
G = [[] for i in range(N)]
for x,y in paths:
G[x-1].append(y-1)
G[y-1].append(x-1)
for i in range(N):
res[i] = ({1,2,3,4} - {res[j] for j in G[i]}).po... | class Solution:
def garden_no_adj(self, N: int, paths: List[List[int]]) -> List[int]:
res = [0] * N
g = [[] for i in range(N)]
for (x, y) in paths:
G[x - 1].append(y - 1)
G[y - 1].append(x - 1)
for i in range(N):
res[i] = ({1, 2, 3, 4} - {res[j] f... |
input_file = open("input.txt", "r")
entriesArray = input_file.read().split("\n")
depth_measure_increase = 0
for i in range(1, len(entriesArray), 1):
if int(entriesArray[i]) > int(entriesArray[i-1]):
depth_measure_increase += 1
print(f'{depth_measure_increase=}')
| input_file = open('input.txt', 'r')
entries_array = input_file.read().split('\n')
depth_measure_increase = 0
for i in range(1, len(entriesArray), 1):
if int(entriesArray[i]) > int(entriesArray[i - 1]):
depth_measure_increase += 1
print(f'depth_measure_increase={depth_measure_increase!r}') |
class TranslationMissing(Exception):
# Exception for commands which currently do not support translation.
def __init__(self, name):
super().__init__(
f"Translation for the command {name} is not currently supported"
)
| class Translationmissing(Exception):
def __init__(self, name):
super().__init__(f'Translation for the command {name} is not currently supported') |
MONGO_SERVER_CONFIG = {
'host': 'mongo',
'port': 27017,
'username': 'spark-user',
'password': 'spark123'
}
MONGO_DATABASE_CONFIG = {
'DATABASE_NAME': 'video_games_analysis',
'COLLECTION_NAME': 'games'
} | mongo_server_config = {'host': 'mongo', 'port': 27017, 'username': 'spark-user', 'password': 'spark123'}
mongo_database_config = {'DATABASE_NAME': 'video_games_analysis', 'COLLECTION_NAME': 'games'} |
"""
atpthings.util.dataframe
------------------------
"""
def add_one(number: int = 8) -> int:
"""Add one
:param number: write number
:type number: int
:return: return the number
:rtype: int
"""
return number + 1
def add_two(number: int) -> int:
"""Add two
:param number: write... | """
atpthings.util.dataframe
------------------------
"""
def add_one(number: int=8) -> int:
"""Add one
:param number: write number
:type number: int
:return: return the number
:rtype: int
"""
return number + 1
def add_two(number: int) -> int:
"""Add two
:param number: write numb... |
# Authors: Hyunwoo Lee <hyunwoo9301@naver.com>
# Released under the MIT license.
def read_data(file):
with open(file, 'r', encoding="utf-8") as f:
data = [line.split('\t') for line in f.read().splitlines()]
data = data[1:]
return data | def read_data(file):
with open(file, 'r', encoding='utf-8') as f:
data = [line.split('\t') for line in f.read().splitlines()]
data = data[1:]
return data |
class Rounder:
def round(self, n, b):
m = n%b
return n-m if m < (b/2 + b%2) else n+b-m
| class Rounder:
def round(self, n, b):
m = n % b
return n - m if m < b / 2 + b % 2 else n + b - m |
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Build the specific library dependencies for validating on x86-64
{
'includes': [
'../../../../../build/common.gypi',
],
'target_defaults... | {'includes': ['../../../../../build/common.gypi'], 'target_defaults': {'variables': {'target_base': 'none'}, 'target_conditions': [['target_base=="ncvalidate_x86_64"', {'sources': ['ncvalidate.c'], 'cflags!': ['-Wextra', '-Wswitch-enum', '-Wsign-compare'], 'defines': ['NACL_TRUSTED_BUT_NOT_TCB'], 'xcode_settings': {'WA... |
n1 = int(input('enter first number: '))
n2 = int(input('enter second number: '))
print('Sum: ', int(n1+n2))
| n1 = int(input('enter first number: '))
n2 = int(input('enter second number: '))
print('Sum: ', int(n1 + n2)) |
n1=480
n2=10
soma=0
for i in range (0,30,1):
div=n1/n2
if i%2==0:
soma=soma+div
else:
soma=soma-div
n1=n1-5
n2=n2+1
print(soma)
| n1 = 480
n2 = 10
soma = 0
for i in range(0, 30, 1):
div = n1 / n2
if i % 2 == 0:
soma = soma + div
else:
soma = soma - div
n1 = n1 - 5
n2 = n2 + 1
print(soma) |
class Student:
"""
Create a student.
"""
def __init__(self, name):
self.name = name
def __repr__(self):
return 'This student is easy 4.0'
#__str__ has high priority than __repr__
def __str__(self):
return 'Zhang A +'
def _get_name(self):
print('This is... | class Student:
"""
Create a student.
"""
def __init__(self, name):
self.name = name
def __repr__(self):
return 'This student is easy 4.0'
def __str__(self):
return 'Zhang A +'
def _get_name(self):
print('This is get')
return self._name
def _se... |
'''
ALU for CPU
'''
bit = 0 | 1
byte = 8 * bit
def adder(num1: bit, num2: bit, carry: bit) -> [bit, bit]:
x = num1 ^ num2
s = x ^ carry
a = x & carry
b = num1 & num2
c = a | b
return [c, s]
def adder4bit(num1: byte, num2: byte) -> [bit, byte]:
carry, a = adder(int(num1[3]), int(num2[3]),... | """
ALU for CPU
"""
bit = 0 | 1
byte = 8 * bit
def adder(num1: bit, num2: bit, carry: bit) -> [bit, bit]:
x = num1 ^ num2
s = x ^ carry
a = x & carry
b = num1 & num2
c = a | b
return [c, s]
def adder4bit(num1: byte, num2: byte) -> [bit, byte]:
(carry, a) = adder(int(num1[3]), int(num2[3]),... |
def dot(self, name, content):
path = j.sal.fs.getTmpFilePath()
j.sal.fs.writeFile(filename=path, contents=content)
dest = j.sal.fs.joinPaths(j.sal.fs.getDirName(self.last_dest), "%s.png" % name)
j.do.execute("dot '%s' -Tpng > '%s'" % (path, dest))
j.sal.fs.remove(path)
return "... | def dot(self, name, content):
path = j.sal.fs.getTmpFilePath()
j.sal.fs.writeFile(filename=path, contents=content)
dest = j.sal.fs.joinPaths(j.sal.fs.getDirName(self.last_dest), '%s.png' % name)
j.do.execute("dot '%s' -Tpng > '%s'" % (path, dest))
j.sal.fs.remove(path)
return ''... |
class PagedList(list):
def __init__(self, items, token):
super(PagedList, self).__init__(items)
self.token = token
| class Pagedlist(list):
def __init__(self, items, token):
super(PagedList, self).__init__(items)
self.token = token |
"""
@deprecated will be remove next minor
"""
class Singleton(type):
"""
@deprecated will be remove next minor
"""
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
re... | """
@deprecated will be remove next minor
"""
class Singleton(type):
"""
@deprecated will be remove next minor
"""
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
ret... |
class CircularQueuek:
def __init__(self, k: int):
self.queue = [0 for _ in range(k)]
self.k = k
self.front = 0
self.rear = -1
self.length = 0
def enQueue(self, value):
if self.length < self.k:
self.length = self.length +1
self.rear = (self... | class Circularqueuek:
def __init__(self, k: int):
self.queue = [0 for _ in range(k)]
self.k = k
self.front = 0
self.rear = -1
self.length = 0
def en_queue(self, value):
if self.length < self.k:
self.length = self.length + 1
self.rear = (s... |
n=(int)(input())
dict1={}
dict2={}
c1=0
while(n>0):
n-=1
str1=(input().split(" "))
if(str1[0] not in dict1.keys()):
dict1[str1[0]]=str1[1]
if(str1[1] not in dict2.keys()):
dict2[str1[1]]=1
else:
dict2[str1[1]]+=1
c1=max(dict2.values())
for i in dict2.key... | n = int(input())
dict1 = {}
dict2 = {}
c1 = 0
while n > 0:
n -= 1
str1 = input().split(' ')
if str1[0] not in dict1.keys():
dict1[str1[0]] = str1[1]
if str1[1] not in dict2.keys():
dict2[str1[1]] = 1
else:
dict2[str1[1]] += 1
c1 = max(dict2.values())
for i in dict2.keys():
... |
# config files
CONFIG_DIR = "config"
# Link to DB Configuration
DB_CONFIG_FILE = "db.yml"
# Name of collection
COLLECTION_NAME = 'collection_name'
CONFIG_DIR = "config"
CONFIG_FNAME = "rss_feeds.yml"
PARAM_CONFIG_FILE = "services.yml"
APP_KEYS_FILE = "keys.yml"
NLU_CONFIG = "nlu_config.yml"
MESSAGING_FILE = "messagin... | config_dir = 'config'
db_config_file = 'db.yml'
collection_name = 'collection_name'
config_dir = 'config'
config_fname = 'rss_feeds.yml'
param_config_file = 'services.yml'
app_keys_file = 'keys.yml'
nlu_config = 'nlu_config.yml'
messaging_file = 'messaging_platforms.yml'
socialmedia_file = 'socialmedia.yml'
email_file ... |
'''
URL: https://leetcode.com/problems/build-an-array-with-stack-operations/
Difficulty: Easy
Description: Build an Array With Stack Operations
Given an array target and an integer n. In each iteration, you will read a number from list = {1,2,3..., n}.
Build the target array using the following operations:
Push: ... | """
URL: https://leetcode.com/problems/build-an-array-with-stack-operations/
Difficulty: Easy
Description: Build an Array With Stack Operations
Given an array target and an integer n. In each iteration, you will read a number from list = {1,2,3..., n}.
Build the target array using the following operations:
Push: ... |
#todo function to access owner and forces more easily
CONNECTIONS = {'Alaska': ['Alberta', 'Northwest Territories', 'Kamchatka'],
'Northwest Territories': ['Alberta', 'Greenland', 'Ontario', 'Alaska'],
'Greenland': ['Quebec', 'Northwest Territories', 'Ontario', 'Iceland'],
... | connections = {'Alaska': ['Alberta', 'Northwest Territories', 'Kamchatka'], 'Northwest Territories': ['Alberta', 'Greenland', 'Ontario', 'Alaska'], 'Greenland': ['Quebec', 'Northwest Territories', 'Ontario', 'Iceland'], 'Alberta': ['Western United States', 'Northwest Territories', 'Ontario', 'Alaska'], 'Ontario': ['Alb... |
#!/usr/bin/python
# Copyright 2017 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | """
Management of Contrail resources
================================
:depends: - vnc_api Python module
Enforce the virtual router existence
------------------------------------
.. code-block:: yaml
virtual_router:
contrail.virtual_router_present:
name: tor01
ip_address: 10.0.0.23
... |
# There's a function blackbox(lst) that takes a list, does some magic, and returns a list.
# You don't know if it modifies the given list or creates a completely different one.
# Find this out testing the function on your own list and print "modifies" if the fu
# blackbox(lst)
# print("modifies")
# if the function ch... | football_list = ['Liverpool Football Club', 'English Premier League', 'Champion 2019-2020']
football_list_id = id(football_list)
new_list = blackbox(football_list)
new_list_id = id(new_list)
if football_list_id == new_list_id:
print('modifies')
else:
print('new') |
# Path to the root location of the application inside the container.
APP_ROOT = '/intend4'
# Configuration directory, inside the application
CONFIG_DIR = "{}/config".format(APP_ROOT)
# Logging level
LOG_LEVEL = 'INFO' # CRITICAL / ERROR / WARNING / INFO / DEBUG
| app_root = '/intend4'
config_dir = '{}/config'.format(APP_ROOT)
log_level = 'INFO' |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @return a ListNode
def removeNthFromEnd(self, head, n):
if head is None: return None
nodes = []
p = head
while p :
... | class Solution:
def remove_nth_from_end(self, head, n):
if head is None:
return None
nodes = []
p = head
while p:
nodes.append(p)
p = p.next
if n == len(nodes):
return nodes[1] if len(nodes) > 1 else None
else:
... |
#
# Automatically generated
#
class Asm6502(object):
pass
Asm6502.BRK = 0x00
Asm6502.ORA_IX = 0x01
Asm6502.ORA_Z = 0x05
Asm6502.ASL_Z = 0x06
Asm6502.PHP = 0x08
Asm6502.ORA_IM = 0x09
Asm6502.ASL = 0x0A
Asm6502.ORA_A = 0x0D
Asm6502.ASL_A = 0x0E
Asm6502.BPL = 0x10
... | class Asm6502(object):
pass
Asm6502.BRK = 0
Asm6502.ORA_IX = 1
Asm6502.ORA_Z = 5
Asm6502.ASL_Z = 6
Asm6502.PHP = 8
Asm6502.ORA_IM = 9
Asm6502.ASL = 10
Asm6502.ORA_A = 13
Asm6502.ASL_A = 14
Asm6502.BPL = 16
Asm6502.ORA_IY = 17
Asm6502.ORA_ZX = 21
Asm6502.ASL_ZX = 22
Asm6502.CLC = 24
Asm6502.ORA_AY = 25
Asm6502.ORA_A... |
class WindowPosition:
position = []
def get(self, quantity, pos_x, pos_y, width, height):
if quantity == 1:
self.position.append({'pos_x': pos_x, 'pos_y': pos_y, 'width': width, 'height': height})
else:
height_ratio = height * 4 / 3 # TODO hard coded 4:3 ratio
... | class Windowposition:
position = []
def get(self, quantity, pos_x, pos_y, width, height):
if quantity == 1:
self.position.append({'pos_x': pos_x, 'pos_y': pos_y, 'width': width, 'height': height})
else:
height_ratio = height * 4 / 3
if width > height_ratio:
... |
#! python3
# __author__ = "YangJiaHao"
# date: 2018/12/25
def duplicate(nums):
length = len(nums)
for n in nums:
if n < 0 or n >= length:
return False
for i in range(len(nums)):
while nums[i] != i:
if nums[i] == nums[nums[i]]:
return nums[i]
... | def duplicate(nums):
length = len(nums)
for n in nums:
if n < 0 or n >= length:
return False
for i in range(len(nums)):
while nums[i] != i:
if nums[i] == nums[nums[i]]:
return nums[i]
else:
(nums[i], nums[nums[i]]) = (nums[n... |
#!/usr/bin/env python3
PIKS_DEFAULT_DIR=".piks"
PIKS_DEFAULT_FILE="piks.db"
PIKS_DEFAULT_CHECKSUM="sha512"
if __name__ == "__main__":
pass
| piks_default_dir = '.piks'
piks_default_file = 'piks.db'
piks_default_checksum = 'sha512'
if __name__ == '__main__':
pass |
categories = {
'Network Stereo Zone Amplifier',
'Network Stereo Receiver',
'Portable Player',
'Media Player',
'Network Streamer',
'Network player & Preamplifier',
'CD Player',
'Speaker',
'DAC',
'CD player',
'Streaming DAC',
'DAC & Network Streamer',
'DAC & Headphone Amp',
'Network Audio & CD... | categories = {'Network Stereo Zone Amplifier', 'Network Stereo Receiver', 'Portable Player', 'Media Player', 'Network Streamer', 'Network player & Preamplifier', 'CD Player', 'Speaker', 'DAC', 'CD player', 'Streaming DAC', 'DAC & Network Streamer', 'DAC & Headphone Amp', 'Network Audio & CD Player', 'All-in-One', 'Wire... |
#return True if sum of any two num in list equals key O(n)
num=[]
n=int(input())
for x in range(n):
num.append(int(input()))
key=int(input())
for x in range(n):
if key-num[x] in num:
print(True)
exit() #quit()
print(None)
| num = []
n = int(input())
for x in range(n):
num.append(int(input()))
key = int(input())
for x in range(n):
if key - num[x] in num:
print(True)
exit()
print(None) |
class Order():
ASCENDING = 0 # lower is better
DESCENDING = 1 # higher is better
class Format():
ANONYMOUS = 0b0001
NAMED = 0b0010
LEADERBOARD = 0b0100
LIST = 0b1000
Delim = '|'
KeyScorePosition = -1 # indeks v rezultatu, po katerem sortiramo
ExpectedNicknamePosition = 10000 # indeks nickn... | class Order:
ascending = 0
descending = 1
class Format:
anonymous = 1
named = 2
leaderboard = 4
list = 8
delim = '|'
key_score_position = -1
expected_nickname_position = 10000
labels = ['no label']
file_name = 'LEADERBOARDS.txt'
output_format = Format.LEADERBOARD | Format.NAMED
output_order = O... |
"""Holodeck Exceptions"""
class HolodeckException(Exception):
"""Base class for a generic exception in Holodeck."""
class HolodeckConfigurationException(HolodeckException):
"""The user provided an invalid configuration for Holodeck"""
class TimeoutException(HolodeckException):
"""Exception raised when... | """Holodeck Exceptions"""
class Holodeckexception(Exception):
"""Base class for a generic exception in Holodeck."""
class Holodeckconfigurationexception(HolodeckException):
"""The user provided an invalid configuration for Holodeck"""
class Timeoutexception(HolodeckException):
"""Exception raised when co... |
n = int(input())
triangleList = []
for i in range(n):
temp = []
if i == 0:
temp.append(1)
else:
for j in range(i+1):
if j==0 or j==i:
temp.append(triangleList[i-1][j-1])
else:
temp.append(triangleList[i-1][j]+triangleList[i-1... | n = int(input())
triangle_list = []
for i in range(n):
temp = []
if i == 0:
temp.append(1)
else:
for j in range(i + 1):
if j == 0 or j == i:
temp.append(triangleList[i - 1][j - 1])
else:
temp.append(triangleList[i - 1][j] + triangleList... |
"""
Constants used in project.
"""
class VersionParts:
"""
Utility class with constants for version parts.
"""
ALPHA = "alpha"
BETA = "beta"
RC = "rc"
PRE = "pre"
POST = "post"
DEV = "dev"
MAJOR = "major"
MINOR = "minor"
MICRO = "micro"
LOCAL = "local"
EPOCH = ... | """
Constants used in project.
"""
class Versionparts:
"""
Utility class with constants for version parts.
"""
alpha = 'alpha'
beta = 'beta'
rc = 'rc'
pre = 'pre'
post = 'post'
dev = 'dev'
major = 'major'
minor = 'minor'
micro = 'micro'
local = 'local'
epoch = 'e... |
# Copyright (c) 2020 The DAML Authors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
lf_stable_version = "1.6"
lf_latest_version = "1.7"
lf_dev_version = "1.dev"
lf_versions = [lf_stable_version, lf_latest_version, lf_dev_version]
| lf_stable_version = '1.6'
lf_latest_version = '1.7'
lf_dev_version = '1.dev'
lf_versions = [lf_stable_version, lf_latest_version, lf_dev_version] |
class PluginBase(object):
def run(self, **kwargs):
err = "Error, this is an abstract method " \
"you need implement this in a derived class"
raise NotImplementedError(err)
class PluginDescription(object):
def __init__(self,
name,
author,
... | class Pluginbase(object):
def run(self, **kwargs):
err = 'Error, this is an abstract method you need implement this in a derived class'
raise not_implemented_error(err)
class Plugindescription(object):
def __init__(self, name, author, short_desc, long_desc, help_str, instance):
self.n... |
# -*- coding: utf-8 -*-
config = dict(
age_config={
"feature_name": "age",
"feature_data_type": "int",
"default_value": "PositiveSignedTypeDefault",
"json_path_list": [("age", "$..content.age", "f_assert_not_null->f_assert_must_digit_or_float")],
"f_map_and_filter_chain": "m_... | config = dict(age_config={'feature_name': 'age', 'feature_data_type': 'int', 'default_value': 'PositiveSignedTypeDefault', 'json_path_list': [('age', '$..content.age', 'f_assert_not_null->f_assert_must_digit_or_float')], 'f_map_and_filter_chain': 'm_get_seq_index_value(0)', 'reduce_chain': '', 'l_map_and_filter_chain':... |
#
# @lc app=leetcode id=309 lang=python3
#
# [309] Best Time to Buy and Sell Stock with Cooldown
#
# @lc code=start
class Solution:
def maxProfit(self, prices: List[int]) -> int:
if len(prices) < 2:
return 0
s0 = 0
s1 = -prices[0]
s2 = float('-inf')
for i in rang... | class Solution:
def max_profit(self, prices: List[int]) -> int:
if len(prices) < 2:
return 0
s0 = 0
s1 = -prices[0]
s2 = float('-inf')
for i in range(len(prices)):
pre0 = s0
pre1 = s1
pre2 = s2
s0 = max(pre0, pre2)
... |
class ArgumentsMethods(object):
def add_arguments(self, parser):
parser.add_argument(
"states", nargs="+", help="States to export by FIPS code."
)
| class Argumentsmethods(object):
def add_arguments(self, parser):
parser.add_argument('states', nargs='+', help='States to export by FIPS code.') |
# Programa recebe uma lista e transforma em uma strng separada por ',' e and antecedendo o ultimo elemento.
def concatenar(lista):
temporario = ''
index = 0
for item in lista:
if index == len(lista)-1:
temporario += f'and {item}.'
else:
temporario += f'{item}, '
... | def concatenar(lista):
temporario = ''
index = 0
for item in lista:
if index == len(lista) - 1:
temporario += f'and {item}.'
else:
temporario += f'{item}, '
index += 1
return temporario
spam = ['apples', 'bananas', 'tofu', 'cats', 1]
print(concatenar(spam)... |
MESSAGES = dict({
"1": "\n\nData provided for method __init__() of class Feature \n"
"was not correct to create dict() object",
"2": "\n\nFeature object is not a valid geojson feature object, \n"
"one of the following failed, geometry, properties or type field are missing \n",
"3": "\n\nCo... | messages = dict({'1': '\n\nData provided for method __init__() of class Feature \nwas not correct to create dict() object', '2': '\n\nFeature object is not a valid geojson feature object, \none of the following failed, geometry, properties or type field are missing \n', '3': '\n\nCoordinates Array Items must be of floa... |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftTYPECASTrightUMINUSrightUNOTleftMASMENOSleftPOTENCIAleftPORDIVRESIDUOleftANDORSIMBOLOOR2SIMBOLOORSIMBOLOAND2leftDESPLAZAMIENTOIZQUIERDADESPLAZAMIENTODERECHAABS ACOS... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftTYPECASTrightUMINUSrightUNOTleftMASMENOSleftPOTENCIAleftPORDIVRESIDUOleftANDORSIMBOLOOR2SIMBOLOORSIMBOLOAND2leftDESPLAZAMIENTOIZQUIERDADESPLAZAMIENTODERECHAABS ACOS ACOSD ACOSH ADD ALL ALTER AND ANY AS ASC ASIN ASIND ASINH ATAN ATAN2 ATAN2D ATAND ATANH AUTO_... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyLabours(PythonPackage):
"""Python module dependency visualization."""
homepage = "https://github.com/src... | class Pylabours(PythonPackage):
"""Python module dependency visualization."""
homepage = 'https://github.com/src-d/hercules'
url = 'https://github.com/src-d/hercules/archive/v10.7.2.tar.gz'
version('10.7.2', sha256='4654dcfb1eee5af1610fd05677c6734c2ca1161535fcc14d3933d6debda4bc34')
build_directory =... |
"""Deployment rules
"""
load("//tools:providers.bzl", "DeploymentZoneInfo")
def _deployment_zone_impl(ctx):
if len(ctx.attr.account_id) != 12:
fail("AWS Account IDs are 12 characters long")
return [
DeploymentZoneInfo(
account_id = ctx.attr.account_id,
deployment_role =... | """Deployment rules
"""
load('//tools:providers.bzl', 'DeploymentZoneInfo')
def _deployment_zone_impl(ctx):
if len(ctx.attr.account_id) != 12:
fail('AWS Account IDs are 12 characters long')
return [deployment_zone_info(account_id=ctx.attr.account_id, deployment_role=ctx.attr.deployment_role, owner_role... |
def read(filename):
with open(filename, "r") as file:
lines = file.readlines()
result = {}
mode = "main"
result[mode] = {}
for i in lines:
i = i.replace("\n", "")
if i.startswith(" "):
i = i[4:]
if i.startswith(" "):
i ... | def read(filename):
with open(filename, 'r') as file:
lines = file.readlines()
result = {}
mode = 'main'
result[mode] = {}
for i in lines:
i = i.replace('\n', '')
if i.startswith(' '):
i = i[4:]
if i.startswith(' '):
i = i[2:]
if '/... |
"""Interop with Java."""
load("@bazel_skylib//lib:collections.bzl", "collections")
JavaInteropInfo = provider(
doc = "Information needed for interop with Java rules.",
fields = {
"inputs": "Files needed during build.",
"env": "Dict with env variables that should be set during build.",
},
)... | """Interop with Java."""
load('@bazel_skylib//lib:collections.bzl', 'collections')
java_interop_info = provider(doc='Information needed for interop with Java rules.', fields={'inputs': 'Files needed during build.', 'env': 'Dict with env variables that should be set during build.'})
def java_interop_info(deps):
"""... |
description = ''
pages = ['header']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
click(header.my_account)
verify_text('You must be logged in to use this page. Please use the form below to login to your account.')
def teardown(data):
pass
| description = ''
pages = ['header']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
click(header.my_account)
verify_text('You must be logged in to use this page. Please use the form below to login to your account.')
def teardown(data):
pass |
# Two City Scheduling
# There are 2N people a company is planning to interview. The cost of flying the i-th person to city A is costs[i][0], and the cost of flying the i-th person to city B is costs[i][1].
# A function to return the minimum cost to fly every person to a city such that exactly N people arrive in each ci... | class Solution(object):
def two_city_sched_cost(self, costs):
"""
:type costs: List[List[int]]
:rtype: int
"""
diff = {0: [], 1: []}
a = 0
b = 0
total = 0
for cost in costs:
if cost[0] < cost[1]:
diff[0].append(abs(... |
mystr = "banana"
for x in mystr:
print(x)
| mystr = 'banana'
for x in mystr:
print(x) |
FETCH_DATA_SOURCES_SQL = "select description, downloaded, url, data_source_type, group_name " \
"from data_source " \
"order by downloaded, group_name, description;"
class DataSourcesQueryNames(object):
DESCRIPTION = 'description'
DOWNLOADED = 'downloaded'
... | fetch_data_sources_sql = 'select description, downloaded, url, data_source_type, group_name from data_source order by downloaded, group_name, description;'
class Datasourcesquerynames(object):
description = 'description'
downloaded = 'downloaded'
url = 'url'
data_source_type = 'data_source_type'
gr... |
geral = {}
aproveitamento = list()
geral['nome'] = str(input('Nome jogador: '))
partidas = int(input(f'Quantas partidas {geral["nome"]} jogou ?'))
count = 0
total = 0
while count < partidas:
gols_games = (int(input(f'Quantos gols na partida {count}?')))
aproveitamento.append(gols_games)
total = total + gol... | geral = {}
aproveitamento = list()
geral['nome'] = str(input('Nome jogador: '))
partidas = int(input(f"Quantas partidas {geral['nome']} jogou ?"))
count = 0
total = 0
while count < partidas:
gols_games = int(input(f'Quantos gols na partida {count}?'))
aproveitamento.append(gols_games)
total = total + gols_g... |
# Exports
__all__ = (
"CommandFailed",
"InputError",
"OutputError",
"ResourceUnavailable",
)
# Classes
class CommandFailed(Exception):
"""Occurs when a library function or method fails to successfully run a :py:class:`shell.Command`."""
pass
class InputError(Exception):
"""Occurs when ... | __all__ = ('CommandFailed', 'InputError', 'OutputError', 'ResourceUnavailable')
class Commandfailed(Exception):
"""Occurs when a library function or method fails to successfully run a :py:class:`shell.Command`."""
pass
class Inputerror(Exception):
"""Occurs when improper or invalid input has been supplied... |
INTEGER = "int"
FLOAT = "float"
BOOLEAN = "bool"
STRING = "str"
EMAIL = "email"
ALPHA = "alpha"
ALPHANUMERIC = "alphanumeric"
STD = "std"
LIST = "list"
DICT = "dict"
FILE = "file"
ALLOWED_TYPES = {INTEGER: {"type": "integer"}, FLOAT: {"type": "number"}, BOOLEAN: {"type": "boolean"}, STRING: {"type": "string"},
... | integer = 'int'
float = 'float'
boolean = 'bool'
string = 'str'
email = 'email'
alpha = 'alpha'
alphanumeric = 'alphanumeric'
std = 'std'
list = 'list'
dict = 'dict'
file = 'file'
allowed_types = {INTEGER: {'type': 'integer'}, FLOAT: {'type': 'number'}, BOOLEAN: {'type': 'boolean'}, STRING: {'type': 'string'}, EMAIL: {... |
# Change colours here --> format as (colour, colour on opposite side)
pairs = (("white","yellow"),
("yellow","white"),
("red","orange"),
("orange","red"),
("green","blue"),
("blue","green"))
# Make sure there are 6 logically valid pairs
class Piece:
def __init... | pairs = (('white', 'yellow'), ('yellow', 'white'), ('red', 'orange'), ('orange', 'red'), ('green', 'blue'), ('blue', 'green'))
class Piece:
def __init__(self, x, y, z, cx, cy, cz):
self.x = x
self.y = y
self.z = z
self.cx = cx
self.cy = cy
self.cz = cz
def stat... |
APP_ID_TO_ARN_IDS = {
'co.justyo.yoapp': [
'ios',
'ios-beta',
'ios-development',
'android',
'winphone'
],
'co.justyo.yopolls': [
'com.flashpolls.beta.dev',
'com.flashpolls.beta.prod',
'com.flashpolls.flashpolls.dev',
'com.flashpolls.... | app_id_to_arn_ids = {'co.justyo.yoapp': ['ios', 'ios-beta', 'ios-development', 'android', 'winphone'], 'co.justyo.yopolls': ['com.flashpolls.beta.dev', 'com.flashpolls.beta.prod', 'com.flashpolls.flashpolls.dev', 'com.flashpolls.flashpolls.prod', 'com.flashpolls.beta', 'com.thenet.flashpolls.dev', 'com.thenet.flashpoll... |
class ObjectSerializer(object):
"""
The object serializer is responsible for converting objects to and
from basic data types. Basic data types are serializable to and
from most common data representation languages (such as yaml or json)
Basic data types are:
- str (basestring in Python2, str i... | class Objectserializer(object):
"""
The object serializer is responsible for converting objects to and
from basic data types. Basic data types are serializable to and
from most common data representation languages (such as yaml or json)
Basic data types are:
- str (basestring in Python2, str i... |
#!/usr/bin/python
zoo = ('python', 'elephant', 'penguin') # remember the parentheses are optional
print('Number of animals in the zoo is', len(zoo))
new_zoo = ('monkey', 'camel', zoo)
print('Number of cages in the zoo is', len(new_zoo))
print('All animals in new zoo are', new_zoo)
print('Animals brought from old zoo... | zoo = ('python', 'elephant', 'penguin')
print('Number of animals in the zoo is', len(zoo))
new_zoo = ('monkey', 'camel', zoo)
print('Number of cages in the zoo is', len(new_zoo))
print('All animals in new zoo are', new_zoo)
print('Animals brought from old zoo is', new_zoo[2])
print('last animal brought from old zoo is'... |
def interest_template(isPlain, user_id, sim_percent):
percent = int(sim_percent * 100)
if isPlain:
text = "Connect with {{user-%d}} as you have %d%% interests in common" \
% (user_id, percent)
else:
text = "<orange>Connect with {{user-%d}}</orange> as you have %d%% interests in common" \
% (user_id, p... | def interest_template(isPlain, user_id, sim_percent):
percent = int(sim_percent * 100)
if isPlain:
text = 'Connect with {{user-%d}} as you have %d%% interests in common' % (user_id, percent)
else:
text = '<orange>Connect with {{user-%d}}</orange> as you have %d%% interests in common' % (user... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Helper functions for configuring scraper URLs.
"""
def house_url(path):
"""
Joins relative house url paths with stem or returns url if stem present.
:param path: String path to format.
:return: Full house URL.
"""
stem = "https://house.mo.gov"
... | """
Helper functions for configuring scraper URLs.
"""
def house_url(path):
"""
Joins relative house url paths with stem or returns url if stem present.
:param path: String path to format.
:return: Full house URL.
"""
stem = 'https://house.mo.gov'
if 'http://' in path:
path = path.r... |
# Implementation of Binary Search #
print('hello world')
print(' ')
# Define the Binary search variables #
def binary_Search(array, start, end, x):
if end >= start: # Alot the mid value #
mid = (start + end) // 2
if array[mid] == x: # Array pointer equal to mid value #
return mi... | print('hello world')
print(' ')
def binary__search(array, start, end, x):
if end >= start:
mid = (start + end) // 2
if array[mid] == x:
return mid
elif array[mid] > x:
return binary__search(array, start, mid - 1, x)
else:
return binary__search(arr... |
with open('1X-PBS_CurrentVsTime_10000sWait_Still.csv', 'r') as f:
f.readline()
f.readline()
lastVoltage = 0.0
line = f.readline()
o = None
while line:
splits = line.split(',')
voltage = float(splits[1])
if voltage != lastVoltage:
if o is not None:
... | with open('1X-PBS_CurrentVsTime_10000sWait_Still.csv', 'r') as f:
f.readline()
f.readline()
last_voltage = 0.0
line = f.readline()
o = None
while line:
splits = line.split(',')
voltage = float(splits[1])
if voltage != lastVoltage:
if o is not None:
... |
#ToDo remove version found in wp1 parser
def create_chr_mapper(mapper_file, chr_to_nc=True):
"""
First and second column of input file should be of the following
format:
First column: chr1
Second column: NC_000001.10
:param file: path to input file
:return dict= {'N... | def create_chr_mapper(mapper_file, chr_to_nc=True):
"""
First and second column of input file should be of the following
format:
First column: chr1
Second column: NC_000001.10
:param file: path to input file
:return dict= {'NC_000001.10': 'chr1'} or {'chr1': 'NC_0000... |
length = int(input())
width = int(input())
height = int(input())
number = float(input())
volume = length * width * height
total_liters = volume * 0.001
percent = number * 0.01
result = total_liters * (1 - percent)
print('{0:.3f}'.format(result)) | length = int(input())
width = int(input())
height = int(input())
number = float(input())
volume = length * width * height
total_liters = volume * 0.001
percent = number * 0.01
result = total_liters * (1 - percent)
print('{0:.3f}'.format(result)) |
class HandshakeRequestMessage(object):
def __init__(self, protocol, version):
self.protocol = protocol
self.version = version
| class Handshakerequestmessage(object):
def __init__(self, protocol, version):
self.protocol = protocol
self.version = version |
"""Interface defines required methods for an action class"""
class ActionInterface:
def execute(self):
"""Primary method of any action is to execute the code required to
fulfil the action"""
pass
| """Interface defines required methods for an action class"""
class Actioninterface:
def execute(self):
"""Primary method of any action is to execute the code required to
fulfil the action"""
pass |
a, b, c = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
MaiorAB = (a + b + abs(a - b)) / 2
MaiorABC = (MaiorAB + c + abs(MaiorAB - c)) / 2
print(f'{MaiorABC:.0f} eh o maior') | (a, b, c) = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
maior_ab = (a + b + abs(a - b)) / 2
maior_abc = (MaiorAB + c + abs(MaiorAB - c)) / 2
print(f'{MaiorABC:.0f} eh o maior') |
"""Package init."""
__author__ = """Ivan Savchenko"""
__email__ = 'iam.savchenko@gmail.com'
__version__ = '0.2.0'
| """Package init."""
__author__ = 'Ivan Savchenko'
__email__ = 'iam.savchenko@gmail.com'
__version__ = '0.2.0' |
def while_loop():
cycle = 1
print('While loop: ')
while cycle < 6:
print('Inside a loop -> cycle : ', cycle)
cycle = cycle + 1
print('Done - cycle =', cycle)
def multiplication_table():
print(' -------------------- ')
print('Multiplication table: ')
number = 1; count = 1
... | def while_loop():
cycle = 1
print('While loop: ')
while cycle < 6:
print('Inside a loop -> cycle : ', cycle)
cycle = cycle + 1
print('Done - cycle =', cycle)
def multiplication_table():
print(' -------------------- ')
print('Multiplication table: ')
number = 1
count = 1
... |
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
# simplest case
if len(s) == 0: return 0
longestSubstr = ""
tempLongest = ""
for i in range(0, len(s)):
currentChar = s[i]
tempLongest = self.getFirstNonrepeatingSubstr(s[i:])
... | class Solution:
def length_of_longest_substring(self, s: str) -> int:
if len(s) == 0:
return 0
longest_substr = ''
temp_longest = ''
for i in range(0, len(s)):
current_char = s[i]
temp_longest = self.getFirstNonrepeatingSubstr(s[i:])
i... |
#python3 code
def solution(x, y):
# Your code here
res = ((x+y-1)*(x+y-2))/2 + x
return str(res)
| def solution(x, y):
res = (x + y - 1) * (x + y - 2) / 2 + x
return str(res) |
"""Top-level package for pytolanalyst."""
__author__ = """Rob Siegwart"""
__email__ = 'rob@robsiegwart.com'
__version__ = '0.1.0'
| """Top-level package for pytolanalyst."""
__author__ = 'Rob Siegwart'
__email__ = 'rob@robsiegwart.com'
__version__ = '0.1.0' |
class GameState(object):
def __init__(self, boxes, worker, parent):
self.boxes = boxes
self.worker = worker
self.parent = parent
def __eq__(self, other):
return self.boxes == other.boxes and self.worker == other.worker
def __hash__(self):
return hash( (self.worker,... | class Gamestate(object):
def __init__(self, boxes, worker, parent):
self.boxes = boxes
self.worker = worker
self.parent = parent
def __eq__(self, other):
return self.boxes == other.boxes and self.worker == other.worker
def __hash__(self):
return hash((self.worker, ... |
def parse_adjustment(data):
return parse_adjustment_data(data['$objects'], data['$top']['root'].data)
def parse_adjustment_data(data, root_index):
out = {}
for idx, key in enumerate(data[root_index]['NS.keys']):
objkey = data[key.data]
keyval = data[root_index]['NS.objects'][idx].data
... | def parse_adjustment(data):
return parse_adjustment_data(data['$objects'], data['$top']['root'].data)
def parse_adjustment_data(data, root_index):
out = {}
for (idx, key) in enumerate(data[root_index]['NS.keys']):
objkey = data[key.data]
keyval = data[root_index]['NS.objects'][idx].data
... |
def binaryTreePaths(root: Optional[TreeNode]) -> List[str]:
paths = []
if not root:
return paths
if (not root.right) and (not root.left):
# This is a leaf
paths.append(str(root.val))
if root.right:
# append result of subtree on right
paths.extend([f"{root.val}->{s... | def binary_tree_paths(root: Optional[TreeNode]) -> List[str]:
paths = []
if not root:
return paths
if not root.right and (not root.left):
paths.append(str(root.val))
if root.right:
paths.extend([f'{root.val}->{subpath}' for subpath in self.binaryTreePaths(root.right)])
if roo... |
class InnerClass:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def generate_stuff(self):
return self.a+10*self.b+100*self.c | class Innerclass:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def generate_stuff(self):
return self.a + 10 * self.b + 100 * self.c |
def for_pentagon():
for row in range(10):
for col in range(9):
if (row==9) or (row>4 and (col==0 or col==8)) or (row+col==4 or col-row==4):
print("*",end=" ")
else:
print(end=" ")
print()
def while_pentagon():
row=0
while r... | def for_pentagon():
for row in range(10):
for col in range(9):
if row == 9 or (row > 4 and (col == 0 or col == 8)) or (row + col == 4 or col - row == 4):
print('*', end=' ')
else:
print(end=' ')
print()
def while_pentagon():
row = 0
w... |
"""
--------------------------------------------------------------------------------
Description:
Generates a statistical report for genetic circuit scoring
Written by W.R. Jackson, Ben Bremer, Eric South
--------------------------------------------------------------------------------
"""
| """
--------------------------------------------------------------------------------
Description:
Generates a statistical report for genetic circuit scoring
Written by W.R. Jackson, Ben Bremer, Eric South
--------------------------------------------------------------------------------
""" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.