content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def proc(command, message): return { "data": { "status": "ok", "html": """ <p> Hi! I can control your Raspberry Pi. Send me the commands <b>in bold</b> to make me do stuff.<br><br> &#128247; camera controls<br> ...
def proc(command, message): return {'data': {'status': 'ok', 'html': "\n <p>\n Hi! I can control your Raspberry Pi. Send me the commands <b>in bold</b> to make me do stuff.<br><br>\n \n &#128247; camera controls<br>\n <b>camera photo</b>: I ...
class User: def __init__(self, name, email, title): self.name = name self.email = email self.title = title def change_title(self, new_title): self.title = new_title def print_info(self): print(f"\nUser details:\nName: {self.name}\nEmail: {self.email}\nTitle: {self.t...
class User: def __init__(self, name, email, title): self.name = name self.email = email self.title = title def change_title(self, new_title): self.title = new_title def print_info(self): print(f'\nUser details:\nName: {self.name}\nEmail: {self.email}\nTitle: {self....
#!/usr/bin/env python3 # gets info from file, strips whitespaces, returns list of data in file def get_data_from_file(): flag = False # absolute path, should probably change in future filename = "/Users/visrunner/Desktop/PHerc118/2016_07_06_10_26_41/2016_07_06_10_26_41data.hdr" while flag == False: ...
def get_data_from_file(): flag = False filename = '/Users/visrunner/Desktop/PHerc118/2016_07_06_10_26_41/2016_07_06_10_26_41data.hdr' while flag == False: try: infile = open(filename, 'r') flag = True except: print('Filename not valid') filenam...
"""***************************************************************************** * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
"""***************************************************************************** * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
#!/usr/bin/env python3 ####################################################################################### # # # Program purpose: Converts an integer to binary, keeping leading zeros. # # Program Author : Happi ...
if __name__ == '__main__': x = 12 print(format(x, '08b')) print(format(x, '010b'))
# URI Online Judge 1172 X = [] for i in range(10): X.append( int(input()) ) if X[i] <= 0: X[i] = 1 for i in range(10): print('X[{:}] = {:}'.format(i, X[i]))
x = [] for i in range(10): X.append(int(input())) if X[i] <= 0: X[i] = 1 for i in range(10): print('X[{:}] = {:}'.format(i, X[i]))
# SPDX-FileCopyrightText: 2022 Stephan Lachnit <stephanlachnit@debian.org> # # SPDX-License-Identifier: EUPL-1.2 """ Classes holding the information of a SPDX document. """ class SPDXHeaderParagraph: """ Class containing the header paragraph of a SPDX document. """ # pylint: disable=too-few-public-me...
""" Classes holding the information of a SPDX document. """ class Spdxheaderparagraph: """ Class containing the header paragraph of a SPDX document. """ def __init__(self) -> None: pass class Spdxfileparagraph: """ Class containing a single file paragraph of a SPDX document. """ ...
# https://leetcode.com/problems/binary-search/ class Solution: def search(self, nums, target): i = 0 n = len(nums) while nums[i] < target: i += 1 if i == n: return -1 if nums[i] == target: flag = i else: flag = ...
class Solution: def search(self, nums, target): i = 0 n = len(nums) while nums[i] < target: i += 1 if i == n: return -1 if nums[i] == target: flag = i else: flag = -1 return flag
""" Config """ """======= Main =======""" WEB_PREFIX = "http://zhjwxk.cic.tsinghua.edu.cn/" """======= Main =======""" """======= Urls =======""" CAPTCHAR_PATH = WEB_PREFIX + "login-jcaptcah.jpg?captchaflag=login1" LOGIN_PAGE = WEB_PREFIX + "xklogin.do" #LOGIN_POST_PAGE = WEB_PREFIX + "j_acegi_formlogin_xsxk.do"...
""" Config """ '======= Main =======' web_prefix = 'http://zhjwxk.cic.tsinghua.edu.cn/' '======= Main =======' '======= Urls =======' captchar_path = WEB_PREFIX + 'login-jcaptcah.jpg?captchaflag=login1' login_page = WEB_PREFIX + 'xklogin.do' login_post_page = 'https://zhjwxk.cic.tsinghua.edu.cn:443/j_acegi_formlogi...
def ListComprehensions(x,y,z,n): data = [] for i in range(x+1): for j in range(y+1): for k in range(z+1): data.append([i,j,k]) datos = [x for x in data if (x[0]+x[1]+x[2])!= n] print(datos) if __name__ =="__main__": ListComprehensions(1,1,2,3)
def list_comprehensions(x, y, z, n): data = [] for i in range(x + 1): for j in range(y + 1): for k in range(z + 1): data.append([i, j, k]) datos = [x for x in data if x[0] + x[1] + x[2] != n] print(datos) if __name__ == '__main__': list_comprehensions(1, 1, 2, 3)
# NOTE: Some variables are set as public variables for testing. They should be reset # to private variables in an official deployment of the contract. # # Events # RegisterNotary: event({index_in_notary_pool: int128, notary: indexed(address)}) DeregisterNotary: event({index_in_notary_pool: int128, notary: indexed(ad...
register_notary: event({index_in_notary_pool: int128, notary: indexed(address)}) deregister_notary: event({index_in_notary_pool: int128, notary: indexed(address), deregistered_period: int128}) release_notary: event({index_in_notary_pool: int128, notary: indexed(address)}) add_header: event({period: int128, shard_id: in...
''' practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates ''' print(14 // 3) #end-of-the program
""" practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates """ print(14 // 3)
# -*- coding: utf-8 -*- class DeviceBusyError(Exception): pass class BlockedByRfKillError(Exception): pass class IncorrectInterfaceError(Exception): pass class IncorrectInterfaceStateError(Exception): pass class IncorrectInterfaceNameError(Exception): pass
class Devicebusyerror(Exception): pass class Blockedbyrfkillerror(Exception): pass class Incorrectinterfaceerror(Exception): pass class Incorrectinterfacestateerror(Exception): pass class Incorrectinterfacenameerror(Exception): pass
#oct(x) for i in range(16): print(i, oct(i)) print() for i in range(16): print('{0:2d} {0:>4o}'.format(i))
for i in range(16): print(i, oct(i)) print() for i in range(16): print('{0:2d} {0:>4o}'.format(i))
class InstrumentUpdate: insId: int updatedAt: str def __init__(self, insId, updatedAt): self.insId = insId self.updatedAt = updatedAt def __str__(self): return '{}: {}'.format(self.insId, self.updatedAt) def __repr__(self): return '{}: {}'.format(self.insId, self.u...
class Instrumentupdate: ins_id: int updated_at: str def __init__(self, insId, updatedAt): self.insId = insId self.updatedAt = updatedAt def __str__(self): return '{}: {}'.format(self.insId, self.updatedAt) def __repr__(self): return '{}: {}'.format(self.insId, self...
class Solution(object): def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ best = 0 run = 0 for n in nums: if n == 1: run += 1 else: run = 0 if run > best: ...
class Solution(object): def find_max_consecutive_ones(self, nums): """ :type nums: List[int] :rtype: int """ best = 0 run = 0 for n in nums: if n == 1: run += 1 else: run = 0 if run > best: ...
__description__ = "VOEvent Broker" __url__ = "https://comet.transientskp.org/" __author__ = "John Swinbank" __contact__ = "john@swinbank.org" __version__ = "3.2.0-pre"
__description__ = 'VOEvent Broker' __url__ = 'https://comet.transientskp.org/' __author__ = 'John Swinbank' __contact__ = 'john@swinbank.org' __version__ = '3.2.0-pre'
def fib_iter(n): a=1 b=1 if n==1: print('0') elif n==2: print('0','1') else: print("Iterative Approach: ", end=' ') print('0',a,b,end=' ') for i in range(n-3): total = a + b b=a a= total print(total,end=' ') ...
def fib_iter(n): a = 1 b = 1 if n == 1: print('0') elif n == 2: print('0', '1') else: print('Iterative Approach: ', end=' ') print('0', a, b, end=' ') for i in range(n - 3): total = a + b b = a a = total print(to...
class User(object): def __init__(self, user_name, user_id, email): self.user_name = user_name self.user_id = user_id self.email = email self.teams = [] def get_user_name(self): return self.user_name def get_user_id(self): return self.user_id def get_tea...
class User(object): def __init__(self, user_name, user_id, email): self.user_name = user_name self.user_id = user_id self.email = email self.teams = [] def get_user_name(self): return self.user_name def get_user_id(self): return self.user_id def get_te...
""" i represents the index of the current character we are checking We loop until one of the exit conditions are met. Every iteration of the parent loop increases i, moving on to the next character. It also loops through all the provided strings, checking to make sure they have the same charac...
""" i represents the index of the current character we are checking We loop until one of the exit conditions are met. Every iteration of the parent loop increases i, moving on to the next character. It also loops through all the provided strings, checking to make sure they have the same charac...
""" Errors to be used by PyHomeSeer. """ class PyHomeSeerError(Exception): """ Base error for PyHomeSeer. """ pass class PyHomeSeerAuthenticationError(PyHomeSeerError): """ Error Authenticating to HomeSeer """ pass
""" Errors to be used by PyHomeSeer. """ class Pyhomeseererror(Exception): """ Base error for PyHomeSeer. """ pass class Pyhomeseerauthenticationerror(PyHomeSeerError): """ Error Authenticating to HomeSeer """ pass
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def cppHttplib(): http_archive( name="cpp_httplib" , build_file="//bazel/deps/cpp_httplib:build.BUILD" , sha256="1...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def cpp_httplib(): http_archive(name='cpp_httplib', build_file='//bazel/deps/cpp_httplib:build.BUILD', sha256='166103fc4281a438e1f5b9611981f2351ab12136086404895fe5d22e5db3aff5', strip_prefix='cpp-httplib-22615f96828a72d84019b748ede01fa11d905977',...
""" Author: Rayla Kurosaki File: my_colors.py Description: This file returns a list of certain color sets. """ def get_math_colors(): """ Gets the standard mathematics colors. """ black = "#000000" red = "#FF0000" blue = "#0000FF" return [black, red, blue] def get_shades_cyan(): ""...
""" Author: Rayla Kurosaki File: my_colors.py Description: This file returns a list of certain color sets. """ def get_math_colors(): """ Gets the standard mathematics colors. """ black = '#000000' red = '#FF0000' blue = '#0000FF' return [black, red, blue] def get_shades_cyan(): """ ...
class Colour: _MAX = 16**3 - 1 def __init__(self, r: int, g: int, b: int, scl=1): self.r, self.g, self.b = r, g, b self._scl = self._MAX / scl def fmt(self) -> str: """#rrrgggbbb""" return f"#{self._fmt(self.r)}{self._fmt(self.g)}{self._fmt(self.b)}" def _fmt(self, va...
class Colour: _max = 16 ** 3 - 1 def __init__(self, r: int, g: int, b: int, scl=1): (self.r, self.g, self.b) = (r, g, b) self._scl = self._MAX / scl def fmt(self) -> str: """#rrrgggbbb""" return f'#{self._fmt(self.r)}{self._fmt(self.g)}{self._fmt(self.b)}' def _fmt(sel...
""" We know that, after swapping, the length of the continuous 1 will be equal to number of 1 in the data. Let's call it `L`. So what we need to do is sliding window with length L and see what is the max 1 count within the window. The window with max 1 count will need to do minimal swap. Time: O(N) Space: O(1) """ cla...
""" We know that, after swapping, the length of the continuous 1 will be equal to number of 1 in the data. Let's call it `L`. So what we need to do is sliding window with length L and see what is the max 1 count within the window. The window with max 1 count will need to do minimal swap. Time: O(N) Space: O(1) """ cl...
def cipher(text, shift, encrypt=True): """ Encrypts a given input alphabetical text string. Parameters ---------- text : str This is the input text data sent to be ciphered (should be English). shift : int This is the ficed number that each letter is replaced by a letter some fixed...
def cipher(text, shift, encrypt=True): """ Encrypts a given input alphabetical text string. Parameters ---------- text : str This is the input text data sent to be ciphered (should be English). shift : int This is the ficed number that each letter is replaced by a letter some fixed...
''' This problem was asked by Amazon. There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. For example, if N is 4, then there are 5 unique ways: 1, 1, 1, 1 ...
""" This problem was asked by Amazon. There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. For example, if N is 4, then there are 5 unique ways: 1, 1, 1, 1 ...
x, y = 0, 0 def mul(a, b, mod): ans = 0 while b > 0: if b % 2 == 1: ans = (ans + a % mod) % mod a = (a + a) % mod b >>= 1 return ans def exgcd(a, b): global x, y if b == 0: x, y = 1, 0 return a d = exgcd(b, a % b) tmp, x = x, y y ...
(x, y) = (0, 0) def mul(a, b, mod): ans = 0 while b > 0: if b % 2 == 1: ans = (ans + a % mod) % mod a = (a + a) % mod b >>= 1 return ans def exgcd(a, b): global x, y if b == 0: (x, y) = (1, 0) return a d = exgcd(b, a % b) (tmp, x) = (x, y...
# -*- coding: utf-8 -*- __author__ = "Hua777" __copyright__ = "Copyright 2018, Hua777" __version__ = "2.0" __email__ = "liao.700529@gmail.com" class ClassSelect(object): def __init__(self, data): self.Data = data ''' self.Get = array[0] self.Department = array[1] self.Numb...
__author__ = 'Hua777' __copyright__ = 'Copyright 2018, Hua777' __version__ = '2.0' __email__ = 'liao.700529@gmail.com' class Classselect(object): def __init__(self, data): self.Data = data '\n self.Get = array[0]\n self.Department = array[1]\n self.Number = array[2]\n s...
''' Created on 09.10.2017 @author: rustr ''' def read_file_to_string(afile): with file(afile) as f: afile_str = f.read() return afile_str def read_file_to_list(afile): return [line for line in open(afile, "r").readlines()]
""" Created on 09.10.2017 @author: rustr """ def read_file_to_string(afile): with file(afile) as f: afile_str = f.read() return afile_str def read_file_to_list(afile): return [line for line in open(afile, 'r').readlines()]
''' Description: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 s...
""" Description: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 s...
''' @author: cnunezre @Link: https://github.com/cnunezre/deepRacerReinvent @License: N/D ''' def reward_function (on_track, x, y, distance_from_center, car_orientation, progress, steps, throttle, steering, track_width, waypoints, closest_waypoint): reward = 1e-3 if distance_from_center >= 0.0 and...
""" @author: cnunezre @Link: https://github.com/cnunezre/deepRacerReinvent @License: N/D """ def reward_function(on_track, x, y, distance_from_center, car_orientation, progress, steps, throttle, steering, track_width, waypoints, closest_waypoint): reward = 0.001 if distance_from_center >= 0.0 and d...
for i in range(int(input())): s = input() year, month, day = map(int, [s[:4], s[4:6], s[6:]]) answer = -1 if 1 <= month and month <= 12: dayOfMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] if 1 <= day and day <= dayOfMonth[month - 1]: answer = "{}/{}/{}".format(str(...
for i in range(int(input())): s = input() (year, month, day) = map(int, [s[:4], s[4:6], s[6:]]) answer = -1 if 1 <= month and month <= 12: day_of_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] if 1 <= day and day <= dayOfMonth[month - 1]: answer = '{}/{}/{}'.format(...
''' You are working in a ball factory where you have n balls numbered from lowLimit up to highLimit inclusive (i.e., n == highLimit - lowLimit + 1), and an infinite number of boxes numbered from 1 to infinity. Your job at this factory is to put each ball in the box with a number equal to the sum of digits of the bal...
""" You are working in a ball factory where you have n balls numbered from lowLimit up to highLimit inclusive (i.e., n == highLimit - lowLimit + 1), and an infinite number of boxes numbered from 1 to infinity. Your job at this factory is to put each ball in the box with a number equal to the sum of digits of the bal...
class Solution: def tribonacci(self, n: int) -> int: def dp(n: int) -> int: if n == 0: return 0 if n == 1: return 1 if n == 2: return 1 if n not in memo: memo[n] = dp(n-1)+dp(n-2) + dp(n-3) ...
class Solution: def tribonacci(self, n: int) -> int: def dp(n: int) -> int: if n == 0: return 0 if n == 1: return 1 if n == 2: return 1 if n not in memo: memo[n] = dp(n - 1) + dp(n - 2) + dp(n -...
# Converts a set of numbers into a python list with those numbers occurring multiple times # IE: by setting the step size to one, and replacing the percentNum list with [40,60], you # would get an output of 40 1s followed by 60 2s # almost exclusively useful for generating histograms and some other graph types when onl...
output_numbers = [] percent_num = [35, 148, 187, 160, 125, 82, 81, 59, 44, 36, 21, 9, 6, 4, 2] total = 14 step = 1 index_num = 0 count = 0 while indexNum < total: count = percentNum[indexNum] while count > 1: outputNumbers.append(indexNum + 1) count = count - 1 index_num = indexNum + step pr...
class Solution: def sortByBits(self, arr: List[int]) -> List[int]: x={} f=[] if len(set(arr))==1 and len(arr)!=1: return arr for i in arr: x[i]=str(bin(i)[2:]).count('1') for i in set(x.values()): d=[] for m,n in x.items(): ...
class Solution: def sort_by_bits(self, arr: List[int]) -> List[int]: x = {} f = [] if len(set(arr)) == 1 and len(arr) != 1: return arr for i in arr: x[i] = str(bin(i)[2:]).count('1') for i in set(x.values()): d = [] for (m, n) ...
class Data: def __init__(self, a, b): self.testData = a + b
class Data: def __init__(self, a, b): self.testData = a + b
def bubble_sort(alist): for _ in range(len(alist)-1,0,-1): for i in range(_): if alist[i] > alist[i+1]: alist[i+1],alist[i] = alist[i],alist[i+1] return alist alist = [10,2,3,11,23,0,1,4] print(bubble_sort(alist))
def bubble_sort(alist): for _ in range(len(alist) - 1, 0, -1): for i in range(_): if alist[i] > alist[i + 1]: (alist[i + 1], alist[i]) = (alist[i], alist[i + 1]) return alist alist = [10, 2, 3, 11, 23, 0, 1, 4] print(bubble_sort(alist))
class Controller: def __init__(self): pass def key_press(self, event): pass def key_release(self, event): pass def update(self): pass def receive_joy(self, event): pass
class Controller: def __init__(self): pass def key_press(self, event): pass def key_release(self, event): pass def update(self): pass def receive_joy(self, event): pass
class Solution: def maxDiff(self, number: int) -> int: number_as_string = str(number) size = len(number_as_string) larger_number = str(number_as_string) for i in range(size): digit = number_as_string[i] if digit < "9": larger_number = larger_nu...
class Solution: def max_diff(self, number: int) -> int: number_as_string = str(number) size = len(number_as_string) larger_number = str(number_as_string) for i in range(size): digit = number_as_string[i] if digit < '9': larger_number = larger_...
# Time: O(n^4) # Space: O(n^3) class Solution(object): # @return a boolean def isScramble(self, s1, s2): if not s1 or not s2 or len(s1) != len(s2): return False if s1 == s2: return True result = [[[False for j in xrange(len(s2))] for i in xrange(len(s1...
class Solution(object): def is_scramble(self, s1, s2): if not s1 or not s2 or len(s1) != len(s2): return False if s1 == s2: return True result = [[[False for j in xrange(len(s2))] for i in xrange(len(s1))] for n in xrange(len(s1) + 1)] for i in xrange(len(s1)...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Loyalty Program', 'version': '1.0', 'category': 'Point of Sale', 'sequence': 6, 'summary': 'Loyalty Program for the Point of Sale ', 'description': """ This module allows you to defin...
{'name': 'Loyalty Program', 'version': '1.0', 'category': 'Point of Sale', 'sequence': 6, 'summary': 'Loyalty Program for the Point of Sale ', 'description': '\n\nThis module allows you to define a loyalty program in\nthe point of sale, where the customers earn loyalty points\nand get rewards.\n\n', 'depends': ['point_...
a, b, c = sorted([int(x) for x in input().split()]) left = a * a + b * b right = c * c print(a, b, c) if a+b > c: if left > right: print('Acute') elif left == right: print('Right') else: print('Obtuse') else: print('No')
(a, b, c) = sorted([int(x) for x in input().split()]) left = a * a + b * b right = c * c print(a, b, c) if a + b > c: if left > right: print('Acute') elif left == right: print('Right') else: print('Obtuse') else: print('No')
def readAI(ch): if 7<=ch<=0: raise Exeption('MCP3208 channel must be 0-7: ' + str(ch)) cmd = 128 cmd += 64 cmd += ((ch & 0x07) << 3) ret = spi.xfer2([cmd, 0x0, 0x0]) val = (ret[0] & 0x01) <<11 val |=ret[1]<<3 val |=ret[2]>>5 return (val & 0x0FFF)
def read_ai(ch): if 7 <= ch <= 0: raise exeption('MCP3208 channel must be 0-7: ' + str(ch)) cmd = 128 cmd += 64 cmd += (ch & 7) << 3 ret = spi.xfer2([cmd, 0, 0]) val = (ret[0] & 1) << 11 val |= ret[1] << 3 val |= ret[2] >> 5 return val & 4095
num1 = input() num2 = input() print(num1+num2)
num1 = input() num2 = input() print(num1 + num2)
# Word Pattern 290 # ttungl@gmail.com class Solution(object): def wordPattern(self, pattern, str): """ :type pattern: str :type str: str :rtype: bool """ # sol 1 s = pattern t = str.split() return map(s.find, s)==map(t.index, t) ...
class Solution(object): def word_pattern(self, pattern, str): """ :type pattern: str :type str: str :rtype: bool """ s = pattern t = str.split() return map(s.find, s) == map(t.index, t) s = pattern t = str.split() return len(se...
"""**TODO** .. autosummary:: :toctree: Ord """ class Ord(): """**TODO**"""
"""**TODO** .. autosummary:: :toctree: Ord """ class Ord: """**TODO**"""
__author__ = "Nicolas Delplanque" __credits__ = ["Nicolas Delplanque"] __version__ = "1.0.1" __maintainer__ = "Nicolas Delplanque" __email__ = "nicolas.delplanque@student.umons.ac.be" class Ope: pass
__author__ = 'Nicolas Delplanque' __credits__ = ['Nicolas Delplanque'] __version__ = '1.0.1' __maintainer__ = 'Nicolas Delplanque' __email__ = 'nicolas.delplanque@student.umons.ac.be' class Ope: pass
""" Module to handle data operations for freqtrade """ # limit what's imported when using `from freqtrade.data import *` __all__ = [ 'converter' ]
""" Module to handle data operations for freqtrade """ __all__ = ['converter']
#Maze 2020 history module prev_driven = [] prev_tile = [] def add_driven(new): prev_driven.append(new) def add_tile(new): prev_tile.append(new) def get_last_drive(): return prev_driven[-1] def get_last_tile(): return prev_tile[-1]
prev_driven = [] prev_tile = [] def add_driven(new): prev_driven.append(new) def add_tile(new): prev_tile.append(new) def get_last_drive(): return prev_driven[-1] def get_last_tile(): return prev_tile[-1]
pytest_plugins = ['errbot.backends.test'] extra_plugin_dir = 'plugins' def test_cloudcv_lowercase(testbot): testbot.assertCommand('what is cloudcv?', 'cloudcv is always written with a lower case c') def test_cep(testbot): testbot.assertCommand('what is a CEP?', ...
pytest_plugins = ['errbot.backends.test'] extra_plugin_dir = 'plugins' def test_cloudcv_lowercase(testbot): testbot.assertCommand('what is cloudcv?', 'cloudcv is always written with a lower case c') def test_cep(testbot): testbot.assertCommand('what is a CEP?', 'cEP is always written with a lower case c')
helpstring = "part <channel>" minlevel = 4 arguments = ["self", "args"] def main(connection, args) : """Parts from the specifed channel""" connection.rawsend("PART %s \n" % (args[1]))
helpstring = 'part <channel>' minlevel = 4 arguments = ['self', 'args'] def main(connection, args): """Parts from the specifed channel""" connection.rawsend('PART %s \n' % args[1])
''' Created on 1.12.2016 @author: Darren '''''' Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). The above rectangle (with the red border) is defined by (row1, col1) = (2, 1) and (row2, col2) =...
""" Created on 1.12.2016 @author: Darren Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). The above rectangle (with the red border) is defined by (row1, col1) = (2, 1) and (row2, col2) = (4, 3), which ...
class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items) - 1] def size(self): ...
class Stack: def __init__(self): self.items = [] def is_empty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items) - 1] def size(self): ...
num = 10 num3 = 20 num2 = 20 num4 = 50 num5 =100 num7 = 10000
num = 10 num3 = 20 num2 = 20 num4 = 50 num5 = 100 num7 = 10000
# Cell if __name__ == "__main__" and not IN_NOTEBOOK: args = parse_args(sys.argv[1:]) config = {} if args.config: with open(args.config) as f: config.update(json.load(f)) hparams = HParams(**config) if hparams.data_sub == None: positions, randomindices = subset_data(hp...
if __name__ == '__main__' and (not IN_NOTEBOOK): args = parse_args(sys.argv[1:]) config = {} if args.config: with open(args.config) as f: config.update(json.load(f)) hparams = h_params(**config) if hparams.data_sub == None: (positions, randomindices) = subset_data(hparams...
# Deaarrollo de funciones def digit(a): if a == '0' or a == '1' or a == '2' or a == '3' or a == '4' or a == '5' or a == '6' or a == '7' or a == '8' or a == '9': return True else: return False def main(): # Entrada while True: letter = input('Ingrese un caracter: ') if le...
def digit(a): if a == '0' or a == '1' or a == '2' or (a == '3') or (a == '4') or (a == '5') or (a == '6') or (a == '7') or (a == '8') or (a == '9'): return True else: return False def main(): while True: letter = input('Ingrese un caracter: ') if len(letter) < 2: ...
""" http://adventofcode.com/2017/day/5 """ def escapeMaze(numList): count = 1 instructions = numList[:] currentPos = 0 currentJump = instructions[currentPos] nextPos = currentPos+currentJump while ((currentPos>=0) & (currentPos<len(numList))): instructions[currentPos]+=1 #update jump ...
""" http://adventofcode.com/2017/day/5 """ def escape_maze(numList): count = 1 instructions = numList[:] current_pos = 0 current_jump = instructions[currentPos] next_pos = currentPos + currentJump while (currentPos >= 0) & (currentPos < len(numList)): instructions[currentPos] += 1 ...
class Solution: def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]: dic = {} # First we add all people into dictionary where key will be the group size. for i in range(len(groupSizes)): if groupSizes[i] in dic: dic[groupSizes[i]].append(i) ...
class Solution: def group_the_people(self, groupSizes: List[int]) -> List[List[int]]: dic = {} for i in range(len(groupSizes)): if groupSizes[i] in dic: dic[groupSizes[i]].append(i) else: dic[groupSizes[i]] = [i] res = [] print...
lines = [li for li in open("input.txt").read().split()] # apparently readlines() was not working ok then pos = [0, 0] trees = 0 while pos[0] < len(lines): if lines[pos[0]][pos[1]] == "#": trees += 1 pos[0] += 1 pos[1] = (pos[1] + 3) % len(lines[0]) print(trees)
lines = [li for li in open('input.txt').read().split()] pos = [0, 0] trees = 0 while pos[0] < len(lines): if lines[pos[0]][pos[1]] == '#': trees += 1 pos[0] += 1 pos[1] = (pos[1] + 3) % len(lines[0]) print(trees)
class TwoDArray(object): """ A class representing a 2D array. The first index is the row number, and the second is the column number. """ def __init__(self, dimensions, oned_list=None): """ Initialize the 2D array. dimensions should be a tuple with the number of rows a...
class Twodarray(object): """ A class representing a 2D array. The first index is the row number, and the second is the column number. """ def __init__(self, dimensions, oned_list=None): """ Initialize the 2D array. dimensions should be a tuple with the number of rows and the...
DEBUG = True THREADS_PER_PAGE = 2 CSRF_ENABLED = True DB_URL = 'http://localhost:5984' GOOGLE_OAUTH2_SCOPE = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email' GOOGLE_OAUTH2_URL = 'https://accounts.google.com/o/oauth2/' GOOGLE_API_URL = 'https://www.googleapis.com/oauth...
debug = True threads_per_page = 2 csrf_enabled = True db_url = 'http://localhost:5984' google_oauth2_scope = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email' google_oauth2_url = 'https://accounts.google.com/o/oauth2/' google_api_url = 'https://www.googleapis.com/oauth2/v...
''' Create a game rank from a win-loss record Status: Accepted ''' ############################################################################### def main(): """Read input and print output""" rank_stars = [5] * 11 + [4] * 5 + [3] * 5 + [2] * 5 rank, stars, last3 = 25, 0, '' for game in input(): ...
""" Create a game rank from a win-loss record Status: Accepted """ def main(): """Read input and print output""" rank_stars = [5] * 11 + [4] * 5 + [3] * 5 + [2] * 5 (rank, stars, last3) = (25, 0, '') for game in input(): if rank: last3 = (last3 + game)[-3:] if game == '...
x = 1 def __dir__(): return ['a', 'b', 'c'] def __getattr__(name): if name == "yolo": raise AttributeError("Deprecated, use whatever instead") return f"There is {name}" y = 2
x = 1 def __dir__(): return ['a', 'b', 'c'] def __getattr__(name): if name == 'yolo': raise attribute_error('Deprecated, use whatever instead') return f'There is {name}' y = 2
TYPE_WEIGHTS = [5 * 10 ** 17, 2 * 10 ** 18] GAUGE_WEIGHTS = [2 * 10 ** 18, 10 ** 18, 5 * 10 ** 17] def test_total_weight(accounts, chain, gauge_controller, three_gauges): gauge_controller.add_gauge(three_gauges[0], 0, GAUGE_WEIGHTS[0], {'from': accounts[0]}) assert gauge_controller.get_total_weight() == (G...
type_weights = [5 * 10 ** 17, 2 * 10 ** 18] gauge_weights = [2 * 10 ** 18, 10 ** 18, 5 * 10 ** 17] def test_total_weight(accounts, chain, gauge_controller, three_gauges): gauge_controller.add_gauge(three_gauges[0], 0, GAUGE_WEIGHTS[0], {'from': accounts[0]}) assert gauge_controller.get_total_weight() == GAUGE_...
class Solution: def searchMatrix(self, matrix, target) -> bool: m, n = len(matrix), len(matrix[0]) if len(matrix) > 0 else 0 if m == 0: return False i, j = m - 1, 0 while i >= 0 and j < n and matrix[i][j] != target: if matrix[i][j] > target: i ...
class Solution: def search_matrix(self, matrix, target) -> bool: (m, n) = (len(matrix), len(matrix[0]) if len(matrix) > 0 else 0) if m == 0: return False (i, j) = (m - 1, 0) while i >= 0 and j < n and (matrix[i][j] != target): if matrix[i][j] > target: ...
class Display: def __init__(self, width=1, height=1): self.grid = [] if width < 1 or height < 1: raise Exception('width and height must both be > 0') self.width = width self.height = height for y in range(height): row = [] for x in range...
class Display: def __init__(self, width=1, height=1): self.grid = [] if width < 1 or height < 1: raise exception('width and height must both be > 0') self.width = width self.height = height for y in range(height): row = [] for x in range(w...
class node: def __init__(self, id, heuristic, f): self.id=id self.heuristic=heuristic self.totalCost=0 self.f=f self.parent=None def setParent(self,parent): self.parent=parent def __lt__(self, other): return self.f < other.f def __repr__(self): ...
class Node: def __init__(self, id, heuristic, f): self.id = id self.heuristic = heuristic self.totalCost = 0 self.f = f self.parent = None def set_parent(self, parent): self.parent = parent def __lt__(self, other): return self.f < other.f def _...
# i=1 # while i<=100: # print(i) # i=i+1 i=1 while i<=100: if i%5==0 and i%15==0: print("navgur") elif i%5==0: print(i,"nav") elif i%15==0: print(i,"gurkul") i=i+1
i = 1 while i <= 100: if i % 5 == 0 and i % 15 == 0: print('navgur') elif i % 5 == 0: print(i, 'nav') elif i % 15 == 0: print(i, 'gurkul') i = i + 1
""" Greater Common Divisor. Wikipedia reference: https://en.wikipedia.org/wiki/Greatest_common_divisor """ def gcd(a, b): """Calculate Greater Common Divisor (GCD).""" return b if a == 0 else gcd(b % a, a) def main(): """Call GCD Function.""" try: nums = input("Enter two Integers separated ...
""" Greater Common Divisor. Wikipedia reference: https://en.wikipedia.org/wiki/Greatest_common_divisor """ def gcd(a, b): """Calculate Greater Common Divisor (GCD).""" return b if a == 0 else gcd(b % a, a) def main(): """Call GCD Function.""" try: nums = input('Enter two Integers separated by...
DATA = [ { "Url": "http://actransit.org/stops-closed-bancroft-at-dana-and-ellsworth", "NoticeText": "Due to construction, lines 6, 36, 51B, 52, 79, 604, 605, 851 ", "Title": "Stops Closed Bancroft at Dana and Ellsworth", "PostDate": "2019-05-31T16:10:01", "ImpactedRoutes": [ ...
data = [{'Url': 'http://actransit.org/stops-closed-bancroft-at-dana-and-ellsworth', 'NoticeText': 'Due to construction, lines 6, 36, 51B, 52, 79, 604, 605, 851 ', 'Title': 'Stops Closed Bancroft at Dana and Ellsworth', 'PostDate': '2019-05-31T16:10:01', 'ImpactedRoutes': ['36', '51B', '52', '6', '604', '605', '79', '85...
# Time: O(n * 4^n) # Space: O(n) class Solution(object): # @return a list of strings, [s1, s2] def letterCombinations(self, digits): if not digits: return [] lookup, result = ["", "", "abc", "def", "ghi", "jkl", "mno", \ "pqrs", "tuv", "wxyz"], ...
class Solution(object): def letter_combinations(self, digits): if not digits: return [] (lookup, result) = (['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'], ['']) for digit in reversed(digits): choices = lookup[int(digit)] (m, n) = (len...
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class Dbow2(CMakePackage): """DBoW2 is an improved version of the DBow library, an open source C++ library for in...
class Dbow2(CMakePackage): """DBoW2 is an improved version of the DBow library, an open source C++ library for indexing and converting images into a bag-of-word representation.""" homepage = 'https://github.com/dorian3d/DBoW2' git = 'https://github.com/dorian3d/DBoW2.git' version('master', branc...
# Affine Cipher def egcd(a, b): x,y,u,v = 0,1,1,0 while a!=0: q, r = b//a, b%a m, n = x-u*q, y-v*q b,a, x,y, u,v = a,r, u,v, m,n gcd = b return gcd, x, y def modinv(a, m): gcd, x, y = egcd(a, m) if gcd != 1: return None # modular inverse does ...
def egcd(a, b): (x, y, u, v) = (0, 1, 1, 0) while a != 0: (q, r) = (b // a, b % a) (m, n) = (x - u * q, y - v * q) (b, a, x, y, u, v) = (a, r, u, v, m, n) gcd = b return (gcd, x, y) def modinv(a, m): (gcd, x, y) = egcd(a, m) if gcd != 1: return None else:...
class BaseError(Exception): pass class UnauthorizedError(BaseError): pass class WrongFormatInputError(BaseError): pass class ContactsLimitExceededError(BaseError): pass
class Baseerror(Exception): pass class Unauthorizederror(BaseError): pass class Wrongformatinputerror(BaseError): pass class Contactslimitexceedederror(BaseError): pass
"""Constants for Bravia TV integration.""" ATTR_CID = "cid" ATTR_MAC = "macAddr" ATTR_MANUFACTURER = "Sony" ATTR_MODEL = "model" CONF_IGNORED_SOURCES = "ignored_sources" BRAVIA_COORDINATOR = "bravia_coordinator" BRAVIA_CONFIG_FILE = "bravia.conf" CLIENTID_PREFIX = "HomeAssistant" DEFAULT_NAME = f"{ATTR_MANUFACTURER} ...
"""Constants for Bravia TV integration.""" attr_cid = 'cid' attr_mac = 'macAddr' attr_manufacturer = 'Sony' attr_model = 'model' conf_ignored_sources = 'ignored_sources' bravia_coordinator = 'bravia_coordinator' bravia_config_file = 'bravia.conf' clientid_prefix = 'HomeAssistant' default_name = f'{ATTR_MANUFACTURER} Br...
def jp(input, d, n): tmp = [] for s in input: try: tmp.append([helper(s, d)]) except: pass input = tmp while True: hasChanged = False res = [] for l1 in input: flag = False for l2 in res: if check(l1,...
def jp(input, d, n): tmp = [] for s in input: try: tmp.append([helper(s, d)]) except: pass input = tmp while True: has_changed = False res = [] for l1 in input: flag = False for l2 in res: if check(l1...
""" Vision manager. """ class VisionManager: """ Keeps track of vision components """ def __init__(self): # Map of bot name and its location. self.locations = {} # How many bots are registered via vision system. self.counter = 0 def update_location(self, bot_name, ...
""" Vision manager. """ class Visionmanager: """ Keeps track of vision components """ def __init__(self): self.locations = {} self.counter = 0 def update_location(self, bot_name, loc_info): """ Updates the location of a given bot with the location information. ...
# Given an integer, write a function to determine if it is a power of two. # Example 1: # Input: 1 # Output: true # Explanation: 20 = 1 # Example 2: # Input: 16 # Output: true # Explanation: 24 = 16 # Example 3: # Input: 218 # Output: false class Solution: def isPowerOfTwo(self, n): """ :typ...
class Solution: def is_power_of_two(self, n): """ :type n: int :rtype: bool """ if n <= 0: return False while n > 1: if n & 1: return False n >>= 1 return True
tasks = { 'calclib' : { 'features' : 'cshlib', 'source' : 'calclib/**/*.c', 'ver-num' : '1.2.4', }, 'printlib' : { 'features' : 'cstlib', 'source' : 'printlib/**/*.c', 'configure' : [ dict(do = 'check-headers', names = 'stdio.h'), ], ...
tasks = {'calclib': {'features': 'cshlib', 'source': 'calclib/**/*.c', 'ver-num': '1.2.4'}, 'printlib': {'features': 'cstlib', 'source': 'printlib/**/*.c', 'configure': [dict(do='check-headers', names='stdio.h')]}} buildtypes = {'debug': {'cflags.select': {'default': '-fPIC -O0 -g', 'msvc': '/Od'}}, 'release': {'cflags...
# -*- config:utf-8 -*- DEBUG = True TESTING = False
debug = True testing = False
# -*- coding: utf-8 -*- """ ytelapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Status1Enum(object): """Implementation of the 'Status1' enum. Status to set the in-progress call to Attributes: CANCELED: TODO: type description ...
""" ytelapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Status1Enum(object): """Implementation of the 'Status1' enum. Status to set the in-progress call to Attributes: CANCELED: TODO: type description here. COMPLETED: TODO: type descr...
# ====================================================================== # Program Alarm # Advent of Code 2019 Day 02 -- Eric Wastl -- https://adventofcode.com # # Computer simulation by Dr. Dean Earl Wright III # ====================================================================== # =======================...
"""Computer Row for Program Alarm problem for Advent of Code 2018 Day 02""" stop_hlt = 0 stop_op1 = 1 stop_op2 = 2 stop_op3 = 3 stop_bad = 4 stop_xpc = 5 stop_run = 6 stop_stp = 7 op_add = 1 op_mul = 2 op_hlt = 99 opcodes = set([OP_ADD, OP_MUL, OP_HLT]) addr_rslt = 0 addr_noun = 1 addr_verb = 2 class Intcode: """O...
description = 'Detector stage' pvprefix = 'SQ:AMOR:motserial:' devices = dict( com = device('nicos_ess.devices.epics.motor.EpicsMotor', description = 'Detector tilt', motorpv = pvprefix + 'com', errormsgpv = pvprefix + 'com-MsgTxt', ), coz = device('nicos_ess.devices.epics.motor.Ep...
description = 'Detector stage' pvprefix = 'SQ:AMOR:motserial:' devices = dict(com=device('nicos_ess.devices.epics.motor.EpicsMotor', description='Detector tilt', motorpv=pvprefix + 'com', errormsgpv=pvprefix + 'com-MsgTxt'), coz=device('nicos_ess.devices.epics.motor.EpicsMotor', description='Detector height', motorpv=p...
def solve(): n = int(input()) ans = [[0] * 10 for _ in range(n)] ans[0][1:] = [1] * 9 for i in range(1, n): ans[i][0] = ans[i - 1][1] for j in range(1, 9): ans[i][j] = ans[i - 1][j - 1] + ans[i - 1][j + 1] ans[i][9] = ans[i - 1][8] print(sum(ans[-1]) % 1000000000)...
def solve(): n = int(input()) ans = [[0] * 10 for _ in range(n)] ans[0][1:] = [1] * 9 for i in range(1, n): ans[i][0] = ans[i - 1][1] for j in range(1, 9): ans[i][j] = ans[i - 1][j - 1] + ans[i - 1][j + 1] ans[i][9] = ans[i - 1][8] print(sum(ans[-1]) % 1000000000)...
# Python3 def chessKnight(cell): col, row = ord(cell[0]) - ord('a'), int(cell[1]) - 1 count = 0 for c, r in [(-1, 2), (1, 2), (-1, -2), (1, -2), (-2, 1), (2, 1), (-2, -1), (2, -1)]: if 0 <= (col + c) < 8 and 0 <= (row + r) < 8: count += 1 return count
def chess_knight(cell): (col, row) = (ord(cell[0]) - ord('a'), int(cell[1]) - 1) count = 0 for (c, r) in [(-1, 2), (1, 2), (-1, -2), (1, -2), (-2, 1), (2, 1), (-2, -1), (2, -1)]: if 0 <= col + c < 8 and 0 <= row + r < 8: count += 1 return count
n = int(input("Digite o valor de n: ")) impar = 1 i = 1 while i <= n: print(impar) impar = impar + 2 i = i + 1
n = int(input('Digite o valor de n: ')) impar = 1 i = 1 while i <= n: print(impar) impar = impar + 2 i = i + 1
def subarraySort(array): minUnsorted = float("inf") maxUnsorted = float("-inf") for i in range(len(array)): num = array[i] if isUnsorted(i, num, array): minUnsorted = min(minUnsorted, num) maxUnsorted = max(maxUnsorted, num) if minUnsorted == float("inf") or maxUn...
def subarray_sort(array): min_unsorted = float('inf') max_unsorted = float('-inf') for i in range(len(array)): num = array[i] if is_unsorted(i, num, array): min_unsorted = min(minUnsorted, num) max_unsorted = max(maxUnsorted, num) if minUnsorted == float('inf') or...
num=int(input("enter the number :")) i=1 n={} while i<=num: square=i**2 n[i]=square i=i+1 print(n)
num = int(input('enter the number :')) i = 1 n = {} while i <= num: square = i ** 2 n[i] = square i = i + 1 print(n)
def index_is_in_range(index, length): return 0 <= index < lenght tanks = input().split(", ") commands_count = int(input()) for _ in range(commands_count): args = input().split(", ") command = args[0] if command == "Add": tank_name = args[1] if tank_name in tanks: print('T...
def index_is_in_range(index, length): return 0 <= index < lenght tanks = input().split(', ') commands_count = int(input()) for _ in range(commands_count): args = input().split(', ') command = args[0] if command == 'Add': tank_name = args[1] if tank_name in tanks: print('Tank ...
# # PySNMP MIB module ENLOGIC-PDU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENLOGIC-PDU-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:03:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
class Solution: def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ jump_table = {} def deepJump(idx): # if have already jumping if jump_table.get(str(idx), False) == False: jump_table[str(idx)] = True ...
class Solution: def can_jump(self, nums): """ :type nums: List[int] :rtype: bool """ jump_table = {} def deep_jump(idx): if jump_table.get(str(idx), False) == False: jump_table[str(idx)] = True else: return Fal...
# -*- coding: utf-8 -*- class ShiftType(object): def __init__(self, name, time, not_followed_by): self.name = name self.time = time self.not_followed_by = not_followed_by self.cover_requirements = [] def can_follow(self, shift): return self.name not in shift.not_followe...
class Shifttype(object): def __init__(self, name, time, not_followed_by): self.name = name self.time = time self.not_followed_by = not_followed_by self.cover_requirements = [] def can_follow(self, shift): return self.name not in shift.not_followed_by def can_be_fol...
# Query modes ASYNC_QUERY = 'broker' TALARIA_INDEXER = 'indexer' TALARIA_SERVER = 'server' ASYNC_INITIALIZED = 'INITIALIZED' ASYNC_RUNNING = 'RUNNING' ASYNC_COMPLETE = 'COMPLETE' ASYNC_FAILED = 'FAILED' TALARIA_KEY = 'talaria' TALARIA_SERVICE = 'talaria' # Talaria task filters ALL_LEADERS = 'ALL' WAITING_LEADERS =...
async_query = 'broker' talaria_indexer = 'indexer' talaria_server = 'server' async_initialized = 'INITIALIZED' async_running = 'RUNNING' async_complete = 'COMPLETE' async_failed = 'FAILED' talaria_key = 'talaria' talaria_service = 'talaria' all_leaders = 'ALL' waiting_leaders = 'WAITING' running_leadrers = 'RUNNING' co...
# model model = Model() start = Input("start", "TENSOR_FLOAT32", "{}") limit = Input("limit", "TENSOR_FLOAT32", "{}") delta = Input("delta", "TENSOR_FLOAT32", "{}") out = Output("output", "TENSOR_FLOAT32", "{8}") model = model.Operation("RANGE_EX", start, limit, delta).To(out) input0 = {start: [1], limit...
model = model() start = input('start', 'TENSOR_FLOAT32', '{}') limit = input('limit', 'TENSOR_FLOAT32', '{}') delta = input('delta', 'TENSOR_FLOAT32', '{}') out = output('output', 'TENSOR_FLOAT32', '{8}') model = model.Operation('RANGE_EX', start, limit, delta).To(out) input0 = {start: [1], limit: [5], delta: [0.5]} ou...
# calculate body mass in squared metres # weight 65 # height 180 # bmi 20.06 weight = float(input("weight in kg ")) height = float(input("height in cm ")) # bmi = weight / height # bmi - kg / m2 heightsquare = (height * height) # to calulate heightsqaure multiply height by height bmi = round(weight / heightsquar...
weight = float(input('weight in kg ')) height = float(input('height in cm ')) heightsquare = height * height bmi = round(weight / heightsquare, 6) bmi2 = bmi * 10000 print('Your BMI is', bmi2)
# Worked out from https://raganwald.com/2017/04/30/transducers.html # JS -> Python conversion. def reduceWith(reducer, seed, iterable): """ reduceWith takes reducer as first argument, computes a reduction over iterable. Think foldl from Haskell. reducer is (b -> a -> b) Seed is b iterable is [a...
def reduce_with(reducer, seed, iterable): """ reduceWith takes reducer as first argument, computes a reduction over iterable. Think foldl from Haskell. reducer is (b -> a -> b) Seed is b iterable is [a] reduceWith is (b -> a -> b) -> b -> [a] -> b """ accumulation = seed for valu...
class Solution: def fullJustify(self, words: List[str], maxWidth: int) -> List[str]: count, cur_words = 0, [] res = [] for word in words: if count+ len(word) + len(cur_words) > maxWidth: spaces = maxWidth - count if len(cur_words) == 1: ...
class Solution: def full_justify(self, words: List[str], maxWidth: int) -> List[str]: (count, cur_words) = (0, []) res = [] for word in words: if count + len(word) + len(cur_words) > maxWidth: spaces = maxWidth - count if len(cur_words) == 1: ...
# # PySNMP MIB module Nortel-Magellan-Passport-PorsTrunksMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-PorsTrunksMIB # Produced by pysmi-0.3.4 at Wed May 1 14:28:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ...