content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- """ Created on Fri Jun 12 17:44:11 2020 @author: Ashish """ x = int ( input("Enter a number: ")) y = int ( input("Enter a number: ")) n = int ( input("Enter a number: ")) print ([[ i, j] for i in range( x + 1) for j in range( y + 1) if ( ( i + j ) != n )])
""" Created on Fri Jun 12 17:44:11 2020 @author: Ashish """ x = int(input('Enter a number: ')) y = int(input('Enter a number: ')) n = int(input('Enter a number: ')) print([[i, j] for i in range(x + 1) for j in range(y + 1) if i + j != n])
_base_ = ["../../_base_/gdrn_base.py"] OUTPUT_DIR = "output/gdrn_selfocc/lm/mm_r50v1d_a6_cPnP_GN_gelu_lm13" INPUT = dict( DZI_PAD_SCALE=1.5, COLOR_AUG_PROB=0.0, COLOR_AUG_TYPE="code", COLOR_AUG_CODE=( "Sequential([" "Sometimes(0.4, CoarseDropout( p=0.1, size_percent=0.05) )," # ...
_base_ = ['../../_base_/gdrn_base.py'] output_dir = 'output/gdrn_selfocc/lm/mm_r50v1d_a6_cPnP_GN_gelu_lm13' input = dict(DZI_PAD_SCALE=1.5, COLOR_AUG_PROB=0.0, COLOR_AUG_TYPE='code', COLOR_AUG_CODE='Sequential([Sometimes(0.4, CoarseDropout( p=0.1, size_percent=0.05) ),Sometimes(0.5, GaussianBlur(np.random.rand())),Some...
N,K=map(int,input().split()) x=list(map(int,input().split())) n=N-K+1 left=[0]*n for i in range(n):left[i]=abs(x[i])+abs(x[i]-x[i+K-1]) x=x[::-1] right=[0]*n for i in range(n):right[i]=abs(x[i])+abs(x[i]-x[i+K-1]) print(min(min(left),min(right)))
(n, k) = map(int, input().split()) x = list(map(int, input().split())) n = N - K + 1 left = [0] * n for i in range(n): left[i] = abs(x[i]) + abs(x[i] - x[i + K - 1]) x = x[::-1] right = [0] * n for i in range(n): right[i] = abs(x[i]) + abs(x[i] - x[i + K - 1]) print(min(min(left), min(right)))
''' Created on Mar 13, 2021 @author: mballance ''' print("SystemVerilog generator")
""" Created on Mar 13, 2021 @author: mballance """ print('SystemVerilog generator')
def reverse_print_for(word): reversed_word = '' for letter in reversed(word): reversed_word += letter print(reversed_word) reverse_print_for('banannafor') def reverse_print(word): print(word[::-1]) reverse_print('bananna') def is_palindrome(sequence): return sequence.lower() == sequence[...
def reverse_print_for(word): reversed_word = '' for letter in reversed(word): reversed_word += letter print(reversed_word) reverse_print_for('banannafor') def reverse_print(word): print(word[::-1]) reverse_print('bananna') def is_palindrome(sequence): return sequence.lower() == sequence[::...
def calc_combinations(names, n, combs=[]): if len(combs) == n: print(", ".join(combs)) for i in range(len(names)): name = names[i] combs.append(name) calc_combinations(names[i+1:], n, combs) combs.pop() names = input().split(", ") n = int(input()) calc_combinations(...
def calc_combinations(names, n, combs=[]): if len(combs) == n: print(', '.join(combs)) for i in range(len(names)): name = names[i] combs.append(name) calc_combinations(names[i + 1:], n, combs) combs.pop() names = input().split(', ') n = int(input()) calc_combinations(name...
#! /usr/bin/python3 def partOne(arr): timeStamp = int(arr[0]) busses = [] tmp = [x for x in arr[1].split(',')] for x in tmp: if x != 'x': busses.append(int(x)) maxTime = max(busses) calculateTimeStamp = timeStamp + maxTime # shortest waittime ? # find bus near timest...
def part_one(arr): time_stamp = int(arr[0]) busses = [] tmp = [x for x in arr[1].split(',')] for x in tmp: if x != 'x': busses.append(int(x)) max_time = max(busses) calculate_time_stamp = timeStamp + maxTime busses.sort() sol = {} keys = [] for y in busses: ...
def main(request, response): if b'mime' in request.GET: return [(b'Content-Type', request.GET[b'mime'])], b"" return [], b""
def main(request, response): if b'mime' in request.GET: return ([(b'Content-Type', request.GET[b'mime'])], b'') return ([], b'')
#!/usr/bin/env python """Interface for packaging""" __author__ = 'edelman@room77.com (Nicholas Edelman)' __copyright__ = 'Copyright 2013 Room77, Inc.' class PkgRulesInterface(object): """Base class for making packages""" @classmethod def make_package(cls, rule): """Generates a package Args: rule:...
"""Interface for packaging""" __author__ = 'edelman@room77.com (Nicholas Edelman)' __copyright__ = 'Copyright 2013 Room77, Inc.' class Pkgrulesinterface(object): """Base class for making packages""" @classmethod def make_package(cls, rule): """Generates a package Args: rule: rule to gene...
N = int(input()) if -(2 ** 31) <= N < 2 ** 31: print("Yes") else: print("No")
n = int(input()) if -2 ** 31 <= N < 2 ** 31: print('Yes') else: print('No')
def motif_and_its_rev_comp_counter(motif, sample): counter_of_motif = 0 counter_of_res_comp_motif = 0 for i in range(len(sample)): if sample.startswith(motif, i): counter_of_motif += 1 comp_pairs = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'} rev_comp_of_motif = '' for i in moti...
def motif_and_its_rev_comp_counter(motif, sample): counter_of_motif = 0 counter_of_res_comp_motif = 0 for i in range(len(sample)): if sample.startswith(motif, i): counter_of_motif += 1 comp_pairs = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'} rev_comp_of_motif = '' for i in motif...
""" Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ACE" is a subsequen...
""" Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ACE" is a subsequen...
#!/usr/bin/env python3 # coding: utf8 if __name__ == "__main__": pass
if __name__ == '__main__': pass
def piece_wise_linear_fn(x, y_0,y_1,x_0,x_1): ''' This fn computes y_0 + (y_1 - y_0)/(x_1-x_0)*(x - x_0), i.e. a fn with offset y_0 and slope (y_1 - y_0)/(x_1-x_0) before x_0 the value is returned as y_0 after x_1 the value is returned as y_1 :param y_0: :param y_1: :param x_0: :para...
def piece_wise_linear_fn(x, y_0, y_1, x_0, x_1): """ This fn computes y_0 + (y_1 - y_0)/(x_1-x_0)*(x - x_0), i.e. a fn with offset y_0 and slope (y_1 - y_0)/(x_1-x_0) before x_0 the value is returned as y_0 after x_1 the value is returned as y_1 :param y_0: :param y_1: :param x_0: :p...
class Solution: """ @param nums: a list of integers @param m: an integer @return: return a integer """ def splitArray(self, nums, m): # write your code here start, end = max(nums), sum(nums) def doable(target): count = 1 sum = 0 for num...
class Solution: """ @param nums: a list of integers @param m: an integer @return: return a integer """ def split_array(self, nums, m): (start, end) = (max(nums), sum(nums)) def doable(target): count = 1 sum = 0 for num in nums: ...
# # PySNMP MIB module Nortel-Magellan-Passport-VnsMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-VnsMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:19:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pytho...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
def selection_sort(ar): n = len(ar) for k in range(n): minimal = k for j in range(k + 1, n): if ar[j] < ar[minimal]: minimal = j print(k, j, minimal, ar) ar[k], ar[minimal] = ar[minimal], ar[k] return ar ar = [1, 5, 2, 7, 9, 6] res = sele...
def selection_sort(ar): n = len(ar) for k in range(n): minimal = k for j in range(k + 1, n): if ar[j] < ar[minimal]: minimal = j print(k, j, minimal, ar) (ar[k], ar[minimal]) = (ar[minimal], ar[k]) return ar ar = [1, 5, 2, 7, 9, 6] res = se...
# coding = utf-8 vis_js_template = """ <html> <head> <script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,...
vis_js_template = '\n<html>\n<head>\n <script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>\n <link rel="preconnect" href="https://fonts.gstatic.com"> \n<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,700;1,100&disp...
# Time: O(n) # Space: O(h) # Given the root of a binary tree, then value v and depth d, # you need to add a row of nodes with value v at the given depth d. The root node is at depth 1. # # The adding rule is: given a positive integer depth d, # for each NOT null tree nodes N in depth d-1, create two tree nodes # with...
class Solution(object): def add_one_row(self, root, v, d): """ :type root: TreeNode :type v: int :type d: int :rtype: TreeNode """ if d in (0, 1): node = tree_node(v) if d == 1: node.left = root else: ...
# The Nexus software is licensed under the BSD 2-Clause license. # # You should have recieved a copy of this license with the software. # If you did not, you can find one at the following link. # # http://opensource.org/licenses/bsd-license.php (i,j,k) = (x,y,z) entitylist.append(["fish",(x,y,z),7,7,(i,j,k),3,False])...
(i, j, k) = (x, y, z) entitylist.append(['fish', (x, y, z), 7, 7, (i, j, k), 3, False]) self.client.sendServerMessage('A fish was created.')
# # PySNMP MIB module ONEACCESS-BRIDGE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-BRIDGE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:34:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, single_value_constraint, value_range_constraint) ...
""" OS related constants """ LINK_ROOT = "http://localhost:8050" LINK_ROOT_LOGIN = "http://{}:{}@localhost:8050" LINK_MAIN = "/" LINK_DASHBOARD = "/dashboard" LINK_EVOLUTION = "/evolution" LINK_COMPARISON = "/comparison" LINK_HEATMAPS = "/heatmaps" LINK_PIES = "/pies" LINK_LIQUID = "/liquid" LINK_INVESTMENTS = "/...
""" OS related constants """ link_root = 'http://localhost:8050' link_root_login = 'http://{}:{}@localhost:8050' link_main = '/' link_dashboard = '/dashboard' link_evolution = '/evolution' link_comparison = '/comparison' link_heatmaps = '/heatmaps' link_pies = '/pies' link_liquid = '/liquid' link_investments = '/in...
data = ( ((-0.010000, -0.090000), (-0.010000, -0.040000)), ((0.589999, -0.040000), (0.730000, -0.040000)), ((0.990000, -0.980000), (0.990000, -0.840000)), ((0.630000, -0.490000), (0.630000, -0.480000)), ((-0.300000, 0.160000), (-0.250000, 0.160000)), ((0.440000, -0.190000), (0.440000, -0.240000)), ((0.150000, -0.630000...
data = (((-0.01, -0.09), (-0.01, -0.04)), ((0.589999, -0.04), (0.73, -0.04)), ((0.99, -0.98), (0.99, -0.84)), ((0.63, -0.49), (0.63, -0.48)), ((-0.3, 0.16), (-0.25, 0.16)), ((0.44, -0.19), (0.44, -0.24)), ((0.15, -0.63), (0.15, -0.68)), ((0.429999, -0.54), (0.29, -0.54)), ((-0.690001, 0.2), (-0.75, 0.2)), ((0.929999, -...
name1 = "Atilla" for ch in name1: print(ch)
name1 = 'Atilla' for ch in name1: print(ch)
def add_feather_vertex(location=(0.0, 0.0)): pass def add_feather_vertex_slide(MASK_OT_add_feather_vertex=None, MASK_OT_slide_point=None): pass def add_vertex(location=(0.0, 0.0)): pass def add_vertex_slide(MASK_OT_add_vertex=None, MASK_OT_slide_point=None): pass def copy_splines(): pass d...
def add_feather_vertex(location=(0.0, 0.0)): pass def add_feather_vertex_slide(MASK_OT_add_feather_vertex=None, MASK_OT_slide_point=None): pass def add_vertex(location=(0.0, 0.0)): pass def add_vertex_slide(MASK_OT_add_vertex=None, MASK_OT_slide_point=None): pass def copy_splines(): pass def cy...
# # Copyright 2013 The Regents of The University California # Copyright 2016 Alex Caudill # # 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 # ...
""" A TaskPlacer is responsible for assigning the tasks in a job to backends. Assigning tasks to backends occurs in two phases: (1) Task reservations are enqueued on backends. Typically more task reservations are enqueued than there are tasks that need to run (the ratio of task reservations to t...
""" 246. Strobogrammatic Number A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number is strobogrammatic. The number is represented as a string. Example 1: Input: "69" Output: true Example 2: Input: "88" Output: true Exampl...
""" 246. Strobogrammatic Number A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number is strobogrammatic. The number is represented as a string. Example 1: Input: "69" Output: true Example 2: Input: "88" Output: true Exampl...
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: r = len(numbers) for ind in range(r): goal = target - numbers[ind] l = ind while l < r: m = l + (r - l) // 2 if numbers[m] == goal: ...
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: r = len(numbers) for ind in range(r): goal = target - numbers[ind] l = ind while l < r: m = l + (r - l) // 2 if numbers[m] == goal: ...
""" generate table: from matplotlib import cm import numpy as np _m = cm.get_cmap('jet') gradient = np.linspace(0, 1, 256) l = [cm.colors.to_hex(_m(c)) for c in gradient] """ COLORS = ['#000080', '#000084', '#000089', '#00008d', '#000092', '#000096', '#00009b', '#00009f', '#0000a4', '#0000a8', '#0000ad', '#...
""" generate table: from matplotlib import cm import numpy as np _m = cm.get_cmap('jet') gradient = np.linspace(0, 1, 256) l = [cm.colors.to_hex(_m(c)) for c in gradient] """ colors = ['#000080', '#000084', '#000089', '#00008d', '#000092', '#000096', '#00009b', '#00009f', '#0000a4', '#0000a8', '#0000ad', '#0000b2', '...
@staticmethod def __filter_contours( input_contours, min_area, min_perimeter, min_width, max_width, min_height, max_height, solidity, max_vertex_count, min_vertex_count, min_ratio, max_ratio, ): """Filters out contours that do not meet certain criteria. Args: ...
@staticmethod def __filter_contours(input_contours, min_area, min_perimeter, min_width, max_width, min_height, max_height, solidity, max_vertex_count, min_vertex_count, min_ratio, max_ratio): """Filters out contours that do not meet certain criteria. Args: input_contours: Contours as a list of numpy.nda...
# logger = logging.getLogger() # logger.setLevel(logging.DEBUG) """--- Main handler --- """ def lambda_handler(event, context): # os.environ['TZ'] = 'America/New_York' # time.tzset() # logger.debug('event.bot.name={}'.format(event['bot']['name'])) return dispatch(event) def dispatch(intent_request): intent_...
"""--- Main handler --- """ def lambda_handler(event, context): return dispatch(event) def dispatch(intent_request): intent_name = intent_request['currentIntent']['name'] if intent_name == 'sayHello': return get_info(intent_request) raise exception('Intent with name' + intent_name + ' not supp...
# Title : TODO # Objective : TODO # Created by: Wenzurk # Created on: 2018/2/6 alien_color = 'green' # if alien_color == 'green': # print("You get 5 point.") # if alien_color == 'yellow': # print("You are a loser.") # if alien_color == 'green': # print("You got 5 point.") # else: # print("You got...
alien_color = 'green' if alien_color == 'green': print('You got 5 point.') elif alien_color == 'yellow': print('You got 10 point.') elif alien_color == 'red': print('You got 15 point.')
expected_output = { 'dir': { 'total_free_bytes': '939092 kbytes', 'files': {'pnet_cfg.log': {'permission': '-rw-r--r--', 'date': 'May 10 2017', 'index': '14', 'size': '10429'}, 'status_file': {'permission': '-rw-r--r--', 'date': 'May 10 13:1...
expected_output = {'dir': {'total_free_bytes': '939092 kbytes', 'files': {'pnet_cfg.log': {'permission': '-rw-r--r--', 'date': 'May 10 2017', 'index': '14', 'size': '10429'}, 'status_file': {'permission': '-rw-r--r--', 'date': 'May 10 13:15', 'index': '18', 'size': '2458'}, 'nvgen_traces': {'permission': 'drwxr-xr-x', ...
''' Author: your name Date: 2021-08-16 11:00:16 LastEditTime: 2021-08-16 11:00:17 LastEditors: Please set LastEditors Description: In User Settings Edit FilePath: /lanenet-lane-detection-pytorch/local_utils/__init__.py '''
""" Author: your name Date: 2021-08-16 11:00:16 LastEditTime: 2021-08-16 11:00:17 LastEditors: Please set LastEditors Description: In User Settings Edit FilePath: /lanenet-lane-detection-pytorch/local_utils/__init__.py """
arr = [1,2,3,4,6,7,8,9,12,4,2,5,7,2,5,2,1,4,6,3] # arr = [21,31,43,57,97,89,63,61,51,75,2,4,6,8,0,12,22,24,12,68,62] print(arr) lst = list(sorted(arr, key=lambda x: [x % 2, x])) print(lst) # f_idx = 0 # b_idx = len(arr) - 1 # while f_idx < b_idx: # if arr[f_idx] % 2 != 0: # if arr[b_idx] % 2 != 0: # ...
arr = [1, 2, 3, 4, 6, 7, 8, 9, 12, 4, 2, 5, 7, 2, 5, 2, 1, 4, 6, 3] print(arr) lst = list(sorted(arr, key=lambda x: [x % 2, x])) print(lst)
def test_str(RS, str_data): assert RS(str_data, 0.8) != str_data assert type(RS(str_data, 0.8)) is str assert len(RS(str_data, 0.8, repetition=3)) == 3 def test_list(RS, list_data): assert RS(list_data, 0.8) != list_data assert type(RS(list_data, 0.8)) is list assert len(RS(list_data, 0.8, rep...
def test_str(RS, str_data): assert rs(str_data, 0.8) != str_data assert type(rs(str_data, 0.8)) is str assert len(rs(str_data, 0.8, repetition=3)) == 3 def test_list(RS, list_data): assert rs(list_data, 0.8) != list_data assert type(rs(list_data, 0.8)) is list assert len(rs(list_data, 0.8, repe...
class Solution: def minArea(self, image: List[List[str]], x: int, y: int) -> int: m = len(image) n = len(image[0]) dirs = [0, 1, 0, -1, 0] topLeft = [x, y] bottomRight = [x, y] q = deque([(x, y)]) image[x][y] = '2' # visited while q: i, j = q.popleft() for k in range(4): ...
class Solution: def min_area(self, image: List[List[str]], x: int, y: int) -> int: m = len(image) n = len(image[0]) dirs = [0, 1, 0, -1, 0] top_left = [x, y] bottom_right = [x, y] q = deque([(x, y)]) image[x][y] = '2' while q: (i, j) = q.p...
""" ID: TRAN Title: Transitions and Transversions URL: http://rosalind.info/problems/tran/ """ def fasta_file_parser(fasta_file_path): """ Parses Fasta files. Args: fasta_file_path {str}: path of Fasta file Returns: dict: list of dnas """ with open(fasta_file_path, 'r'...
""" ID: TRAN Title: Transitions and Transversions URL: http://rosalind.info/problems/tran/ """ def fasta_file_parser(fasta_file_path): """ Parses Fasta files. Args: fasta_file_path {str}: path of Fasta file Returns: dict: list of dnas """ with open(fasta_file_path, 'r'...
#@+leo-ver=5-thin #@+node:ekr.20170428084207.353: * @file ../external/npyscreen/npysNPSFilteredData.py #@+others #@+node:ekr.20170428084207.354: ** class NPSFilteredDataBase class NPSFilteredDataBase: #@+others #@+node:ekr.20170428084207.355: *3* __init__ def __init__(self, values=None): self._value...
class Npsfiltereddatabase: def __init__(self, values=None): self._values = None self._filter = None self._filtered_values = None self.set_values(values) def set_values(self, value): self._values = value def get_all_values(self): return self._values def...
my_dictionary = {'name': 'naeim', 'age': 33} print(my_dictionary['name']) print(my_dictionary['age']) print(type(my_dictionary)) print(my_dictionary) my_dictionary['family'] = 'nobahari' print(my_dictionary) for item in my_dictionary: print(f"your {item} is {my_dictionary[item]}") del my_dictionary['family'] pri...
my_dictionary = {'name': 'naeim', 'age': 33} print(my_dictionary['name']) print(my_dictionary['age']) print(type(my_dictionary)) print(my_dictionary) my_dictionary['family'] = 'nobahari' print(my_dictionary) for item in my_dictionary: print(f'your {item} is {my_dictionary[item]}') del my_dictionary['family'] pri...
''' There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color. The cost of painting each house with a certain color is represented by a n x k c...
""" There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color. The cost of painting each house with a certain color is represented by a n x k c...
""" Inverting Keys & Values """ # Invert dict1 - make the current keys into values and the current values into keys. dict1 = { "k1" : "v1", "k2" : "v2", "k3" : "v1" }
""" Inverting Keys & Values """ dict1 = {'k1': 'v1', 'k2': 'v2', 'k3': 'v1'}
############################################################ # from django.urls import path, include ############################################################ app_name = "adventure" urlpatterns = []
app_name = 'adventure' urlpatterns = []
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def helper(self, node, cur_sum): if not node.left and not node.right: self.ans += cur_sum*2 + node.val ...
class Solution: def helper(self, node, cur_sum): if not node.left and (not node.right): self.ans += cur_sum * 2 + node.val if node.left: self.helper(node.left, cur_sum * 2 + node.val) if node.right: self.helper(node.right, cur_sum * 2 + node.val) def...
#declaration of x x = "There are %d types of people." % 10 #declaration of a variable binary = "binary" #here it is also a variable do_not = "don't" #declaretion of y y = "Those who know %s and those who %s." % (binary,do_not) # it prints x print (x + y) # it prints y print ("hello '%s' hi" % y)
x = 'There are %d types of people.' % 10 binary = 'binary' do_not = "don't" y = 'Those who know %s and those who %s.' % (binary, do_not) print(x + y) print("hello '%s' hi" % y)
class Bracket: def __init__(self, round16): self.round16 = round16 self.quarters = [None] * 8 self.semis = [None] * 4 self.finals = [None] * 2 self.thirdPlaceMatch = [None] * 2 # results self.champion = [None] * 1 self.runnerUp = [None] * 1 sel...
class Bracket: def __init__(self, round16): self.round16 = round16 self.quarters = [None] * 8 self.semis = [None] * 4 self.finals = [None] * 2 self.thirdPlaceMatch = [None] * 2 self.champion = [None] * 1 self.runnerUp = [None] * 1 self.third = [None] ...
input = """ 8 2 2 3 0 0 6 0 2 0 2 3 1 2 0 3 b 2 a 0 B+ 0 B- 1 0 1 """ output = """ COST 1@1 """
input = '\n8 2 2 3 0 0\n6 0 2 0 2 3 1 2\n0\n3 b\n2 a\n0\nB+\n0\nB-\n1\n0\n1\n' output = '\nCOST 1@1\n'
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param: he...
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param: hea...
#Python 3.X solution for Easy Challenge #0008 #GitHub: https://github.com/Ashkore #https://www.reddit.com/user/Ashkoree/ string = " bottles of beer on the wall, take one down, pass it around." bottles = 99 for x in range(bottles+1): print (str(bottles-x)+string) #Extra Credit ?? newstring = "" for x in range(bott...
string = ' bottles of beer on the wall, take one down, pass it around.' bottles = 99 for x in range(bottles + 1): print(str(bottles - x) + string) newstring = '' for x in range(bottles + 1): newstring += str(bottles - x) + string print(newstring)
# DO NOT SHARE YOUR CREDENTIALS # Login into your Spotify developer account at https://developer.spotify.com. # Create an app and visit the Dashboard, go to the app's overview to retrieve the 'Client ID' and 'Client Secret' values. # Put these values into the variables below. client_id = '' client_secret = '' usernam...
client_id = '' client_secret = '' username = '' redirect_uri = 'http://localhost:8080/'
# Python Variables # Variables # Variables are containers for storing data values. # Creating Variables # Python has no command for declaring a variable. # A variable is created the moment you first assign a value to it. # Example x = 5 y = "John" print(x) print(y) # Variables do not need to be declared with any par...
x = 5 y = 'John' print(x) print(y) x = 4 x = 'Vera Kasela' print(x) x = str(3) y = int(3) z = float(3) x = 5 y = 'John' print(type(x)) print(type(y)) x = 'John' x = 'John' a = 4 a = 'Sally' myvar = 'John' my_var = 'John' _my_var = 'John' my_var = 'John' myvar = 'John' myvar2 = 'John' my_variable_name = 'John' my_variab...
class Solver: @staticmethod def create(board): return Solver(board) def __init__(self, board): self._board = board def solve(self): return self._tryToPlaceValidQueen(self._board) def _tryToPlaceValidQueen(self, solution): columns = self._getNonThreatenedList(solut...
class Solver: @staticmethod def create(board): return solver(board) def __init__(self, board): self._board = board def solve(self): return self._tryToPlaceValidQueen(self._board) def _try_to_place_valid_queen(self, solution): columns = self._getNonThreatenedList(s...
def export_tomo_scan_legacy(h, fpath=None): if fpath is None: fpath = './' else: if not fpath[-1] == '/': fpath += '/' scan_type = "tomo_scan" scan_id = h.start["scan_id"] try: x_eng = h.start["XEng"] except: x_eng = h.start["x_ray_energy"] bkg_i...
def export_tomo_scan_legacy(h, fpath=None): if fpath is None: fpath = './' elif not fpath[-1] == '/': fpath += '/' scan_type = 'tomo_scan' scan_id = h.start['scan_id'] try: x_eng = h.start['XEng'] except: x_eng = h.start['x_ray_energy'] bkg_img_num = h.start['...
class Options: def __init__(self, *, filename: str, collapse_single_pages: bool, strict: bool): self.filename = filename self.collapse_single_pages = collapse_single_pages self.strict = strict
class Options: def __init__(self, *, filename: str, collapse_single_pages: bool, strict: bool): self.filename = filename self.collapse_single_pages = collapse_single_pages self.strict = strict
__all__ = [ 'Mouse', 'Render' ]
__all__ = ['Mouse', 'Render']
METRICS = ['cityblock', 'euclidean'] NORMALIZE = 'gaussian' SUB_SAMPLE = 64_000 # for testing the implementation MAX_DEPTH = 50 # even though no dataset reaches this far
metrics = ['cityblock', 'euclidean'] normalize = 'gaussian' sub_sample = 64000 max_depth = 50
""" """ def authenticate(username): return 'm:auth:' + username def get_user(user_id): return 'm:geus:' + str(user_id) def has_account(username): return 'm:haac:' + username
""" """ def authenticate(username): return 'm:auth:' + username def get_user(user_id): return 'm:geus:' + str(user_id) def has_account(username): return 'm:haac:' + username
# from ..package1 import module1a ValueError: attempted relative import beyond top-level package def func2a(): print('2a')
def func2a(): print('2a')
configs = { 'camera_res': (320, 240), 'crop_top' : 2/6, 'crop_bot' : 5/6, 'exposure' : 3, 'CSIexposure' : 3000, 'CSIframerate': 90 } cropped_vres = int(configs['camera_res'][1]*(configs['crop_bot'])) - int(configs['camera_res'][1]*(configs['crop_top'])) configs['output_res'] = (configs['ca...
configs = {'camera_res': (320, 240), 'crop_top': 2 / 6, 'crop_bot': 5 / 6, 'exposure': 3, 'CSIexposure': 3000, 'CSIframerate': 90} cropped_vres = int(configs['camera_res'][1] * configs['crop_bot']) - int(configs['camera_res'][1] * configs['crop_top']) configs['output_res'] = (configs['camera_res'][0], cropped_vres)
headPort = "COM5" i01 = Runtime.createAndStart("i01", "InMoov") mouthControl=i01.startMouthControl("COM5") head = i01.startHead(headPort) leftArm = i01.startLeftArm(headPort) leftHand = i01.startLeftHand(headPort) headTracking = i01.startHeadTracking("COM5") eyesTracking= i01.startEyesTracking("COM5") i01.headTrac...
head_port = 'COM5' i01 = Runtime.createAndStart('i01', 'InMoov') mouth_control = i01.startMouthControl('COM5') head = i01.startHead(headPort) left_arm = i01.startLeftArm(headPort) left_hand = i01.startLeftHand(headPort) head_tracking = i01.startHeadTracking('COM5') eyes_tracking = i01.startEyesTracking('COM5') i01.head...
def method1(n: int) -> int: '''Return a list of prime factors of an integer by first checking if the modulo of the value of d and number is equal to 0. Then applying the for loop inside the for loop to count a factor only once. ''' divisors = [d for d in range(2, n // 2 + 1) if n % d == 0] retu...
def method1(n: int) -> int: """Return a list of prime factors of an integer by first checking if the modulo of the value of d and number is equal to 0. Then applying the for loop inside the for loop to count a factor only once. """ divisors = [d for d in range(2, n // 2 + 1) if n % d == 0] retur...
class Solution: def totalNQueens(self, n: int) -> int: def backtrack(row, cols, diagonals, antiDiagonals): if row == n: return 1 solutions = 0 for col in range(n): currentDiagonal = row - col currentAntiDiagonal = row + col ...
class Solution: def total_n_queens(self, n: int) -> int: def backtrack(row, cols, diagonals, antiDiagonals): if row == n: return 1 solutions = 0 for col in range(n): current_diagonal = row - col current_anti_diagonal = row...
s = '''en;q=0.8, de;q=0.7, fr-CH, fr;q=0.9, *;q=0.5''' accept_language = AcceptLanguage(s) pobj(accept_language.sarr) pobj(accept_language.darr) accept_language.header_type accept_language.forbidden_header_name accept_language.cros_safelisted_request_header accept_language.qsort() accept_language.rm_locale("CH") acce...
s = 'en;q=0.8, de;q=0.7, fr-CH, fr;q=0.9, *;q=0.5' accept_language = accept_language(s) pobj(accept_language.sarr) pobj(accept_language.darr) accept_language.header_type accept_language.forbidden_header_name accept_language.cros_safelisted_request_header accept_language.qsort() accept_language.rm_locale('CH') accept_la...
# Python Program to Calculate Sum of Odd Numbers from 1 to 20 maxnum = 20 oddadd = 0 for num in range(1, maxnum + 1): if num % 2 != 0: #print("odd number :",num) oddadd=oddadd+num print("Sum of Odd Number from 1 to 20 is:",oddadd)
maxnum = 20 oddadd = 0 for num in range(1, maxnum + 1): if num % 2 != 0: oddadd = oddadd + num print('Sum of Odd Number from 1 to 20 is:', oddadd)
#!/usr/bin/env python NAME = 'Naxsi' def is_waf(self): return self.match_header(('X-Data-Origin', '^naxsi'))
name = 'Naxsi' def is_waf(self): return self.match_header(('X-Data-Origin', '^naxsi'))
# Copyright (c) The Libra Core Contributors # SPDX-License-Identifier: Apache-2.0 class Database: """ The interface that underlying database should implement """ def get(self, prefix, key): """ Given a prefix and key, return the value in db """ return NotImplementedError() # pragma: no cover...
class Database: """ The interface that underlying database should implement """ def get(self, prefix, key): """ Given a prefix and key, return the value in db """ return not_implemented_error() def try_get(self, prefix, key): """ Given a prefix and key, return the value in ...
#!/usr/bin/env python3 class FuseModel: def fuse(self, first, second): raise NotImplementedError()
class Fusemodel: def fuse(self, first, second): raise not_implemented_error()
"""Protocol for server side messenger app.""" def validate_request(raw): """Checking for exists of 'action' and 'time' in request.""" return True if 'action' in raw and 'time' in raw else False def make_response(request, code, data=None): """Make response based on passed request, status code and data.""...
"""Protocol for server side messenger app.""" def validate_request(raw): """Checking for exists of 'action' and 'time' in request.""" return True if 'action' in raw and 'time' in raw else False def make_response(request, code, data=None): """Make response based on passed request, status code and data.""" ...
table = {"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000} roman = "MDCLXVI" number = 0 for ch in roman: number += table[ch] print(number)
table = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} roman = 'MDCLXVI' number = 0 for ch in roman: number += table[ch] print(number)
# STATIC FILES HOUSING_SECTOR_BILL_FILE = 'static_files/bill.pdf' PRODUCTS_CSV_FILE = 'static_files/list.csv' INDEX_CSV_FILE = 'static_files/index.csv' # URLs URL_TO_PARSE_FUEL = "https://auto.mail.ru/fuel/" URL_TO_PARSE_MCD_TICKETS = "https://troikarta.ru/tarify/mcd/" URL_TO_PARSE_ELECTRICITY_PRICE = "https://www.mo...
housing_sector_bill_file = 'static_files/bill.pdf' products_csv_file = 'static_files/list.csv' index_csv_file = 'static_files/index.csv' url_to_parse_fuel = 'https://auto.mail.ru/fuel/' url_to_parse_mcd_tickets = 'https://troikarta.ru/tarify/mcd/' url_to_parse_electricity_price = 'https://www.mosenergosbyt.ru/individua...
class Solution: def twoSum(self, numbers, target): i, j = 0, len(numbers) - 1 while i < j: ts = numbers[i] + numbers[j] if ts == target: break elif ts > target: j = j - 1 else: i = i + 1 return [i...
class Solution: def two_sum(self, numbers, target): (i, j) = (0, len(numbers) - 1) while i < j: ts = numbers[i] + numbers[j] if ts == target: break elif ts > target: j = j - 1 else: i = i + 1 ret...
class bedfeature(object): def __init__(self, chr,start,stop, name=None,value=None,strand=None, thickStart=None,thickStop=None,itemRGB=None, blockCount=None,blockSizes=None,blockStarts=None): self.chr=chr self.start=int(start) self.stop=int(s...
class Bedfeature(object): def __init__(self, chr, start, stop, name=None, value=None, strand=None, thickStart=None, thickStop=None, itemRGB=None, blockCount=None, blockSizes=None, blockStarts=None): self.chr = chr self.start = int(start) self.stop = int(stop) self.name = name ...
''' Find first missing positive integer (>0) Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. Note: you can modify the ...
""" Find first missing positive integer (>0) Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. Note: you can modify the ...
BASKET_CREATED = 'basket_created' ADD_ITEM = 'add_item' ITEM_ADDED = 'item_added' CHECKOUT = 'checkout' CHECKOUT_STARTED = 'checkout_started' PAY_ORDER = 'pay_order'
basket_created = 'basket_created' add_item = 'add_item' item_added = 'item_added' checkout = 'checkout' checkout_started = 'checkout_started' pay_order = 'pay_order'
def check_scope(func): def check(self, other): if not isinstance(other, self.__class__) and type(other) != str: raise TypeError(f"Cannot compare type Scope with type {type(other).__name__}") if isinstance(other, self.__class__): other = other.scope if other not in sel...
def check_scope(func): def check(self, other): if not isinstance(other, self.__class__) and type(other) != str: raise type_error(f'Cannot compare type Scope with type {type(other).__name__}') if isinstance(other, self.__class__): other = other.scope if other not in s...
try: unicode except NameError: unicode = str messages = [u'Circle is 360\u00B0', u'Hyv\u00E4\u00E4 \u00FC\u00F6t\u00E4', u'\u0989\u09C4 \u09F0 \u09FA \u099F \u09EB \u09EA \u09B9'] class NonAsciiLibrary: def print_non_ascii_strings(self): """Prints message containing non-...
try: unicode except NameError: unicode = str messages = [u'Circle is 360°', u'Hyvää üötä', u'উৄ ৰ ৺ ট ৫ ৪ হ'] class Nonasciilibrary: def print_non_ascii_strings(self): """Prints message containing non-ASCII characters""" for msg in messages: print('*INFO*' + msg) def print...
expected_output = { { "object_manager_statistics": { "batch_begin": { "pending_acknowledgement": 0, "pending_issue": 0 }, "batch_end": { "pending_acknowledgement": 0, "pending_issue": 0 }, "childless_delete_objects": "0", ...
expected_output = {{'object_manager_statistics': {'batch_begin': {'pending_acknowledgement': 0, 'pending_issue': 0}, 'batch_end': {'pending_acknowledgement': 0, 'pending_issue': 0}, 'childless_delete_objects': '0', 'command': '0', 'error_objects': '0', 'object_update': {'pending_acknowledgement': 0, 'pending_issue': 0}...
# creating a Class of name Employee class Employee: # creating a Class Variable increament = 1.5 # Creating a Constructor of the Class Employee def __init__(self, fname, lname, salary): # setting Values to the variables self.fname = fname # setting Values to the variables ...
class Employee: increament = 1.5 def __init__(self, fname, lname, salary): self.fname = fname self.lname = lname self.salary = salary def increase(self): self.salary = int(self.salary * Employee.increament) @classmethod def change_increament(cls, amount): c...
''' Count sort. Outperforms the default sorting routine when the range of values is reasonably bounded. ''' def count_sort(a): mn, mx = float('inf'), -float('inf') for x in a: if x < mn: mn = x if x > mx: mx = x counter = [0 for _ in range(mx - mn + 1)] for x in a: counter[x - ...
""" Count sort. Outperforms the default sorting routine when the range of values is reasonably bounded. """ def count_sort(a): (mn, mx) = (float('inf'), -float('inf')) for x in a: if x < mn: mn = x if x > mx: mx = x counter = [0 for _ in range(mx - mn + 1)] for ...
name = "alita" version = "0.3.28" build_command = "python -m rezutil build {root}" private_build_requires = ["rezutil-1"] # Variables unrelated to Rez are typically prefixed with `_` _data = { "label": "Alita - Battle Angel", "icon": "{root}/resources/icon_{width}x{height}.png" } _requires = { "any": [ ...
name = 'alita' version = '0.3.28' build_command = 'python -m rezutil build {root}' private_build_requires = ['rezutil-1'] _data = {'label': 'Alita - Battle Angel', 'icon': '{root}/resources/icon_{width}x{height}.png'} _requires = {'any': ['welcome-1', 'base-1', '~blender==2.80.0', '~maya==2017.0.4|==2018.0.6', '~dev_ma...
class Coins: ''' Coins class for monetization ''' def __init__(self): self.quarter = True
class Coins: """ Coins class for monetization """ def __init__(self): self.quarter = True
firstname = input("Give me your firstname: ") familyname = input("Give me your lastname: ") age = int(input("Give me your age: ")) # print(type(age)) print(firstname + familyname + str(age) + "years old") if age >= 18: print("You are an adult") elif age < 16: print("F U FAGGOT!") else: print("Fokking bab...
firstname = input('Give me your firstname: ') familyname = input('Give me your lastname: ') age = int(input('Give me your age: ')) print(firstname + familyname + str(age) + 'years old') if age >= 18: print('You are an adult') elif age < 16: print('F U FAGGOT!') else: print('Fokking baby') print('end program...
class EmployeeModel: def __init__(self, eid=0, did=0, name="", money=0): self.eid = eid self.did = did self.name = name self.money = money
class Employeemodel: def __init__(self, eid=0, did=0, name='', money=0): self.eid = eid self.did = did self.name = name self.money = money
# cmd blacklist __blacklist__ = { "help": "crashes the app (requires unsupported external user input)", "license": "crashes the app (requires unsupported external user input)" }
__blacklist__ = {'help': 'crashes the app (requires unsupported external user input)', 'license': 'crashes the app (requires unsupported external user input)'}
def function1(x, n): if n <= 0: return x else: return 1 + function1(x, n - 1) def function2(a, b): if a <= 0: return 1 + function1(a+1, b**a) else: return b def function3(a, b): if b <= 0: return a else: return a + b + function3(a, b -1) def fun...
def function1(x, n): if n <= 0: return x else: return 1 + function1(x, n - 1) def function2(a, b): if a <= 0: return 1 + function1(a + 1, b ** a) else: return b def function3(a, b): if b <= 0: return a else: return a + b + function3(a, b - 1) de...
#Passphrases #Advent of Code 2017 Day 4 #deal with the file file = open('input4.txt','r') input = file.read() file.close() lines = input.split("\n") validLines = 0 def isValid(line): words = line.split(" ") #print( str(len(words))) for x in range( 0, len(words) ): for y in range( x+1, len(words...
file = open('input4.txt', 'r') input = file.read() file.close() lines = input.split('\n') valid_lines = 0 def is_valid(line): words = line.split(' ') for x in range(0, len(words)): for y in range(x + 1, len(words)): if words[x] == words[y]: return False return True for e...
# Merge two sorted linked lists and return it as a new list. # The new list should be made by splicing together the nodes # of the first two lists. # # Input: 1->2->4, 1->3->4 # Output: 1->1->2->3->4->4 class ListNode: def __init__(self, val): self.val = val self.next = None class Solution: ...
class Listnode: def __init__(self, val): self.val = val self.next = None class Solution: def merge(self, l1, l2): newnode = list_node(-1) node = newnode while l1 is not None and l2 is not None: if l1.val <= l2.val: node.next = l1 ...
class Empty: """ A constant that is Like None, but adding a little more. When compared with "==", it negates the bool(other) e.g. [] == Empty, {} == Empty, None == Empty When compared with "is", "Empty is Empty" only evaluates to True. This feature about "is" is convenient when checking default arg...
class Empty: """ A constant that is Like None, but adding a little more. When compared with "==", it negates the bool(other) e.g. [] == Empty, {} == Empty, None == Empty When compared with "is", "Empty is Empty" only evaluates to True. This feature about "is" is convenient when checking default arg...
rows = [[1 if c == '#' else 0 for c in line[:-1]] for line in open('input.txt')] height, width, result = len(rows), len(rows[0]), 1 steps = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)] for right, down in steps: trees, row, col = 0, 0, 0 for row in range(0, height, down): trees += rows[row][col] ...
rows = [[1 if c == '#' else 0 for c in line[:-1]] for line in open('input.txt')] (height, width, result) = (len(rows), len(rows[0]), 1) steps = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)] for (right, down) in steps: (trees, row, col) = (0, 0, 0) for row in range(0, height, down): trees += rows[row][col] ...
def alternatingSort(a): b = [] i = 0 ; j = len(a)-1 j_turn = True while (i <= j): if (j_turn): b.append(a[i]) i += 1 j_turn = False else: b.append(a[j]) j -= 1 j_turn = True print(b) alter...
def alternating_sort(a): b = [] i = 0 j = len(a) - 1 j_turn = True while i <= j: if j_turn: b.append(a[i]) i += 1 j_turn = False else: b.append(a[j]) j -= 1 j_turn = True print(b) alternating_sort([1, 2, 3, 4...
def writeuser_tex(text_tex,env): if env == 1: text_file = open("latex/user_eq.tex", "w") text_file.write(r"\begin{align*}") text_file.write("\n") text_file.write(r"%s" % text_tex) text_file.write("\n") text_file.write(r"\end{align*}") text_file.close() e...
def writeuser_tex(text_tex, env): if env == 1: text_file = open('latex/user_eq.tex', 'w') text_file.write('\\begin{align*}') text_file.write('\n') text_file.write('%s' % text_tex) text_file.write('\n') text_file.write('\\end{align*}') text_file.close() eli...
def subset_sum(numbers, target, partial=[]): s = sum(partial) # check if the partial sum is equals to target if s == target: return True elif s > target: return False # if we reach the number why bother to continue i=0 while i < len(numbers): n = numbers[i] rem...
def subset_sum(numbers, target, partial=[]): s = sum(partial) if s == target: return True elif s > target: return False i = 0 while i < len(numbers): n = numbers[i] remaining = numbers[i + 1:] if subset_sum(remaining, target, partial + [n]) == True: ...
LEN_TIME = 3 MAPPING_TEXT = { "Train a l'approche": "APR", "Train a quai": "QAI", "Train retarde": "RET", "A l'approche": "APR", "A l'arret": "ARR", "Train arrete": "TAR", "": "NAV", "NAV": "NAV", "UNC": "UNC" } def get_timings(returned_page_data): first_destination = returned...
len_time = 3 mapping_text = {"Train a l'approche": 'APR', 'Train a quai': 'QAI', 'Train retarde': 'RET', "A l'approche": 'APR', "A l'arret": 'ARR', 'Train arrete': 'TAR', '': 'NAV', 'NAV': 'NAV', 'UNC': 'UNC'} def get_timings(returned_page_data): first_destination = returned_page_data[0] first_time = returned_...
#Add prod locations and copy to file_locations_prod.py LAST_ID = 'last_id.txt' LOCK_FILE = 'locked.txt' LOG_FILE = 'errors.txt'
last_id = 'last_id.txt' lock_file = 'locked.txt' log_file = 'errors.txt'
book = {"apple": 0.67, "banana": 1.49, "milk": 2.3 } book["avocado"] = 1.5 print(book) print(book["banana"]) print(book["avocado"])
book = {'apple': 0.67, 'banana': 1.49, 'milk': 2.3} book['avocado'] = 1.5 print(book) print(book['banana']) print(book['avocado'])
print ("program mayor menor") numero1= input ("INTRODUCE UN NUMERO:") numero1= int (numero1) numero2= input ("INTRODUCE UN NUMERO:") numero2= int (numero2) if numero1<numero2: print ("Usted Escribio los nmeros %d " %numero1, end="") print (" y %d" %numero2)
print('program mayor menor') numero1 = input('INTRODUCE UN NUMERO:') numero1 = int(numero1) numero2 = input('INTRODUCE UN NUMERO:') numero2 = int(numero2) if numero1 < numero2: print('Usted Escribio los nmeros %d ' % numero1, end='') print(' y %d' % numero2)
''' Problem statement: Create a function to find only the root value of x in any quadratic equation ax^2 + bx + c. The function will take three arguments: - a as the coefficient of x^2 - b as the coefficient of x - c as the constant term Problem Link: https://edabit.com/challenge/MDWFcHCTiJfHmwTFx ''' def quadratic_eq...
""" Problem statement: Create a function to find only the root value of x in any quadratic equation ax^2 + bx + c. The function will take three arguments: - a as the coefficient of x^2 - b as the coefficient of x - c as the constant term Problem Link: https://edabit.com/challenge/MDWFcHCTiJfHmwTFx """ def quadratic_eq...
def make_cmd_params(command, nodes, env, sourcehash): inputs = {} outputs = [] files = [] #to be monitored refs = [] output_refs = [] params = { "lineno": command["cmd"]["lineno"], "source": command["cmd"]["source"], "sourcehash": sourcehash, "refs": refs, ...
def make_cmd_params(command, nodes, env, sourcehash): inputs = {} outputs = [] files = [] refs = [] output_refs = [] params = {'lineno': command['cmd']['lineno'], 'source': command['cmd']['source'], 'sourcehash': sourcehash, 'refs': refs, 'output_refs': output_refs, 'inputs': inputs, 'outputs': ...
def marge(arr, start, mid, end): num1 = mid - start + 1 num2 = end - mid left = [0] * (num1) right = [0] * (num2) for i in range(0, num1): left[i] = arr[start+i] for j in range(0, num2): right[j] = arr[mid+1+j] i = 0 j = 0 k = start while i < num1 and j < num2:...
def marge(arr, start, mid, end): num1 = mid - start + 1 num2 = end - mid left = [0] * num1 right = [0] * num2 for i in range(0, num1): left[i] = arr[start + i] for j in range(0, num2): right[j] = arr[mid + 1 + j] i = 0 j = 0 k = start while i < num1 and j < num2: ...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def pathSum(self, root, sum): """ :type root: TreeNode :type sum: int :rtype: int """ self.result =...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def path_sum(self, root, sum): """ :type root: TreeNode :type sum: int :rtype: int """ self.result = 0 cache = {0: 1} ...