content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def collect(): pass
def disable(): pass
def enable(): pass
def get_count(): pass
def get_debug(): pass
def get_objects(): pass
def get_referents(): pass
def get_referrers(): pass
def get_threshold(): pass
def is_tracked(): pass
def isenabled(): pass
def set_debug(): pass
def set_threshold(): pass
DEBUG... | def collect():
pass
def disable():
pass
def enable():
pass
def get_count():
pass
def get_debug():
pass
def get_objects():
pass
def get_referents():
pass
def get_referrers():
pass
def get_threshold():
pass
def is_tracked():
pass
def isenabled():
pass
def set_debug()... |
# Use the file name mbox-short.txt as the file name
fname = input("Enter file name: ")
fh = open(fname)
count=0
add=0
for line in fh:
if line.startswith("X-DSPAM-Confidence:"):
line= line.rstrip()
print(line)
| fname = input('Enter file name: ')
fh = open(fname)
count = 0
add = 0
for line in fh:
if line.startswith('X-DSPAM-Confidence:'):
line = line.rstrip()
print(line) |
distancia = int(input())
combustivel = float(input())
print(f'{(distancia/combustivel):.3f} km/l')
| distancia = int(input())
combustivel = float(input())
print(f'{distancia / combustivel:.3f} km/l') |
n = int(input())
ratios = [0, 0, 0]
def add(i: int): ratios[i] += 1
for e in map(lambda e: int(e), input().split()): add(0 if e > 0 else 1 if e < 0 else 2)
for r in ratios: print(f'{(r / n):.6f}')
| n = int(input())
ratios = [0, 0, 0]
def add(i: int):
ratios[i] += 1
for e in map(lambda e: int(e), input().split()):
add(0 if e > 0 else 1 if e < 0 else 2)
for r in ratios:
print(f'{r / n:.6f}') |
print("Welcome to the Factor Generator App\n")
flag = True
while flag:
factors = []
number = int(input("Enter a number to determine all factors of that number: "))
print()
print("The factors of {} are:".format(number))
for i in range(1, number + 1):
if number % i == 0:
factors.... | print('Welcome to the Factor Generator App\n')
flag = True
while flag:
factors = []
number = int(input('Enter a number to determine all factors of that number: '))
print()
print('The factors of {} are:'.format(number))
for i in range(1, number + 1):
if number % i == 0:
factors.ap... |
def fahrenheit_to_celsius(f):
return (f-32)*5/9
print(fahrenheit_to_celsius(float(input()))) | def fahrenheit_to_celsius(f):
return (f - 32) * 5 / 9
print(fahrenheit_to_celsius(float(input()))) |
############################################################################
# Helper file for ExportTools
# Written by dane22 on the Plex Forums, UKDTOM on GitHub
#
# This one contains the valid fields and attributes for photos
#
# To disable a field not needed, simply put a # sign in front of the line,
# and it'll be... | date_time_fields = ['addedAt', 'updatedAt', 'lastViewedAt']
time_fields = ['duration']
single_call = ['Level 1', 'Level 2', 'Level 3']
level_1 = [('Media ID', '@ratingKey'), ('Title', '@title'), ('Summary', '@summary'), ('Originally Available At', '@originallyAvailableAt'), ('Added At', '@addedAt'), ('Updated At', '@up... |
# python3
def max_pairwise_product_naive(numbers):
assert len(numbers) >= 2
assert all(0 <= x <= 2 * 10 ** 5 for x in numbers)
product = 0
for i in range(len(numbers)):
for j in range(i + 1, len(numbers)):
product = max(product, numbers[i] * numbers[j])
return product
def m... | def max_pairwise_product_naive(numbers):
assert len(numbers) >= 2
assert all((0 <= x <= 2 * 10 ** 5 for x in numbers))
product = 0
for i in range(len(numbers)):
for j in range(i + 1, len(numbers)):
product = max(product, numbers[i] * numbers[j])
return product
def max_pairwise_p... |
def add_time(start, duration, day=""):
start_time=start.split()
duration_time=list(map(lambda x:int(x),duration.split(":")))
weekdays=[", Monday ",", Tuesday ",", Wednesday ",", Thursday ",", Friday ",", Saturday ", ", Sunday "]
weekdays2=["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY", ... | def add_time(start, duration, day=''):
start_time = start.split()
duration_time = list(map(lambda x: int(x), duration.split(':')))
weekdays = [', Monday ', ', Tuesday ', ', Wednesday ', ', Thursday ', ', Friday ', ', Saturday ', ', Sunday ']
weekdays2 = ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FR... |
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# Self-checking test applications, which return PASS or FAIL after completion,
# usable on all targets.
TEST_APPS_SELFCHECKING = [
"aes_test",
"crt_test",
"dif_... | test_apps_selfchecking = ['aes_test', 'crt_test', 'dif_plic_sanitytest', 'dif_rv_timer_sanitytest', 'dif_uart_sanitytest', 'flash_ctrl_test', 'pmp_sanitytest_napot', 'pmp_sanitytest_tor', 'sha256_test']
test_apps_selfchecking_sim_verilator = TEST_APPS_SELFCHECKING + ['usbdev_test'] |
DATA = (
5.8, 2.7, 5.1, 1.9, 'virginica',
5.1, 3.5, 1.4, 0.2, 'setosa',
5.7, 2.8, 4.1, 1.3, 'versicolor',
6.3, 2.9, 5.6, 1.8, 'virginica',
6.4, 3.2, 4.5, 1.5, 'versicolor',
4.7, 3.2, 1.3, 0.2, 'setosa',
)
features = [
DATA[0:4],
DATA[5:9],
DATA[10:14],
DATA[15:19],
DATA[20:2... | data = (5.8, 2.7, 5.1, 1.9, 'virginica', 5.1, 3.5, 1.4, 0.2, 'setosa', 5.7, 2.8, 4.1, 1.3, 'versicolor', 6.3, 2.9, 5.6, 1.8, 'virginica', 6.4, 3.2, 4.5, 1.5, 'versicolor', 4.7, 3.2, 1.3, 0.2, 'setosa')
features = [DATA[0:4], DATA[5:9], DATA[10:14], DATA[15:19], DATA[20:24], DATA[25:29]]
labels = list(DATA[4::5])
specie... |
SECRET_KEY = 'TEST'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django_archive',
'tests.sample',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
| secret_key = 'TEST'
installed_apps = ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django_archive', 'tests.sample')
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} |
def tribonacci(signature, n):
arr = []
if n == 0:
return []
p = 0
if n <= 3:
while p < n:
arr.append(signature[p])
p = p + 1
else:
arr = signature
suma = sum(signature)
p = 3
while p < n:
arr.append(suma)
... | def tribonacci(signature, n):
arr = []
if n == 0:
return []
p = 0
if n <= 3:
while p < n:
arr.append(signature[p])
p = p + 1
else:
arr = signature
suma = sum(signature)
p = 3
while p < n:
arr.append(suma)
... |
class Doc: # base class
def __mod__(self, other):
other = self.mod.getdoc(other)
return self.mapchildren(lambda x: x % other)
def __rmod__(self, other):
return self.mod.getdoc(other) % self
def __str__(self):
return self.getstr()
def __eq__(self, other):
if no... | class Doc:
def __mod__(self, other):
other = self.mod.getdoc(other)
return self.mapchildren(lambda x: x % other)
def __rmod__(self, other):
return self.mod.getdoc(other) % self
def __str__(self):
return self.getstr()
def __eq__(self, other):
if not isinstance(... |
num_stages = 4
num_layers = 10
num_f_maps = 64
features_dim = 2048
batch_size = 1
lr = 5e-4
num_epochs = 50
batch_size=1
dataset_root = './dataset'
model_root = './model'
result_root ='./result'
record_root = './record'
iou_thresholds = [0.1, 0.25, 0.5]
| num_stages = 4
num_layers = 10
num_f_maps = 64
features_dim = 2048
batch_size = 1
lr = 0.0005
num_epochs = 50
batch_size = 1
dataset_root = './dataset'
model_root = './model'
result_root = './result'
record_root = './record'
iou_thresholds = [0.1, 0.25, 0.5] |
class Averager:
def __init__(self):
self.average_ratio = 0
self.average_size = 0
self.ratios = []
def update_average(self, added):
self.average_ratio = (self.average_size * self.average_ratio + added) / (self.average_size + 1)
self.average_size += 1
self.ratios.a... | class Averager:
def __init__(self):
self.average_ratio = 0
self.average_size = 0
self.ratios = []
def update_average(self, added):
self.average_ratio = (self.average_size * self.average_ratio + added) / (self.average_size + 1)
self.average_size += 1
self.ratios.... |
n=int(input())
arr=list(map(int,input().split()))
l=0
h=n-1
s=0
d=0
st=1
dt=0
while(l<=h):
if(st>dt):
if(arr[l]>arr[h]):
s=s+arr[l]
l=l+1
else:
s=s+arr[h]
h=h-1
dt=1
st=0
else:
if(arr[l]>arr[h]):
d=d+arr[l]
... | n = int(input())
arr = list(map(int, input().split()))
l = 0
h = n - 1
s = 0
d = 0
st = 1
dt = 0
while l <= h:
if st > dt:
if arr[l] > arr[h]:
s = s + arr[l]
l = l + 1
else:
s = s + arr[h]
h = h - 1
dt = 1
st = 0
else:
if ar... |
class Config:
VERSION = 1.06
MEMORY_SIZE = 100000
NUM_LAST_FRAMES = 4
LEVEL = "snakeai/levels/10x10-blank.json"
NUM_EPISODES = -1
BATCH_SIZE = 64
DISCOUNT_FACTOR = 0.95
USE_PRETRAINED_MODEL = False
PRETRAINED_MODEL = "dqn-00000000.model"
# Either sarsa, dqn, ddqn
LEARNING_ME... | class Config:
version = 1.06
memory_size = 100000
num_last_frames = 4
level = 'snakeai/levels/10x10-blank.json'
num_episodes = -1
batch_size = 64
discount_factor = 0.95
use_pretrained_model = False
pretrained_model = 'dqn-00000000.model'
learning_method = 'dqn'
multi_step_rew... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
dummy = ListNode(-1)
head = dummy
while l1 or l2:
if l1 and l2:... | class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
dummy = list_node(-1)
head = dummy
while l1 or l2:
if l1 and l2:
if l1.val < l2.val:
head.next = l1
l1 = l1.next
else:
... |
def Render(app, HTMLResponse):
def to_render(filepath, **variables):
return HTMLResponse(app.jinja2_env.get_template(filepath).render(**variables))
return to_render
| def render(app, HTMLResponse):
def to_render(filepath, **variables):
return html_response(app.jinja2_env.get_template(filepath).render(**variables))
return to_render |
class Solution:
def maxUncrossedLines(self, A: List[int], B: List[int]) -> int:
dp = [[0] * (len(B) + 1) for i in range(len(A) + 1)]
for i in range(1, len(A) + 1):
for j in range(1, len(B) + 1):
if(A[i - 1] == B[j - 1]):
dp[i][j] = 1 + dp[i - 1][j - 1]... | class Solution:
def max_uncrossed_lines(self, A: List[int], B: List[int]) -> int:
dp = [[0] * (len(B) + 1) for i in range(len(A) + 1)]
for i in range(1, len(A) + 1):
for j in range(1, len(B) + 1):
if A[i - 1] == B[j - 1]:
dp[i][j] = 1 + dp[i - 1][j - ... |
# -*- coding: utf-8 -*-
class Solution:
def containsNearbyDuplicate(self, nums, k):
occurrences = {}
for i, num in enumerate(nums):
if num in occurrences and abs(i - occurrences[num]) <= k:
return True
occurrences[num] = i
return False
if __name__... | class Solution:
def contains_nearby_duplicate(self, nums, k):
occurrences = {}
for (i, num) in enumerate(nums):
if num in occurrences and abs(i - occurrences[num]) <= k:
return True
occurrences[num] = i
return False
if __name__ == '__main__':
solu... |
class Zoo:
total_animals = []
def __init__(self,reserved_food_in_kgs=0):
self.animals_list = []
self._reserved_food_in_kgs = reserved_food_in_kgs
@property
def reserved_food_in_kgs(self):
return self._reserved_food_in_kgs
def add_food_to_reserve(self,food):... | class Zoo:
total_animals = []
def __init__(self, reserved_food_in_kgs=0):
self.animals_list = []
self._reserved_food_in_kgs = reserved_food_in_kgs
@property
def reserved_food_in_kgs(self):
return self._reserved_food_in_kgs
def add_food_to_reserve(self, food):
self.... |
expected_output = {
"ospf3-interface-information": {
"ospf3-interface": [
{
"adj-count": "1",
"bdr-id": "0.0.0.0",
"dead-interval": "40",
"dr-id": "0.0.0.0",
"hello-interval": "10",
"interface-address... | expected_output = {'ospf3-interface-information': {'ospf3-interface': [{'adj-count': '1', 'bdr-id': '0.0.0.0', 'dead-interval': '40', 'dr-id': '0.0.0.0', 'hello-interval': '10', 'interface-address': 'fe80::250:56ff:fe8d:c829', 'interface-cost': '5', 'interface-name': 'ge-0/0/0.0', 'interface-type': 'P2P', 'mtu': '1500'... |
class Key:
def PrimaryKey(self):
pass
def __class_getitem__(cls, params):
return None
| class Key:
def primary_key(self):
pass
def __class_getitem__(cls, params):
return None |
def myfunc(n):
return lambda a : a * n
mytripler = myfunc(3)
print(mytripler(11))
print(mytripler(2)) | def myfunc(n):
return lambda a: a * n
mytripler = myfunc(3)
print(mytripler(11))
print(mytripler(2)) |
FibArray = [0,1]
def fibonacci(n):
if n<0:
print("Incorrect input")
elif n<=len(FibArray):
return FibArray[n-1]
else:
temp_fib = fibonacci(n-1)+fibonacci(n-2)
FibArray.append(temp_fib)
return temp_fib
print(fibonacci(13))
| fib_array = [0, 1]
def fibonacci(n):
if n < 0:
print('Incorrect input')
elif n <= len(FibArray):
return FibArray[n - 1]
else:
temp_fib = fibonacci(n - 1) + fibonacci(n - 2)
FibArray.append(temp_fib)
return temp_fib
print(fibonacci(13)) |
class Solution:
def addToArrayForm(self, A, K):
i, dm = len(A) - 1, divmod
# go through and try and add number.
while i >= 0 and K:
# Add rightmost digit.
K, r = dm(K, 10)
if A[i] + r > 9:
A[i] = (r + A[i]) % 10
K = K + 1
... | class Solution:
def add_to_array_form(self, A, K):
(i, dm) = (len(A) - 1, divmod)
while i >= 0 and K:
(k, r) = dm(K, 10)
if A[i] + r > 9:
A[i] = (r + A[i]) % 10
k = K + 1
else:
A[i] += r
i = i - 1
... |
class Symbol:
def __init__(self, name, var_type, kind, number):
self._name = name
self._type = var_type
self._kind = kind
self._number = number
def get_kind(self):
if self._kind == 'field':
return 'this'
return self._kind
def get_number(self):
... | class Symbol:
def __init__(self, name, var_type, kind, number):
self._name = name
self._type = var_type
self._kind = kind
self._number = number
def get_kind(self):
if self._kind == 'field':
return 'this'
return self._kind
def get_number(self):
... |
class User:
def __init__(self,id,secondName,name):
self.id=id
self.secondName=secondName
self.name=name
self.friendList=[]
def FullName(self):
fullName=self.secondName+" "+self.name
return fullName
def FillUserList(self,userList):
for u in userList:... | class User:
def __init__(self, id, secondName, name):
self.id = id
self.secondName = secondName
self.name = name
self.friendList = []
def full_name(self):
full_name = self.secondName + ' ' + self.name
return fullName
def fill_user_list(self, userList):
... |
#link https://practice.geeksforgeeks.org/problems/cyclically-rotate-an-array-by-one/0#
#code
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
b = arr.pop()
if n > 1:
print(b, *arr)
else:
print(b)
| for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
b = arr.pop()
if n > 1:
print(b, *arr)
else:
print(b) |
class OneOnly:
_singleton = None
def __new__(cls, *args, **kwargs):
if not cls._singleton:
cls._singleton = super(OneOnly, cls).__new__(
cls, *args, **kwargs)
return cls._singleton
| class Oneonly:
_singleton = None
def __new__(cls, *args, **kwargs):
if not cls._singleton:
cls._singleton = super(OneOnly, cls).__new__(cls, *args, **kwargs)
return cls._singleton |
def text_recognition(str0, f):
start = 0
n = len(str0)
sentence = []
while start != n:
for last_letter in range(n, start, -1):
if str0[start:last_letter] in f:
sentence.append(str0[start:last_letter])
start = last_letter
brea... | def text_recognition(str0, f):
start = 0
n = len(str0)
sentence = []
while start != n:
for last_letter in range(n, start, -1):
if str0[start:last_letter] in f:
sentence.append(str0[start:last_letter])
start = last_letter
break
... |
command = input()
numbers = [int(x) for x in input().split()]
if command == 'Even':
filtered_numbers = sum(filter(lambda x: x % 2 == 0 , numbers))
else:
filtered_numbers = sum(filter(lambda x: x % 2 != 0 , numbers))
print(filtered_numbers * len(numbers))
| command = input()
numbers = [int(x) for x in input().split()]
if command == 'Even':
filtered_numbers = sum(filter(lambda x: x % 2 == 0, numbers))
else:
filtered_numbers = sum(filter(lambda x: x % 2 != 0, numbers))
print(filtered_numbers * len(numbers)) |
def test_keystone_is_installed(host):
keystone = host.package("keystone")
assert keystone.is_installed
def test_apache2_is_installed(host):
apache2 = host.package("apache2")
assert apache2.is_installed
def test_apache2_running_and_enabled(host):
apache2 = host.service("apache2")
assert apach... | def test_keystone_is_installed(host):
keystone = host.package('keystone')
assert keystone.is_installed
def test_apache2_is_installed(host):
apache2 = host.package('apache2')
assert apache2.is_installed
def test_apache2_running_and_enabled(host):
apache2 = host.service('apache2')
assert apache2... |
# Copyright 2018-19 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
def setup_test_model(env, model_clses):
for model_cls in model_clses:
model_cls._build_model(env.registry, env.cr)
env.registry.setup_models(env.cr)
env.registry.in... | def setup_test_model(env, model_clses):
for model_cls in model_clses:
model_cls._build_model(env.registry, env.cr)
env.registry.setup_models(env.cr)
env.registry.init_models(env.cr, [model_cls._name for model_cls in model_clses], dict(env.context, update_custom_fields=True))
def teardown_test_model... |
XAXIS = "ABCDEFGH"
YAXIS = "12345678"
FORBIDDEN = {
"A2": ["right"],
"B2": ["left"],
"B6": ["up"],
"B7": ["down"],
"C5": ["up"],
"C6": ["down"],
"D4": ["up"],
"D5": ["down"],
"D7": ["up"],
"D8": ["down"],
"E2": ["up"],
"E3": ["down"],
"E8": ["right"],
"F8":... | xaxis = 'ABCDEFGH'
yaxis = '12345678'
forbidden = {'A2': ['right'], 'B2': ['left'], 'B6': ['up'], 'B7': ['down'], 'C5': ['up'], 'C6': ['down'], 'D4': ['up'], 'D5': ['down'], 'D7': ['up'], 'D8': ['down'], 'E2': ['up'], 'E3': ['down'], 'E8': ['right'], 'F8': ['left'], 'F6': ['right'], 'G6': ['left'], 'G1': ['up'], 'G2': ... |
with open('scratch/short.json', mode='r', encoding='utf-8', errors='ignore') as f:
json = ' '.join(f.readlines())
with open('data/template-default.html', mode='r', encoding='utf-8', errors='ignore') as f:
lines = f.readlines()
output_lines = []
for line in lines:
if '/*GENERATED JSON*/' in line:
l... | with open('scratch/short.json', mode='r', encoding='utf-8', errors='ignore') as f:
json = ' '.join(f.readlines())
with open('data/template-default.html', mode='r', encoding='utf-8', errors='ignore') as f:
lines = f.readlines()
output_lines = []
for line in lines:
if '/*GENERATED JSON*/' in line:
lin... |
class PersonData:
def __init__(self, name, age):
self.name = name
self.age = age
def get_age_in_five_years(self):
return 'age will be '+ str(self.age + 5)
| class Persondata:
def __init__(self, name, age):
self.name = name
self.age = age
def get_age_in_five_years(self):
return 'age will be ' + str(self.age + 5) |
my_fav_num = 14
print(f'{my_fav_num} is my favorite number')
# is the number of my birth day.
| my_fav_num = 14
print(f'{my_fav_num} is my favorite number') |
crt_storage = 'data/certificates/'
root_cert = crt_storage + 'ca-root.pem'
# certificate if you run the program as user
certificate = crt_storage + 'certificate-alice-pub.pem'
priv_key = crt_storage + 'certificate-alice-key.pem'
| crt_storage = 'data/certificates/'
root_cert = crt_storage + 'ca-root.pem'
certificate = crt_storage + 'certificate-alice-pub.pem'
priv_key = crt_storage + 'certificate-alice-key.pem' |
class Node:
def __init__(self, value):
self.val = value
self.next = self.pre = None
class MyCircularDeque:
def __init__(self, k):
self.head = self.tail = Node(-1)
self.head.next = self.tail
self.tail.pre = self.head
self.size = k
self.curSize = 0... | class Node:
def __init__(self, value):
self.val = value
self.next = self.pre = None
class Mycirculardeque:
def __init__(self, k):
self.head = self.tail = node(-1)
self.head.next = self.tail
self.tail.pre = self.head
self.size = k
self.curSize = 0
d... |
# Stylesheets
# Color definitions can be given as strings ('white','black', ...)
# or HEX color definitions
# Defaults
CUE_CARD_COLOR_TM = 'white' # Cue card line color in tuning map
# AXES TUNING MAPS AND AUTOCORRELATION
AXES_COLOR_TM = 'black' # Axes color in tuning map (axes_color_tuningmap)
AXES_COLOR_ACO... | cue_card_color_tm = 'white'
axes_color_tm = 'black'
axes_color_acorr = 'black'
color_line_hd = 'black'
color_line_hd_occ = '#444'
path = '#333'
path_event = '#666'
path_event_hd = '#888'
event = '#000'
roi_text_color = '#000'
roi_dot_color = '#000'
styles = {'default': {'cue_card_color_tuningmap': 'white', 'axes_color_... |
class Solution:
def largestRectangleArea(self, heights: List[int]) -> int:
n = len(heights)
stack = []
left = [0] * n
for i in range(n):
if not stack:
stack.append(i)
left[i] = i
else:
while stack and heights[sta... | class Solution:
def largest_rectangle_area(self, heights: List[int]) -> int:
n = len(heights)
stack = []
left = [0] * n
for i in range(n):
if not stack:
stack.append(i)
left[i] = i
else:
while stack and heights[... |
n = int(input('Digite um numero:'))
if n %2 == 0:
if n in range(2,5):
print('Not Weird')
elif n in range(6,20):
print('Weird')
elif n ==20:
print('Weird')
elif n >20:
print('Not Weird')
else:
print('Weird') | n = int(input('Digite um numero:'))
if n % 2 == 0:
if n in range(2, 5):
print('Not Weird')
elif n in range(6, 20):
print('Weird')
elif n == 20:
print('Weird')
elif n > 20:
print('Not Weird')
else:
print('Weird') |
#print nilai ekstra tik
nilai_ekstra_tik = 95
print("nilai anda adalah", nilai_ekstra_tik)
if nilai_ekstra_tik >= 80:
print('selamat erik kun anda lulus')
else :
print('anda tidak lulus') | nilai_ekstra_tik = 95
print('nilai anda adalah', nilai_ekstra_tik)
if nilai_ekstra_tik >= 80:
print('selamat erik kun anda lulus')
else:
print('anda tidak lulus') |
# instantite queue objects
job_queue='dewberry-post-process.fifo'
sqs = boto3.resource("sqs")
queue = sqs.get_queue_by_name(QueueName=job_queue)
# check for items in queue
jobs_remaining = int(queue.attributes['ApproximateNumberOfMessages'])
# Add While-True loop, scheduler for managing multiple processes
for messag... | job_queue = 'dewberry-post-process.fifo'
sqs = boto3.resource('sqs')
queue = sqs.get_queue_by_name(QueueName=job_queue)
jobs_remaining = int(queue.attributes['ApproximateNumberOfMessages'])
for message in queue.receive_messages():
job_start = datetime.now()
dtm = job_start.strftime('%Y-%m-%d %H:%M')
job_id ... |
#
# @lc app=leetcode id=130 lang=python3
#
# [130] Surrounded Regions
#
# @lc code=start
class Solution:
def dfs(self, graph, node, visited, region):
visited[node] = True
region.append(node)
for next_node in graph[node]:
if visited[next_node] is False:
self.df... | class Solution:
def dfs(self, graph, node, visited, region):
visited[node] = True
region.append(node)
for next_node in graph[node]:
if visited[next_node] is False:
self.dfs(graph, next_node, visited, region)
def solve(self, board):
m = len(board)
... |
# EG5-06 Broken Greeter
name = input('Enter your name: ')
if name == 'Rob':
print('Hello, Oh great one')
| name = input('Enter your name: ')
if name == 'Rob':
print('Hello, Oh great one') |
DEBUG_MODE = True
def debug_print(text_content):
if DEBUG_MODE:
print(text_content)
| debug_mode = True
def debug_print(text_content):
if DEBUG_MODE:
print(text_content) |
def find_largest(arr):
largest = 0
# iterate through array, if current is greater than largest then replace largest with current
for i in range(len(arr)):
if arr[i] > largest:
largest = arr[i]
# return largest
return largest
def find_smallest(arr):
try:
smalles... | def find_largest(arr):
largest = 0
for i in range(len(arr)):
if arr[i] > largest:
largest = arr[i]
return largest
def find_smallest(arr):
try:
smallest = arr[0]
except IndexError:
return None
for i in range(len(arr)):
if arr[i] < smallest:
... |
# Exceptions for squid-py
# Raised when an invalid address is passed to the contract loader
class OceanInvalidContractAddress(Exception):
pass
class OceanKeeperContractsNotFound(Exception):
pass
# Raised when an DID attribute is assigned to a DID in the same chain of DIDs
class OceanDIDCircularReference(E... | class Oceaninvalidcontractaddress(Exception):
pass
class Oceankeepercontractsnotfound(Exception):
pass
class Oceandidcircularreference(Exception):
pass
class Oceandidnotfound(Exception):
pass
class Oceandidunknownvaluetype(Exception):
pass
class Oceandidalreadyexist(Exception):
pass
class ... |
res1, res2 = 0, 0
for i in range(1, 101):
res1 += i ** 2
res2 += i
res2 = res2 ** 2
print(res2 - res1) | (res1, res2) = (0, 0)
for i in range(1, 101):
res1 += i ** 2
res2 += i
res2 = res2 ** 2
print(res2 - res1) |
with open('file02.txt', 'r') as f:
content = f.readlines(5)
print(content)
content = f.readlines(5)
print(content)
content = f.readlines(100)
print(content)
| with open('file02.txt', 'r') as f:
content = f.readlines(5)
print(content)
content = f.readlines(5)
print(content)
content = f.readlines(100)
print(content) |
def prompt(text, default=""):
user_input = raw_input(text)
if 0 == len(user_input):
user_input = default
return user_input
| def prompt(text, default=''):
user_input = raw_input(text)
if 0 == len(user_input):
user_input = default
return user_input |
AVAIL_COINS = [1, 2, 5, 10, 20, 50, 100, 200]
# please enter coin required in pence
def coin_combinations(den):
comb = [1] + [0] * den
for coin in AVAIL_COINS:
for i in range(len(comb) - coin):
comb[i+coin] += comb[i]
return comb[-1]
if __name__ == '__main__':
print(coin_combinations... | avail_coins = [1, 2, 5, 10, 20, 50, 100, 200]
def coin_combinations(den):
comb = [1] + [0] * den
for coin in AVAIL_COINS:
for i in range(len(comb) - coin):
comb[i + coin] += comb[i]
return comb[-1]
if __name__ == '__main__':
print(coin_combinations(200)) |
class AtomExperimentalData(object):
def __init__(self, occupancy = None, bfactor = None):
# If from a crystallographic source store the occupancy
self._occupancy = occupancy
# If from a crystallographic source store the bfactor
self._bfactor = bfactor
@property
def occu... | class Atomexperimentaldata(object):
def __init__(self, occupancy=None, bfactor=None):
self._occupancy = occupancy
self._bfactor = bfactor
@property
def occupancy(self):
return self._occupancy
@property
def bfactor(self):
return self._bfactor
@occupancy.setter
... |
IMAGE_KEY = "image_raw"
MASK_KEY = "mask_raw"
EPOCHS = 1
TRAIN_STEPS = 1
EVAL_STEPS = 2
TRAIN_BATCH_SIZE = 4
EVAL_BATCH_SIZE = 1
HEIGHT = 320
WIDTH = 320
PRETRAINED_WEIGHTS = "imagenet"
BACKBONE_TRAINABLE = False
BACKBONE_NAME = "efficientnetb3"
TOTAL_CLASSES = ['sky', 'building', 'pole', 'road', 'pavement',
... | image_key = 'image_raw'
mask_key = 'mask_raw'
epochs = 1
train_steps = 1
eval_steps = 2
train_batch_size = 4
eval_batch_size = 1
height = 320
width = 320
pretrained_weights = 'imagenet'
backbone_trainable = False
backbone_name = 'efficientnetb3'
total_classes = ['sky', 'building', 'pole', 'road', 'pavement', 'tree', 's... |
#! /usr/bin/env python3
'''
Project's configuration file
This file holds necessary variables to this project.
Data (csv) confs:
data_dir (str): Path to data (csv) files
facts_csv (str): csv filename with facts
sources_csv (str): csv filename with facts sources
'''
# Data (csv) confs:
data_dir = 'data'
fa... | """
Project's configuration file
This file holds necessary variables to this project.
Data (csv) confs:
data_dir (str): Path to data (csv) files
facts_csv (str): csv filename with facts
sources_csv (str): csv filename with facts sources
"""
data_dir = 'data'
facts_csv = 'facts.csv'
sources_csv = 'sources.... |
# pylint: skip-file
# flake8: noqa
def main():
'''
ansible oc module for scaling
'''
module = AnsibleModule(
argument_spec=dict(
kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
state=dict(default='present', type='str', choices=['present', 'li... | def main():
"""
ansible oc module for scaling
"""
module = ansible_module(argument_spec=dict(kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'), state=dict(default='present', type='str', choices=['present', 'list']), debug=dict(default=False, type='bool'), kind=dict(default='dc',... |
def unpack_varint(buf):
nread = 0
res = 0
while True:
read = buf.read(1)[0]
val = (read & 0b01111111)
res |= (val << (7 * nread))
nread += 1
if nread > 5:
raise Exception("VarInt too long")
if (read & 0b10000000) == 0:
break
return ... | def unpack_varint(buf):
nread = 0
res = 0
while True:
read = buf.read(1)[0]
val = read & 127
res |= val << 7 * nread
nread += 1
if nread > 5:
raise exception('VarInt too long')
if read & 128 == 0:
break
return res
def pack_varint(v... |
pkgname = "libseccomp"
pkgver = "2.5.3"
pkgrel = 0
build_style = "gnu_configure"
make_cmd = "gmake"
hostmakedepends = [
"bash", "gsed", "gmake", "automake", "libtool", "gperf", "pkgconf"
]
makedepends = ["linux-headers"]
pkgdesc = "High level interface to seccomp"
maintainer = "q66 <q66@chimera-linux.org>"
license ... | pkgname = 'libseccomp'
pkgver = '2.5.3'
pkgrel = 0
build_style = 'gnu_configure'
make_cmd = 'gmake'
hostmakedepends = ['bash', 'gsed', 'gmake', 'automake', 'libtool', 'gperf', 'pkgconf']
makedepends = ['linux-headers']
pkgdesc = 'High level interface to seccomp'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'LGP... |
total = 0
f = open("input.txt", 'r')
opcodes = list(map(int, f.readline().split(',')))
opcodes[1] = 12
opcodes[2] = 2
ip = 0
while(opcodes[ip] != 99):
v1 = opcodes[ opcodes[ip + 1]]
v2 = opcodes[ opcodes[ip + 2]]
pout = opcodes[ip + 3]
if (opcodes[ip] == 1):
opcodes[pout] = v1 + v2
if ... | total = 0
f = open('input.txt', 'r')
opcodes = list(map(int, f.readline().split(',')))
opcodes[1] = 12
opcodes[2] = 2
ip = 0
while opcodes[ip] != 99:
v1 = opcodes[opcodes[ip + 1]]
v2 = opcodes[opcodes[ip + 2]]
pout = opcodes[ip + 3]
if opcodes[ip] == 1:
opcodes[pout] = v1 + v2
if opcodes[ip]... |
# -*- coding: UTF-8 -*-
def yourMethodExtractExample(string, ini):
text = ""
i = ini;
while i < len(string):
if (string[i] != " "):
text += string[i]
if (string[i] == " "):
break
i += 1
return text | def your_method_extract_example(string, ini):
text = ''
i = ini
while i < len(string):
if string[i] != ' ':
text += string[i]
if string[i] == ' ':
break
i += 1
return text |
{
'targets': [
{
'target_name': 'buffertools',
'sources': [ 'buffertools.cc' ]
}
]
}
| {'targets': [{'target_name': 'buffertools', 'sources': ['buffertools.cc']}]} |
# Use groupBy and mean to aggregate the column
ratings_per_film_df = rating_df.groupBy('film_id').mean('rating')
# Join the tables using the film_id column
film_df_with_ratings = film_df.join(
ratings_per_film_df,
film_df.film_id== ratings_per_film_df.film_id
)
# Show the 5 first results
print(film_df_with_ra... | ratings_per_film_df = rating_df.groupBy('film_id').mean('rating')
film_df_with_ratings = film_df.join(ratings_per_film_df, film_df.film_id == ratings_per_film_df.film_id)
print(film_df_with_ratings.show(5)) |
_base_ = ['./segmentation_static.py', '../_base_/backends/pplnn.py']
onnx_config = dict(input_shape=[2048, 1024])
backend_config = dict(model_inputs=dict(opt_shape=[1, 3, 1024, 2048]))
| _base_ = ['./segmentation_static.py', '../_base_/backends/pplnn.py']
onnx_config = dict(input_shape=[2048, 1024])
backend_config = dict(model_inputs=dict(opt_shape=[1, 3, 1024, 2048])) |
'''
Considering that I'ld would like to spread a promotion message across all people in twitter. Assuming the ideal case, if a person tweets a message, then every follower will re-tweet the message.
You need to find the minimum number of people to reach out (for example, who doesn't follow anyone etc) so that your pro... | """
Considering that I'ld would like to spread a promotion message across all people in twitter. Assuming the ideal case, if a person tweets a message, then every follower will re-tweet the message.
You need to find the minimum number of people to reach out (for example, who doesn't follow anyone etc) so that your pro... |
# Useless Function
def func():
pass
if __name__ == "__main__":
# Main Function
func()
c = '# Useless Function\ndef func():\n pass\n\nif __name__ == "__main__":\n # Main Function\n func()\n c = %r\n print(c %% c)'
print(c % c)
| def func():
pass
if __name__ == '__main__':
func()
c = '# Useless Function\ndef func():\n pass\n\nif __name__ == "__main__":\n # Main Function\n func()\n c = %r\n print(c %% c)'
print(c % c) |
def solution(phone_book):
phone_book.sort()
for p1, p2 in zip(phone_book, phone_book[1:]):
if p2.startswith(p1):
return False
return True | def solution(phone_book):
phone_book.sort()
for (p1, p2) in zip(phone_book, phone_book[1:]):
if p2.startswith(p1):
return False
return True |
if config.root.host_arch not in ['aarch64', 'arm64']:
config.unsupported = True
if config.target_arch not in ['aarch64', 'arm64']:
config.unsupported = True | if config.root.host_arch not in ['aarch64', 'arm64']:
config.unsupported = True
if config.target_arch not in ['aarch64', 'arm64']:
config.unsupported = True |
# Interview Question 2.1
class ListNode(object):
def __init__(self, value):
self.value = value
self.next = None
def remove_duplicates(head):
values = set()
prev = None
curr = head
while curr is not None:
if curr.value in values:
prev.next = curr.next
... | class Listnode(object):
def __init__(self, value):
self.value = value
self.next = None
def remove_duplicates(head):
values = set()
prev = None
curr = head
while curr is not None:
if curr.value in values:
prev.next = curr.next
else:
values.add... |
VERSION_CONFIG = {
"FB_APP_VERSION": "15.0.0.10.340",
# These are bumped by automation
# See https://our.intern.facebook.com/intern/wiki/index.php/Releng/Mobile/Version_numbers
"FB_BUNDLE_VERSION_SHORT": "15.0",
}
| version_config = {'FB_APP_VERSION': '15.0.0.10.340', 'FB_BUNDLE_VERSION_SHORT': '15.0'} |
{
"targets": [
{
"target_name": "bugsnag_pecsp_bindings",
"sources": [
"src/api.c",
"src/bugsnag_electron_client_state_persistence.c",
"src/deps/parson/parson.c",
"src/deps/tinycthread/tinycthread.c"
],
'conditions': [
['OS == "linux"', {"sources": [... | {'targets': [{'target_name': 'bugsnag_pecsp_bindings', 'sources': ['src/api.c', 'src/bugsnag_electron_client_state_persistence.c', 'src/deps/parson/parson.c', 'src/deps/tinycthread/tinycthread.c'], 'conditions': [['OS == "linux"', {'sources': ['src/crash_handler-posix.c']}], ['OS == "mac"', {'sources': ['src/crash_hand... |
APP_DATA = {
"product_id": "prod_ta",
"basic_data": {
"countries": [
"GERMANY",
"JAPAN"
],
"policy_date": "2018-12-11",
"expiry_date": "2018-12-18",
"policy_unit": "D"
},
"package_options": {
"insurer_count": 2
},
"additiona... | app_data = {'product_id': 'prod_ta', 'basic_data': {'countries': ['GERMANY', 'JAPAN'], 'policy_date': '2018-12-11', 'expiry_date': '2018-12-18', 'policy_unit': 'D'}, 'package_options': {'insurer_count': 2}, 'additional_data': {'customer_title': 'MR.', 'customer_first_name': 'MANA', 'customer_last_name': 'MUNGMARN', 'co... |
class ProductRepository:
def getProductByID(self, productID):
query = '''
SELECT
`id`,
`name`,
`description`
FROM
`products`
WHERE
`id` = {productID}
'''.format(productID = productID)... | class Productrepository:
def get_product_by_id(self, productID):
query = '\n SELECT\n `id`,\n `name`,\n `description`\n FROM\n `products`\n WHERE\n `id` = {productID}\n '.format(productID=prod... |
def keyGeneration(p, q):
n = p * q
phi = (p - 1) * (q - 1)
e = 3
while (e < phi and phi % e == 0):
e += 2
d, cur = 0, 1
over = 0
fir = 0
while True:
over += 1
cur += phi
if (cur % e == 0):
d = cur // e
break
if over > 100... | def key_generation(p, q):
n = p * q
phi = (p - 1) * (q - 1)
e = 3
while e < phi and phi % e == 0:
e += 2
(d, cur) = (0, 1)
over = 0
fir = 0
while True:
over += 1
cur += phi
if cur % e == 0:
d = cur // e
break
if over > 10000... |
# -*- coding: utf-8 -*-
INDENT_LENGTH = 4
| indent_length = 4 |
def retrieve_packet_members(holder):
return Packet(holder['sender_ip_address'], holder['sender_mac_address'], holder['packet_seq_number'],
holder['number_of_packets'], holder['payload'], holder['receiver_ip_address'],
holder['certificate'], holder['packet_type'], holder["path"])
... | def retrieve_packet_members(holder):
return packet(holder['sender_ip_address'], holder['sender_mac_address'], holder['packet_seq_number'], holder['number_of_packets'], holder['payload'], holder['receiver_ip_address'], holder['certificate'], holder['packet_type'], holder['path'])
class Packet:
def __init__(sel... |
phonebook = {
'TTS': 123,
'Nakov': 1234,
'Stamat': 2134,
'Nikolay': 1239123,
'asd': 123,
'sdf': 1234,
'gfh': 2134,
'asfa': 1239123,
'fahash': 123,
'dghfdgh': 1234,
'sdflsd': 2134
}
revese_phonebook = {}
for key in phonebook:
value = phonebook[key]
if value in revese_... | phonebook = {'TTS': 123, 'Nakov': 1234, 'Stamat': 2134, 'Nikolay': 1239123, 'asd': 123, 'sdf': 1234, 'gfh': 2134, 'asfa': 1239123, 'fahash': 123, 'dghfdgh': 1234, 'sdflsd': 2134}
revese_phonebook = {}
for key in phonebook:
value = phonebook[key]
if value in revese_phonebook:
revese_phonebook[value].appe... |
class Driver:
def __init__(self):
self.passengers = 0
def addPassenger(self):
if self.passengers <= 3:
self.passengers += 1
def removePassengers(self):
self.passengers = 0
def __repr__(self):
return f'Passengers: {self.passengers}' | class Driver:
def __init__(self):
self.passengers = 0
def add_passenger(self):
if self.passengers <= 3:
self.passengers += 1
def remove_passengers(self):
self.passengers = 0
def __repr__(self):
return f'Passengers: {self.passengers}' |
# Huu Hung Nguyen
# 09/11/2021
# Nguyen_HuuHung_prices.py
# The program assigns the sales tax.
# It prompts the user for the prices of five items.
# It then displays the subtotal of the sale, the amount of sales tax,
# and the total.
# Assume sales tax is 7 percent
SALES_TAX_RATE = 0.07
# Prompt user for... | sales_tax_rate = 0.07
price_1 = float(input('Enter price for item 1: '))
price_2 = float(input('Enter price for item 2: '))
price_3 = float(input('Enter price for item 3: '))
price_4 = float(input('Enter price for item 4: '))
price_5 = float(input('Enter price for item 5: '))
subtotal = price_1 + price_2 + price_3 + pr... |
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | datasource_paths = {'repository/conf/datasources/master-datasources.xml', 'repository/conf/datasources/metrics-datasources.xml'}
m2_path = 'am/wso2am'
dist_pom_path = 'modules/distribution/product/pom.xml'
lib_path = 'repository/components/lib'
distribution_path = 'modules/distribution/product/target'
integration_path ... |
def convert_currency(amount: int, from_currency_abbreviation: str, to_currency_abbreviation: str):
if from_currency_abbreviation == to_currency_abbreviation:
return amount
converter = {
'RUB': {
'USD': 1 / 72,
'EUR': 1 / 82
},
'USD': {
'RUB': 7... | def convert_currency(amount: int, from_currency_abbreviation: str, to_currency_abbreviation: str):
if from_currency_abbreviation == to_currency_abbreviation:
return amount
converter = {'RUB': {'USD': 1 / 72, 'EUR': 1 / 82}, 'USD': {'RUB': 72, 'EUR': 1 / 1.16}, 'EUR': {'RUB': 82, 'USD': 1.16}}
return... |
f1 = 'attention_deficity_and_hyper_activity_disorder_type_a'
f2 = 'attention_deficity_and_hyper_activity_disorder_type_b'
f3 = 'attention_deficity_and_hyper_activity_disorder_total'
f4 = 'oppositional_defant_disorder'
f5 = 'conduct_disorder'
f6 = 'generalized_anxiety_disorder_type_a'
f7 = 'generalized_anxiety_disorder_... | f1 = 'attention_deficity_and_hyper_activity_disorder_type_a'
f2 = 'attention_deficity_and_hyper_activity_disorder_type_b'
f3 = 'attention_deficity_and_hyper_activity_disorder_total'
f4 = 'oppositional_defant_disorder'
f5 = 'conduct_disorder'
f6 = 'generalized_anxiety_disorder_type_a'
f7 = 'generalized_anxiety_disorder_... |
class Solution:
def removeDuplicates(self, nums):
if len(nums) == 0:
return 0
left = 0
for i in range(1, len(nums)):
if nums[left] == nums[i]:
continue
else:
left += 1
nums[left] = nums[i]
return lef... | class Solution:
def remove_duplicates(self, nums):
if len(nums) == 0:
return 0
left = 0
for i in range(1, len(nums)):
if nums[left] == nums[i]:
continue
else:
left += 1
nums[left] = nums[i]
return le... |
# -*- coding: UTF-8 -*-
# The mighty gremlins.
ZW_JOINER = u'\u200D'
ZW_NON_JOINER = u'\u200C'
ZW_SPACE = u'\u200B'
ZW_NO_BREAK_SPACE = u'\uFEFF'
def _convert_txt_to_binary(txt):
return ' '.join(format(ord(x), 'b') for x in txt)
def _convert_binary_to_zwc(binary):
def map_char(x):
if x == '1':
... | zw_joiner = u'\u200d'
zw_non_joiner = u'\u200c'
zw_space = u'\u200b'
zw_no_break_space = u'\ufeff'
def _convert_txt_to_binary(txt):
return ' '.join((format(ord(x), 'b') for x in txt))
def _convert_binary_to_zwc(binary):
def map_char(x):
if x == '1':
return ZW_JOINER
elif x == '0':... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"path_data": "NER_tagging.ipynb",
"CoNLL03DatasetReader": "NER_tagging.ipynb"}
modules = ["conll_reader.py"]
doc_url = "https://Tom Roth.github.io/tagger/"
git_url = "https://github.com/Tom Roth/t... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'path_data': 'NER_tagging.ipynb', 'CoNLL03DatasetReader': 'NER_tagging.ipynb'}
modules = ['conll_reader.py']
doc_url = 'https://Tom Roth.github.io/tagger/'
git_url = 'https://github.com/Tom Roth/tagger/tree/master/'
def custom_doc_links(name):
... |
FRAMEWORK_VERSION = "%%FRAMEWORK_VERSION%%"
PLUGIN_NAME_INDEX = "Name-index"
PLUGIN_VERSION_INDEX = "Version-index"
MODEL_NAME_INDEX = "Name-index"
MODEL_VERSION_INDEX = "Version-index"
EVENT_CHANNEL_INDEX = "Channel-index"
EVENT_PROGRAMID_INDEX = "ProgramId-index"
EVENT_CONTENT_GROUP_INDEX = "ContentGroup-index"
EVENT... | framework_version = '%%FRAMEWORK_VERSION%%'
plugin_name_index = 'Name-index'
plugin_version_index = 'Version-index'
model_name_index = 'Name-index'
model_version_index = 'Version-index'
event_channel_index = 'Channel-index'
event_programid_index = 'ProgramId-index'
event_content_group_index = 'ContentGroup-index'
event... |
# ======================================================================
# Bathroom Security
# Advent of Code 2016 Day 02 -- Eric Wastl -- https://adventofcode.com
#
# Python implementation by Dr. Dean Earl Wright III
# ======================================================================
# ========================... | """A solver for the Advent of Code 2016 Day 02 puzzle"""
keypad_one = '######123##456##789######'
delta_one = {'U': -5, 'D': 5, 'L': -1, 'R': 1}
keypad_two = '##########1#####234###56789###ABC#####D##########'
delta_two = {'U': -7, 'D': 7, 'L': -1, 'R': 1}
class Keypad(object):
"""Object for Bathroom Security"""
... |
'''
Created on Jul 14, 2015
@author: beimer
'''
class AnidbModel(object):
'''
Represents a single table in the database
'''
def __init__(self, engine):
'''
Constructor
'''
self.engine = engine
def get(self, key):
'''
Returns a single reco... | """
Created on Jul 14, 2015
@author: beimer
"""
class Anidbmodel(object):
"""
Represents a single table in the database
"""
def __init__(self, engine):
"""
Constructor
"""
self.engine = engine
def get(self, key):
"""
Returns a single record using ... |
def calculate_target_heart_rate(age, resting_pulse):
intensity = 55
intensity_and_rate_lists = []
while intensity <= 95:
thr = round((((220 - age) - resting_pulse) * intensity / 100) + resting_pulse)
intensity_and_rate_list = [intensity, thr]
intensity_and_rate_lists.append(intensity... | def calculate_target_heart_rate(age, resting_pulse):
intensity = 55
intensity_and_rate_lists = []
while intensity <= 95:
thr = round((220 - age - resting_pulse) * intensity / 100 + resting_pulse)
intensity_and_rate_list = [intensity, thr]
intensity_and_rate_lists.append(intensity_and... |
'''
Pattern
Enter number of rows: 5
12345
1234
123
12
1
'''
print('pattern: ')
number_rows=int(input('Enter number of rows: '))
for row in range(1,number_rows+1):
for column in range(1,number_rows-row+2):
if column < 10:
print(f'0{column}',end=' ')
else:
print(column,end=' ')
print() | """
Pattern
Enter number of rows: 5
12345
1234
123
12
1
"""
print('pattern: ')
number_rows = int(input('Enter number of rows: '))
for row in range(1, number_rows + 1):
for column in range(1, number_rows - row + 2):
if column < 10:
print(f'0{column}', end=' ')
else:
print(colu... |
#
# Copyright (C) 2015 The Android Open Source Project
#
# 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 la... | {'target_defaults': {'variables': {'deps': ['dbus-1', 'libbrillo-<(libbase_ver)', 'libchrome-<(libbase_ver)'], 'enable_exceptions': 1}, 'cflags': ['-Wextra', '-Werror', '-Wno-unused-parameter'], 'cflags_cc': ['-fno-strict-aliasing', '-Woverloaded-virtual', '-Wno-missing-field-initializers'], 'defines': ['ENABLE_CHROMEO... |
class Scale:
def __init__(self,chord):
self.chord = list(chord)
def __getitem__(self,index):
cd = self.chord
l = len(cd)
o = index//l
i = index%l
return cd[i] + o*12
# def __contains__(self,item):
# for x in self.chord:
# if (it... | class Scale:
def __init__(self, chord):
self.chord = list(chord)
def __getitem__(self, index):
cd = self.chord
l = len(cd)
o = index // l
i = index % l
return cd[i] + o * 12 |
# No.1/2019-06-06/36 ms/13.1 MB
class Solution:
def isValid(self, s: str) -> bool:
flag=''
dict={')':'(','}':'{',']':'['}
for sign in s:
if sign in ['(','{','[']:
flag+=sign
else:
if len(flag)==0 or flag[-1]!=dict[sign]:
... | class Solution:
def is_valid(self, s: str) -> bool:
flag = ''
dict = {')': '(', '}': '{', ']': '['}
for sign in s:
if sign in ['(', '{', '[']:
flag += sign
elif len(flag) == 0 or flag[-1] != dict[sign]:
return False
else:
... |
n = 6
b = Beam(10*n, E, I)
for i in range(n):
b.apply_load(1 / (5**i), 10*i + 5, i, end=10*i + 10)
plot(b.load, (x, 0, 10*n)) # doctest: +SKIP
| n = 6
b = beam(10 * n, E, I)
for i in range(n):
b.apply_load(1 / 5 ** i, 10 * i + 5, i, end=10 * i + 10)
plot(b.load, (x, 0, 10 * n)) |
while True:
L = [*map(int,input().split())]
if sum(L) == 0: break
idx = L.index(0)
L[idx]=1
L[idx] = L[0]*L[1]*L[2] if idx == 3 else L[3]//(L[0]*L[1]*L[2])
print(*L)
| while True:
l = [*map(int, input().split())]
if sum(L) == 0:
break
idx = L.index(0)
L[idx] = 1
L[idx] = L[0] * L[1] * L[2] if idx == 3 else L[3] // (L[0] * L[1] * L[2])
print(*L) |
def ottf():
yield 1
yield 2
yield 3
yield 4
for i in ottf():
print(i) | def ottf():
yield 1
yield 2
yield 3
yield 4
for i in ottf():
print(i) |
# OpenWeatherMap API Key
weather_api_key = "c15784d529eb408f99621d7958fb0038"
# Google API Key
g_key = "AIzaSyAyrdd67uqcFI4GpI6ZSgzjL0--52mhEEg"
| weather_api_key = 'c15784d529eb408f99621d7958fb0038'
g_key = 'AIzaSyAyrdd67uqcFI4GpI6ZSgzjL0--52mhEEg' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.