content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
number = input("Type a number: ")
try:
number = float(number)
print("The number is: ", number)
except:
print("Invalid number") | number = input('Type a number: ')
try:
number = float(number)
print('The number is: ', number)
except:
print('Invalid number') |
"""
Good morning! Here's your coding interview problem for today.
This problem was asked by Google.
We can determine how "out of order" an array A is by counting the number of inversions it has. Two elements A[i] and A[j] form an inversion if A[i] > A[j] but i < j. That is, a smaller element appears after a larger el... | """
Good morning! Here's your coding interview problem for today.
This problem was asked by Google.
We can determine how "out of order" an array A is by counting the number of inversions it has. Two elements A[i] and A[j] form an inversion if A[i] > A[j] but i < j. That is, a smaller element appears after a larger el... |
def show_banner(value: str, times: int):
print(value * times)
def validate_loan_eligibility(has_income: bool, credit_report: bool, payment_default: bool) -> str:
if(has_income and (credit_report and (not payment_default))):
return "Eligible for loan"
else:
return "Not Eligible for loan"
... | def show_banner(value: str, times: int):
print(value * times)
def validate_loan_eligibility(has_income: bool, credit_report: bool, payment_default: bool) -> str:
if has_income and (credit_report and (not payment_default)):
return 'Eligible for loan'
else:
return 'Not Eligible for loan'
def... |
#!/usr/bin/env python3
shifted_serial = '''
0000000000400d00 db 0x96 ; '.'
0000000000400d01 db 0x9e ; '.'
0000000000400d02 db 0x86 ; '.'
0000000000400d03 db 0xb0 ; '.'
0000000000400d04 db 0xb4 ; '.'
0000000000400d05 db 0x8c ; '.'
0000000000400d06 db 0x5a ;... | shifted_serial = "\n0000000000400d00 db 0x96 ; '.'\n0000000000400d01 db 0x9e ; '.'\n0000000000400d02 db 0x86 ; '.'\n0000000000400d03 db 0xb0 ; '.'\n0000000000400d04 db 0xb4 ; '.'\n0000000000400d05 db 0x8c ; '.'\n0000000000400d06 db 0x5a ; 'Z'\n0000000000400... |
class Node:
hostname = None
username = None
key_file = None
def __init__(self, hostname, username, key_file):
self.hostname = hostname
self.username = username
self.key_file = key_file
def __repr__(self):
return self.__str__()
def __str__(self):
return ... | class Node:
hostname = None
username = None
key_file = None
def __init__(self, hostname, username, key_file):
self.hostname = hostname
self.username = username
self.key_file = key_file
def __repr__(self):
return self.__str__()
def __str__(self):
return ... |
#!/usr/bin/python
"""
Generate a line in the html table.
"""
def gen_records(in_data):
"""
Generate a sorted list of results to be output in an html table.
"""
rec_vec = []
factor = 0
for rec in in_data:
new_rec = {}
if factor == 0:
expon = 2 * len(in_data[rec][1]) ... | """
Generate a line in the html table.
"""
def gen_records(in_data):
"""
Generate a sorted list of results to be output in an html table.
"""
rec_vec = []
factor = 0
for rec in in_data:
new_rec = {}
if factor == 0:
expon = 2 * len(in_data[rec][1]) - 1
fac... |
def _print_error_message(error_message, default_message):
if error_message == "default":
print(default_message)
elif error_message:
print(error_message)
def _filter_inputs_by_min(inputs_int, min_val, error_message="default"):
default_message = "Input value should be bigger\
than or eq... | def _print_error_message(error_message, default_message):
if error_message == 'default':
print(default_message)
elif error_message:
print(error_message)
def _filter_inputs_by_min(inputs_int, min_val, error_message='default'):
default_message = 'Input value should be bigger than or equal... |
def sub(s):
# print(s)
a = list(map(int, s.split('-')))
print(a)
return a[0]*2 - sum(a)
def main():
s = input()
add = s.split('+')
print(add)
print(sum(map(sub, add)))
if __name__ == "__main__":
print(main()) | def sub(s):
a = list(map(int, s.split('-')))
print(a)
return a[0] * 2 - sum(a)
def main():
s = input()
add = s.split('+')
print(add)
print(sum(map(sub, add)))
if __name__ == '__main__':
print(main()) |
""" The layer module contains a Layer class to help when working with layers."""
class Layer(object):
def __init__(self, definition):
# Name -- Required
try:
self.name = definition['name']
except KeyError:
raise KeyError('The "name" key is required for the ... | """ The layer module contains a Layer class to help when working with layers."""
class Layer(object):
def __init__(self, definition):
try:
self.name = definition['name']
except KeyError:
raise key_error('The "name" key is required for the Layer object.')
try:
... |
# File system, where one can create and edit files protected with Login system. You can call it Personal Diary.
def menu():
print("***Menu***")
inp = input("Welcome user... \nWant to Login(lgn) or Register(reg) (lgn/reg)? ")
if inp == 'lgn':
loginAcct()
elif inp == 'reg':
regA... | def menu():
print('***Menu***')
inp = input('Welcome user... \nWant to Login(lgn) or Register(reg) (lgn/reg)? ')
if inp == 'lgn':
login_acct()
elif inp == 'reg':
reg_acct()
else:
print('\nInvalid choice...')
menu()
def reg_acct():
print('\n*** Registration ***\nP... |
m3 = range(0,1000,3)
m5 = range(0,1000,5)
m15 = range(0,1000,15)
answer = sum(m3)+sum(m5)-sum(m15)
print (answer)
| m3 = range(0, 1000, 3)
m5 = range(0, 1000, 5)
m15 = range(0, 1000, 15)
answer = sum(m3) + sum(m5) - sum(m15)
print(answer) |
#!/usr/bin/env python
class Solution(object):
def numDistinct(self, s, t):
"""
Counts the number of distinct subequences of t in s.
"""
n = len(s)
m = len(t)
if n == 0 or m == 0:
return 0
#
# Setup the DP. Each entry dp[i][j] represents ... | class Solution(object):
def num_distinct(self, s, t):
"""
Counts the number of distinct subequences of t in s.
"""
n = len(s)
m = len(t)
if n == 0 or m == 0:
return 0
dp = [[0 for j in range(0, n + 1)] for i in range(0, m + 1)]
for j in ra... |
__all__=["layer",
"fflayers",
"convnet"
"model",
"optimize"
"cost",
"train",
"util",
"nnfuns",
"dataset"] | __all__ = ['layer', 'fflayers', 'convnetmodel', 'optimizecost', 'train', 'util', 'nnfuns', 'dataset'] |
test = {
'name': 'Problem EC1',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> key_distance_diff("wird", "word", 4)
0.6834861261734088
>>> key_distance_diff("aird", "word", 4)
1.650081475501692
>>> key_distance_diff("bord", "w... | test = {'name': 'Problem EC1', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> key_distance_diff("wird", "word", 4)\n 0.6834861261734088\n >>> key_distance_diff("aird", "word", 4)\n 1.650081475501692\n >>> key_distance_diff("bord", "word", 4)\n 2\n >>> ... |
[
[
0.20155604,
0.13307383,
0.12784087,
float("NaN"),
0.06557849,
0.07970277,
float("NaN"),
0.05212981,
],
[
0.24451376,
0.14168013,
0.12661545,
float("NaN"),
0.10445491,
0.10288933,
float... | [[0.20155604, 0.13307383, 0.12784087, float('NaN'), 0.06557849, 0.07970277, float('NaN'), 0.05212981], [0.24451376, 0.14168013, 0.12661545, float('NaN'), 0.10445491, 0.10288933, float('NaN'), 0.07330904], [0.23630201, 0.15291979, 0.13264396, float('NaN'), 0.10157328, 0.09673594, float('NaN'), 0.07012212], [0.20088469, ... |
def compares_expressions(exp1, exp2) -> bool:
def compile_exp(exp):
return exp.compile(compile_kwargs={"literal_binds": True})
return str(compile_exp(exp1)) == str(compile_exp(exp2))
| def compares_expressions(exp1, exp2) -> bool:
def compile_exp(exp):
return exp.compile(compile_kwargs={'literal_binds': True})
return str(compile_exp(exp1)) == str(compile_exp(exp2)) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isMirror(self,t1,t2):
if not t1 and not t2:
return True
elif not t1 or not... | class Solution:
def is_mirror(self, t1, t2):
if not t1 and (not t2):
return True
elif not t1 or not t2:
return False
return t1.val == t2.val and self.isMirror(t1.left, t2.rigt) and self.isMirror(t1.right, t2.left)
def is_symmetric(self, root: TreeNode) -> bool:
... |
def reverse(self):
"""Reverse the begin and end point of the Line
Parameters
----------
self : Segment
An Segment object
Returns
-------
"""
end = self.end
self.end = self.begin
self.begin = end
| def reverse(self):
"""Reverse the begin and end point of the Line
Parameters
----------
self : Segment
An Segment object
Returns
-------
"""
end = self.end
self.end = self.begin
self.begin = end |
#!/usr/bin/python
""" run under recipient user's account """
""" if exists .forward send new mail """
""" else deliver to mbox/Maildir """
| """ run under recipient user's account """
' if exists .forward send new mail '
' else deliver to mbox/Maildir ' |
""" Defines various physical units for use within narwhal """
# For now, units are simply defined as constants, allowing them to serve as
# hashes
meter = "meter"
kilometer = "kilometer"
decibar = "decibar"
second = "second"
degree_celsius = "degree_celsius"
psu = "psu"
# compound units
meter_per_second = "meter_per... | """ Defines various physical units for use within narwhal """
meter = 'meter'
kilometer = 'kilometer'
decibar = 'decibar'
second = 'second'
degree_celsius = 'degree_celsius'
psu = 'psu'
meter_per_second = 'meter_per_second'
kilogram_per_cubic_meter = 'kilogram_per_cubic_meter' |
class BaseParagraphElement(object):
def __init__(self, element: dict, document):
self._element = element
self._document = document
@property
def start_index(self) -> int:
return self._element.get("startIndex")
@property
def end_index(self) -> int:
return self._eleme... | class Baseparagraphelement(object):
def __init__(self, element: dict, document):
self._element = element
self._document = document
@property
def start_index(self) -> int:
return self._element.get('startIndex')
@property
def end_index(self) -> int:
return self._elem... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 28 10:15:43 2019
@author: Training23
"""
def createdic(n):
n=dict(n)
return n
def acessdic(n):
c={2:2,3:2,1:2}
return c[n]
def update(n,m):
c={2:2,3:2,1:2}
c[n]=m
return c
def delete():
... | """
Created on Tue May 28 10:15:43 2019
@author: Training23
"""
def createdic(n):
n = dict(n)
return n
def acessdic(n):
c = {2: 2, 3: 2, 1: 2}
return c[n]
def update(n, m):
c = {2: 2, 3: 2, 1: 2}
c[n] = m
return c
def delete():
c = {2: 2, 3: 2, 1: 2}
print(c)
del c
print... |
#Bottle deposits
x = float(input('Enter the number of containers holding 1 litre or less: '))
y = float(input('Enter the number of containers holding more than 1 litre: '))
refund = float((x*.10)+(y*.25))
print('The refund received will be $',refund) | x = float(input('Enter the number of containers holding 1 litre or less: '))
y = float(input('Enter the number of containers holding more than 1 litre: '))
refund = float(x * 0.1 + y * 0.25)
print('The refund received will be $', refund) |
__SEPARATOR = '/'
__LAYER_TEMPLATE = '...../...../..?../...../.....'
__INNER_BORDER = set([(1,2), (3,2), (2,1), (2,3)])
def calculateBiodiversityRating(layout):
layoutString = layout.replace(__SEPARATOR, '')
biodiveristyRating = 0
for i in range(0, len(layoutString)):
if layoutString[i] == '#':
... | __separator = '/'
__layer_template = '...../...../..?../...../.....'
__inner_border = set([(1, 2), (3, 2), (2, 1), (2, 3)])
def calculate_biodiversity_rating(layout):
layout_string = layout.replace(__SEPARATOR, '')
biodiveristy_rating = 0
for i in range(0, len(layoutString)):
if layoutString[i] == ... |
{
"targets": [
{
"target_name": "aacencoder",
"sources": [ "aacencoder.cc" ],
"include_dirs": [
],
"libraries": [
"-lfaac"
]
}
]
}
| {'targets': [{'target_name': 'aacencoder', 'sources': ['aacencoder.cc'], 'include_dirs': [], 'libraries': ['-lfaac']}]} |
def main():
my_tuple = (4, 4, 3, 2, 5, 7, 8, 8, 8, 7)
evens = tuple([ item for item in my_tuple if item & 1 == 0 ])
odds = tuple([ item for item in my_tuple if item & 1 == 1 ])
print("Evens :", evens);
print("Odds :", odds);
if __name__ == '__main__':
main()
| def main():
my_tuple = (4, 4, 3, 2, 5, 7, 8, 8, 8, 7)
evens = tuple([item for item in my_tuple if item & 1 == 0])
odds = tuple([item for item in my_tuple if item & 1 == 1])
print('Evens :', evens)
print('Odds :', odds)
if __name__ == '__main__':
main() |
"""Should raise SyntaxError: can't use starred expression here"""
*a
| """Should raise SyntaxError: can't use starred expression here"""
*a |
# http://codeforces.com/problemset/problem/263/A
matrix = [list(map(int, input().split())) for i in range(5)]
# x = [x for x in matrix if 1 in x][0]
# print(x.index(1))
row_counter = 0
for i in range(5):
if sum(matrix[i]) > 0:
break
row_counter += 1
col_counter = 0
for i in range(5):
if matrix[r... | matrix = [list(map(int, input().split())) for i in range(5)]
row_counter = 0
for i in range(5):
if sum(matrix[i]) > 0:
break
row_counter += 1
col_counter = 0
for i in range(5):
if matrix[row_counter][i] == 1:
break
col_counter += 1
row = abs(row_counter - 2)
col = abs(col_counter - 2)
pr... |
N = int(input())
K = int(input())
M = int(input())
def mul(m1, m2):
m = [[0,0],[0,0]]
for i in range(0,2):
for j in range(0,2):
for k in range(0,2):
m[i][j] = m[i][j]+m1[i][k]*m2[k][j]
m[i][j] = m[i][j] % M
return m
def mpow(m, p):
res = [[... | n = int(input())
k = int(input())
m = int(input())
def mul(m1, m2):
m = [[0, 0], [0, 0]]
for i in range(0, 2):
for j in range(0, 2):
for k in range(0, 2):
m[i][j] = m[i][j] + m1[i][k] * m2[k][j]
m[i][j] = m[i][j] % M
return m
def mpow(m, p):
res = [[1, 0... |
"""
585. Maximum Number in Mountain Sequence
"""
class Solution:
"""
@param nums: a mountain sequence which increase firstly and then decrease
@return: then mountain top
"""
def mountainSequence(self, nums):
start, end = 0, len(nums) - 1
while start + 1 < end:
mid = star... | """
585. Maximum Number in Mountain Sequence
"""
class Solution:
"""
@param nums: a mountain sequence which increase firstly and then decrease
@return: then mountain top
"""
def mountain_sequence(self, nums):
(start, end) = (0, len(nums) - 1)
while start + 1 < end:
mid... |
# Copyright 2019 Nicole Borrelli
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | class Outputstream(object):
"""Class to present a bytearray as a stream"""
def __init__(self, max_size: int=None):
self._stream = bytearray()
self._max_size = max_size
def get_buffer(self) -> bytearray:
return self._stream
def size(self) -> int:
"""Gets the currently u... |
# options
NO = 0
YES = 1
def translate_option(options):
option_list = []
for option in options:
option_list.append((option[0], option[1]))
return option_list
yes_no_options = translate_option([("No", NO), ("Yes", YES)])
| no = 0
yes = 1
def translate_option(options):
option_list = []
for option in options:
option_list.append((option[0], option[1]))
return option_list
yes_no_options = translate_option([('No', NO), ('Yes', YES)]) |
class Solution:
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
if n <= 2:
return n
else:
return self.climbStairs(n-1) + self.climbStairs(n-2)
s = Solution()
print(s.climbStairs(3)) | class Solution:
def climb_stairs(self, n):
"""
:type n: int
:rtype: int
"""
if n <= 2:
return n
else:
return self.climbStairs(n - 1) + self.climbStairs(n - 2)
s = solution()
print(s.climbStairs(3)) |
"""Validation services"""
def validate_obligate_fields(fields: any = None):
"""Validate if a list of obligate params are valid
:param fields: object that contains all params that are obligate,
these values can be arrays or simple values."""
'''You can use the following example:
_validate = ... | """Validation services"""
def validate_obligate_fields(fields: any=None):
"""Validate if a list of obligate params are valid
:param fields: object that contains all params that are obligate,
these values can be arrays or simple values."""
'You can use the following example:\n\n _validate = val... |
# Default url patters for the engine.
urlpatterns = []
| urlpatterns = [] |
"""
Smallest Difference:
Write a function that takes in two non-empty arrays of integers,
finds the pair of numbers (one from each array) whose absolute difference is closest to zero,
and returns an array containing these two numbers, with the number from the first array in the first position.
Note that the absolut... | """
Smallest Difference:
Write a function that takes in two non-empty arrays of integers,
finds the pair of numbers (one from each array) whose absolute difference is closest to zero,
and returns an array containing these two numbers, with the number from the first array in the first position.
Note that the absolut... |
class DiscountFactor:
def __init__(self, curve_date, day_counter):
self.curve_date = curve_date
self.day_counter = day_counter
def calculate_year_fraction(self, t):
""" Return the discount factor using continuous compounding
:param t:
:return: e ^ [-r_0 (t) * year_fracti... | class Discountfactor:
def __init__(self, curve_date, day_counter):
self.curve_date = curve_date
self.day_counter = day_counter
def calculate_year_fraction(self, t):
""" Return the discount factor using continuous compounding
:param t:
:return: e ^ [-r_0 (t) * year_fract... |
#
# @lc app=leetcode id=15 lang=python3
#
# [15] 3Sum
#
# O(n^2) time | O(n) space
class Solution:
def threeSum(self, array, k=0):
array.sort()
ans = []
for i in range(len(array) - 1):
left = i + 1
right = len(array) - 1
if i > 0 and array[i] == array[... | class Solution:
def three_sum(self, array, k=0):
array.sort()
ans = []
for i in range(len(array) - 1):
left = i + 1
right = len(array) - 1
if i > 0 and array[i] == array[i - 1]:
continue
while left < right:
pote... |
# Copyright (c) 2015-2022 Adam Karpierz
# Licensed under the MIT License
# https://opensource.org/licenses/MIT
__import__("pkg_about").about("jtypes.pyjava")
__copyright__ = f"Copyright (c) 2015-2022 {__author__}" # noqa
| __import__('pkg_about').about('jtypes.pyjava')
__copyright__ = f'Copyright (c) 2015-2022 {__author__}' |
INVALID_VALUE = -1
## @brief Captures an intraday best quote,i.e. the bid/ask prices/sizes
class Quote( object ):
def __init__( self, bid_price, bid_size, ask_price, ask_size ):
self.bid_price = bid_price
self.bid_size = bid_size
self.ask_price = ask_price
self.ask_size = ask_size
... | invalid_value = -1
class Quote(object):
def __init__(self, bid_price, bid_size, ask_price, ask_size):
self.bid_price = bid_price
self.bid_size = bid_size
self.ask_price = ask_price
self.ask_size = ask_size
def initialize(self):
self.bid_price = INVALID_VALUE
se... |
# confirm that a given IP address is valid.
# naive solution
def validate_ip(ip_address):
"""An IP address consists of 32 bits, shown as 4 terms
of numbers from 0-255 represented in decimal form """
terms = ip_address.split(".")
if len(terms) != 4:
return False
for octet in range(0,4):
i... | def validate_ip(ip_address):
"""An IP address consists of 32 bits, shown as 4 terms
of numbers from 0-255 represented in decimal form """
terms = ip_address.split('.')
if len(terms) != 4:
return False
for octet in range(0, 4):
if not terms[octet].isdecimal():
return False
... |
##python program to print a pattern
n=int(input("No of rows\n"))
for i in range(0,n):
for j in range (0,i+1):
print("*", end="")
print()
| n = int(input('No of rows\n'))
for i in range(0, n):
for j in range(0, i + 1):
print('*', end='')
print() |
# DomirScire
A1=[1,4,9]
A2=[9,9,9]
def plus_one(A):
A[-1] += 1
for i in reversed(range(1, len(A))):
if A[i] != 10:
break
A[i]=0
A[i-1] += 1
if A[0] == 10:
A[0]=1
A.append(0)
return A
if __name__ == "__main__":
print(plus_one(A1))
print(plus... | a1 = [1, 4, 9]
a2 = [9, 9, 9]
def plus_one(A):
A[-1] += 1
for i in reversed(range(1, len(A))):
if A[i] != 10:
break
A[i] = 0
A[i - 1] += 1
if A[0] == 10:
A[0] = 1
A.append(0)
return A
if __name__ == '__main__':
print(plus_one(A1))
print(plus_o... |
# coding=utf-8
"""
Async IRC Interface Library
"""
__all__ = ("protocol", "server")
| """
Async IRC Interface Library
"""
__all__ = ('protocol', 'server') |
def main():
a = int(input("first number: "))
b = int(input("second number: "))
c = int(input("third number: "))
if a == b or b == c or c == a:
message = "\ngood bye"
else:
if a > b:
if a > c:
largest_number = a
else:
largest_nu... | def main():
a = int(input('first number: '))
b = int(input('second number: '))
c = int(input('third number: '))
if a == b or b == c or c == a:
message = '\ngood bye'
else:
if a > b:
if a > c:
largest_number = a
else:
largest_num... |
"""Module with custom errors."""
class InferralError(Exception):
"""Error sent when an inferral failed."""
pass
class DatasetError(Exception):
pass
class DuplicationError(Exception):
pass
class ValidationError(Exception):
pass
| """Module with custom errors."""
class Inferralerror(Exception):
"""Error sent when an inferral failed."""
pass
class Dataseterror(Exception):
pass
class Duplicationerror(Exception):
pass
class Validationerror(Exception):
pass |
BLACK = 1
WHITE = -1
EMPTY = 0
symbols = {BLACK: 'X', WHITE: 'O', EMPTY: '.'}
| black = 1
white = -1
empty = 0
symbols = {BLACK: 'X', WHITE: 'O', EMPTY: '.'} |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
##
# Copyright 2018 FIWARE Foundation, e.V.
# 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.apach... | class Filterdata:
@staticmethod
def filter(data):
result = list(map(lambda x: FilterData.__filter__(x), data))
return result
@staticmethod
def __filter__(data):
result = dict()
result['key'] = data['key']
result['comments'] = list(map(lambda x: FilterData.__get_... |
def normalize_RTL(src: str):
"""
check if a string contains any non-english letters, and if so, return it appended by itself backwards
This is so it would be easy to read hebrew titles
"""
if not src.isascii():
return src + ' (' + src[::-1] + ')'
return src
_safe_chars = frozenset(" ._... | def normalize_rtl(src: str):
"""
check if a string contains any non-english letters, and if so, return it appended by itself backwards
This is so it would be easy to read hebrew titles
"""
if not src.isascii():
return src + ' (' + src[::-1] + ')'
return src
_safe_chars = frozenset(" ._,-... |
OCTICON_DIFF = """
<svg class="octicon octicon-diff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.75 1.75a.75.75 0 00-1.5 0V5H4a.75.75 0 000 1.5h3.25v3.25a.75.75 0 001.5 0V6.5H12A.75.75 0 0012 5H8.75V1.75zM4 13a.75.75 0 000 1.5h8a.75.75 0 100-1.5H4z"></p... | octicon_diff = '\n<svg class="octicon octicon-diff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.75 1.75a.75.75 0 00-1.5 0V5H4a.75.75 0 000 1.5h3.25v3.25a.75.75 0 001.5 0V6.5H12A.75.75 0 0012 5H8.75V1.75zM4 13a.75.75 0 000 1.5h8a.75.75 0 100-1.5H4z"></pat... |
#!/usr/bin/env python3
# create list
proto = ["ssh", "http", "https"]
# print entire list
print(proto)
# print second list item
print(proto[1])
# line add d, n, s
proto.extend("dns")
print(proto)
| proto = ['ssh', 'http', 'https']
print(proto)
print(proto[1])
proto.extend('dns')
print(proto) |
print("Welcome to Hangman")
name=input("What's your name?")
print("Hi "+name)
print("_ _ _ _ _")
firstletter=input("What's your first letter?")
if firstletter==("a"):
print("a _ _ _ _")
secondletter=input("What's your second letter?")
if firstletter==("a"):
if secondletter==("p"):
print(... | print('Welcome to Hangman')
name = input("What's your name?")
print('Hi ' + name)
print('_ _ _ _ _')
firstletter = input("What's your first letter?")
if firstletter == 'a':
print('a _ _ _ _')
secondletter = input("What's your second letter?")
if firstletter == 'a':
if secondletter == 'p':
print('app... |
#
# PySNMP MIB module DLINK-3100-IpRouter (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-IpRouter
# Produced by pysmi-0.3.4 at Mon Apr 29 18:33:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) ... |
class Solution:
def firstUniqChar(self, s: str) -> int:
# warm-up
# check the xor
count = [0]*26
a = ord('a')
for achar in s:
position = ord(achar) - a
count[position] += 1
for i in range(len(s)):
position = ord(s[i]) - a
... | class Solution:
def first_uniq_char(self, s: str) -> int:
count = [0] * 26
a = ord('a')
for achar in s:
position = ord(achar) - a
count[position] += 1
for i in range(len(s)):
position = ord(s[i]) - a
if count[position] == 1:
... |
def get_amble(idx, lines):
return lines[idx-25:idx]
def get_pair(idx, lines):
amble = get_amble(idx, lines)
for i in amble:
for j in amble:
if i > lines[idx] or j > lines[idx]:
continue
if i == j:
continue
if i + j == lines[idx]:
... | def get_amble(idx, lines):
return lines[idx - 25:idx]
def get_pair(idx, lines):
amble = get_amble(idx, lines)
for i in amble:
for j in amble:
if i > lines[idx] or j > lines[idx]:
continue
if i == j:
continue
if i + j == lines[idx]:... |
arr=[0]*101
input();N=[*map(int,input().split())]
ans=0
for i in N:
if arr[i]==0: arr[i]=1
else: ans+=1
print(ans) | arr = [0] * 101
input()
n = [*map(int, input().split())]
ans = 0
for i in N:
if arr[i] == 0:
arr[i] = 1
else:
ans += 1
print(ans) |
'''
Leetcode problem No 719 Find K-th Smallest Pair Distance
Solution written by Xuqiang Fang on 19 June, 2018
'''
class Solution(object):
def smallestDistancePair(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
nums.sort()
print(nums)
... | """
Leetcode problem No 719 Find K-th Smallest Pair Distance
Solution written by Xuqiang Fang on 19 June, 2018
"""
class Solution(object):
def smallest_distance_pair(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
nums.sort()
print(num... |
def twos_difference(lst):
slst = sorted(lst)
pairs = []
for i in range(len(slst)):
for j in range(1, len(slst)):
if slst[j] - slst[i] == 2:
pairs.append((slst[i], slst[j]))
return pairs | def twos_difference(lst):
slst = sorted(lst)
pairs = []
for i in range(len(slst)):
for j in range(1, len(slst)):
if slst[j] - slst[i] == 2:
pairs.append((slst[i], slst[j]))
return pairs |
def fractionSum(a, b):
c = a[1] * b[1]
d = a[0] * b[1] + b[0] * a[1]
gcd = getGcd(c, d)
return [d/gcd, c/gcd]
def getGcd(a, b):
while b:
a, b = b, a % b
return a
| def fraction_sum(a, b):
c = a[1] * b[1]
d = a[0] * b[1] + b[0] * a[1]
gcd = get_gcd(c, d)
return [d / gcd, c / gcd]
def get_gcd(a, b):
while b:
(a, b) = (b, a % b)
return a |
def tflm_kernel_friends():
return []
def tflm_audio_frontend_friends():
return []
def xtensa_fusion_f1_cpu():
return "F1_190305_swupgrade"
def xtensa_hifi_3z_cpu():
return "HIFI_190304_swupgrade"
def xtensa_hifi_5_cpu():
return "AE_HiFi5_LE5_AO_FP_XC"
| def tflm_kernel_friends():
return []
def tflm_audio_frontend_friends():
return []
def xtensa_fusion_f1_cpu():
return 'F1_190305_swupgrade'
def xtensa_hifi_3z_cpu():
return 'HIFI_190304_swupgrade'
def xtensa_hifi_5_cpu():
return 'AE_HiFi5_LE5_AO_FP_XC' |
'''
Problem:
Given a string, find the first un-repeated character in it.
'''
def unrepeated(target):
lookup = {}
# Build a lookup table.
for item in target:
lookup.setdefault(item, 0)
lookup[item] += 1
# Find the first non-repeated character.
for item in target:
if lookup... | """
Problem:
Given a string, find the first un-repeated character in it.
"""
def unrepeated(target):
lookup = {}
for item in target:
lookup.setdefault(item, 0)
lookup[item] += 1
for item in target:
if lookup[item] == 1:
return item
return None
test = 'unrepeated unde... |
EV_SYN = 0x00
EV_KEY = 0x01
EV_REL = 0x02
EV_ABS = 0x03
EV_MSC = 0x04
EV_SW = 0x05
EV_LED = 0x11
EV_SND = 0x12
EV_REP = 0x14
EV_FF = 0x15
EV_PWR = 0x16
EV_FF_STATUS = 0x17
SYN_REPORT = 0
SYN_CONFIG = 1
REL_X = 0x00
REL_Y = 0x01
REL_Z = 0x02
REL_RX = 0x03
REL_RY = 0x04
REL_RZ = 0x05
REL_HWHEEL = 0x06
REL_DIAL = 0x07
R... | ev_syn = 0
ev_key = 1
ev_rel = 2
ev_abs = 3
ev_msc = 4
ev_sw = 5
ev_led = 17
ev_snd = 18
ev_rep = 20
ev_ff = 21
ev_pwr = 22
ev_ff_status = 23
syn_report = 0
syn_config = 1
rel_x = 0
rel_y = 1
rel_z = 2
rel_rx = 3
rel_ry = 4
rel_rz = 5
rel_hwheel = 6
rel_dial = 7
rel_wheel = 8
rel_misc = 9
rel_max = 15
abs_x = 0
abs_y =... |
"""
1. Write a Python program to get a directory listing, sorted by creation date.
2. Write a Python program to get the details of math module.
3. Write a Python program to calculate midpoints of a line.
4. Write a Python program to hash a word.
5. Write a Python program to get the copyright information.... | """
1. Write a Python program to get a directory listing, sorted by creation date.
2. Write a Python program to get the details of math module.
3. Write a Python program to calculate midpoints of a line.
4. Write a Python program to hash a word.
5. Write a Python program to get the copyright information.
6. Write... |
GREEN = 24
RED = 26
BLUE = 22
WHITELIST = {"eb94294a", "044c4fd2222a80"}
SPINTIME = 3
BLINKFRACTION = 3
#espeak
ACCESSDENIED = "Access denied."
SPEAKSPEED = 140
SPEAKPITCH = 50
| green = 24
red = 26
blue = 22
whitelist = {'eb94294a', '044c4fd2222a80'}
spintime = 3
blinkfraction = 3
accessdenied = 'Access denied.'
speakspeed = 140
speakpitch = 50 |
# table definition
table = {
'table_name' : 'ar_allocations',
'module_id' : 'ar',
'short_descr' : 'Ar allocation detail lines',
'long_descr' : 'Ar allocation detail lines',
'sub_types' : None,
'sub_trans' : None,
'sequence' : None,
'tree_params' : None,
'ro... | table = {'table_name': 'ar_allocations', 'module_id': 'ar', 'short_descr': 'Ar allocation detail lines', 'long_descr': 'Ar allocation detail lines', 'sub_types': None, 'sub_trans': None, 'sequence': None, 'tree_params': None, 'roll_params': None, 'indexes': [['ar_alloc_ndx', [['tran_row_id', False]], None, False]], 'le... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
# @desc Checking to see if a number is equal to another number
def is_equal(x, y):
return x == y
def main():
print(is_equal(3, 5))
print(is_equal(5, 4))
print(is_equal(15, 15))
if __name__ == '__main__':
main()
| def is_equal(x, y):
return x == y
def main():
print(is_equal(3, 5))
print(is_equal(5, 4))
print(is_equal(15, 15))
if __name__ == '__main__':
main() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 9 17:54:03 2019
Exam 2 Physical Pendulum
@author: Lauren King
"""
"""
import numpy as np
import scipy as sc
#t=np.arange(0,10.001,.01)
#y=np.arange(0,10.001,.01)
#y[0]=.001
g=9.8
def f(m,ang):
f=m*g*np.sin(ang)
return f
m=2... | """
Created on Sat Nov 9 17:54:03 2019
Exam 2 Physical Pendulum
@author: Lauren King
"""
'\nimport numpy as np\nimport scipy as sc\n\n#t=np.arange(0,10.001,.01)\n\n#y=np.arange(0,10.001,.01)\n#y[0]=.001\n\ng=9.8\n\n\ndef f(m,ang):\n f=m*g*np.sin(ang)\n return f\n\n\nm=2\nang=(np.pi)/2\nh=.01\n\n\narrang=np.ara... |
s = "python3"
r = "raja"
sh = 'shobha'
iv = 'Ivaan'
ag = "34"
python_course = True
r_course = False
number_of_sisters = None
# print("Hi ", r.capitalize(), s.capitalize(), sh.upper())
# print(sh.isalpha())
# print(ag.isdigit())
# print("Hello, am {0}. Nice to meet you {1}.".format(r.capitalize(),sh.capitalize()))
p... | s = 'python3'
r = 'raja'
sh = 'shobha'
iv = 'Ivaan'
ag = '34'
python_course = True
r_course = False
number_of_sisters = None
print(f'Hello, am {r}. Nice to meet you {sh} and {iv}. Learning Python.. Is that {python_course}?. Ivaan has {number_of_sisters} sisters.')
if ag:
print('Shobha is {ag} years old.')
else:
... |
# -*- coding: UTF-8 -*-
'''
Base Service Module
'''
class BaseService():
__repository = None
def __init__(self):
pass
| """
Base Service Module
"""
class Baseservice:
__repository = None
def __init__(self):
pass |
# find the multiple missing numbers in an sorted array
# input Array elements
# find difference between currentArrayValue and value's index
# while i < arrayLength
# while difference < currentElementDifference (if missing elements are more than 1 at a time)
# then print the missing number (difference + currentIn... | print('Enter the elements', end=' ')
array = list(map(int, input().split()))
difference = array[0] - 0
for i in range(len(array)):
while difference < array[i] - i:
print(f'Missing value is {i + difference}')
difference += 1
diff = array[0] - 0
missing_values = list()
for i in range(len(array)):
... |
def format_log(info: str, exception=None, traceback: str=None, values: dict={}):
log = (
f'INFO: {info}\n'
f'------------\n'
)
if exception is not None:
log = log + (
f'EXCEPTION FOUNDED: \n'
f'{repr(exception)}\n'
f'------------\n'
)
if traceback is not None:
log = log + (
f'TRACEBACK: \n'
... | def format_log(info: str, exception=None, traceback: str=None, values: dict={}):
log = f'INFO: {info}\n------------\n'
if exception is not None:
log = log + f'EXCEPTION FOUNDED: \n{repr(exception)}\n------------\n'
if traceback is not None:
log = log + f'TRACEBACK: \n{traceback}\n-----------... |
nt_regex = {
'Matthew': '.*(M[a-z]*t[a-z]*)[\s\.](\d+):(\d+)[\s]*(.*)',
'Mark': '(M[a-z]*k[a-z]*)[\s\.](\d+):(\d+)[\s]*(.+)',
'Luke': '(L[a-z]*k[a-z]*)[\s\.](\d+):(\d+)[\s]*(.+)',
'John': '(^J[a-z]*n[a-z]*)[\s\.](\d+):(\d+)[\s]*(.+)',
'Acts': '(A[a-z]*c[a-z]*)[\s\.](\d+):(\d+)[\s]*(.+)',
'Romans... | nt_regex = {'Matthew': '.*(M[a-z]*t[a-z]*)[\\s\\.](\\d+):(\\d+)[\\s]*(.*)', 'Mark': '(M[a-z]*k[a-z]*)[\\s\\.](\\d+):(\\d+)[\\s]*(.+)', 'Luke': '(L[a-z]*k[a-z]*)[\\s\\.](\\d+):(\\d+)[\\s]*(.+)', 'John': '(^J[a-z]*n[a-z]*)[\\s\\.](\\d+):(\\d+)[\\s]*(.+)', 'Acts': '(A[a-z]*c[a-z]*)[\\s\\.](\\d+):(\\d+)[\\s]*(.+)', 'Romans... |
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums)==0:
return 1
t = set(list(range(1, len(nums)+1))) - set(nums)
if len(t)==0:
return max(nums) + 1
w... | class Solution(object):
def first_missing_positive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 1
t = set(list(range(1, len(nums) + 1))) - set(nums)
if len(t) == 0:
return max(nums) + 1
while... |
"""Metrics-related functionality."""
# def df_classification_report(
| """Metrics-related functionality.""" |
#
# @lc app=leetcode id=206 lang=python3
#
# [206] Reverse Linked List
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
... | class Solution:
def reverse_list(self, head: ListNode) -> ListNode:
"""
time: O(len(head))
space: O(1)
"""
reversed_head = None
while head:
cur = head
head = head.next
cur.next = reversed_head
reversed_head = cur
... |
def is_palindrome(word):
if word.lower() == word[::-1].lower():
print('Your word is a palindrome.')
else:
print('Your word is not a palindrome.')
def is_anagram(word1, word2):
w1 = sorted(word1.lower().replace(' ', ''))
w2 = sorted(word2.lower().replace(' ', ''))
if w1 == w2:
... | def is_palindrome(word):
if word.lower() == word[::-1].lower():
print('Your word is a palindrome.')
else:
print('Your word is not a palindrome.')
def is_anagram(word1, word2):
w1 = sorted(word1.lower().replace(' ', ''))
w2 = sorted(word2.lower().replace(' ', ''))
if w1 == w2:
... |
"""
The ska_tmc_cdm.messages package contains modules that maps Tango structured
arguments to Python.
"""
| """
The ska_tmc_cdm.messages package contains modules that maps Tango structured
arguments to Python.
""" |
#
# common.py
#
# Python utilities for bmk2.
#
# Copyright (c) 2015, 2016 The University of Texas at Austin
#
# Author: Sreepathi Pai <sreepai@ices.utexas.edu>
#
# Intended to be licensed under GPL3
# runs a python file and returns the globals
def load_py_module(f):
"""Executes a python file and returns the global... | def load_py_module(f):
"""Executes a python file and returns the globals in it at the end
of execution.
"""
g = {}
x = execfile(f, g)
return g |
# Produce a list of list using list comprehensions
list1 = [1,2,3,4,5]
x = [[i**2, i**3] for i in list1]
print(x) | list1 = [1, 2, 3, 4, 5]
x = [[i ** 2, i ** 3] for i in list1]
print(x) |
# if a + b + c = P then we need a + b > c with c hypotenuse
# we can also say that a <= b
# Then we also need a^2 + b^2 = c^2
# We can start at 501 since all less than 501 will have a multiple
# less than 1000
def findTris(p):
''' Find potential triangle sides of perimeter p.
yield (a,b,c)
'''
maxC = ... | def find_tris(p):
""" Find potential triangle sides of perimeter p.
yield (a,b,c)
"""
max_c = p / 2
n = 0
for c in xrange(maxC, 1, -1):
max_a = (p - c) / 2
for a in xrange(1, maxA + 1):
b = p - c - a
if a * a + b * b == c * c:
n += 1
re... |
class Solution:
def permute(self, nums):
if not nums or len(nums) == 0:
return []
def doPermute(numsLeft, numsChoosen, results):
if not numsLeft or len(numsLeft) == 0:
results.append(numsChoosen)
return
for i in range(len(n... | class Solution:
def permute(self, nums):
if not nums or len(nums) == 0:
return []
def do_permute(numsLeft, numsChoosen, results):
if not numsLeft or len(numsLeft) == 0:
results.append(numsChoosen)
return
for i in range(len(numsLef... |
class User:
def __init__(self, user_id: int, username: str):
self.user_id = user_id
self.username = username
self.books = []
def info(self):
return ', '.join(sorted(self.books))
def __str__(self):
return f"{self.user_id}, {self.username}, {self.books}"
| class User:
def __init__(self, user_id: int, username: str):
self.user_id = user_id
self.username = username
self.books = []
def info(self):
return ', '.join(sorted(self.books))
def __str__(self):
return f'{self.user_id}, {self.username}, {self.books}' |
# Solution 1
# O(n^2) time / O(n^2) space
def sameBsts(arrayOne, arrayTwo):
if len(arrayOne) != len(arrayTwo):
return False
if len(arrayOne) == 0 and len(arrayTwo) == 0:
return True
if arrayOne[0] != arrayTwo[0]:
return False
leftOne = getSmaller(arrayOne)
leftTwo = getSm... | def same_bsts(arrayOne, arrayTwo):
if len(arrayOne) != len(arrayTwo):
return False
if len(arrayOne) == 0 and len(arrayTwo) == 0:
return True
if arrayOne[0] != arrayTwo[0]:
return False
left_one = get_smaller(arrayOne)
left_two = get_smaller(arrayTwo)
right_one = get_bigge... |
class Bunch(dict):
def __init__(self, *args, **kwargs):
super(Bunch, self).__init__(*args, **kwargs)
self.__dict__ = self
| class Bunch(dict):
def __init__(self, *args, **kwargs):
super(Bunch, self).__init__(*args, **kwargs)
self.__dict__ = self |
class MetaData():
def save_data_source(self):
pass
| class Metadata:
def save_data_source(self):
pass |
ROBOT_LISTENER_API_VERSION = 2
def get_listener_method(name):
def listener_method(*args):
if name in ['message', 'log_message']:
msg = args[0]
message = '%s: %s %s' % (name, msg['level'], msg['message'])
else:
message = name
raise AssertionError(message)
... | robot_listener_api_version = 2
def get_listener_method(name):
def listener_method(*args):
if name in ['message', 'log_message']:
msg = args[0]
message = '%s: %s %s' % (name, msg['level'], msg['message'])
else:
message = name
raise assertion_error(message... |
# 2-Sum Binary Tree
# https://www.interviewbit.com/problems/2sum-binary-tree/
#
# Given a binary search tree T, where each node contains a positive integer, and an integer K,
# you have to find whether or not there exist two different nodes A and B such that A.value + B.value = K.
#
# Return 1 to denote that two such n... | class Solution(object):
def _find_target(self, A, B, dp):
if not A:
return False
if B - A.val in dp:
return True
dp[A.val] = True
return self._findTarget(A.left, B, dp) or self._findTarget(A.right, B, dp)
def t2_sum(self, A, B):
return int(self._... |
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we a... | dirname = 'IO'
if not DIM_3:
clib = 'oof2common'
else:
clib = 'oof3dcommon'
if not NO_GUI:
subdirs = ['GUI']
if not DIM_3:
cfiles = ['bitoverlay.C']
swigfiles = ['bitoverlay.swg']
pyfiles = ['activeareamodmenu.py', 'automatic.py', 'binarydata.py', 'bitmapdisplay.py', 'bitoverlaydisplay.py', 'col... |
class Solution:
def reverseOnlyLetters(self, s: str) -> str:
s=list(s)
left=0
right=len(s)-1
def isChar(a):
return (ord(a)>=ord('a') and ord(a)<=ord('z')) or (ord(a)>=ord('A') and ord(a)<=ord('Z'))
while left<right:
if isChar(s[left]) and isChar(s[righ... | class Solution:
def reverse_only_letters(self, s: str) -> str:
s = list(s)
left = 0
right = len(s) - 1
def is_char(a):
return ord(a) >= ord('a') and ord(a) <= ord('z') or (ord(a) >= ord('A') and ord(a) <= ord('Z'))
while left < right:
if is_char(s[le... |
# Shift cipher
def shift(plain, key):
if plain.isalnum() == False:
raise ValueError("Plaintext should be alphanumeric")
ctext = ""
for c in plain:
if c.islower():
ctext += chr((ord(c) - ord('a') + key) % 26 + ord('a'))
elif c.isupper():
ctext += chr(... | def shift(plain, key):
if plain.isalnum() == False:
raise value_error('Plaintext should be alphanumeric')
ctext = ''
for c in plain:
if c.islower():
ctext += chr((ord(c) - ord('a') + key) % 26 + ord('a'))
elif c.isupper():
ctext += chr((ord(c) - ord('A') + key... |
p = []
i = 0
while i < 10:
p.append(i)
i += 1
p[2] = p[6] = p
p[a] = p # Makes p Top
| p = []
i = 0
while i < 10:
p.append(i)
i += 1
p[2] = p[6] = p
p[a] = p |
n=str(input("Enter the list "))
ls=list(n.split(" "))
le=len(ls)
last=ls[le-1]
print("Last color %s"%last)
print("First color " +ls[0])
| n = str(input('Enter the list '))
ls = list(n.split(' '))
le = len(ls)
last = ls[le - 1]
print('Last color %s' % last)
print('First color ' + ls[0]) |
#Hay que crear una variable donde esta el objetivo, una lo que se va
# suman y otra donde esta lo que queda por cambiar
dinero=100
acumulado=0
resto=100
#Variable lista con billetes
billetes=[[3,20],[5,10],[2,5]]
#variable cambio
cambio2=[[0,20],[0,10],[0,5]]
cambio=cambio2.copy()
#soluciones posibles
solucion=((0,0,0... | dinero = 100
acumulado = 0
resto = 100
billetes = [[3, 20], [5, 10], [2, 5]]
cambio2 = [[0, 20], [0, 10], [0, 5]]
cambio = cambio2.copy()
solucion = ((0, 0, 0), (0, 0, 0), (0, 0, 0))
i = 0
while resto > billetes[i][1] and billetes[i][1] > 0 and (resto > dinero):
billetes[i][1] -= 1
cambio[i][1] += 1
acumula... |
"""
This file contians weird view protocol defintions.
"""
# Configuration options
WV_REQ_TIMEOUT = 0.5
# Weird view protocol definitions.
WV_DISC = "8737808B"
WV_DISC_REPLY = "134E3A9D"
WV_LIST = "7DE0B79C"
WV_LIST_REPLY = "57186F8A"
WV_UPDATE ... | """
This file contians weird view protocol defintions.
"""
wv_req_timeout = 0.5
wv_disc = '8737808B'
wv_disc_reply = '134E3A9D'
wv_list = '7DE0B79C'
wv_list_reply = '57186F8A'
wv_update = '13AC8F62'
wv_update_reply = '0F4E180A'
wv_req = '81c4b463'
wv_plugin_log = '0'
wv_plugin_switch = '1'
wv_plugin_analog = '2'
wv_plu... |
a = "test1"
b = "test2"
c = "test3"
print(2**100) | a = 'test1'
b = 'test2'
c = 'test3'
print(2 ** 100) |
def fa_icon(name):
'''
http://fontawesome.dashgame.com/
'''
return 'fa fa-%s'%name | def fa_icon(name):
"""
http://fontawesome.dashgame.com/
"""
return 'fa fa-%s' % name |
class Customer:
def __init__(self,name):
self.name=name
def greet(self,arg=None):
if arg==None:
print("Hello!")
else:
print("Hello",arg,"!")
def purchase(self,*items):
count=len(items)
print(self.name, "you have purchased", count,"item(s):")
... | class Customer:
def __init__(self, name):
self.name = name
def greet(self, arg=None):
if arg == None:
print('Hello!')
else:
print('Hello', arg, '!')
def purchase(self, *items):
count = len(items)
print(self.name, 'you have purchased', count,... |
"""
LeetCode 30 Day Challenge: Perform String Shifts
Link: https://leetcode.com/explore/challenge/card/30-day-leetcoding-challenge/529/week-2/3299/
Written by: Mostofa Adib Shakib
Language: Python
Cutting and slicing strings in Python
array[0] = The left most character in the array
array[-1] = The right most char... | """
LeetCode 30 Day Challenge: Perform String Shifts
Link: https://leetcode.com/explore/challenge/card/30-day-leetcoding-challenge/529/week-2/3299/
Written by: Mostofa Adib Shakib
Language: Python
Cutting and slicing strings in Python
array[0] = The left most character in the array
array[-1] = The right most char... |
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# 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 applica... | rows = 20
row_rule_len = 6
row_rules = [[0, 0, 0, 1, 1, 4], [0, 0, 0, 0, 1, 6], [1, 1, 1, 1, 2, 3], [0, 0, 1, 1, 2, 3], [0, 0, 3, 1, 2, 3], [0, 0, 4, 5, 2, 2], [0, 0, 0, 7, 3, 2], [0, 0, 3, 5, 1, 2], [0, 0, 2, 2, 4, 1], [0, 0, 2, 2, 3, 4], [0, 0, 0, 2, 5, 2], [0, 0, 2, 1, 5, 1], [0, 0, 2, 2, 3, 1], [0, 0, 0, 6, 2, 2], ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.