content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class_cpp_header = """\
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
{includes}
#include "{class_short_name}.cppwg.hpp"
namespace py = pybind11;
typedef {class_full_name} {class_short_name};{smart_ptr_handle}
"""
class_cpp_header_chaste = """\
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
{incl... | class_cpp_header = '#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n{includes}\n#include "{class_short_name}.cppwg.hpp"\n\nnamespace py = pybind11;\ntypedef {class_full_name} {class_short_name};{smart_ptr_handle}\n'
class_cpp_header_chaste = '#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n{includ... |
# BGR
Blue = (255, 0, 0)
Green = (0, 255, 0)
Red = (0, 0, 255)
Black = (0, 0, 0)
White = (255, 255, 255)
| blue = (255, 0, 0)
green = (0, 255, 0)
red = (0, 0, 255)
black = (0, 0, 0)
white = (255, 255, 255) |
def solve_power_consumption():
"""Print the power consumption."""
with open('../data/day03.txt') as f:
lines = [line.strip() for line in f]
ones = [sum(bit == '1' for bit in column) for column in zip(*lines)]
gamma = ''.join('1' if n > len(lines) / 2 else '0' for n in ones)
epsilon = ''.joi... | def solve_power_consumption():
"""Print the power consumption."""
with open('../data/day03.txt') as f:
lines = [line.strip() for line in f]
ones = [sum((bit == '1' for bit in column)) for column in zip(*lines)]
gamma = ''.join(('1' if n > len(lines) / 2 else '0' for n in ones))
epsilon = ''.... |
# #08 Anomalous Counter!
# @DSAghicha (Darshaan Aghicha)
def counter_value(timer: int) -> int:
if timer == 0:
return 0
counter_dial: int = 0
prev_dial: int = 0
cycle_dial: int = 0
counter = 0
while timer > counter_dial:
counter += 1
prev_dial = counter_dial
c... | def counter_value(timer: int) -> int:
if timer == 0:
return 0
counter_dial: int = 0
prev_dial: int = 0
cycle_dial: int = 0
counter = 0
while timer > counter_dial:
counter += 1
prev_dial = counter_dial
counter_dial = counter_dial + 3 * 2 ** cycle_dial
cycle... |
__version__ = '0.1.3'
__title__ = 'dadjokes-cli'
__description__ = 'Dad Jokes on your Terminal'
__author__ = 'sangarshanan'
__author_email__= 'sangarshanan1998@gmail.com'
__url__ = 'https://github.com/Sangarshanan/dadjokes-cli' | __version__ = '0.1.3'
__title__ = 'dadjokes-cli'
__description__ = 'Dad Jokes on your Terminal'
__author__ = 'sangarshanan'
__author_email__ = 'sangarshanan1998@gmail.com'
__url__ = 'https://github.com/Sangarshanan/dadjokes-cli' |
"""
misc/bi_tree.py
"""
class BiTree:
"""
Binary Indexed Tree is represented as an array.
Each node of the Binary Indexed Tree stores the sum of some elements of the
original array. The size of the Binary Indexed Tree is equal to the size of
the original input array, denoted as n. This class use a... | """
misc/bi_tree.py
"""
class Bitree:
"""
Binary Indexed Tree is represented as an array.
Each node of the Binary Indexed Tree stores the sum of some elements of the
original array. The size of the Binary Indexed Tree is equal to the size of
the original input array, denoted as n. This class use a ... |
# -*- coding: utf-8 -*-
class Header(object):
def __init__(self, name):
if (isinstance(name, Header)):
name = name.normalized
name = name.strip()
self.normalized = name.lower()
def __hash__(self):
return hash(self.normalized)
def __eq__(self, righ... | class Header(object):
def __init__(self, name):
if isinstance(name, Header):
name = name.normalized
name = name.strip()
self.normalized = name.lower()
def __hash__(self):
return hash(self.normalized)
def __eq__(self, right):
assert isinstance(right, Hea... |
# -*- coding: utf-8 -*-
"""Top-level package for SlimStaty."""
__author__ = """Andy Mroczkowski"""
__email__ = 'a@mrox.co'
__version__ = '0.1.0'
| """Top-level package for SlimStaty."""
__author__ = 'Andy Mroczkowski'
__email__ = 'a@mrox.co'
__version__ = '0.1.0' |
class Solution:
def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool:
if not pushed and not popped:
return True
if len(pushed) != len(popped):
return False
popIdx = 0
count = 0
stack = []
for i in range(len(p... | class Solution:
def validate_stack_sequences(self, pushed: List[int], popped: List[int]) -> bool:
if not pushed and (not popped):
return True
if len(pushed) != len(popped):
return False
pop_idx = 0
count = 0
stack = []
for i in range(len(pushe... |
"""
62. Unique Paths
Medium
7114
267
Add to List
Share
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram... | """
62. Unique Paths
Medium
7114
267
Add to List
Share
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram... |
unsorted_list = [("w",23), (9,1), ("543",99), ("sena",18)]
print(sorted(unsorted_list, key=lambda x: x[1]))
list = [43, 743, 342, 8874, 49]
print(sorted(list, reverse=True)) | unsorted_list = [('w', 23), (9, 1), ('543', 99), ('sena', 18)]
print(sorted(unsorted_list, key=lambda x: x[1]))
list = [43, 743, 342, 8874, 49]
print(sorted(list, reverse=True)) |
# This is a handy reverses the endianess of a given binary string in HEX
input = "020000000001017c037e163f8dfee4632a8cf6c87187d3cb61224e6dae8f4b0ed0fae3a38008570000000017160014c5729e3aaacb6a160fa79949a8d7f1e5cd1fbc51feffffff0288102c040000000017a914ed649576ad657747835d116611981c90113c074387005a62020000000017a914e62a29... | input = '020000000001017c037e163f8dfee4632a8cf6c87187d3cb61224e6dae8f4b0ed0fae3a38008570000000017160014c5729e3aaacb6a160fa79949a8d7f1e5cd1fbc51feffffff0288102c040000000017a914ed649576ad657747835d116611981c90113c074387005a62020000000017a914e62a29e7d756eb30c453ae022f315619fe8ddfbb8702483045022100b40db3a574a7254d60f8e6433... |
# startswith
# endswith
inp = "ajay kumar"
out = inp.startswith("aj")
print(out)
out = inp.startswith("jay")
print(out)
# inp1 = "print('a')"
inp1 = "# isdecimal -> given a string, check if it is decimal"
out = inp1.startswith("#")
print(out) | inp = 'ajay kumar'
out = inp.startswith('aj')
print(out)
out = inp.startswith('jay')
print(out)
inp1 = '# isdecimal -> given a string, check if it is decimal'
out = inp1.startswith('#')
print(out) |
class Queue(object):
"""
Implment Queue using List
"""
def __init__(self):
self._list = []
def enqueue(self, value):
self._list.append(value)
def dequeue(self):
try:
value = self._list[0]
del self._list[0]
return value
... | class Queue(object):
"""
Implment Queue using List
"""
def __init__(self):
self._list = []
def enqueue(self, value):
self._list.append(value)
def dequeue(self):
try:
value = self._list[0]
del self._list[0]
return value
except... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 21 15:44:41 2019
@author: f.divruno
"""
ms = 1e-3
us = 1e-6
MHz = 1e6
GHz = 1e9
km = 1e3
minute = 60
hr = 60*minute
km_h = km/hr
k_bolt = 1.38e-23
def Apply_DISH(Telescope_list,Band='B1',scaling = 'Correlator_opimized', atten = 0):
"""
scaling:
... | """
Created on Fri Jun 21 15:44:41 2019
@author: f.divruno
"""
ms = 0.001
us = 1e-06
m_hz = 1000000.0
g_hz = 1000000000.0
km = 1000.0
minute = 60
hr = 60 * minute
km_h = km / hr
k_bolt = 1.38e-23
def apply_dish(Telescope_list, Band='B1', scaling='Correlator_opimized', atten=0):
"""
scaling:
... |
for _ in range(int(input())):
a,b,c=map(int,input().split())
ans=a+c-b-b
ans=abs(ans)
c1=ans%3
c2=ans%(-3)
c2=abs(c2)
if c1<c2:
print(c1)
else:
print(c2) | for _ in range(int(input())):
(a, b, c) = map(int, input().split())
ans = a + c - b - b
ans = abs(ans)
c1 = ans % 3
c2 = ans % -3
c2 = abs(c2)
if c1 < c2:
print(c1)
else:
print(c2) |
"""Config for the `config-f` setting in StyleGAN2."""
_base_ = ['./stylegan2_c2_ffhq_256_b4x8_800k.py']
model = dict(
disc_auxiliary_loss=dict(use_apex_amp=False),
gen_auxiliary_loss=dict(use_apex_amp=False),
)
total_iters = 800002
apex_amp = dict(mode='gan', init_args=dict(opt_level='O1', num_losses=2))
re... | """Config for the `config-f` setting in StyleGAN2."""
_base_ = ['./stylegan2_c2_ffhq_256_b4x8_800k.py']
model = dict(disc_auxiliary_loss=dict(use_apex_amp=False), gen_auxiliary_loss=dict(use_apex_amp=False))
total_iters = 800002
apex_amp = dict(mode='gan', init_args=dict(opt_level='O1', num_losses=2))
resume_from = Non... |
# Author: Mujib Ansari
# Date: Jan 23, 2021
# Problem Statement: WAP to check given number is palindorome or not
def check_palindorme(num):
temp = num
reverse = 0
while temp > 0:
lastDigit = temp % 10
reverse = (reverse * 10) + lastDigit
temp = temp // 10
return... | def check_palindorme(num):
temp = num
reverse = 0
while temp > 0:
last_digit = temp % 10
reverse = reverse * 10 + lastDigit
temp = temp // 10
return 'Yes' if num == reverse else 'No'
n = int(input('Enter a number : '))
print('Entered number : ', n)
print('Is palindrome or not : '... |
#
# PySNMP MIB module CXCFG-IP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXCFG-IP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:16:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, constraints_union, value_size_constraint) ... |
class AttackGroup:
def __init__(self, botai, own, targets, iter):
self.botai = botai
self.own = own
self.targets = targets
self.iteration = iter
@property
def done(self):
return len(self.own) == 0 or len(self.targets) == 0
def actions(self, iter):
action... | class Attackgroup:
def __init__(self, botai, own, targets, iter):
self.botai = botai
self.own = own
self.targets = targets
self.iteration = iter
@property
def done(self):
return len(self.own) == 0 or len(self.targets) == 0
def actions(self, iter):
actio... |
class Rocket:
def calc_fuel_weight(self, weight):
weight = int(weight)
return int(weight / 3) - 2
def calc_fuel_weight_recursive(self, weight):
weight = int(weight)
# This time with recursion for fuel weight
total = self.calc_fuel_weight(weight)
fuelweig... | class Rocket:
def calc_fuel_weight(self, weight):
weight = int(weight)
return int(weight / 3) - 2
def calc_fuel_weight_recursive(self, weight):
weight = int(weight)
total = self.calc_fuel_weight(weight)
fuelweight = self.calc_fuel_weight(total)
while fuelweight ... |
def captial(string):
strs = string.title()
return strs
n = input()
n = captial(n)
print(n)
| def captial(string):
strs = string.title()
return strs
n = input()
n = captial(n)
print(n) |
'''
Copyright (c) 2012-2021 Roel Derickx, Paul Norman <penorman@mac.com>,
Sebastiaan Couwenberg <sebastic@xs4all.nl>, The University of Vermont
<andrew.guertin@uvm.edu>, github contributors
Released under the MIT license, as given in the file LICENSE, which must
accompany any distribution of this code.
'''
__author__... | """
Copyright (c) 2012-2021 Roel Derickx, Paul Norman <penorman@mac.com>,
Sebastiaan Couwenberg <sebastic@xs4all.nl>, The University of Vermont
<andrew.guertin@uvm.edu>, github contributors
Released under the MIT license, as given in the file LICENSE, which must
accompany any distribution of this code.
"""
__author__ ... |
streams_dict = {}
def session_established(session):
# When a WebTransport session is established, a bidirectional stream is
# created by the server, which is used to echo back stream data from the
# client.
session.create_bidirectional_stream()
def stream_data_received(session,
... | streams_dict = {}
def session_established(session):
session.create_bidirectional_stream()
def stream_data_received(session, stream_id: int, data: bytes, stream_ended: bool):
if session.stream_is_unidirectional(stream_id):
if (session.session_id, stream_id) not in streams_dict.keys():
new_s... |
"""gcam_cerf_expansion
Generate an electricity capacity expansion plan from GCAM-USA in the format utilized by CERF.
License: BSD 2-Clause, see LICENSE and DISCLAIMER files
"""
def gcam_cerf_expansion(a, b):
"""Generate an electricity capacity expansion plan from GCAM-USA in the format utilized by CERF."""
... | """gcam_cerf_expansion
Generate an electricity capacity expansion plan from GCAM-USA in the format utilized by CERF.
License: BSD 2-Clause, see LICENSE and DISCLAIMER files
"""
def gcam_cerf_expansion(a, b):
"""Generate an electricity capacity expansion plan from GCAM-USA in the format utilized by CERF."""
... |
n = int(input())
c = int(input())
numbers = []
for i in range(n):
numbers.append(int(input()))
if sum(numbers) < c:
print("IMPOSSIBLE")
else:
while sum(numbers) > c:
numbers[numbers.index(max(numbers))] -= 1
for number in sorted(numbers):
print(number)
| n = int(input())
c = int(input())
numbers = []
for i in range(n):
numbers.append(int(input()))
if sum(numbers) < c:
print('IMPOSSIBLE')
else:
while sum(numbers) > c:
numbers[numbers.index(max(numbers))] -= 1
for number in sorted(numbers):
print(number) |
def change(age,*som):
print(age)
for i in som:
print(i)
return
change(12,'name','year','mon','address')
change('a1','b1')
change('a2','b2',11) | def change(age, *som):
print(age)
for i in som:
print(i)
return
change(12, 'name', 'year', 'mon', 'address')
change('a1', 'b1')
change('a2', 'b2', 11) |
FreeMono18pt7bBitmaps = [
0x27, 0x77, 0x77, 0x77, 0x77, 0x22, 0x22, 0x20, 0x00, 0x6F, 0xF6, 0xF1,
0xFE, 0x3F, 0xC7, 0xF8, 0xFF, 0x1E, 0xC3, 0x98, 0x33, 0x06, 0x60, 0xCC,
0x18, 0x04, 0x20, 0x10, 0x80, 0x42, 0x01, 0x08, 0x04, 0x20, 0x10, 0x80,
0x42, 0x01, 0x10, 0x04, 0x41, 0xFF, 0xF0, 0x44, 0x02, 0x10, 0x... | free_mono18pt7b_bitmaps = [39, 119, 119, 119, 119, 34, 34, 32, 0, 111, 246, 241, 254, 63, 199, 248, 255, 30, 195, 152, 51, 6, 96, 204, 24, 4, 32, 16, 128, 66, 1, 8, 4, 32, 16, 128, 66, 1, 16, 4, 65, 255, 240, 68, 2, 16, 8, 64, 33, 15, 255, 194, 16, 8, 64, 33, 0, 132, 2, 16, 8, 64, 35, 0, 136, 2, 32, 2, 0, 16, 0, 128, 3... |
def intervalIntersection(A, B):
aIndex = 0
bIndex = 0
toReturn = []
arg1 = A[aIndex]
arg2 = B[bIndex]
flag = True
def compareArrs(aArr, bArr):
signifyInd = ""
zipComp = zip(aArr, bArr)
compList = list(zipComp)
lowIntSec = max(compList[0])
highIntSec... | def interval_intersection(A, B):
a_index = 0
b_index = 0
to_return = []
arg1 = A[aIndex]
arg2 = B[bIndex]
flag = True
def compare_arrs(aArr, bArr):
signify_ind = ''
zip_comp = zip(aArr, bArr)
comp_list = list(zipComp)
low_int_sec = max(compList[0])
hi... |
"""Hackerrank Problem: https://www.hackerrank.com/challenges/is-binary-search-tree/problem
For the purposes of this challenge, we define a binary tree to be a binary search tree with the following ordering
requirements:
* The data value of every node in a node's left subtree is less than the data value of that node.
... | """Hackerrank Problem: https://www.hackerrank.com/challenges/is-binary-search-tree/problem
For the purposes of this challenge, we define a binary tree to be a binary search tree with the following ordering
requirements:
* The data value of every node in a node's left subtree is less than the data value of that node.
... |
def test_no_metrics(run):
tracking = run.tracking
metrics = run.dict.pop("metrics")
tracking.on_epoch_end(run)
run.set(metrics=metrics)
| def test_no_metrics(run):
tracking = run.tracking
metrics = run.dict.pop('metrics')
tracking.on_epoch_end(run)
run.set(metrics=metrics) |
"""Top-level package for copyany."""
__author__ = """Natan Bro"""
__email__ = 'code@natanbro.com'
__version__ = '0.1.0'
| """Top-level package for copyany."""
__author__ = 'Natan Bro'
__email__ = 'code@natanbro.com'
__version__ = '0.1.0' |
# -*- coding: utf-8 -*-
VERSION_MAJOR = 0
VERSION_MINOR = 0
VERSION_MICRO = 4
VERSION = (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO)
VERSION_STR = '.'.join(map(str, VERSION))
| version_major = 0
version_minor = 0
version_micro = 4
version = (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO)
version_str = '.'.join(map(str, VERSION)) |
#!/usr/bin/env python3
def fibs():
fib1, fib2 = 1, 1
while True:
yield fib1
fib1, fib2 = fib2, fib1 + fib2
print(next(i for (i, f) in enumerate(fibs(), 1) if len(str(f)) == 1000))
| def fibs():
(fib1, fib2) = (1, 1)
while True:
yield fib1
(fib1, fib2) = (fib2, fib1 + fib2)
print(next((i for (i, f) in enumerate(fibs(), 1) if len(str(f)) == 1000))) |
"""
Given a list of integers and a number K, return which contiguous elements of the list sum to K.
"""
inp = [1,2,3,4,5]
K = 9
def contiguous_sum(arr: list, k: int):
start_index = 0
end_index = -1
current_sum = 0
for i in range(len(arr)):
if current_sum < k:
current_sum += arr[i]
... | """
Given a list of integers and a number K, return which contiguous elements of the list sum to K.
"""
inp = [1, 2, 3, 4, 5]
k = 9
def contiguous_sum(arr: list, k: int):
start_index = 0
end_index = -1
current_sum = 0
for i in range(len(arr)):
if current_sum < k:
current_sum += arr[... |
# Copyright 2018 Tensorforce Team. 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 applicable la... | def is_iterable(x):
if isinstance(x, str):
return False
try:
iter(x)
return True
except TypeError:
return False
class Tensorforceerror(Exception):
"""
Tensorforce error
"""
def __init__(self, message):
if message[0].islower():
message = m... |
#-*-coding: utf-8 -*-
'''
Base cache Adapter object.
'''
class BaseAdapter(object):
db = None
def __init__(self, timeout = -1):
self.timeout = timeout
def get(self, key):
raise NotImplementedError()
def set(self, key, value):
raise NotImplementedError()
def remove(self, key):
raise NotImplementedError(... | """
Base cache Adapter object.
"""
class Baseadapter(object):
db = None
def __init__(self, timeout=-1):
self.timeout = timeout
def get(self, key):
raise not_implemented_error()
def set(self, key, value):
raise not_implemented_error()
def remove(self, key):
raise ... |
def repeated_word(string):
# separate the string
string = string.split(' ')
separated_string = []
for word in string:
if word not in separated_string:
separated_string.append(word)
for word in range(0, len(separated_string)):
print(separated_string[word], 'a... | def repeated_word(string):
string = string.split(' ')
separated_string = []
for word in string:
if word not in separated_string:
separated_string.append(word)
for word in range(0, len(separated_string)):
print(separated_string[word], 'appears', string.count(separated_string[w... |
#Algorythm: Quicksort (sometimes called partition-exchange sort)
#Description: In this file we are using the Hoare partition scheme,
#you can seen other implementation in the other quicksort files
#Source link: I saw the algorithm explanation on https://en.wikipedia.org/wiki/Quicksort
#Use: It is used to sort, it is a ... | def swap_values(array, x, y):
len_arr = len(array)
if len_arr > 0 and x < len_arr and (x >= 0) and (y >= 0) and (y < len_arr) and (x != y):
temp_var = array[y]
array[y] = array[x]
array[x] = temp_var
def partition(array, min_index, max_index):
pivot_value = array[min_index]
i = ... |
GET_ALL_GENRES = """
SELECT name
FROM genres
"""
INSERT_GENRE = """
INSERT INTO genres (name) VALUES (:name)
"""
| get_all_genres = '\nSELECT name\nFROM genres\n'
insert_genre = '\nINSERT INTO genres (name) VALUES (:name)\n' |
def admin_helper(admin) -> dict:
return {
"id": str(admin['_id']),
"fullname": admin['fullname'],
"email": admin['email'],
}
def state_count_helper(state_count) -> dict:
return {
"id": str(state_count['_id']),
"date": state_count['date'],
"state": state_count... | def admin_helper(admin) -> dict:
return {'id': str(admin['_id']), 'fullname': admin['fullname'], 'email': admin['email']}
def state_count_helper(state_count) -> dict:
return {'id': str(state_count['_id']), 'date': state_count['date'], 'state': state_count['state'], 'ad_count': state_count['ad_count'], 'avg_age... |
def get_strings(city):
city = city.lower().replace(" ", "")
ans = [""] * 26
order = ""
for i in city:
if i not in order:
order += i
for i in city:
ans[ord(i) - 97] += "*"
return ",".join([i + ":" + ans[ord(i) - 97] for i in order])
print(get_strings("Chicago")) | def get_strings(city):
city = city.lower().replace(' ', '')
ans = [''] * 26
order = ''
for i in city:
if i not in order:
order += i
for i in city:
ans[ord(i) - 97] += '*'
return ','.join([i + ':' + ans[ord(i) - 97] for i in order])
print(get_strings('Chicago')) |
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
answer = 0
for i in range(1, n):
if a*(x[i]-x[i-1]) < b:
answer += a*(x[i]-x[i-1])
else:
answer += b
print(answer) | (n, a, b) = map(int, input().split())
x = list(map(int, input().split()))
answer = 0
for i in range(1, n):
if a * (x[i] - x[i - 1]) < b:
answer += a * (x[i] - x[i - 1])
else:
answer += b
print(answer) |
# address of mongoDB
MONGO_SERVER = 'mongodb://192.168.1.234:27017/'
# MONGO_SERVER = 'mongodb://mongodb.test:27017/'
SCHEDULER_DB = "scheduler"
JOB_COLLECTION = "jobs"
REGISTRY_URL = "registry.zilliz.com/milvus/milvus"
IDC_NAS_URL = "//172.16.70.249/test"
DEFAULT_IMAGE = "milvusdb/milvus:latest"
SERVER_HOST_DEFAULT... | mongo_server = 'mongodb://192.168.1.234:27017/'
scheduler_db = 'scheduler'
job_collection = 'jobs'
registry_url = 'registry.zilliz.com/milvus/milvus'
idc_nas_url = '//172.16.70.249/test'
default_image = 'milvusdb/milvus:latest'
server_host_default = '127.0.0.1'
server_port_default = 19530
server_version = '2.0.0-RC7'
d... |
def selection_sort(arr, simulation=False):
""" Selection Sort
Complexity: O(n^2)
##-------------------------------------------------------------------
"""
iteration = 0
if simulation:
print("iteration", iteration, ":", *arr)
for i in range(len(arr)):
minimum = i
for... | def selection_sort(arr, simulation=False):
""" Selection Sort
Complexity: O(n^2)
##-------------------------------------------------------------------
"""
iteration = 0
if simulation:
print('iteration', iteration, ':', *arr)
for i in range(len(arr)):
minimum = i
for j... |
src = Split('''
tls_test.c
''')
component = aos_component('tls_test', src)
component.add_comp_deps('security/mbedtls') | src = split('\n tls_test.c\n')
component = aos_component('tls_test', src)
component.add_comp_deps('security/mbedtls') |
NC_READ_REQUEST = 0
NC_READ_REPLY = 1
NC_HOT_READ_REQUEST = 2
NC_WRITE_REQUEST = 4
NC_WRITE_REPLY = 5
NC_UPDATE_REQUEST = 8
NC_UPDATE_REPLY = 9
| nc_read_request = 0
nc_read_reply = 1
nc_hot_read_request = 2
nc_write_request = 4
nc_write_reply = 5
nc_update_request = 8
nc_update_reply = 9 |
"""
string_util.py
Miscellaneous string processing functions
"""
def title_case(sentence):
"""
Capitalize the first letter of every word in a sentence.
Parameters
----------
sentence: string
Sentence to be converted to title case
Returns
-------
result: string
Input string ... | """
string_util.py
Miscellaneous string processing functions
"""
def title_case(sentence):
"""
Capitalize the first letter of every word in a sentence.
Parameters
----------
sentence: string
Sentence to be converted to title case
Returns
-------
result: string
Input string c... |
"""
Hello we are attempting to simulate the cochlea.
The cochlea uses a concept called tonotopy i.e. low frequencies are processed at the apex
and high frequencies are processed at the base. Furthermore sound travels to its point
of transduction as a traveling wave
"""
def __self_description():
print("Simulation ... | """
Hello we are attempting to simulate the cochlea.
The cochlea uses a concept called tonotopy i.e. low frequencies are processed at the apex
and high frequencies are processed at the base. Furthermore sound travels to its point
of transduction as a traveling wave
"""
def __self_description():
print('Simulation... |
__author__ = 'olga'
def scatterhist(ax, x, y):
"""
Create a scatterplot with histogram of the marginals, as in scatterhist()
in Matlab but nicer.
@param ax:
@type ax:
@param x:
@type x:
@param y:
@type y:
@return: hist_patches, scatter_points
@rtype: matplotlib.
"""
... | __author__ = 'olga'
def scatterhist(ax, x, y):
"""
Create a scatterplot with histogram of the marginals, as in scatterhist()
in Matlab but nicer.
@param ax:
@type ax:
@param x:
@type x:
@param y:
@type y:
@return: hist_patches, scatter_points
@rtype: matplotlib.
"""
... |
with open('input.txt') as f:
input = f.readline()
input = input.strip().split('-')
input_min = int(input[0])
input_max = int(input[1])
def pwd_to_digits(pwd):
digits = []
pwd_str = str(pwd)
while len(pwd_str) > 0:
digits.append(int(pwd_str[0]))
pwd_str = pwd_str[1:]
return digi... | with open('input.txt') as f:
input = f.readline()
input = input.strip().split('-')
input_min = int(input[0])
input_max = int(input[1])
def pwd_to_digits(pwd):
digits = []
pwd_str = str(pwd)
while len(pwd_str) > 0:
digits.append(int(pwd_str[0]))
pwd_str = pwd_str[1:]
return digits
d... |
class DrawflowNodeBase:
def __init__(self):
self.nodename = "basenode"
self.nodetitle = "Basenode"
self.nodeinputs = list()
self.nodeoutputs = list()
self.nodeicon = ""
self.nodehtml = "<b>DO NOT USE THE BASE NODE!!!</b>"
def name(self, name):
self.nodena... | class Drawflownodebase:
def __init__(self):
self.nodename = 'basenode'
self.nodetitle = 'Basenode'
self.nodeinputs = list()
self.nodeoutputs = list()
self.nodeicon = ''
self.nodehtml = '<b>DO NOT USE THE BASE NODE!!!</b>'
def name(self, name):
self.noden... |
f = open("Files/Test.txt", mode="rt",encoding="utf-8")
g = open("Files/fil1.txt", mode="rt",encoding="utf-8")
h = open("Files/wasteland.txt", mode="rt",encoding="utf-8")
# return type of read() method is str
# To read specific number of character we have to pass the characters as arguments
# print(f.read(25))
# To re... | f = open('Files/Test.txt', mode='rt', encoding='utf-8')
g = open('Files/fil1.txt', mode='rt', encoding='utf-8')
h = open('Files/wasteland.txt', mode='rt', encoding='utf-8')
print('Content in Test1.txt:\n', f.read())
print()
print('Content in fil1.txt:\n', g.read())
print()
print('Content in wasteland.txt:\n', h.read()) |
# -*- coding: utf-8 -*-
"""Unit test package for django-model-cleanup."""
# Having tests in a separate folder is a safe choice
# You can have them mixed in the src but at some point you will get
# problems with test discovery activating lazy objects and other import time
# headaches. And if you fail to filter test du... | """Unit test package for django-model-cleanup.""" |
class Solution:
def decompressRLElist(self, nums: List[int]) -> List[int]:
ret = []
i = 0
while i < len(nums):
j = 0
while j < nums[i]:
ret.append(nums[i+1])
j += 1
i += 2
return ret
| class Solution:
def decompress_rl_elist(self, nums: List[int]) -> List[int]:
ret = []
i = 0
while i < len(nums):
j = 0
while j < nums[i]:
ret.append(nums[i + 1])
j += 1
i += 2
return ret |
# Given an array of numbers, find all the
# pairs of numbers which sum upto `k`
def find_pairs(num_array, k):
pairs_array = []
for num in num_array:
if (k - num) in num_array:
pairs_array.append((num, (k - num)))
return pairs_array
result = find_pairs([0, 14, 0, 4, 7, 8, 3, 5, 7], 11... | def find_pairs(num_array, k):
pairs_array = []
for num in num_array:
if k - num in num_array:
pairs_array.append((num, k - num))
return pairs_array
result = find_pairs([0, 14, 0, 4, 7, 8, 3, 5, 7], 11)
print(result) |
class Solution:
def champagneTower(self, poured: int, query_row: int, query_glass: int) -> float:
filled = [[0.0] * (query_row + 2) for _ in range (query_row+2)]
filled[0][0] = poured
for row in range(query_row + 1):
for col in range(query_row + 1):
if (filled[ro... | class Solution:
def champagne_tower(self, poured: int, query_row: int, query_glass: int) -> float:
filled = [[0.0] * (query_row + 2) for _ in range(query_row + 2)]
filled[0][0] = poured
for row in range(query_row + 1):
for col in range(query_row + 1):
if filled[r... |
class Headers:
X_VOL_TENANT = "x-vol-tenant";
X_VOL_SITE = "x-vol-site";
X_VOL_CATALOG = "x-vol-catalog";
X_VOL_MASTER_CATALOG = "x-vol-master-catalog";
X_VOL_SITE_DOMAIN = "x-vol-site-domain";
X_VOL_TENANT_DOMAIN = "x-vol-tenant-domain";
X_VOL_CORRELATION = "x-vol-correlation";
X_VOL_HMAC_SHA256 = "x-vol-hmac-... | class Headers:
x_vol_tenant = 'x-vol-tenant'
x_vol_site = 'x-vol-site'
x_vol_catalog = 'x-vol-catalog'
x_vol_master_catalog = 'x-vol-master-catalog'
x_vol_site_domain = 'x-vol-site-domain'
x_vol_tenant_domain = 'x-vol-tenant-domain'
x_vol_correlation = 'x-vol-correlation'
x_vol_hmac_sha2... |
# -*- coding: utf-8 -*-
"""
Yet another static site generator.
"""
| """
Yet another static site generator.
""" |
'''
Exercise 2:
Write a function save_list2file(sentences, filename) that takes two
parameters, where sentences is a list of string, and filename is a string representing the
name of the file where the content of sentences must be saved. Each element of the list
sentences should be written on its own line in the file f... | """
Exercise 2:
Write a function save_list2file(sentences, filename) that takes two
parameters, where sentences is a list of string, and filename is a string representing the
name of the file where the content of sentences must be saved. Each element of the list
sentences should be written on its own line in the file f... |
class Solution:
def uniquePathsWithObstacles(self, grid: List[List[int]]) -> int:
if grid[0][0] == 1: return 0
m = len(grid)
n = len(grid[0])
grid[0][0] = 1
for i in range(1, m):
if grid[i][0] == 0:
grid[i][0] = grid[i - 1][0]
else:
... | class Solution:
def unique_paths_with_obstacles(self, grid: List[List[int]]) -> int:
if grid[0][0] == 1:
return 0
m = len(grid)
n = len(grid[0])
grid[0][0] = 1
for i in range(1, m):
if grid[i][0] == 0:
grid[i][0] = grid[i - 1][0]
... |
def categorical_cross_entropy(y_pred, y):
x = np.multiply(y, np.log(y_pred))
loss = x.sum()
return loss
| def categorical_cross_entropy(y_pred, y):
x = np.multiply(y, np.log(y_pred))
loss = x.sum()
return loss |
largest = None
smallest = None
while True:
num = input("Enter a number: ")
if num == "done":
break
try:
inp=float(num)
except:
print("Invalid input")
if smallest is None:
smallest=inp
elif inp < smallest:
smallest=inp
elif inp>largest... | largest = None
smallest = None
while True:
num = input('Enter a number: ')
if num == 'done':
break
try:
inp = float(num)
except:
print('Invalid input')
if smallest is None:
smallest = inp
elif inp < smallest:
smallest = inp
elif inp > largest:
... |
"""
Copyright (c) 2018-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
class BadConfigError(Excep... | """
Copyright (c) 2018-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
class Badconfigerror(Except... |
class Solution:
def numTilePossibilities(self, tiles: str) -> int:
def dfs(counterMap):
currentSum = 0
for char in counterMap:
if counterMap[char] > 0:
currentSum += 1
counterMap[char] -= 1
currentSum += dfs(... | class Solution:
def num_tile_possibilities(self, tiles: str) -> int:
def dfs(counterMap):
current_sum = 0
for char in counterMap:
if counterMap[char] > 0:
current_sum += 1
counterMap[char] -= 1
current_sum ... |
user1 = {
"user": {
"username": "akram",
"email": "akram.mukasa@andela.com",
"password": "Akram@100555"
}
}
login1 = {"user": {"email": "akram.mukasa@andela.com", "password": "Akram@100555"}}
| user1 = {'user': {'username': 'akram', 'email': 'akram.mukasa@andela.com', 'password': 'Akram@100555'}}
login1 = {'user': {'email': 'akram.mukasa@andela.com', 'password': 'Akram@100555'}} |
class Image:
def __init__(self, name):
self.name = name
def register(self):
raise NotImplementedError
def getImg(self):
raise NotImplementedError
| class Image:
def __init__(self, name):
self.name = name
def register(self):
raise NotImplementedError
def get_img(self):
raise NotImplementedError |
expected_output = {
"five_sec_cpu_total": 13,
"five_min_cpu": 15,
"one_min_cpu": 23,
"five_sec_cpu_interrupts": 0,
}
| expected_output = {'five_sec_cpu_total': 13, 'five_min_cpu': 15, 'one_min_cpu': 23, 'five_sec_cpu_interrupts': 0} |
alg.aggregation (
[ "c_custkey", "c_name", "c_acctbal", "c_phone", "n_name", "c_address", "c_comment" ],
[ ( Reduction.SUM, "rev", "revenue" ) ],
alg.map (
"rev",
scal.MulExpr (
scal.AttrExpr ( "l_extendedprice" ),
scal.SubExpr (
scal.ConstExpr ( "1.... | alg.aggregation(['c_custkey', 'c_name', 'c_acctbal', 'c_phone', 'n_name', 'c_address', 'c_comment'], [(Reduction.SUM, 'rev', 'revenue')], alg.map('rev', scal.MulExpr(scal.AttrExpr('l_extendedprice'), scal.SubExpr(scal.ConstExpr('1.0f', Type.FLOAT), scal.AttrExpr('l_discount'))), alg.join(('l_orderkey', 'o_orderkey'), a... |
# -*- coding: utf-8 -*-
"""
"""
def get_ratios(L1, L2):
""" Assumes: L1 and L2 are lists of equal length of numbers
Returns: a list containing L1[i]/L2[i] """
ratios = []
for index in range(len(L1)):
try:
ratios.append(L1[index]/float(L2[index]))
except ZeroDivisionErro... | """
"""
def get_ratios(L1, L2):
""" Assumes: L1 and L2 are lists of equal length of numbers
Returns: a list containing L1[i]/L2[i] """
ratios = []
for index in range(len(L1)):
try:
ratios.append(L1[index] / float(L2[index]))
except ZeroDivisionError:
ratios.... |
"""
Exceptions to be called by service check plugins when the appropriate situations arrive.
None of these have special behaviour.
"""
class ParamError(Exception):
"""To be thrown when user input causes the issue"""
pass
class ResultError(Exception):
"""To be thrown when the API/Metric Check returns eit... | """
Exceptions to be called by service check plugins when the appropriate situations arrive.
None of these have special behaviour.
"""
class Paramerror(Exception):
"""To be thrown when user input causes the issue"""
pass
class Resulterror(Exception):
"""To be thrown when the API/Metric Check returns eithe... |
class TracardiException(Exception):
pass
class StorageException(TracardiException):
pass
class ExpiredException(TracardiException):
pass
class UnauthorizedException(TracardiException):
pass
| class Tracardiexception(Exception):
pass
class Storageexception(TracardiException):
pass
class Expiredexception(TracardiException):
pass
class Unauthorizedexception(TracardiException):
pass |
def precedence(op):
if op == '^':
return 3
if op == '+' or op == '-':
return 1
if op == '*' or op == '/':
return 2
return 0
def applyOp(a, b, op):
if op == '^': return a ** b
if op == '+': return a + b
if op == '-': return a - b
if op == '*': return a * ... | def precedence(op):
if op == '^':
return 3
if op == '+' or op == '-':
return 1
if op == '*' or op == '/':
return 2
return 0
def apply_op(a, b, op):
if op == '^':
return a ** b
if op == '+':
return a + b
if op == '-':
return a - b
if op == ... |
"""
Question 15 :
Write a program that computes the values of a+aa+aaa+aaaa
with a given digit as the value of a. Suppose the following
input is supplied to the program : 9 Then, the output
should be : 11106
Hints : In case of input data begin supplied to the question,
it should be assumed to b... | """
Question 15 :
Write a program that computes the values of a+aa+aaa+aaaa
with a given digit as the value of a. Suppose the following
input is supplied to the program : 9 Then, the output
should be : 11106
Hints : In case of input data begin supplied to the question,
it should be assumed to b... |
class ControlSys():
def __init__(self, fig, imdis, vol_tran, vol_fron, vol_sagi, ax_tran, ax_fron, ax_sagi):
self.fig =fig
self.imdis = imdis
self.vol_tran = vol_tran
self.vol_fron = vol_fron
self.vol_sagi = vol_sagi
self.ax_tran = ax_tran
self.a... | class Controlsys:
def __init__(self, fig, imdis, vol_tran, vol_fron, vol_sagi, ax_tran, ax_fron, ax_sagi):
self.fig = fig
self.imdis = imdis
self.vol_tran = vol_tran
self.vol_fron = vol_fron
self.vol_sagi = vol_sagi
self.ax_tran = ax_tran
self.ax_fron = ax_fr... |
s = input()
words = ["dream", "dreamer", "erase", "eraser"]
words = sorted(words, reverse=True)
print()
for word in words:
if word in s:
s = s.replace(word, "")
if not s:
ans = "YES"
else:
ans = "NO"
print(ans)
| s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']
words = sorted(words, reverse=True)
print()
for word in words:
if word in s:
s = s.replace(word, '')
if not s:
ans = 'YES'
else:
ans = 'NO'
print(ans) |
def read_safeguard_sql(cluster_descr, host_type):
for schemas_descr in cluster_descr.schemas_list:
if schemas_descr.schemas_type != host_type:
continue
safeguard_descr = schemas_descr.safeguard
if safeguard_descr is None:
continue
yield from safeguard_descr... | def read_safeguard_sql(cluster_descr, host_type):
for schemas_descr in cluster_descr.schemas_list:
if schemas_descr.schemas_type != host_type:
continue
safeguard_descr = schemas_descr.safeguard
if safeguard_descr is None:
continue
yield from safeguard_descr.re... |
def name_printer(user_name):
print("Your name is", user_name)
name = input("Please enter your name: ")
name_printer(name)
| def name_printer(user_name):
print('Your name is', user_name)
name = input('Please enter your name: ')
name_printer(name) |
# <auto-generated>
# This code was generated by the UnitCodeGenerator tool
#
# Changes to this file will be lost if the code is regenerated
# </auto-generated>
def to_millilitres(value):
return value * 4546.091879
def to_litres(value):
return value * 4.546091879
def to_kilolitres(value):
return value * 0.0045460... | def to_millilitres(value):
return value * 4546.091879
def to_litres(value):
return value * 4.546091879
def to_kilolitres(value):
return value * 0.0045460918799
def to_teaspoons(value):
return value * 768.0
def to_tablespoons(value):
return value * 256.0
def to_quarts(value):
return value * ... |
# -*- coding: utf-8 -*-
'''
Service support for Solaris 10 and 11, should work with other systems
that use SMF also. (e.g. SmartOS)
'''
__func_alias__ = {
'reload_': 'reload'
}
def __virtual__():
'''
Only work on systems which default to SMF
'''
# Don't let this work on Solaris 9 since SMF doesn'... | """
Service support for Solaris 10 and 11, should work with other systems
that use SMF also. (e.g. SmartOS)
"""
__func_alias__ = {'reload_': 'reload'}
def __virtual__():
"""
Only work on systems which default to SMF
"""
enable = set(('Solaris', 'SmartOS'))
if __grains__['os'] in enable:
if ... |
n = int(input())
a = set(map(int, input().split()))
m = int(input())
b = set(map(int, input().split()))
inx = a.intersection(b)
unx = a.union(b)
x = unx.difference(inx)
for i in sorted(x):
print(i)
| n = int(input())
a = set(map(int, input().split()))
m = int(input())
b = set(map(int, input().split()))
inx = a.intersection(b)
unx = a.union(b)
x = unx.difference(inx)
for i in sorted(x):
print(i) |
class Simulation:
def __init__(self, x, v, box, potentials, integrator):
self.x = x
self.v = v
self.box = box
self.potentials = potentials
self.integrator = integrator
| class Simulation:
def __init__(self, x, v, box, potentials, integrator):
self.x = x
self.v = v
self.box = box
self.potentials = potentials
self.integrator = integrator |
# Hola 3 -> HolaHolaHola
def repeticiones(n):#Funcion envolvente
def repetidor(string):#funcion anidada
assert type(string) == str, "Solo se pueden utilizar strings" #afirmamos que el valor ingresado es un entero, de lo contrario envia el mensaje de error
return(string*n)# llama a scope superi... | def repeticiones(n):
def repetidor(string):
assert type(string) == str, 'Solo se pueden utilizar strings'
return string * n
return repetidor
def run():
repetir5 = repeticiones(5)
print(repetir5('Hola'))
repetir10 = repeticiones(10)
print(repetir5('Chris'))
if __name__ == '__mai... |
DATASET = "forest-2"
CLASSES = 2
FEATURES = 54
NN_SIZE = 256
DIFFICULTY = 10000
| dataset = 'forest-2'
classes = 2
features = 54
nn_size = 256
difficulty = 10000 |
#!/usr/bin/env python3
class Case:
def __init__(self, number_of_switches):
self.number_of_switches = number_of_switches
self.number_of_toggles = 0
def run(self):
self.number_of_toggles = self.min_toggles_for(self.number_of_switches)
def min_toggles_for(self, switches):
""... | class Case:
def __init__(self, number_of_switches):
self.number_of_switches = number_of_switches
self.number_of_toggles = 0
def run(self):
self.number_of_toggles = self.min_toggles_for(self.number_of_switches)
def min_toggles_for(self, switches):
"""
If there are n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Schooner - Course Management System
# University of Turku / Faculty of Technilogy / Department of Computing
# (c) 2021, Jani Tammi <jasata@utu.fi>
#
# Submission.py - Data dictionary class for core.submission
# 2021-08-27 Initial version.
# 2021-09-03 Updated to ... | class Submission(dict):
def __init__(self, cursor, submission_id: int=None):
self.cursor = cursor
self.pkkeys = [k for k in locals().keys() if k not in ('self', 'cursor')]
self.pkvals = locals()
self.pkvals = [self.pkvals[k] for k in self.pkkeys]
sql = f'SELECT * FROM core.{... |
# -*- coding: utf-8 -*-
def get_node_indice(self, coordinates=None):
"""Return a matrix of nodes coordinates.
Parameters
----------
self : Mesh
an Mesh object
indices : list
Indices of the targeted nodes. If None, return all.
is_indice: bool
Option to return the nodes ... | def get_node_indice(self, coordinates=None):
"""Return a matrix of nodes coordinates.
Parameters
----------
self : Mesh
an Mesh object
indices : list
Indices of the targeted nodes. If None, return all.
is_indice: bool
Option to return the nodes indices (useful for unsort... |
class ContainerHypervisor():
def __init__(self):
self.data = {}
def parse(self, verbose=True):
assert False, "Please use a subclass the implements this method."
def retrieve_inputs(self, inputs, *args):
assert False, "Please use a subclass the implements this method."
def upl... | class Containerhypervisor:
def __init__(self):
self.data = {}
def parse(self, verbose=True):
assert False, 'Please use a subclass the implements this method.'
def retrieve_inputs(self, inputs, *args):
assert False, 'Please use a subclass the implements this method.'
def uploa... |
class ImportError(Exception):
pass
class CatalogueImportError(Exception):
pass
| class Importerror(Exception):
pass
class Catalogueimporterror(Exception):
pass |
class Solution:
def numberToWords(self, num: int) -> str:
LESS_THAN_20 = ["", "One", "Two", "Three", "Four", "Five", "Six",
"Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve",
"Thirteen", "Fourteen", "Fifteen", "Sixteen",
"Seventeen", ... | class Solution:
def number_to_words(self, num: int) -> str:
less_than_20 = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']
tens = ['', 'Ten', 'Twenty', 'Thirty'... |
a = int(input())
b = int(input())
if(a > b):
print(True)
else:
print(False)
| a = int(input())
b = int(input())
if a > b:
print(True)
else:
print(False) |
class X: pass
class Y: pass
class Z: pass
class A(X, Y): pass
class B(Y, Z): pass
class M(B, A, Z): pass
# Output:
# [<class '__main__.M'>, <class '__main__.B'>,
# <class '__main__.A'>, <class '__main__.X'>,
# <class '__main__.Y'>, <class '__main__.Z'>,
# <class 'object'>]
print(M.mro()) | class X:
pass
class Y:
pass
class Z:
pass
class A(X, Y):
pass
class B(Y, Z):
pass
class M(B, A, Z):
pass
print(M.mro()) |
#Its a simple Rock paper scissor game
print('...Rock...')
print('...Paper...')
print('...Scissor...')
x = input('Enter Player 1 Choice ')
print('No Cheating\n\n' * 20)
y = input('Enter Play 2 Choice ')
if x == 'paper' and y == 'rock':
print('Player 1 won')
elif x == 'rock' and y == 'paper':
print('Player 2 wins')
eli... | print('...Rock...')
print('...Paper...')
print('...Scissor...')
x = input('Enter Player 1 Choice ')
print('No Cheating\n\n' * 20)
y = input('Enter Play 2 Choice ')
if x == 'paper' and y == 'rock':
print('Player 1 won')
elif x == 'rock' and y == 'paper':
print('Player 2 wins')
elif x == 'scissor' and y == 'paper... |
def add(x,y):
"""Add two numer together"""
return x + y
def substract(x,y):
"""Substract x from y and return value """
return y - x | def add(x, y):
"""Add two numer together"""
return x + y
def substract(x, y):
"""Substract x from y and return value """
return y - x |
# Program 70 : Function to print binary number using recursion
def convertToBinary(n):
if n > 1:
convertToBinary(n//2)
print(n % 2,end = '')
# decimal number
dec = int(input("Enter Decimal Number : "))
convertToBinary(dec)
print()
| def convert_to_binary(n):
if n > 1:
convert_to_binary(n // 2)
print(n % 2, end='')
dec = int(input('Enter Decimal Number : '))
convert_to_binary(dec)
print() |
def to_celsius(kelvin:float, round_digit=2) -> float:
"""Convert Kelvin to Celsius
Args:
kelvin (float):
round_digit (int, optional): Defaults to 2.
Returns:
float: celcius
"""
return round(kelvin-273.15, round_digit)
def fahr_to_celsius(fahr):
cel=(fahr-32)*(5... | def to_celsius(kelvin: float, round_digit=2) -> float:
"""Convert Kelvin to Celsius
Args:
kelvin (float):
round_digit (int, optional): Defaults to 2.
Returns:
float: celcius
"""
return round(kelvin - 273.15, round_digit)
def fahr_to_celsius(fahr):
cel = (fahr - 32) * ... |
buffet = ('beef', 'chicken', 'fish', 'pork', 'lamb')
for item in buffet:
print(item, end=" ")
print()
buffet = ('wagyu', 'chicken', 'fish', 'squid', 'lamb')
for item in buffet:
print(item, end=" ")
| buffet = ('beef', 'chicken', 'fish', 'pork', 'lamb')
for item in buffet:
print(item, end=' ')
print()
buffet = ('wagyu', 'chicken', 'fish', 'squid', 'lamb')
for item in buffet:
print(item, end=' ') |
'''
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Example 1:
Input: nums = [2,7,11,15]... | """
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Example 1:
Input: nums = [2,7,11,15], targe... |
SQLALCHEMY_DATABASE_URI = \
'postgres+psycopg2://postgres:postgres@172.16.100.140/tdt2018'
# 'postgres+psycopg2://postgres:postgres@localhost/tdt2018'
SECRET_KEY = '\x88D\xf09\x91\x07\x98\x89\x87\x96\xa0A\xc68\xf9\xecJ:U\x17\xc5V\xbe\x8b\xef\xd7\xd8\xd3\xe6\x98*4'
| sqlalchemy_database_uri = 'postgres+psycopg2://postgres:postgres@172.16.100.140/tdt2018'
secret_key = '\x88Dð9\x91\x07\x98\x89\x87\x96\xa0AÆ8ùìJ:U\x17ÅV¾\x8bïרӿ\x98*4' |
class Source(object):
"""Source is a data source capable of fetching and rendering data.
To create your own custom data source, you should subclass this class
and override it with your own fetch() and render() functions.
aiohttp is provided to all Source classes to fetch data over HTTP.
See httpc... | class Source(object):
"""Source is a data source capable of fetching and rendering data.
To create your own custom data source, you should subclass this class
and override it with your own fetch() and render() functions.
aiohttp is provided to all Source classes to fetch data over HTTP.
See httpc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.