content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def slices(num_string,slice_size):
if slice_size>len(num_string):
raise ValueError
list_of_slices = []
for i in range(len(num_string)-slice_size+1):
temp_answer = []
for j in range(slice_size):
temp_answer.append(int(num_string[i+j]))
list_of_slices.append(temp_answer)
return list_of_slices
def l... | def slices(num_string, slice_size):
if slice_size > len(num_string):
raise ValueError
list_of_slices = []
for i in range(len(num_string) - slice_size + 1):
temp_answer = []
for j in range(slice_size):
temp_answer.append(int(num_string[i + j]))
list_of_slices.appen... |
global LAYER_UNKNOWN
LAYER_UNKNOWN = 'unknown'
class Design(object):
def __init__(self, layers, smells) -> None:
self.layers = layers
self.smells = smells
super().__init__()
| global LAYER_UNKNOWN
layer_unknown = 'unknown'
class Design(object):
def __init__(self, layers, smells) -> None:
self.layers = layers
self.smells = smells
super().__init__() |
"""
Initialization file for tweets library module.
These exist here in lib as some of them are useful as help functions of other
scripts (such as getting available campaigns). However, these could be moved to
utils/reporting/ as individual scripts. And they could be called directly or
with make, to avoid having multip... | """
Initialization file for tweets library module.
These exist here in lib as some of them are useful as help functions of other
scripts (such as getting available campaigns). However, these could be moved to
utils/reporting/ as individual scripts. And they could be called directly or
with make, to avoid having multip... |
"""
Coin change
given coins of different denominations and a total amount of money.
Write a function to compute the number of combinations that make up that amount.
You may assume that you have infinite number of each kind of coin.
Input: amount = 25, coins = [1, 2, 5]
"""
class Solution:
def change(self, amount... | """
Coin change
given coins of different denominations and a total amount of money.
Write a function to compute the number of combinations that make up that amount.
You may assume that you have infinite number of each kind of coin.
Input: amount = 25, coins = [1, 2, 5]
"""
class Solution:
def change(self, amoun... |
class RecentCounter:
def __init__(self):
self.slide_window = deque()
def ping(self, t: int) -> int:
self.slide_window.append(t)
# invalidate the outdated pings
while self.slide_window:
if self.slide_window[0] < t - 3000:
self.slide_window.po... | class Recentcounter:
def __init__(self):
self.slide_window = deque()
def ping(self, t: int) -> int:
self.slide_window.append(t)
while self.slide_window:
if self.slide_window[0] < t - 3000:
self.slide_window.popleft()
else:
break
... |
# --------------
# Code starts here
class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio']
class_2=['Hilary Mason','Carla Gentry','Corinna Cortes']
new_class=class_1+class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove("Carla Gentry")
print(new_class)
# Cod... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
courses = {'Math': 65, 'English... |
widget = WidgetDefault()
widget.border = "None"
widget.background = "None"
commonDefaults["RadialMenuWidget"] = widget
def generateRadialMenuWidget(file, screen, menu, parentName):
name = menu.getName()
file.write(" %s = leRadialMenuWidget_New();" % (name))
generateBaseWidget(file, screen, menu)
... | widget = widget_default()
widget.border = 'None'
widget.background = 'None'
commonDefaults['RadialMenuWidget'] = widget
def generate_radial_menu_widget(file, screen, menu, parentName):
name = menu.getName()
file.write(' %s = leRadialMenuWidget_New();' % name)
generate_base_widget(file, screen, menu)
... |
def find_divisor(numbers):
for index, number in enumerate(numbers):
print("len", len(numbers[index + 1:]))
for divider in reversed(numbers[index + 1:]):
if number % divider == 0:
print("found {} and {}. Rest: {}".format(
number, divider, number % divid... | def find_divisor(numbers):
for (index, number) in enumerate(numbers):
print('len', len(numbers[index + 1:]))
for divider in reversed(numbers[index + 1:]):
if number % divider == 0:
print('found {} and {}. Rest: {}'.format(number, divider, number % divider))
... |
class University:
def __init__(self, name, country, world_rank):
self.name = name
self.country = country
self.world_rank = world_rank | class University:
def __init__(self, name, country, world_rank):
self.name = name
self.country = country
self.world_rank = world_rank |
#!/usr/bin/env python
class Solution:
def copyRandomList(self, head: 'Node') -> 'Node':
curr = head
while curr:
node = Node(curr.val, curr.next, None)
curr.next, curr = node, curr.next
curr = head
while curr:
copy = curr.next
copy.ran... | class Solution:
def copy_random_list(self, head: 'Node') -> 'Node':
curr = head
while curr:
node = node(curr.val, curr.next, None)
(curr.next, curr) = (node, curr.next)
curr = head
while curr:
copy = curr.next
copy.random = curr.random... |
def _responses_path(
config: "Config",
sim_runner: "FEMRunner",
sim_params: "SimParams",
response_type: "ResponseType",
) -> str:
"""Path to fem that were generated with given parameters."""
return sim_runner.sim_out_path(
config=config, sim_params=sim_params, ext="npy", response_types=[... | def _responses_path(config: 'Config', sim_runner: 'FEMRunner', sim_params: 'SimParams', response_type: 'ResponseType') -> str:
"""Path to fem that were generated with given parameters."""
return sim_runner.sim_out_path(config=config, sim_params=sim_params, ext='npy', response_types=[response_type])
def det(a):... |
KEY_PRESS = 0
MOUSE_DOWN = 1
MOUSE_UP = 2
MOUSE_DOUBLE_CLICK = 3
MOUSE_MOVE = 5
SCROLL_DOWN = 6
SCROLL_UP = 7
SCROLL_STEP = 1
CTRL = 'ctrl'
SHIFT = 'shift'
ALT = 'alt'
MODIFIER_KEYS = (CTRL, SHIFT, ALT,)
MODIFIER_KEYS_PRESS_DELAY = .4
EVENTS_DELAY = .05
LEFT = "left"
MIDDLE = "middle"
RIGHT = "right"
HIGH_QUALIT... | key_press = 0
mouse_down = 1
mouse_up = 2
mouse_double_click = 3
mouse_move = 5
scroll_down = 6
scroll_up = 7
scroll_step = 1
ctrl = 'ctrl'
shift = 'shift'
alt = 'alt'
modifier_keys = (CTRL, SHIFT, ALT)
modifier_keys_press_delay = 0.4
events_delay = 0.05
left = 'left'
middle = 'middle'
right = 'right'
high_quality = 75... |
#Celsius to Fahrenheit conversion
#F = C *9/5 +32
F= 0
print("Give the Number of Celcius: ")
c=float(input())
print("The result is: ")
F=c*9/5+32
print(F)
| f = 0
print('Give the Number of Celcius: ')
c = float(input())
print('The result is: ')
f = c * 9 / 5 + 32
print(F) |
# -*- coding: utf-8 -*-
"""
ParaMol MM_engines subpackage.
Contains modules related to the ParaMol representation of MM engines.
"""
__all__ = ['openmm', 'resp'] | """
ParaMol MM_engines subpackage.
Contains modules related to the ParaMol representation of MM engines.
"""
__all__ = ['openmm', 'resp'] |
#Software By AwesomeWithRex
def read_file(filename):
with open(filename) as f:
filename = f.readlines()
return filename
def get_template():
template = ''
with open('template.html', 'r') as f:
template = f.readlines()
return template
def put_in_body(file, template):
... | def read_file(filename):
with open(filename) as f:
filename = f.readlines()
return filename
def get_template():
template = ''
with open('template.html', 'r') as f:
template = f.readlines()
return template
def put_in_body(file, template):
count = 0
body_tag = 0
for i in ... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def print_list(self):
cur_node=self.head
while cur_node:
print(cur_node.data)
cur_node = cur_node.next
def ap... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def print_list(self):
cur_node = self.head
while cur_node:
print(cur_node.data)
cur_node = cur_node.next
def... |
# -*- coding: utf-8 -*-
def in_segregation(x0, R, n, N=None):
"""
return the actual indium concentration
in th nth layer
Params
------
x0 : float
the indium concentration between 0 and 1
R : float
the segregation coefficient
n : int
the current layer
N : int... | def in_segregation(x0, R, n, N=None):
"""
return the actual indium concentration
in th nth layer
Params
------
x0 : float
the indium concentration between 0 and 1
R : float
the segregation coefficient
n : int
the current layer
N : int
number of layers... |
class Solution:
def angleClock(self, hour: int, minutes: int) -> float:
hdeg = ((hour*30) + (minutes*0.5))%360
mdeg = (minutes * 6)
angle = abs(hdeg-mdeg)
return min(angle, 360-angle)
| class Solution:
def angle_clock(self, hour: int, minutes: int) -> float:
hdeg = (hour * 30 + minutes * 0.5) % 360
mdeg = minutes * 6
angle = abs(hdeg - mdeg)
return min(angle, 360 - angle) |
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
},
'targets': [
{
# Protobuf comp... | {'variables': {'chromium_code': 1, 'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out'}, 'targets': [{'target_name': 'sync_proto', 'type': 'none', 'sources': ['sync.proto', 'encryption.proto', 'app_specifics.proto', 'autofill_specifics.proto', 'bookmark_specifics.proto', 'extension_specifics.proto', 'nigori_speci... |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_file(pluginname, "sysImages/css/PagesCSS.css", "foosun")
whatweb.recog_from_file(pluginname, "Tags.html", "Foosun")
| def run(whatweb, pluginname):
whatweb.recog_from_file(pluginname, 'sysImages/css/PagesCSS.css', 'foosun')
whatweb.recog_from_file(pluginname, 'Tags.html', 'Foosun') |
# reading withdrawal amount and account balance
x,y=map(float,input().split())
# this will check if account balance is less than the withdrawal amount or
# withdrawal amount is multiple of 5 and print the current account balance
if(x+0.5>=y or x%5!=0 or y<=0):
# printing the result upto two decimals
print("%.2f"%... | (x, y) = map(float, input().split())
if x + 0.5 >= y or x % 5 != 0 or y <= 0:
print('%.2f' % y)
else:
y = y - x - 0.5
print('%.2f' % y) |
#--------------------------------------
# Open and Parse BF File
#--------------------------------------
fileName = input("Enter name of Brainf*** file here: ")
file = open(fileName, "r")
programCode = []
validCommands = [">", "<", "+", "-", ".", ",", "[", "]"]
for x in file:
for y in x:
if y in validComm... | file_name = input('Enter name of Brainf*** file here: ')
file = open(fileName, 'r')
program_code = []
valid_commands = ['>', '<', '+', '-', '.', ',', '[', ']']
for x in file:
for y in x:
if y in validCommands:
programCode.append(y)
file.close()
bracket_positions = []
loop_index = 0
open_index = ... |
_registered_input_modules_types = {}
def register(name, class_type):
if name in _registered_input_modules_types:
raise RuntimeError("Dublicate input module name: " + name)
_registered_input_modules_types[name] = class_type
def load_modules(agent, input_link_config):
input_modules = []
# get in... | _registered_input_modules_types = {}
def register(name, class_type):
if name in _registered_input_modules_types:
raise runtime_error('Dublicate input module name: ' + name)
_registered_input_modules_types[name] = class_type
def load_modules(agent, input_link_config):
input_modules = []
if not ... |
def find_missing(array):
return [x for x in range(array[0], array[-1] + 1) if x not in array]
lst = [2, 4, 1, 7, 10]
print(find_missing(lst)) | def find_missing(array):
return [x for x in range(array[0], array[-1] + 1) if x not in array]
lst = [2, 4, 1, 7, 10]
print(find_missing(lst)) |
def trigger():
return """
CREATE OR REPLACE FUNCTION trg_mensagem_ticket_solucao()
RETURNS TRIGGER AS $$
BEGIN
IF (NEW.solucao) THEN
UPDATE ticket SET solucionado_id = NEW.id, data_solucao = NOW(), hora_solucao = NOW() WHERE id = NEW.ticket_id;
... | def trigger():
return '\n CREATE OR REPLACE FUNCTION trg_mensagem_ticket_solucao()\n RETURNS TRIGGER AS $$\n BEGIN\n IF (NEW.solucao) THEN\n UPDATE ticket SET solucionado_id = NEW.id, data_solucao = NOW(), hora_solucao = NOW() WHERE id = NEW.ticket_id;\n ... |
S1 = "Hello Python"
print(S1) # Prints complete string
print(S1[0]) # Prints first character of the string
print(S1[2:5]) # Prints character starting from 3rd t 5th
print(S1[2:]) # Prints string starting from 3rd character
print(S1 * 2) # Prints string two times
print(S1 + "Thanks") # Prints concatenated string
| s1 = 'Hello Python'
print(S1)
print(S1[0])
print(S1[2:5])
print(S1[2:])
print(S1 * 2)
print(S1 + 'Thanks') |
def onSpawn():
while True:
pet.moveXY(48, 8)
pet.moveXY(12, 8)
pet.on("spawn", onSpawn)
while True:
hero.say("Run!!!")
hero.say("Faster!")
| def on_spawn():
while True:
pet.moveXY(48, 8)
pet.moveXY(12, 8)
pet.on('spawn', onSpawn)
while True:
hero.say('Run!!!')
hero.say('Faster!') |
def valid_parentheses(parens):
"""Are the parentheses validly balanced?
>>> valid_parentheses("()")
True
>>> valid_parentheses("()()")
True
>>> valid_parentheses("(()())")
True
>>> valid_parentheses(")()")
False
>>> valid_parentheses("())"... | def valid_parentheses(parens):
"""Are the parentheses validly balanced?
>>> valid_parentheses("()")
True
>>> valid_parentheses("()()")
True
>>> valid_parentheses("(()())")
True
>>> valid_parentheses(")()")
False
>>> valid_parentheses("())"... |
# TO print Fibonacci Series upto n numbers and replace all prime numbers and multiples of 5 by 0
# Checking for prime numbers
def isprime(numb):
if numb == 2:
return True
elif numb == 3:
return True
else :
for i in range(2, numb // 2 + 1):
if (numb % i) == 0:
... | def isprime(numb):
if numb == 2:
return True
elif numb == 3:
return True
else:
for i in range(2, numb // 2 + 1):
if numb % i == 0:
return False
else:
return True
def fibonacci_series(n):
flag = 0
(a, b) = (1, 1)
if ... |
class Solution:
def reorderLogFiles(self, logs: List[str]) -> List[str]:
def corder(log):
identifier, detail = log.split(None, 1)
return (0, detail, identifier) if detail[0].isalpha() else (1,)
return sorted(logs, key=corder)
| class Solution:
def reorder_log_files(self, logs: List[str]) -> List[str]:
def corder(log):
(identifier, detail) = log.split(None, 1)
return (0, detail, identifier) if detail[0].isalpha() else (1,)
return sorted(logs, key=corder) |
# -*- coding: utf-8 -*-
"""
reV Econ utilities
"""
def lcoe_fcr(fixed_charge_rate, capital_cost, fixed_operating_cost,
annual_energy_production, variable_operating_cost):
"""Calculate the Levelized Cost of Electricity (LCOE) using the
fixed-charge-rate method:
LCOE = ((fixed_charge_rate * ca... | """
reV Econ utilities
"""
def lcoe_fcr(fixed_charge_rate, capital_cost, fixed_operating_cost, annual_energy_production, variable_operating_cost):
"""Calculate the Levelized Cost of Electricity (LCOE) using the
fixed-charge-rate method:
LCOE = ((fixed_charge_rate * capital_cost + fixed_operating_cost)
... |
"""
Base Exception
MLApp Exception - inherit from Base Exception
"""
class MLAppBaseException(Exception):
def __init__(self, message):
self.message = message
class FrameworkException(MLAppBaseException):
def __init__(self, message=None):
if message is not None and isinstance(message, str):
... | """
Base Exception
MLApp Exception - inherit from Base Exception
"""
class Mlappbaseexception(Exception):
def __init__(self, message):
self.message = message
class Frameworkexception(MLAppBaseException):
def __init__(self, message=None):
if message is not None and isinstance(message, str):
... |
# initiate empty list to hold user input and sum value of zero
user_list = []
list_sum = 0
# seek user input for ten numbers
for i in range(10):
userInput = input("Enter any 2-digit number: ")
# check to see if number is even and if yes, add to list_sum
# print incorrect value warning when ValueError ex... | user_list = []
list_sum = 0
for i in range(10):
user_input = input('Enter any 2-digit number: ')
try:
number = int(userInput)
user_list.append(number)
if number % 2 == 0:
list_sum += number
except ValueError:
print("Incorrect value. That's not an int!")
print('use... |
load("@io_bazel_rules_docker//container:pull.bzl", "container_pull")
def containers():
container_pull(
name = "alpine_linux_amd64",
registry = "index.docker.io",
repository = "library/alpine",
tag = "3.14.2",
)
| load('@io_bazel_rules_docker//container:pull.bzl', 'container_pull')
def containers():
container_pull(name='alpine_linux_amd64', registry='index.docker.io', repository='library/alpine', tag='3.14.2') |
BUILD_STATE = (
('triggered', 'Triggered'),
('building', 'Building'),
('finished', 'Finished'),
)
BUILD_TYPES = (
('html', 'HTML'),
('pdf', 'PDF'),
('epub', 'Epub'),
('man', 'Manpage'),
)
| build_state = (('triggered', 'Triggered'), ('building', 'Building'), ('finished', 'Finished'))
build_types = (('html', 'HTML'), ('pdf', 'PDF'), ('epub', 'Epub'), ('man', 'Manpage')) |
class Solution:
def getDecimalValue(self, head: ListNode) -> int:
return self.getDecimalValueHelper(head)[0]
def getDecimalValueHelper(self, head: ListNode) -> int:
if head is None:
return (0, 0)
total, exp = self.getDecimalValueHelper(head.next)
currbit = head.val
... | class Solution:
def get_decimal_value(self, head: ListNode) -> int:
return self.getDecimalValueHelper(head)[0]
def get_decimal_value_helper(self, head: ListNode) -> int:
if head is None:
return (0, 0)
(total, exp) = self.getDecimalValueHelper(head.next)
currbit = he... |
# Copyright (C) 2009 Duncan McGreggor <duncan@canonical.com>
# Copyright (C) 2009 Robert Collins <robertc@robertcollins.net>
# Copyright (C) 2012 New Dream Network, LLC (DreamHost)
# Licenced under the txaws licence available at /LICENSE in the txaws source.
__all__ = ["REGION_US", "REGION_EU", "EC2_US_EAST", "EC2_US_... | __all__ = ['REGION_US', 'REGION_EU', 'EC2_US_EAST', 'EC2_US_WEST', 'EC2_ASIA_PACIFIC', 'EC2_EU_WEST', 'EC2_SOUTH_AMERICA_EAST', 'EC2_ALL_REGIONS']
region_us = 'US'
region_eu = 'EU'
ec2_endpoint_us = 'https://us-east-1.ec2.amazonaws.com/'
ec2_endpoint_eu = 'https://eu-west-1.ec2.amazonaws.com/'
sqs_endpoint_us = 'https:... |
"""
224. Basic Calculator
Example 1:
Input: "1 + 1"
Output: 2
Example 2:
Input: " 2-1 + 2 "
Output: 3
Example 3:
Input: "(1+(4+5+2)-3)+(6+8)"
Output: 23
"""
class Solution:
def calculate(self, s):
"""
:type s: str
:rtype: int
"""
self.stack = []
... | """
224. Basic Calculator
Example 1:
Input: "1 + 1"
Output: 2
Example 2:
Input: " 2-1 + 2 "
Output: 3
Example 3:
Input: "(1+(4+5+2)-3)+(6+8)"
Output: 23
"""
class Solution:
def calculate(self, s):
"""
:type s: str
:rtype: int
"""
self.stack = []
(i, res, n, sign... |
n = int(input())
for i in range(0, n):
line = input()
b, p = line.split()
b = int(b)
p = float(p)
calc = (60 * b) / p
var = 60 / p
min = calc - var
max = calc + var
print(min, calc, max) | n = int(input())
for i in range(0, n):
line = input()
(b, p) = line.split()
b = int(b)
p = float(p)
calc = 60 * b / p
var = 60 / p
min = calc - var
max = calc + var
print(min, calc, max) |
a = int(input('First number'))
b = int(input('Second number'))
if a>b:
print(a)
else:
print(b)
| a = int(input('First number'))
b = int(input('Second number'))
if a > b:
print(a)
else:
print(b) |
# Copyright (c) Microsoft Corporation.
#
# 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 agreed to in wri... | async def test_should_clear_cookies(context, page, server):
await page.goto(server.EMPTY_PAGE)
await context.addCookies([{'url': server.EMPTY_PAGE, 'name': 'cookie1', 'value': '1'}])
assert await page.evaluate('document.cookie') == 'cookie1=1'
await context.clearCookies()
assert await context.cookie... |
"""
RedPocket Exceptions
"""
class RedPocketException(Exception):
"""Base API Exception"""
def __init__(self, message: str = ""):
self.message = message
class RedPocketAuthError(RedPocketException):
"""Invalid Account Credentials"""
class RedPocketAPIError(RedPocketException):
"""Error re... | """
RedPocket Exceptions
"""
class Redpocketexception(Exception):
"""Base API Exception"""
def __init__(self, message: str=''):
self.message = message
class Redpocketautherror(RedPocketException):
"""Invalid Account Credentials"""
class Redpocketapierror(RedPocketException):
"""Error returne... |
# pylint: disable=C0111
__all__ = ["test_dataset",
"test_label_smoother",
"test_noam_optimizer",
"test_tokenizer",
"test_transformer",
"test_transformer_data_batching",
"test_transformer_dataset",
"test_transformer_positional_encoder",
... | __all__ = ['test_dataset', 'test_label_smoother', 'test_noam_optimizer', 'test_tokenizer', 'test_transformer', 'test_transformer_data_batching', 'test_transformer_dataset', 'test_transformer_positional_encoder', 'test_vocabulary', 'test_word2vec', 'test_data', 'test_cnn'] |
distancia1: float; distancia2: float; distancia3: float; maiorD: float
print("Digite as tres distancias: ")
distancia1 = float(input())
distancia2 = float(input())
distancia3 = float(input())
if distancia1 > distancia2 and distancia1 > distancia3:
maiorD = distancia1
elif distancia2 > distancia3:
maiorD = dis... | distancia1: float
distancia2: float
distancia3: float
maior_d: float
print('Digite as tres distancias: ')
distancia1 = float(input())
distancia2 = float(input())
distancia3 = float(input())
if distancia1 > distancia2 and distancia1 > distancia3:
maior_d = distancia1
elif distancia2 > distancia3:
maior_d = dista... |
#
# PySNMP MIB module ALTIGA-GLOBAL-REG (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-GLOBAL-REG
# Produced by pysmi-0.3.4 at Wed May 1 11:21:16 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, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ... |
# 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 agreed to in writing, software
# distributed under the... | """
This module is part of the nmeta2 suite
.
It defines a custom traffic classifier
.
To create your own custom classifier, copy this example to a new
file in the same directory and update the code as required.
Call it from nmeta by specifying the name of the file (without the
.py) in main_policy.yaml
.
Classifiers ar... |
# Since any modulus should lay between 0 and 101, we can record all
# possible modulus at any given point in the calculation. The possible
# set of values of next step can be calculated using the previous set.
# Since there's guaranteed to be an answer, we will eventually make
# modulus 0 possible. We then backtrack to... | n = int(input())
a = list(map(int, input().split()))
op = ['*'] * (N - 1)
possible = [[None] * 101 for i in range(N)]
possible[0][A[0]] = True
end = N - 1
for i in range(N - 1):
if possible[i][0]:
end = i
break
for x in range(101):
if possible[i][x]:
possible[i + 1][(x + A[i ... |
# File: koodous_consts.py
#
# Copyright (c) 2018-2021 Splunk 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 app... | phantom_err_code_unavailable = 'Error code unavailable'
phantom_err_msg_unavailable = 'Unknown error occurred. Please check the asset configuration and|or action parameters.'
vault_err_invalid_vault_id = 'Invalid Vault ID'
vault_err_file_not_found = 'Vault file could not be found with supplied Vault ID'
koodous_base_ur... |
"""
Conditional expression Evaluated to one of two expressions depending on a boolean.
e.g: result = true_value if condition else false_value
"""
def sequence_class(immutable):
return tuple if immutable else list
seq = sequence_class(immutable=True)
t = seq("OrHasson")
print(t)
print(type(t))
| """
Conditional expression Evaluated to one of two expressions depending on a boolean.
e.g: result = true_value if condition else false_value
"""
def sequence_class(immutable):
return tuple if immutable else list
seq = sequence_class(immutable=True)
t = seq('OrHasson')
print(t)
print(type(t)) |
def print_two(*args):
arg1, arg2 =args
print(f"arg1 : {arg1},arg2 : {arg2}")
def print_two_again(arg1,arg2):
print(f"arg1:{arg1},arg2:{arg2}")
def print_one(arg1):
print(f"arg1:{arg1}")
def print_none():
print("I got nothing")
print_two("Zed","Shaw")
print_two_again("Zed","Shaw")
print_one("First!")... | def print_two(*args):
(arg1, arg2) = args
print(f'arg1 : {arg1},arg2 : {arg2}')
def print_two_again(arg1, arg2):
print(f'arg1:{arg1},arg2:{arg2}')
def print_one(arg1):
print(f'arg1:{arg1}')
def print_none():
print('I got nothing')
print_two('Zed', 'Shaw')
print_two_again('Zed', 'Shaw')
print_one(... |
'''
Provide transmission-daemon RPC credentials
'''
rpc_ip = ''
rpc_port = ''
rpc_username = ''
rpc_password = ''
| """
Provide transmission-daemon RPC credentials
"""
rpc_ip = ''
rpc_port = ''
rpc_username = ''
rpc_password = '' |
''' Kattis - secretchamber
Without much execution time pressure along with nodes being characters, we opt to use python with a
dict of dicts as our adjacency matrix. This is basically just floyd warshall transitive closure.
Time: O(V^3), Mem: O(V^2)
'''
n, q = input().split()
n = int(n)
q = int(q)
edges = []
node_nam... | """ Kattis - secretchamber
Without much execution time pressure along with nodes being characters, we opt to use python with a
dict of dicts as our adjacency matrix. This is basically just floyd warshall transitive closure.
Time: O(V^3), Mem: O(V^2)
"""
(n, q) = input().split()
n = int(n)
q = int(q)
edges = []
node_na... |
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
maria = Person("Maria Popova", 25)
print(hasattr(maria,"name"))
print(hasattr(maria,"surname"))
print(getattr(maria, "age"))
setattr(maria, "surname", "Popova")
print(getattr(maria, "surname"))
| class Person:
def __init__(self, name, age):
self.name = name
self.age = age
maria = person('Maria Popova', 25)
print(hasattr(maria, 'name'))
print(hasattr(maria, 'surname'))
print(getattr(maria, 'age'))
setattr(maria, 'surname', 'Popova')
print(getattr(maria, 'surname')) |
def spiral(steps):
dx = 1
dy = 0
dd = 1
x = 0
y = 0
d = 0
for _ in range(steps - 1):
x += dx
y += dy
d += 1
if d == dd:
d = 0
tmp = dx
dx = -dy
dy = tmp
if dy == 0:
dd += 1
yie... | def spiral(steps):
dx = 1
dy = 0
dd = 1
x = 0
y = 0
d = 0
for _ in range(steps - 1):
x += dx
y += dy
d += 1
if d == dd:
d = 0
tmp = dx
dx = -dy
dy = tmp
if dy == 0:
dd += 1
yie... |
with open('do-plecaka.txt', 'r') as f:
dane = []
# getting and cleaning data
for line in f:
dane.append([int(x) for x in line.split()])
# printing
for x in dane:
print(x) | with open('do-plecaka.txt', 'r') as f:
dane = []
for line in f:
dane.append([int(x) for x in line.split()])
for x in dane:
print(x) |
# measurements in inches
ball_radius = 3
goal_top = 50
goal_width = 58
goal_half = 29
angle_threshold = .1
class L_params(object):
horizontal_offset = 14.5
vertical_offset = 18.5
min_y = ball_radius - vertical_offset+3 # in robot coords
max_y = goal_top - vertical_offset
min_x = -14.5
max_x = 14.0
l1 = 11
l... | ball_radius = 3
goal_top = 50
goal_width = 58
goal_half = 29
angle_threshold = 0.1
class L_Params(object):
horizontal_offset = 14.5
vertical_offset = 18.5
min_y = ball_radius - vertical_offset + 3
max_y = goal_top - vertical_offset
min_x = -14.5
max_x = 14.0
l1 = 11
l2 = 11
shoulder... |
class Solution:
def numDecodings(self, s: str) -> int:
if s[0] == '0' or '00' in s:
return 0
for idx, _ in enumerate(s):
if idx == 0:
pre, cur = 1, 1
else:
tmp = cur
if _ != '0':
if s[idx - 1] == ... | class Solution:
def num_decodings(self, s: str) -> int:
if s[0] == '0' or '00' in s:
return 0
for (idx, _) in enumerate(s):
if idx == 0:
(pre, cur) = (1, 1)
else:
tmp = cur
if _ != '0':
if s[idx ... |
def find_skew_value(text):
length_of_text = len(text)
skew_value = 0
skew_value_list = []
for i in range(0, length_of_text):
if text[i] == 'C':
skew_value = skew_value - 1
elif text[i] == 'G':
skew_value = skew_value + 1
skew_value_list.append(skew_v... | def find_skew_value(text):
length_of_text = len(text)
skew_value = 0
skew_value_list = []
for i in range(0, length_of_text):
if text[i] == 'C':
skew_value = skew_value - 1
elif text[i] == 'G':
skew_value = skew_value + 1
skew_value_list.append(skew_value)
... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 22 10:46:35 2019
@author: SPAD-FCS
"""
class correlations:
pass
def selectG(G, selection='average'):
"""
Return a selection of the autocorrelations
========== ===============================================================
Input Meaning
-... | """
Created on Wed May 22 10:46:35 2019
@author: SPAD-FCS
"""
class Correlations:
pass
def select_g(G, selection='average'):
"""
Return a selection of the autocorrelations
========== ===============================================================
Input Meaning
---------- ------------... |
#!/usr/bin/env python3
etape = 1
compteur = 0
n = 0
while True:
print(f"{etape:4d} : {n:5d} { -2+(etape)*(etape+2):6d} ; ", end="")
for _ in range(3 + etape):
n += 1
print(n, end=" ")
compteur += 1
if compteur == 500000:
print(n)
exit()
print()... | etape = 1
compteur = 0
n = 0
while True:
print(f'{etape:4d} : {n:5d} {-2 + etape * (etape + 2):6d} ; ', end='')
for _ in range(3 + etape):
n += 1
print(n, end=' ')
compteur += 1
if compteur == 500000:
print(n)
exit()
print()
n += etape
etape... |
class EPIconst:
class FeatureName:
pseknc = "pseknc"
cksnap = "cksnap"
dpcp = "dpcp"
eiip = "eiip"
kmer = "kmer"
tpcp = "tpcp"
all = sorted([pseknc, cksnap, dpcp, eiip, kmer, tpcp])
class CellName:
K562 = "K562"
NHEK = "NHEK"
IMR90... | class Epiconst:
class Featurename:
pseknc = 'pseknc'
cksnap = 'cksnap'
dpcp = 'dpcp'
eiip = 'eiip'
kmer = 'kmer'
tpcp = 'tpcp'
all = sorted([pseknc, cksnap, dpcp, eiip, kmer, tpcp])
class Cellname:
k562 = 'K562'
nhek = 'NHEK'
imr9... |
# Functions can encapsulate functionality you want to reuse:
def even_odd(x):
if x % 2 == 0:
print("even")
else:
print("odd")
# reused
even_odd(2)
even_odd(4)
even_odd(7)
even_odd(22)
even_odd(8)
# output should be >>> even, even, odd, even, even
| def even_odd(x):
if x % 2 == 0:
print('even')
else:
print('odd')
even_odd(2)
even_odd(4)
even_odd(7)
even_odd(22)
even_odd(8) |
version = '0.11.0'
version_cmd = 'confd -version'
download_url = 'https://github.com/kelseyhightower/confd/releases/download/vVERSION/confd-VERSION-linux-amd64'
install_script = """
chmod +x confd-VERSION-linux-amd64
mv -f confd-VERSION-linux-amd64 /usr/local/bin/confd
"""
| version = '0.11.0'
version_cmd = 'confd -version'
download_url = 'https://github.com/kelseyhightower/confd/releases/download/vVERSION/confd-VERSION-linux-amd64'
install_script = '\nchmod +x confd-VERSION-linux-amd64\nmv -f confd-VERSION-linux-amd64 /usr/local/bin/confd\n' |
class Sensors:
def __init__(self, **kwargs):
self.sensor_data_dictionary = kwargs
def update(self, **kwargs):
self.sensor_data_dictionary = kwargs
def get_value(self, key):
return (self.sensor_data_dictionary.get(key))
| class Sensors:
def __init__(self, **kwargs):
self.sensor_data_dictionary = kwargs
def update(self, **kwargs):
self.sensor_data_dictionary = kwargs
def get_value(self, key):
return self.sensor_data_dictionary.get(key) |
# https://www.google.com/webhp?sourceid=chrome-
# instant&ion=1&espv=2&ie=UTF-8#q=dp%20coin%20change
def coin_change_recur(coins,n,change_sum):
# If sum is 0 there exists a solution with no coins
if change_sum == 0:
return 1
# if sum is less then 0 no solution exists
if change_sum < 0:
... | def coin_change_recur(coins, n, change_sum):
if change_sum == 0:
return 1
if change_sum < 0:
return 0
if n <= 0 and change_sum > 0:
return 0
return coin_change_recur(coins, n - 1, change_sum) + coin_change_recur(coins, n, change_sum - coins[n - 1])
memo_dict = {}
def coin_change... |
def calc_fuel(mass: int):
return max(mass // 3 - 2, 0)
def calc_fuel_rec(mass: int):
fuel = calc_fuel(mass)
if fuel == 0:
return fuel
else:
return fuel + calc_fuel_rec(fuel)
| def calc_fuel(mass: int):
return max(mass // 3 - 2, 0)
def calc_fuel_rec(mass: int):
fuel = calc_fuel(mass)
if fuel == 0:
return fuel
else:
return fuel + calc_fuel_rec(fuel) |
MODEL_TYPE = {
"PointRend" : 1,
"MobileNetV3Large" : 2,
"MobileNetV3Small" : 3
}
TASK_TYPE = {
"Object Detection" : 1,
"Instance Segmentation (Map)" : 2,
"Instance Segmentation (Blend)" : 3
}
"""
0 : No Ml model to run
1 : Object Detection : PointRend
2 : Instance Detection (Map) : MobileV3Lar... | model_type = {'PointRend': 1, 'MobileNetV3Large': 2, 'MobileNetV3Small': 3}
task_type = {'Object Detection': 1, 'Instance Segmentation (Map)': 2, 'Instance Segmentation (Blend)': 3}
'\n0 : No Ml model to run \n1 : Object Detection : PointRend\n2 : Instance Detection (Map) : MobileV3Large \n3 : Instance Detection (Blend... |
class Cls:
x = "a"
d = {"a": "ab"}
cl = Cls()
cl.x = "b"
d[cl.x]
| class Cls:
x = 'a'
d = {'a': 'ab'}
cl = cls()
cl.x = 'b'
d[cl.x] |
#Copyright 2018 Infosys Ltd.
#Use of this source code is governed by Apache 2.0 license that can be found in the LICENSE file or at
#http://www.apache.org/licenses/LICENSE-2.0 .
####DATABASE QUERY STATUS CODES####
CON000 = 'CON000' # Successfull database connection
CON001 = 'CON001' # Failed to connect to databa... | con000 = 'CON000'
con001 = 'CON001'
exe000 = 'EXE000'
exe001 = 'EXE001' |
#a = int(input())
#b = int(input())
entrada = input()
a, b = entrada.split(" ")
a = int(a)
b = int(b)
if(a > b):
if(a%b == 0):
print ("Sao Multiplos")
else:
print("Nao sao Multiplos")
else:
if(b%a == 0):
print("Sao Multiplos")
else:
print("Nao sao Multiplos")
| entrada = input()
(a, b) = entrada.split(' ')
a = int(a)
b = int(b)
if a > b:
if a % b == 0:
print('Sao Multiplos')
else:
print('Nao sao Multiplos')
elif b % a == 0:
print('Sao Multiplos')
else:
print('Nao sao Multiplos') |
class Solution:
def orangesRotting(self, grid: List[List[int]]) -> int:
d=0
while True:
c=False
old=[]
for i in range(len(grid)):
s=[]
for j in range(len(grid[0])):
s.append(grid[i][j])
old.append... | class Solution:
def oranges_rotting(self, grid: List[List[int]]) -> int:
d = 0
while True:
c = False
old = []
for i in range(len(grid)):
s = []
for j in range(len(grid[0])):
s.append(grid[i][j])
... |
class Solution:
def binaryGap(self, n: int) -> int:
a = str(bin(n))
a = a[2:]
dis = []
c = 0
for i in range(len(a)):
if a[i] == "1":
dis.append(c)
c = 0
c +=1
return max(dis)
... | class Solution:
def binary_gap(self, n: int) -> int:
a = str(bin(n))
a = a[2:]
dis = []
c = 0
for i in range(len(a)):
if a[i] == '1':
dis.append(c)
c = 0
c += 1
return max(dis) |
class Suggestion:
def __init__(self, obj=None):
"""
See "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-response"
"""
self.text = obj.get('text', None)
self.street_line = obj.get('street_line', None)
self.city = obj.get('city', None)
self.state ... | class Suggestion:
def __init__(self, obj=None):
"""
See "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-response"
"""
self.text = obj.get('text', None)
self.street_line = obj.get('street_line', None)
self.city = obj.get('city', None)
self.state... |
# coding: utf-8
# In[1]:
#num01_SwethaMJ.py
sum_ = 0
for i in range(1,1000):
if i%3==0 or i%5==0:
sum_ += i
print(sum_)
| sum_ = 0
for i in range(1, 1000):
if i % 3 == 0 or i % 5 == 0:
sum_ += i
print(sum_) |
# M6 #2
str = 'inet addr:127.0.0.1 Mask:255.0.0.0'
index = str.find(':')
if index > 0:
# clip off the front
str1 = str[index+1:]
i = str1.find(' ')
addr = str1[:i].rstrip()
# addr is the inet address
print('Address: ', addr)
| str = 'inet addr:127.0.0.1 Mask:255.0.0.0'
index = str.find(':')
if index > 0:
str1 = str[index + 1:]
i = str1.find(' ')
addr = str1[:i].rstrip()
print('Address: ', addr) |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
... | class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls] |
class Solution:
def romanToInt(self, s: str) -> int:
dic = {"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000}
res = 0
while s:
letter = s[0]
if len(s)==1:
res+=dic[letter]
return res
if dic[letter]>=d... | class Solution:
def roman_to_int(self, s: str) -> int:
dic = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
res = 0
while s:
letter = s[0]
if len(s) == 1:
res += dic[letter]
return res
if dic[letter] >= d... |
class blank (object):
def __init__ (self):
object.__init__ (self)
deployment_settings = blank ()
# Web2py Settings
deployment_settings.web2py = blank ()
deployment_settings.web2py.port = 8000
# Database settings
deployment_settings.database = blank ()
deployment_settings.database.db_type = "sqlite"
deplo... | class Blank(object):
def __init__(self):
object.__init__(self)
deployment_settings = blank()
deployment_settings.web2py = blank()
deployment_settings.web2py.port = 8000
deployment_settings.database = blank()
deployment_settings.database.db_type = 'sqlite'
deployment_settings.database.host = 'localhost'
dep... |
def insertion_sort(to_sort):
i=0
while i <= len(to_sort)-1:
hole = i;
item = to_sort[i]
while hole > 0 and to_sort[hole-1] > item:
to_sort[hole] = to_sort[hole-1]
hole-=1
to_sort[hole] = item
i+=1
return to_sort
| def insertion_sort(to_sort):
i = 0
while i <= len(to_sort) - 1:
hole = i
item = to_sort[i]
while hole > 0 and to_sort[hole - 1] > item:
to_sort[hole] = to_sort[hole - 1]
hole -= 1
to_sort[hole] = item
i += 1
return to_sort |
load_modules = {
'hw_USBtin': {'port':'auto', 'speed':500}, # IO hardware module # Module for sniff and replay
'mod_stat': {"bus":'mod_stat','debug':2},'mod_stat~2': {"bus":'mod_stat'},
'mod_firewall': {}, 'mod_fuzz1':{'debug':2},
'gen_replay': {'debug': 1}# Stats
}... | load_modules = {'hw_USBtin': {'port': 'auto', 'speed': 500}, 'mod_stat': {'bus': 'mod_stat', 'debug': 2}, 'mod_stat~2': {'bus': 'mod_stat'}, 'mod_firewall': {}, 'mod_fuzz1': {'debug': 2}, 'gen_replay': {'debug': 1}}
actions = [{'hw_USBtin': {'action': 'read', 'pipe': 1}}, {'mod_stat': {'pipe': 1}}, {'mod_firewall': {'w... |
def dragon_lives_for(sequence):
dragon_size = 50
sheep = 0
squeezed_for = 0
days = 0
while True:
sheep += sequence.pop(0)
if dragon_size <= sheep:
sheep -= dragon_size
dragon_size += 1
squeezed_for = 0
else:
sheep = 0
... | def dragon_lives_for(sequence):
dragon_size = 50
sheep = 0
squeezed_for = 0
days = 0
while True:
sheep += sequence.pop(0)
if dragon_size <= sheep:
sheep -= dragon_size
dragon_size += 1
squeezed_for = 0
else:
sheep = 0
... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------
# Copyright (C) 2009 StatPro Italia s.r.l.
#
# StatPro Italia
# Via G. B. Vico 4
# I-20123 Milano
# ITALY
#
# phone: +39 02 96875 1
# fax: +39 02 96875 605
#
# email: info@riskmap.net
#
# This program is distributed in the ... | """drmaa constants"""
attr_buffer = 1024
contact_buffer = 1024
drm_system_buffer = 1024
drmaa_implementation_buffer = 1024
error_string_buffer = 1024
jobname_buffer = 1024
signal_buffer = 32
timeout_wait_forever = -1
timeout_no_wait = 0
job_ids_session_any = 'DRMAA_JOB_IDS_SESSION_ANY'
job_ids_session_all = 'DRMAA_JOB_... |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
AUTO_VALUE_VERSION = "1.7.4"
maven_jar(
name = "auto-value",
artifact = "com.google.auto.value:auto-value:" + AUTO_VALUE_VERSION,
sha1 = "6b126cb218af768339e4d6e95a9b0ae41f74e73d",
)
maven_jar(
... | load('//tools/bzl:maven_jar.bzl', 'maven_jar')
def external_plugin_deps():
auto_value_version = '1.7.4'
maven_jar(name='auto-value', artifact='com.google.auto.value:auto-value:' + AUTO_VALUE_VERSION, sha1='6b126cb218af768339e4d6e95a9b0ae41f74e73d')
maven_jar(name='auto-value-annotations', artifact='com.goo... |
# -*- coding: utf-8 -*-
class AzureShellCache:
__inst = None
__cache = {}
@staticmethod
def Instance():
if AzureShellCache.__inst == None:
AzureShellCache()
return AzureShellCache.__inst
def __init__(self):
if AzureShellCache.__inst != None:
raise ... | class Azureshellcache:
__inst = None
__cache = {}
@staticmethod
def instance():
if AzureShellCache.__inst == None:
azure_shell_cache()
return AzureShellCache.__inst
def __init__(self):
if AzureShellCache.__inst != None:
raise exception('This must not... |
solutions = []
maxAllowed = 10**1000
value = 1
base = 1
while value * value <= maxAllowed:
while value < base * 10:
solutions.append(value)
value += base
base = value
solutions.append(value)
while True:
num = int(input())
if num == 0:
break
# Binary search
... | solutions = []
max_allowed = 10 ** 1000
value = 1
base = 1
while value * value <= maxAllowed:
while value < base * 10:
solutions.append(value)
value += base
base = value
solutions.append(value)
while True:
num = int(input())
if num == 0:
break
start = 0
end = len(solution... |
# template_parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'template_validateALL ARROW ARROWPARENS ARROW_PRE ASSIGN ASSIGNBAND ASSIGNBOR ASSIGNBXOR ASSIGNDIVIDE ASSIGNLLSHIFT ASSIGNLSHIFT ASSIGNMINUS ASSIGNMOD ASSIGNPLU... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'template_validateALL ARROW ARROWPARENS ARROW_PRE ASSIGN ASSIGNBAND ASSIGNBOR ASSIGNBXOR ASSIGNDIVIDE ASSIGNLLSHIFT ASSIGNLSHIFT ASSIGNMINUS ASSIGNMOD ASSIGNPLUS ASSIGNRRSHIFT ASSIGNRSHIFT ASSIGNTIMES AWAIT BACKSLASH BAND BITINV BNEGATE BOR BREAK BXOR BYTE CASE C... |
def f():
print('f executed from module 1')
if __name__ == '__main__':
print('We are in module 1')
| def f():
print('f executed from module 1')
if __name__ == '__main__':
print('We are in module 1') |
class ParserError(Exception):
"""
Base parser exception class.
Throws when any error occurs.
"""
pass
| class Parsererror(Exception):
"""
Base parser exception class.
Throws when any error occurs.
"""
pass |
n=int(input("Enter a number : "))
r=int(input("Enter range of table : "))
print("Multiplication Table of",n,"is")
for i in range(0,r):
i=i+1
print(n,"X",i,"=",n*i)
print("Loop completed") | n = int(input('Enter a number : '))
r = int(input('Enter range of table : '))
print('Multiplication Table of', n, 'is')
for i in range(0, r):
i = i + 1
print(n, 'X', i, '=', n * i)
print('Loop completed') |
PRACTICE = False
N_DAYS = 80
with open("test.txt" if PRACTICE else "input.txt", "r") as f:
content = f.read().strip()
state = list(map(int, content.split(",")))
def next_day(state):
new_state = []
num_new = 0
for fish in state:
if fish == 0:
new_state.append(6)
num_new... | practice = False
n_days = 80
with open('test.txt' if PRACTICE else 'input.txt', 'r') as f:
content = f.read().strip()
state = list(map(int, content.split(',')))
def next_day(state):
new_state = []
num_new = 0
for fish in state:
if fish == 0:
new_state.append(6)
num_new +... |
# This program says hello
print("Hello World!")
# Ask the user to input their name and assign it to the name variable
print("What is your name? ")
myName = input()
# Print out greet followed by name
print("It is good to meet you, " + myName)
# Print out the length of the name
print("The length of your name " + str(le... | print('Hello World!')
print('What is your name? ')
my_name = input()
print('It is good to meet you, ' + myName)
print('The length of your name ' + str(len(myName)))
print('What is your age?')
my_age = input()
print('You will be ' + str(int(myAge) + 1) + 'in a year. ') |
N = int(input())
x, y = 0, 0
for _ in range(N):
T, S = input().split()
T = int(T)
x += min(int(12 * T / 1000), len(S))
y += max(len(S) - int(12 * T / 1000), 0)
print(x, y)
| n = int(input())
(x, y) = (0, 0)
for _ in range(N):
(t, s) = input().split()
t = int(T)
x += min(int(12 * T / 1000), len(S))
y += max(len(S) - int(12 * T / 1000), 0)
print(x, y) |
# -*- coding: utf-8 -*-
# tomolab
# Michele Scipioni
# Harvard University, Martinos Center for Biomedical Imaging
# University of Pisa
LIGHT_BLUE = "rgb(200,228,246)"
BLUE = "rgb(47,128,246)"
LIGHT_RED = "rgb(246,228,200)"
RED = "rgb(246,128,47)"
LIGHT_GRAY = "rgb(246,246,246)"
GRAY = "rgb(200,200,200)"
GREEN = "rgb(0... | light_blue = 'rgb(200,228,246)'
blue = 'rgb(47,128,246)'
light_red = 'rgb(246,228,200)'
red = 'rgb(246,128,47)'
light_gray = 'rgb(246,246,246)'
gray = 'rgb(200,200,200)'
green = 'rgb(0,100,0)' |
__all__ = [
'manager', \
'node', \
'feature', \
'python_utils'
]
| __all__ = ['manager', 'node', 'feature', 'python_utils'] |
TEST_LAT=-12
TEST_LONG=60
TEST_LOCATION_HIERARCHY_FOR_GEO_CODE=['madagascar']
class DummyLocationTree(object):
def get_location_hierarchy_for_geocode(self, lat, long ):
return TEST_LOCATION_HIERARCHY_FOR_GEO_CODE
def get_centroid(self, location_name, level):
if location_name=="jalgaon" and lev... | test_lat = -12
test_long = 60
test_location_hierarchy_for_geo_code = ['madagascar']
class Dummylocationtree(object):
def get_location_hierarchy_for_geocode(self, lat, long):
return TEST_LOCATION_HIERARCHY_FOR_GEO_CODE
def get_centroid(self, location_name, level):
if location_name == 'jalgaon'... |
#
# PySNMP MIB module HUAWEI-PGI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-PGI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:35:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ... |
class Solution:
def frequencySort(self, s: str) -> str:
freq = {}
for ch in s:
if(ch in freq):
freq[ch] += 1
else:
freq[ch] = 1
out = ""
for k,v in sorted(freq.items(), key=lambda x: x[1], reverse=True):
ou... | class Solution:
def frequency_sort(self, s: str) -> str:
freq = {}
for ch in s:
if ch in freq:
freq[ch] += 1
else:
freq[ch] = 1
out = ''
for (k, v) in sorted(freq.items(), key=lambda x: x[1], reverse=True):
out += k... |
psys_game_rain = 0
psys_game_snow = 1
psys_game_blood = 2
psys_game_blood_2 = 3
psys_game_hoof_dust = 4
psys_game_hoof_dust_mud = 5
psys_game_water_splash_1 = 6
psys_game_water_splash_2 = 7
psys_game_water_splash_3 = 8
psys_torch_fire = 9
psys_fire_glow_1 = 10
psys_fire_glow_fixed = 11
psys_torch_smoke = 12
psys_flue_s... | psys_game_rain = 0
psys_game_snow = 1
psys_game_blood = 2
psys_game_blood_2 = 3
psys_game_hoof_dust = 4
psys_game_hoof_dust_mud = 5
psys_game_water_splash_1 = 6
psys_game_water_splash_2 = 7
psys_game_water_splash_3 = 8
psys_torch_fire = 9
psys_fire_glow_1 = 10
psys_fire_glow_fixed = 11
psys_torch_smoke = 12
psys_flue_s... |
# config:utf-8
"""
production settings file.
"""
| """
production settings file.
""" |
def isEven(num):
num1 = num / 2
num2 = num // 2
if num1 == num2:
return True
else:
return False
# pi = (4/1) - (4/3) + (4/5) - (4/7) + (4/9) - (4/11) + (4/13) - (4/15)
pi = 0.0
for index, i in enumerate(range(1, 100), start=1):
thing = (4/((2 * index) - 1))
if isEven(index):
... | def is_even(num):
num1 = num / 2
num2 = num // 2
if num1 == num2:
return True
else:
return False
pi = 0.0
for (index, i) in enumerate(range(1, 100), start=1):
thing = 4 / (2 * index - 1)
if is_even(index):
pi -= thing
else:
pi += thing
print(pi) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.