content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def increment(a):
return a+1
def decrement(a):
return a-1
| def increment(a):
return a + 1
def decrement(a):
return a - 1 |
class Referee:
def __init__(self, json_referee_info: dict) -> None:
self.id = json_referee_info.get("id")
self.bonuses = json_referee_info.get("bonuses")
self.bonuses_total = json_referee_info.get("bonuses_total")
self.email = json_referee_info.get("email")
class Referrals:
de... | class Referee:
def __init__(self, json_referee_info: dict) -> None:
self.id = json_referee_info.get('id')
self.bonuses = json_referee_info.get('bonuses')
self.bonuses_total = json_referee_info.get('bonuses_total')
self.email = json_referee_info.get('email')
class Referrals:
de... |
def find_the_max_sum_of_subarray(arr, K):
# Input: [2, 1, 5, 1, 3, 2], k=3
# Output: 9
start_index = 0
sum_index = 0
target_sum = 0
for index, value in enumerate(arr):
sum_index += value
if index >= K-1:
if sum_index > target_sum:
target_sum = s... | def find_the_max_sum_of_subarray(arr, K):
start_index = 0
sum_index = 0
target_sum = 0
for (index, value) in enumerate(arr):
sum_index += value
if index >= K - 1:
if sum_index > target_sum:
target_sum = sum_index
sum_index -= arr[start_index]
... |
for i in range(10000000):
str_i = str(i)
s1 = 'ABCDEFH' + str_i
s2 = '123456789' + str_i
result = ''
x = 0
if len(s1) < len(s2):
while x < len(s1):
result += s1[x] + s2[x]
x += 1
result += s2[x:]
else:
while x < len(s2):
result += s... | for i in range(10000000):
str_i = str(i)
s1 = 'ABCDEFH' + str_i
s2 = '123456789' + str_i
result = ''
x = 0
if len(s1) < len(s2):
while x < len(s1):
result += s1[x] + s2[x]
x += 1
result += s2[x:]
else:
while x < len(s2):
result += s... |
class parent:
counter=10
hit=15
def __init__(self):
print("Parent class initialized.")
def SetCounter(self, num):
self.counter= num
class child(parent): # child is the child class of Parent
def __init__(self):
print("Child class being initialized.")
def SetHit(self, num2):
self.hit=num2
c= child()
print... | class Parent:
counter = 10
hit = 15
def __init__(self):
print('Parent class initialized.')
def set_counter(self, num):
self.counter = num
class Child(parent):
def __init__(self):
print('Child class being initialized.')
def set_hit(self, num2):
self.hit = num2... |
class Node:
def __init__(self, data=None , next_ref=None):
self.data = data
self.next = next_ref
class Stack:
def __init__(self, data=None):
self.__top= None
self.__size = 0
if data:
node = Node(data)
self.__top = node
self.__size = 1
def push(self, data):
node = Node(data,self.__top)
self... | class Node:
def __init__(self, data=None, next_ref=None):
self.data = data
self.next = next_ref
class Stack:
def __init__(self, data=None):
self.__top = None
self.__size = 0
if data:
node = node(data)
self.__top = node
self.__size = ... |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def reverseBetween(self, head: ListNode) -> ListNode:
value = 0
currentNode = head
while currentNode!=None :
node = currentNode
while node.next!=None:
... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def reverse_between(self, head: ListNode) -> ListNode:
value = 0
current_node = head
while currentNode != None:
node = currentNode
while node.next != None:
... |
__title__ = 'ki'
__version__ = '1.1.0'
__author__ = 'Joshua Scott & Caleb Pina'
__description__ = 'Python bindings and extensions for libki'
| __title__ = 'ki'
__version__ = '1.1.0'
__author__ = 'Joshua Scott & Caleb Pina'
__description__ = 'Python bindings and extensions for libki' |
# filename : Graph.py
# ------------------------------------------------------------------------------------
class Graph:
def __init__(self, number_of_vertex, number_of_edges, is_directed = False, is_weighted = False):
self.number_of_vertices = number_of_vertex
self.number_of_edges = number_... | class Graph:
def __init__(self, number_of_vertex, number_of_edges, is_directed=False, is_weighted=False):
self.number_of_vertices = number_of_vertex
self.number_of_edges = number_of_edges
self.is_directed = is_directed
self.is_weighted = is_weighted
self.graph_list = [[] for... |
class SimulationNotFinished(Exception):
def __init__(self, keyword):
super().__init__(
"Run simulation first before using `{}` method.".format(keyword)
)
class DailyReturnsNotRegistered(Exception):
def __init__(self):
super().__init__("Daily returns data have not yet regist... | class Simulationnotfinished(Exception):
def __init__(self, keyword):
super().__init__('Run simulation first before using `{}` method.'.format(keyword))
class Dailyreturnsnotregistered(Exception):
def __init__(self):
super().__init__('Daily returns data have not yet registered.') |
class FilterGroupController:
def __init__(self, filterGroups):
self.filterGroups = filterGroups
def sendCoT(self, CoT):
pass
def addUser(self, clientInformation):
pass
def removeUser(self, clientInformation):
pass | class Filtergroupcontroller:
def __init__(self, filterGroups):
self.filterGroups = filterGroups
def send_co_t(self, CoT):
pass
def add_user(self, clientInformation):
pass
def remove_user(self, clientInformation):
pass |
class Solution:
def maxSumTwoNoOverlap(self, A: List[int], L: int, M: int) -> int:
prefix, n, res, left = [0 for _ in range(len(A) + 1)], len(A) + 1, 0, 0
for i in range(1, n):
prefix[i] = prefix[i - 1] + A[i - 1]
for i in range(L + M, n):
left = max(left, prefix[i - ... | class Solution:
def max_sum_two_no_overlap(self, A: List[int], L: int, M: int) -> int:
(prefix, n, res, left) = ([0 for _ in range(len(A) + 1)], len(A) + 1, 0, 0)
for i in range(1, n):
prefix[i] = prefix[i - 1] + A[i - 1]
for i in range(L + M, n):
left = max(left, pr... |
valores = input().split()
valores = list(map(int,valores))
A, B = valores
if (B%A == 0) or (A%B == 0):
print('Sao Multiplos')
else:
print('Nao sao Multiplos') | valores = input().split()
valores = list(map(int, valores))
(a, b) = valores
if B % A == 0 or A % B == 0:
print('Sao Multiplos')
else:
print('Nao sao Multiplos') |
def search(str, lst, size):
for i in range(0, size):
if lst[i] == str:
return i
return -1
print(search("a", ["a", "b", "c"], 3))
print(search("b", ["a", "b", "c"], 3))
print(search("c", ["a", "b", "c"], 3))
print(search("d", ["a", "b", "c"], 3))
| def search(str, lst, size):
for i in range(0, size):
if lst[i] == str:
return i
return -1
print(search('a', ['a', 'b', 'c'], 3))
print(search('b', ['a', 'b', 'c'], 3))
print(search('c', ['a', 'b', 'c'], 3))
print(search('d', ['a', 'b', 'c'], 3)) |
#!/usr/bin/env python3
def divisor(n):
num = 0
i = 1
while i * i <= n:
if n % i == 0:
num += 2
i += 1
if i * i == n:
num -= 1
return num
def main():
i = 1
sum = 0
while True:
sum = divisor(i*(i+1)/2)
if sum >= 500:
pr... | def divisor(n):
num = 0
i = 1
while i * i <= n:
if n % i == 0:
num += 2
i += 1
if i * i == n:
num -= 1
return num
def main():
i = 1
sum = 0
while True:
sum = divisor(i * (i + 1) / 2)
if sum >= 500:
print((sum, i * (i + 1) /... |
# Individuals Script Runs
Y = True
N = False
topics_run = Y
groups_run = Y
events_and_members_run = Y
events_run = Y
members_run = Y
rsvps_run = Y
# Topics searches by keyword query
# topics = ['innovation']
topics = ['startups','entrepreneurship','innovation']
topics_per_page=20
# topics_offset=0 n/a
# How many t... | y = True
n = False
topics_run = Y
groups_run = Y
events_and_members_run = Y
events_run = Y
members_run = Y
rsvps_run = Y
topics = ['startups', 'entrepreneurship', 'innovation']
topics_per_page = 20
topic_order = 'ASC'
topic_limit = 100
groups_order = 'DESC'
groups_limit = 1000
groups_per_page = 200
groups_offset = 0
ev... |
class A:
def __init__(self, a):
self.a = a
a = A(0)
b = a
print(b.a)
b = A(5)
print(a.a)
print(b.a)
| class A:
def __init__(self, a):
self.a = a
a = a(0)
b = a
print(b.a)
b = a(5)
print(a.a)
print(b.a) |
class Solution:
def numRescueBoats(self, people: List[int], limit: int) -> int:
people.sort()
i, j, boats = 0, len(people) - 1, 0
while i <= j:
boats += 1
if people[i] + people[j] <= limit:
i += 1
j -= 1
return boats | class Solution:
def num_rescue_boats(self, people: List[int], limit: int) -> int:
people.sort()
(i, j, boats) = (0, len(people) - 1, 0)
while i <= j:
boats += 1
if people[i] + people[j] <= limit:
i += 1
j -= 1
return boats |
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
count = Counter(s)
for i, c in enumerate(t):
count[c] -= 1
if count[c] == -1:
return c
| class Solution:
def find_the_difference(self, s: str, t: str) -> str:
count = counter(s)
for (i, c) in enumerate(t):
count[c] -= 1
if count[c] == -1:
return c |
#!/usr/bin/env python
class Empire(dict):
''' Methods for updating/viewing Empirees '''
def __init__(self, Empire_dict):
super(Empire, self).__init__()
self.update(Empire_dict)
| class Empire(dict):
""" Methods for updating/viewing Empirees """
def __init__(self, Empire_dict):
super(Empire, self).__init__()
self.update(Empire_dict) |
class ParserError(Exception):
pass
class ReceiptNotFound(ParserError):
pass
| class Parsererror(Exception):
pass
class Receiptnotfound(ParserError):
pass |
text = input().split(", ")
valid_names = ""
for word in text:
if 3 <= len(word) <= 16:
if word.isalnum() or "-" in word or "_" in word:
valid_names = word
print(valid_names)
| text = input().split(', ')
valid_names = ''
for word in text:
if 3 <= len(word) <= 16:
if word.isalnum() or '-' in word or '_' in word:
valid_names = word
print(valid_names) |
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
if len(s) == 0:
return 0
temp = dict()
i = 0
max_dis = 0
for k in range(len(s)):
if s[k] in temp:
i = max(temp[s[k]] + 1, i)
temp[s[k]] = k
max_d... | class Solution:
def length_of_longest_substring(self, s: str) -> int:
if len(s) == 0:
return 0
temp = dict()
i = 0
max_dis = 0
for k in range(len(s)):
if s[k] in temp:
i = max(temp[s[k]] + 1, i)
temp[s[k]] = k
m... |
#!/usr/bin/env python3
sum = 0
prod = 1
for i in range(1,11):
sum += i
prod *= i
print('sum: %d' % sum)
print('prod: %d' % prod)
| sum = 0
prod = 1
for i in range(1, 11):
sum += i
prod *= i
print('sum: %d' % sum)
print('prod: %d' % prod) |
#No job instantiation, just an interface that could be implemented with a priority queue or map.
class Executor():
def __init__(self, IP, port):
self.server_info = (IP, port)
#server stores info of jobs in centralized location, so should manage encoding
def submit(self, job_name, siz... | class Executor:
def __init__(self, IP, port):
self.server_info = (IP, port)
def submit(self, job_name, size, priority=1, retries=0, send_data=True):
new_future = future(function_name, self.server_info)
self.server_info
return new_future
def shutdown(self, wait=True):
... |
def binary_search(target, num_list):
if not target:
raise Exception
if not num_list:
raise Exception
left, right = 0, len(num_list)-1
mid = left + (right - left)//2
while left <= right:
mid = left + (right - left)//2
if num_list[mid] == target:
return T... | def binary_search(target, num_list):
if not target:
raise Exception
if not num_list:
raise Exception
(left, right) = (0, len(num_list) - 1)
mid = left + (right - left) // 2
while left <= right:
mid = left + (right - left) // 2
if num_list[mid] == target:
r... |
def rotateMatrixby90(ipMat, size):
opMat = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
for j in range(size):
opMat[j][i] = ipMat[i][j]
return opMat
def reverseMatrix(ipMat, size):
opMat = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
for j i... | def rotate_matrixby90(ipMat, size):
op_mat = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
for j in range(size):
opMat[j][i] = ipMat[i][j]
return opMat
def reverse_matrix(ipMat, size):
op_mat = [[0 for i in range(size)] for j in range(size)]
for i in rang... |
#!/usr/bin/env python
#Modify once acccording to your setup
WORKSPACE = "/Users/Gautam/AndroidStudioProjects/AndroidGPSTracking"
#Modify the below lines for each project
PROJECT_NAME = "AndroidGPSTracking"
#Modify if using DB
DB_NAME = "mainTuple"
TABLE_NAME = "footRecords"
MAIN_ACTIVITY = "TrackActivity"
#DO NOT MO... | workspace = '/Users/Gautam/AndroidStudioProjects/AndroidGPSTracking'
project_name = 'AndroidGPSTracking'
db_name = 'mainTuple'
table_name = 'footRecords'
main_activity = 'TrackActivity'
prefix = 'com.example.gpstracking' |
class Solution(object):
def removeKdigits(self, num, k):
if len(num) <= k:
return "0"
ret = []
for i in range(len(num)):
while k > 0 and ret and ret[-1] > num[i]:
ret.pop()
k-=1
ret.append(num[i])
while k >... | class Solution(object):
def remove_kdigits(self, num, k):
if len(num) <= k:
return '0'
ret = []
for i in range(len(num)):
while k > 0 and ret and (ret[-1] > num[i]):
ret.pop()
k -= 1
ret.append(num[i])
while k > 0 a... |
class TooShort(Exception):
pass
class Stale(Exception):
pass
class Incomplete(Exception):
pass
class Boring(Exception):
pass
| class Tooshort(Exception):
pass
class Stale(Exception):
pass
class Incomplete(Exception):
pass
class Boring(Exception):
pass |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class ExampleData(object):
def __init__(
self,
question: str = None,
is_multi_select: bool = False,
option1: str = None,
option2: str = None,
option3: str = None,
):
... | class Exampledata(object):
def __init__(self, question: str=None, is_multi_select: bool=False, option1: str=None, option2: str=None, option3: str=None):
self.question = question
self.is_multi_select = is_multi_select
self.option1 = option1
self.option2 = option2
self.option3... |
#
# PySNMP MIB module CISCO-CEF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CEF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:53:12 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) ... |
arr = [[1, 2, 3, 12],
[4, 5, 6, 45],
[7, 8, 9, 78]]
x = 3
print("start")
w = len(arr)
h = len(arr[0])
i = 0
j = 0
while i < w and j < h and arr[i][j] < x:
ib = i
ie = w - 1
i2 = -1
while ib < ie:
i2n = (ie - ib) // 2
if i2 == i2n:
break
i2 = i2n
print("i2 ", i2, ib, ie)
if arr[i2... | arr = [[1, 2, 3, 12], [4, 5, 6, 45], [7, 8, 9, 78]]
x = 3
print('start')
w = len(arr)
h = len(arr[0])
i = 0
j = 0
while i < w and j < h and (arr[i][j] < x):
ib = i
ie = w - 1
i2 = -1
while ib < ie:
i2n = (ie - ib) // 2
if i2 == i2n:
break
i2 = i2n
print('i2 ',... |
'''
Min Depth of Binary Tree
Asked in: Facebook, Amazon
https://www.interviewbit.com/problems/min-depth-of-binary-tree/
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
NOTE : The path has to end on a lea... | """
Min Depth of Binary Tree
Asked in: Facebook, Amazon
https://www.interviewbit.com/problems/min-depth-of-binary-tree/
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
NOTE : The path has to end on a lea... |
def selection_sort(nums):
# This value of i corresponds to how many values were sorted
for i in range(len(nums)):
# We assume that the first item of the unsorted segment is the smallest
lowest_value_index = i
# This loop iterates over the unsorted items
for j in range(i + 1, len(... | def selection_sort(nums):
for i in range(len(nums)):
lowest_value_index = i
for j in range(i + 1, len(nums)):
if nums[j] < nums[lowest_value_index]:
lowest_value_index = j
(nums[i], nums[lowest_value_index]) = (nums[lowest_value_index], nums[i])
random_list_of_num... |
# Q: A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2
# For example, 32 + 42 = 9 + 16 = 25 = 52.
#
# There exists exactly one Pythagorean triplet for which a + b + c = 1000, Find the product abc.
def main():
print (find_abc(1000))
# We do this in a function to avoid ... | def main():
print(find_abc(1000))
def find_abc(total):
for a in range(1, total - 2):
for b in range(a, total - 2):
c = total - a - b
if a * a + b * b == c * c:
return a * b * c
if __name__ == '__main__':
main() |
annual_salary = float(input('Enter your annual salary: '))
portion_saved = float(input('Enter the percent of your salary to save, as a '
'decimal: '))
total_cost = float(input('Enter cost of your dream home: '))
portion_down_payment = 0.25
current_savings = 0
r = 0.04
months = 0
portion_mon... | annual_salary = float(input('Enter your annual salary: '))
portion_saved = float(input('Enter the percent of your salary to save, as a decimal: '))
total_cost = float(input('Enter cost of your dream home: '))
portion_down_payment = 0.25
current_savings = 0
r = 0.04
months = 0
portion_monthly_salary = portion_saved * an... |
def greet(name):
get_greet = f"Hi, {name}"
return get_greet
greeting = greet("Ahmed")
print(greeting)
| def greet(name):
get_greet = f'Hi, {name}'
return get_greet
greeting = greet('Ahmed')
print(greeting) |
def removeElement(nums, val):
newArray = [n for n in nums if n != val]
print(newArray)
print(len(newArray))
| def remove_element(nums, val):
new_array = [n for n in nums if n != val]
print(newArray)
print(len(newArray)) |
class Node:
# Constructor to create a new node
def __init__(self, data):
self.data = data # Pointer to data
self.next = None # Initialize next as null
def deleteNode(head, position):
if head is None:
return head
elif position == 0:
return head.next
prev_node ... | class Node:
def __init__(self, data):
self.data = data
self.next = None
def delete_node(head, position):
if head is None:
return head
elif position == 0:
return head.next
prev_node = head
current_node = head
current_position = 0
while current_position < posi... |
# -*- coding: utf-8 -*-
L = [
['Apple', 'Google', 'Microsoft'],
['Java', 'Python', 'Ruby', 'PHP'],
['Adam', 'Bart', 'Lisa']
]
print(L[0][0])
print(L[1][1])
print(L[2][2])
sum = 0
for x in range(101):
sum = sum + x
print(sum)
sum1 = 0
n = 99
while n>0:
sum1 = sum1 + n
n = n -2
print(sum1... | l = [['Apple', 'Google', 'Microsoft'], ['Java', 'Python', 'Ruby', 'PHP'], ['Adam', 'Bart', 'Lisa']]
print(L[0][0])
print(L[1][1])
print(L[2][2])
sum = 0
for x in range(101):
sum = sum + x
print(sum)
sum1 = 0
n = 99
while n > 0:
sum1 = sum1 + n
n = n - 2
print(sum1)
l = ['Bart', 'Lisa', 'Adam']
for name in L... |
ori_file = '/home/unaguo/hanson/data/landmark/WFLW191104/train_data/300W_LP.txt'
save_file = '/home/unaguo/hanson/data/landmark/WFLW191104/train_data/300W_LP1.txt'
lable = '0'
ori_lines = []
with open(ori_file, 'r')as f:
ori_lines = f.readlines()
with open(save_file, 'w')as f:
for line in ori_lines:
l... | ori_file = '/home/unaguo/hanson/data/landmark/WFLW191104/train_data/300W_LP.txt'
save_file = '/home/unaguo/hanson/data/landmark/WFLW191104/train_data/300W_LP1.txt'
lable = '0'
ori_lines = []
with open(ori_file, 'r') as f:
ori_lines = f.readlines()
with open(save_file, 'w') as f:
for line in ori_lines:
l... |
class QueryParams:
def _append_query_list(query_list, key, values):
if isinstance(values, list):
for value in values:
QueryParams._append_query_list(query_list, key, value)
elif isinstance(values, bool):
if values == True:
QueryParams._... | class Queryparams:
def _append_query_list(query_list, key, values):
if isinstance(values, list):
for value in values:
QueryParams._append_query_list(query_list, key, value)
elif isinstance(values, bool):
if values == True:
QueryParams._append_... |
def partition(arr, low, high):
i = low -1
pivot = arr[high]
for j in range(low, high):
if arr[j] < pivot:
i+=1
arr[i], arr[j] =arr[j], arr[i]
arr[i+1], arr[high] = arr[high], arr[i+1]
return i+1
def quicksort(arr, low,high):
if low < high:
pi = partition(... | def partition(arr, low, high):
i = low - 1
pivot = arr[high]
for j in range(low, high):
if arr[j] < pivot:
i += 1
(arr[i], arr[j]) = (arr[j], arr[i])
(arr[i + 1], arr[high]) = (arr[high], arr[i + 1])
return i + 1
def quicksort(arr, low, high):
if low < high:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-07-07 12:07:46
# @Author : Lewis Tian (taseikyo@gmail.com)
# @Link : github.com/taseikyo
# @Version : Python3.7
# https://projecteuler.net/problem=1
def main():
return sum([i for i in range(1, 1000) if (i % 3 == 0) or (i % 5 == 0)])
if __name_... | def main():
return sum([i for i in range(1, 1000) if i % 3 == 0 or i % 5 == 0])
if __name__ == '__main__':
print(main()) |
def line(a, b):
def para(x):
return a * x + b
return para
def count(x=0):
def incre():
nonlocal x
x += 1
return x
return incre
def my_avg():
data = list()
def add(num):
data.append(num)
return sum(data)/len(data)
return add
if __name__ =... | def line(a, b):
def para(x):
return a * x + b
return para
def count(x=0):
def incre():
nonlocal x
x += 1
return x
return incre
def my_avg():
data = list()
def add(num):
data.append(num)
return sum(data) / len(data)
return add
if __name__ =... |
class Solution:
def monotoneIncreasingDigits(self, n: int) -> int:
if n < 10:
return n
break_point = None
digits = [int(el) for el in str(n)]
for i in range(len(digits) - 1):
if digits[i] > digits[i + 1]:
break_point = i
break
... | class Solution:
def monotone_increasing_digits(self, n: int) -> int:
if n < 10:
return n
break_point = None
digits = [int(el) for el in str(n)]
for i in range(len(digits) - 1):
if digits[i] > digits[i + 1]:
break_point = i
brea... |
crypt_words = input().split()
for word in crypt_words:
first_number = ""
second_part = ""
for letter in word:
if 48 <= ord(letter) <= 57:
first_number += letter
else:
second_part += letter
first_letter = chr(int(first_number))
half = first_letter + second_par... | crypt_words = input().split()
for word in crypt_words:
first_number = ''
second_part = ''
for letter in word:
if 48 <= ord(letter) <= 57:
first_number += letter
else:
second_part += letter
first_letter = chr(int(first_number))
half = first_letter + second_part... |
PDAC_MODES = {
"debug" : {
"session-id" : "debug",
"sources" : {
"audio" : { "active" : False },
"video" : { "active" : True },
"heartrate" : { "active" : False },
},
"inference" : None,
"transform" : False,
"sinks" : {
... | pdac_modes = {'debug': {'session-id': 'debug', 'sources': {'audio': {'active': False}, 'video': {'active': True}, 'heartrate': {'active': False}}, 'inference': None, 'transform': False, 'sinks': {'rstp': {'active': True}, 'file': {'active': False}, 'window': {'active': False}}}, 'rtsp-only': {'session-id': 'live', 'sou... |
# error lib?
def typeError(expected, value):
raise TypeError('expected \n |> %s \n but found \n |> %s' %
(expected, type(value)))
| def type_error(expected, value):
raise type_error('expected \n |> %s \n but found \n |> %s' % (expected, type(value))) |
n = int(input())
ar = list(map(int, input().split()))
print(ar.count(max(ar)))
| n = int(input())
ar = list(map(int, input().split()))
print(ar.count(max(ar))) |
def main():
name = "John Doe"
age = 40
print("The user's name is", name, "and his/her age is", age, end=".\n")
print("Next year he/she will be", age+1, "years old.", end="\n\n")
print("The characters of the user's name are:")
for i in range(len(name)):
print(name[i].upper(), end=" ")... | def main():
name = 'John Doe'
age = 40
print("The user's name is", name, 'and his/her age is', age, end='.\n')
print('Next year he/she will be', age + 1, 'years old.', end='\n\n')
print("The characters of the user's name are:")
for i in range(len(name)):
print(name[i].upper(), end=' ')
... |
a = input()
b = int(input())
def calculate_price(product, qty):
PRICE_LIST = {
"coffee": 1.50,
"water": 1.00,
"coke": 1.40,
"snacks": 2.00
}
return '{:.2f}'.format(PRICE_LIST[product] * qty)
print(calculate_price(a, b))
| a = input()
b = int(input())
def calculate_price(product, qty):
price_list = {'coffee': 1.5, 'water': 1.0, 'coke': 1.4, 'snacks': 2.0}
return '{:.2f}'.format(PRICE_LIST[product] * qty)
print(calculate_price(a, b)) |
class JsonRPCError(Exception):
def __init__(self, request_id, code, message, data, is_notification=False):
super().__init__(message)
self.request_id = request_id
self.code = code
self.message = message
self.data = data
self.is_notification = is_notification
def f... | class Jsonrpcerror(Exception):
def __init__(self, request_id, code, message, data, is_notification=False):
super().__init__(message)
self.request_id = request_id
self.code = code
self.message = message
self.data = data
self.is_notification = is_notification
def ... |
# # Sets (kopas)
# # unordered
# # unique items
# # use: get rid of duplicates, membership testing
# # https://docs.python.org/3/tutorial/datastructures.html#sets
# # https://realpython.com/python-sets/
# chars = set("abracadabra") # you pass an iterable to set(iterablehere)
# print(chars)
# print(len(chars))
# print... | numbers = set(range(12))
print(numbers)
n3_7 = set(range(3, 8))
print(n3_7)
n5_9 = set(range(5, 10))
print(n5_9)
print(n3_7 | n5_9)
print(n3_7.union(n5_9))
n3_9 = n3_7 | n5_9
print(n3_9)
n5_7 = n3_7 & n5_9
print(n3_7.intersection(n5_9))
print(n5_7)
n3_4 = n3_7 - n5_9
print(n3_4)
n8_9 = n5_9 - n3_7
print(n8_9, n5_9.diff... |
class Skill:
def __init__(self, skill_data: dict):
self.id = skill_data['id']
self.name = skill_data['skill_name']
self.explain = skill_data['explain']
self.en_explain = skill_data['explain_en']
self.skill_type = skill_data['skill_type']
self.judge_type = skill_data[... | class Skill:
def __init__(self, skill_data: dict):
self.id = skill_data['id']
self.name = skill_data['skill_name']
self.explain = skill_data['explain']
self.en_explain = skill_data['explain_en']
self.skill_type = skill_data['skill_type']
self.judge_type = skill_data[... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
spinMultiplicity = 2
energy = {
'BMK/cbsb7': GaussianLog('CH3bmk.log'),
'CCSD(T)-F12/cc-pVTZ-F12': MolproLog('CH3bmk_f12.out'),
}
frequencies = GaussianLog('CH3bmkfreq.log')
rotors = []
| spin_multiplicity = 2
energy = {'BMK/cbsb7': gaussian_log('CH3bmk.log'), 'CCSD(T)-F12/cc-pVTZ-F12': molpro_log('CH3bmk_f12.out')}
frequencies = gaussian_log('CH3bmkfreq.log')
rotors = [] |
class Solution:
def largestRectangleArea(self, heights: list[int]) -> int:
heights.append(0)
stack: list[int] = [-1]
ans = 0
for i, h in enumerate(heights):
while stack and h <= heights[stack[-1]]:
curH = heights[stack.pop()]
if not stack: ... | class Solution:
def largest_rectangle_area(self, heights: list[int]) -> int:
heights.append(0)
stack: list[int] = [-1]
ans = 0
for (i, h) in enumerate(heights):
while stack and h <= heights[stack[-1]]:
cur_h = heights[stack.pop()]
if not s... |
def solve(x: int) -> int:
x = y # err
z = x + 1
return y # err
| def solve(x: int) -> int:
x = y
z = x + 1
return y |
number = int(input())
counter = int(input())
number_add = number
list_numbers = [number]
for i in range(counter - 1):
number_add += number
list_numbers.append(number_add)
print(list_numbers)
| number = int(input())
counter = int(input())
number_add = number
list_numbers = [number]
for i in range(counter - 1):
number_add += number
list_numbers.append(number_add)
print(list_numbers) |
def plot_data(data, ax, keys=None, width=0.5, colors=None):
if keys is None:
keys = ['Latent Test error', 'Test Information Loss']
if colors is None:
colors = ['blue', 'red']
for i, entry in enumerate(data):
h1 = entry[keys[0]]
h2 = h1 + entry[keys[1]]
ax.fill_betwee... | def plot_data(data, ax, keys=None, width=0.5, colors=None):
if keys is None:
keys = ['Latent Test error', 'Test Information Loss']
if colors is None:
colors = ['blue', 'red']
for (i, entry) in enumerate(data):
h1 = entry[keys[0]]
h2 = h1 + entry[keys[1]]
ax.fill_betwe... |
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
#
# Constants for MIDI notes.
#
# For example:
# F# in Octave 3: O3.Fs
# C# in Octave -2: On2.Cs
# D-flat in Octave 1: O1.Db
# D in Octave 0: O0.D
# E in Octave 2: O2.E
class Octave:
def __init__(self, base):
... | class Octave:
def __init__(self, base):
self.C = base
self.Cs = base + 1
self.Db = base + 1
self.D = base + 2
self.Ds = base + 3
self.Eb = base + 3
self.E = base + 4
self.F = base + 5
self.Fs = base + 6
self.Gb = base + 6
self.... |
class Task:
def __init__(self, id, title):
self.title = title
self.id = id
self.status = "new"
| class Task:
def __init__(self, id, title):
self.title = title
self.id = id
self.status = 'new' |
def problem(a):
try:
return float(a) * 50 + 6
except ValueError:
return "Error" | def problem(a):
try:
return float(a) * 50 + 6
except ValueError:
return 'Error' |
class AccountInfo():
def __init__(self, row_id, email, password, cookies, status_id):
self.row_id = row_id
self.email = email
self.password = password
self.cookies = cookies
self.status_id = status_id
def __repr__(self):
return f"id: {self.row_id}, email: {self... | class Accountinfo:
def __init__(self, row_id, email, password, cookies, status_id):
self.row_id = row_id
self.email = email
self.password = password
self.cookies = cookies
self.status_id = status_id
def __repr__(self):
return f'id: {self.row_id}, email: {self.em... |
class ssdict:
def __init__(self, ss, param, collectiontype):
factory = {
'projects': self.getProjects,
'reviews': self.getReviews,
'items': self.getItems,
'comments': self.getComments,
}
func = factory[collectiontype]
self.collection = ... | class Ssdict:
def __init__(self, ss, param, collectiontype):
factory = {'projects': self.getProjects, 'reviews': self.getReviews, 'items': self.getItems, 'comments': self.getComments}
func = factory[collectiontype]
self.collection = func(ss, param)
def get_projects(self, ss, accountid)... |
#
# PySNMP MIB module CISCOSB-ippreflist-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-ippreflist-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:08:08 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint) ... |
class c_iterateur(object):
def __init__(self, obj):
self.obj = obj
self.length = len(obj)
self.count = 0
def __iter__(self):
return self
def next(self):
if self.count > self.length:
raise StopIteration
else:
result = self.obj[self.co... | class C_Iterateur(object):
def __init__(self, obj):
self.obj = obj
self.length = len(obj)
self.count = 0
def __iter__(self):
return self
def next(self):
if self.count > self.length:
raise StopIteration
else:
result = self.obj[self.co... |
# input number of strings in the set
N = int(input())
trie = {}
end = object()
# input the strings
for _ in range(N):
s = input()
t = trie
for c in s[:-1]:
if c in t:
t = t[c]
else:
t[c] = {}
t = t[c]
# Print GOOD SET if the set is valid else, outp... | n = int(input())
trie = {}
end = object()
for _ in range(N):
s = input()
t = trie
for c in s[:-1]:
if c in t:
t = t[c]
else:
t[c] = {}
t = t[c]
if t is end:
print('BAD SET')
print(s)
exit()
if s[-1] in t:
... |
# Google Kickstart 2019 Round: Practice
def solution(N, K, x1, y1, C, D, E1, E2, F):
alarmList = []
alarmPowermap = [[] for i in range(K)]
alarmPower = 0
# Calculate alarmList
element = (x1 + y1) % F
xPrev, yPrev = x1, y1
alarmList.append(element)
for _ in range(N-1):
xi = (C*... | def solution(N, K, x1, y1, C, D, E1, E2, F):
alarm_list = []
alarm_powermap = [[] for i in range(K)]
alarm_power = 0
element = (x1 + y1) % F
(x_prev, y_prev) = (x1, y1)
alarmList.append(element)
for _ in range(N - 1):
xi = (C * xPrev + D * yPrev + E1) % F
yi = (D * xPrev + C ... |
thistuple = ("apple", "banana", "cherry")
print(thistuple)
thistuple = ("apple", "banana", "cherry")
print(thistuple[1])
thistuple = ("apple", "banana", "cherry")
print(thistuple[-1])
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[2:5])
x = ("apple", "banana", "che... | thistuple = ('apple', 'banana', 'cherry')
print(thistuple)
thistuple = ('apple', 'banana', 'cherry')
print(thistuple[1])
thistuple = ('apple', 'banana', 'cherry')
print(thistuple[-1])
thistuple = ('apple', 'banana', 'cherry', 'orange', 'kiwi', 'melon', 'mango')
print(thistuple[2:5])
x = ('apple', 'banana', 'cherry')
y ... |
def test_response_protocol_with_http1_0_request_():
pass
def test_response_protocol_with_http1_1_request_():
pass
def test_response_protocol_with_http1_1_request_and_http1_0_server():
pass
def test_response_protocol_with_http0_9_request_():
pass
def test_response_protocol_with_http2_0_request_():
pass
| def test_response_protocol_with_http1_0_request_():
pass
def test_response_protocol_with_http1_1_request_():
pass
def test_response_protocol_with_http1_1_request_and_http1_0_server():
pass
def test_response_protocol_with_http0_9_request_():
pass
def test_response_protocol_with_http2_0_request_():
... |
plain_text = list(input("Enter plain text:\n"))
encrypted_text = []
original_text = []
for char in plain_text:
encrypted_text.append(chr(ord(char)+5))
for char in encrypted_text:
original_text.append(chr(ord(char)-5))
print(encrypted_text)
print(original_text) | plain_text = list(input('Enter plain text:\n'))
encrypted_text = []
original_text = []
for char in plain_text:
encrypted_text.append(chr(ord(char) + 5))
for char in encrypted_text:
original_text.append(chr(ord(char) - 5))
print(encrypted_text)
print(original_text) |
'''
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
Example:
Input: [-2,1,-3,4,-1,2,1,-5,4],
Output: 6
Explanation: [4,-1,2,1] has the largest sum = 6.
Follow up:
If you have figured out the O(n) solution, try coding another sol... | """
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
Example:
Input: [-2,1,-3,4,-1,2,1,-5,4],
Output: 6
Explanation: [4,-1,2,1] has the largest sum = 6.
Follow up:
If you have figured out the O(n) solution, try coding another sol... |
POSSIBLE_MARKS = (
("4", "4"),
("5", "5"),
("6", "6"),
("7", "7"),
("8", "8"),
("9", "9"),
("10", "10"),
)
| possible_marks = (('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10')) |
#
# PySNMP MIB module IPAD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPAD-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:44:34 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, 09:23:1... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ... |
distancia = float(input('Digite a distancia em KM da viagem: '))
passag1 = distancia * 0.5
passag2 = distancia * 0.45
if distancia <= 200:
print('Sua passagem vai custar R${:.2f}'.format(passag1))
else:
print('Sua passagem vai custar R${:.2f}'.format(passag2))
| distancia = float(input('Digite a distancia em KM da viagem: '))
passag1 = distancia * 0.5
passag2 = distancia * 0.45
if distancia <= 200:
print('Sua passagem vai custar R${:.2f}'.format(passag1))
else:
print('Sua passagem vai custar R${:.2f}'.format(passag2)) |
f=float(8.11)
print(f)
i=int(f)
print(i)
j=7
print(type(j))
j=f
print(j)
print(type(j))
print(int(8.6))
| f = float(8.11)
print(f)
i = int(f)
print(i)
j = 7
print(type(j))
j = f
print(j)
print(type(j))
print(int(8.6)) |
def _impl(ctx):
name = ctx.attr.name
deps = ctx.attr.deps
suites = ctx.attr.suites
visibility = None # ctx.attr.visibility
suites_mangled = [s.partition(".")[0].rpartition("/")[2] for s in suites]
for s in suites_mangled:
native.cc_test(
name = "{}-{}".format(name, s),
... | def _impl(ctx):
name = ctx.attr.name
deps = ctx.attr.deps
suites = ctx.attr.suites
visibility = None
suites_mangled = [s.partition('.')[0].rpartition('/')[2] for s in suites]
for s in suites_mangled:
native.cc_test(name='{}-{}'.format(name, s), deps=deps, visibility=visibility, args=[s])... |
while True:
budget = float(input("Enter your budget : "))
available=budget
break
d ={"name":[], "quantity":[], "price":[]}
l= list(d.values())
name = l[0]
quantity= l[1]
price = l[2]
while True:
ch = int(input("1.ADD\n2.EXIT\nEnter your choice : "))
if ch == 1 and... | while True:
budget = float(input('Enter your budget : '))
available = budget
break
d = {'name': [], 'quantity': [], 'price': []}
l = list(d.values())
name = l[0]
quantity = l[1]
price = l[2]
while True:
ch = int(input('1.ADD\n2.EXIT\nEnter your choice : '))
if ch == 1 and available > 0:
pn =... |
data="7.dat"
s=0.0
c=0
with open(data) as fp:
for line in fp:
words=line.split(':')
if(words[0]=="RMSE"):
c+=1
# print(words[1])
s+=float(words[1])
# print(s)
print("average:")
print(s/c) | data = '7.dat'
s = 0.0
c = 0
with open(data) as fp:
for line in fp:
words = line.split(':')
if words[0] == 'RMSE':
c += 1
s += float(words[1])
print('average:')
print(s / c) |
if __name__ == '__main__':
n = int(input())
for num in range(n):
print(num * num)
| if __name__ == '__main__':
n = int(input())
for num in range(n):
print(num * num) |
#
# PySNMP MIB module ONEACCESS-CONFIGMGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-CONFIGMGMT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:34:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) ... |
coco_keypoints = [ "nose", # 0
"left_eye", # 1
"right_eye", # 2
"left_ear", # 3
"right_ear", # 4
"left_shoulder", # 5
"right_shoulder", # 6
"left_elbow", # 7
... | coco_keypoints = ['nose', 'left_eye', 'right_eye', 'left_ear', 'right_ear', 'left_shoulder', 'right_shoulder', 'left_elbow', 'right_elbow', 'left_wrist', 'right_wrist', 'left_hip', 'right_hip', 'left_knee', 'right_knee', 'left_ankle', 'right_ankle']
coco_pairs = [(0, 1), (0, 2), (1, 3), (2, 4), (5, 6), (5, 7), (6, 8), ... |
# Return tracebacks with OperationOutcomes when an exceprion occurs
DEBUG = False
# How many items should we include in budles whwn count is not specified
DEFAULT_BUNDLE_SIZE = 20
# Limit bundles to this size even if more are requested
# TODO: Disable limiting when set to 0
MAX_BUNDLE_SIZE = 100
# Path to the models... | debug = False
default_bundle_size = 20
max_bundle_size = 100
models_path = 'models'
db_backend = 'SQLAlchemy'
strict_mode = {'set_attribute_without_setter': False, 'set_non_existent_reference': False} |
peso = float(input('Digite o peso da pessoa \t'))
engorda = peso + (peso*0.15)
emagrece = peso - (peso*0.20)
print('Se engordar , peso = ',engorda)
print('Se emagrece , peso = ',emagrece)
| peso = float(input('Digite o peso da pessoa \t'))
engorda = peso + peso * 0.15
emagrece = peso - peso * 0.2
print('Se engordar , peso = ', engorda)
print('Se emagrece , peso = ', emagrece) |
#conditional tests- testing for equalities
sanrio_1 = 'keroppi'
print("Is sanrio == 'keroppi'? I predict True.")
print(sanrio_1 == 'keroppi')
sanrio_2 = 'hello kitty'
print("Is sanrio == 'Hello Kitty'? I predict True.")
print(sanrio_2 == 'hello kitty')
sanrio_3 = 'pochacco'
print("Is sanrio == 'Pochacco'? I... | sanrio_1 = 'keroppi'
print("Is sanrio == 'keroppi'? I predict True.")
print(sanrio_1 == 'keroppi')
sanrio_2 = 'hello kitty'
print("Is sanrio == 'Hello Kitty'? I predict True.")
print(sanrio_2 == 'hello kitty')
sanrio_3 = 'pochacco'
print("Is sanrio == 'Pochacco'? I predict True.")
print(sanrio_3 == 'pochacco')
sanrio_4... |
num =int(input(" Input a Number: "))
def factorsOf(num):
factors=[]
for i in range(1,num+1):
if num%i==0:
factors.append(i)
print(factors)
factorsOf(num)
| num = int(input(' Input a Number: '))
def factors_of(num):
factors = []
for i in range(1, num + 1):
if num % i == 0:
factors.append(i)
print(factors)
factors_of(num) |
# A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired.
# Write a function: that, given an array A consisting of N integers fulfilling t... | def odd_occurances_in_array(A):
if len(A) == 1:
return A[0]
a = sorted(A)
for i in range(0, len(A), 2):
if i + 1 == len(A):
return A[i]
if A[i] != A[i + 1]:
return A[i]
print(odd_occurances_in_array([9, 3, 9, 3, 9, 7, 9])) |
# Find which triangle numbers and which square numbers are the same
# Written: 13 Jul 2016 by Alex Vear
# Public domain. No rights reserved.
STARTVALUE = 1 # set the start value for the program to test
ENDVALUE = 1000000 # set the end value for the program to test
for num in range(STARTVALUE, ENDVALUE):
sqr... | startvalue = 1
endvalue = 1000000
for num in range(STARTVALUE, ENDVALUE):
sqr = num * num
for i in range(STARTVALUE, ENDVALUE):
tri = i * (i + 1) / 2
if sqr == tri:
print('Square Number:', sqr, ' ', 'Triangle Number:', tri, ' ', 'Squared:', num, ' ', 'Triangled:', i)
else:
... |
class Solution:
def missingNumber(self, nums: List[int]) -> int:
l = len(nums)
return l * (1 + l) // 2 - sum(nums)
| class Solution:
def missing_number(self, nums: List[int]) -> int:
l = len(nums)
return l * (1 + l) // 2 - sum(nums) |
def quick_sort(data: list, first: int, last: int):
if not isinstance(data, list):
print(f'The data {data} MUST be of type list')
return
if not isinstance(first, int) or not isinstance(last, int):
print(f'The args {first}, and {last} MUST be an index')
return
if first <... | def quick_sort(data: list, first: int, last: int):
if not isinstance(data, list):
print(f'The data {data} MUST be of type list')
return
if not isinstance(first, int) or not isinstance(last, int):
print(f'The args {first}, and {last} MUST be an index')
return
if first < last:
... |
# ------------------------------
# 42. Trapping Rain Water
#
# Description:
# Given n non-negative integers representing an elevation map where the width of each
# bar is 1, compute how much water it is able to trap after raining.
# (see picture on the website)
#
# Example:
# Input: [0,1,0,2,1,0,1,3,2,1,2,1]
# Outpu... | class Solution:
def trap(self, height: List[int]) -> int:
res = 0
current = 0
stack = []
while current < len(height):
while stack and height[current] > height[stack[-1]]:
last = stack.pop()
if not stack:
break
... |
# Scaler problem
def solve(s, queries):
left_most = [-1] * len(s)
index = -1
for i in range(len(s) - 1, -1, -1):
if s[i] == '1':
index = i
left_most[i] = index
right_most = [-1] * len(s)
index = -1
for i in range(len(s)):
if s[i] == '1':
index = ... | def solve(s, queries):
left_most = [-1] * len(s)
index = -1
for i in range(len(s) - 1, -1, -1):
if s[i] == '1':
index = i
left_most[i] = index
right_most = [-1] * len(s)
index = -1
for i in range(len(s)):
if s[i] == '1':
index = i
right_mos... |
def getime(date):
list1=[]
for hour in range(8):
for minute in range(0,56,5):
if minute<10:
time=str(date)+'-0'+str(hour)+':0'+str(minute)+':01'
else:
time=str(date)+'-0'+str(hour)+':'+str(minute)+':01'
list1.append(time)
for hour in range(8,24):
if hour<10:
for minute in range(0,60):
if... | def getime(date):
list1 = []
for hour in range(8):
for minute in range(0, 56, 5):
if minute < 10:
time = str(date) + '-0' + str(hour) + ':0' + str(minute) + ':01'
else:
time = str(date) + '-0' + str(hour) + ':' + str(minute) + ':01'
lis... |
HASH_KEY = 55
WORDS_LENGTH = 5
REQUIRED_WORDS = 365
MAX_GAME_ATTEMPTS = 6
WORDS_PATH = 'out/palabras5.txt'
GAME_HISTORY_PATH = 'out/partidas.json'
GAME_WORDS_PATH = 'out/palabras_por_fecha.json' | hash_key = 55
words_length = 5
required_words = 365
max_game_attempts = 6
words_path = 'out/palabras5.txt'
game_history_path = 'out/partidas.json'
game_words_path = 'out/palabras_por_fecha.json' |
#hyperparameter
hidden_size = 256 # hidden size of model
layer_size = 3 # number of layers of model
dropout = 0.2 # dropout rate in training
bidirectional = True # use bidirectional RNN for encoder
use_attention = True # use attention between encoder-decoder
batch_size = 8 # batch size in training
workers = 4 # number... | hidden_size = 256
layer_size = 3
dropout = 0.2
bidirectional = True
use_attention = True
batch_size = 8
workers = 4
max_epochs = 10
lr = 0.0001
teacher_forcing = 0.9
max_len = 80
seed = 1
mode = 'train'
data_csv_path = './dataset/train/train_data/data_list.csv'
dataset_path = './dataset/train'
sample_rate = 16000
windo... |
''' write a function to sort a given list and return sorted list using sort() or sorted() functions'''
def sorted_list(alist):
return sorted(alist)
sorted_me = sorted_list([5,2,1,7,8,3,2,9,4])
print(sorted_me)
def sort_list(alist):
return alist.sort()
sort_me = sort_list([5,2,1,7,8,3,2,9,4])
print(sort_me)
| """ write a function to sort a given list and return sorted list using sort() or sorted() functions"""
def sorted_list(alist):
return sorted(alist)
sorted_me = sorted_list([5, 2, 1, 7, 8, 3, 2, 9, 4])
print(sorted_me)
def sort_list(alist):
return alist.sort()
sort_me = sort_list([5, 2, 1, 7, 8, 3, 2, 9, 4])
p... |
def solution(A):
h = set(A)
l = len(h)
for i in range(1, l+1):
if i not in h:
return i
return -1
# final check
print(solution([1, 2, 3, 4, 6]))
| def solution(A):
h = set(A)
l = len(h)
for i in range(1, l + 1):
if i not in h:
return i
return -1
print(solution([1, 2, 3, 4, 6])) |
class BitmaskPrinter:
bitmask_object_template = '''/* Autogenerated Code - do not edit directly */
#pragma once
#include <stdint.h>
#include <jude/core/c/jude_enum.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef uint%SIZE%_t %BITMASK%_t;
extern const jude_bitmask_map_t %BITMASK%_bitmask_map[];
#ifdef __cplus... | class Bitmaskprinter:
bitmask_object_template = '/* Autogenerated Code - do not edit directly */\n#pragma once\n\n#include <stdint.h>\n#include <jude/core/c/jude_enum.h>\n\n#ifdef __cplusplus\nextern "C" {\n#endif\n\ntypedef uint%SIZE%_t %BITMASK%_t;\nextern const jude_bitmask_map_t %BITMASK%_bitmask_map[];\n\n#ifd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.