content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# This sample tests a series of nested loops containing variables # with significant dependencies. for val1 in range(10): cnt1 = 4 for val2 in range(10 - val1): cnt2 = 4 if val2 == val1: cnt2 -= 1 for val3 in range(10 - val1 - val2): cnt3 = 4 if val3 ...
for val1 in range(10): cnt1 = 4 for val2 in range(10 - val1): cnt2 = 4 if val2 == val1: cnt2 -= 1 for val3 in range(10 - val1 - val2): cnt3 = 4 if val3 == val1: cnt3 -= 1 if val3 == val2: cnt3 -= 1 ...
# https://app.codesignal.com/arcade/intro/level-2/bq2XnSr5kbHqpHGJC def makeArrayConsecutive2(statues): statues = sorted(statues) res = 0 # Make elements of the array be consecutive. If there's a # gap between two statues heights', then figure out how # many extra statues have to be added so that al...
def make_array_consecutive2(statues): statues = sorted(statues) res = 0 for i in range(1, len(statues)): res += statues[i] - statues[i - 1] - 1 return res
# https://leetcode.com/problems/count-of-matches-in-tournament/ """ Problem Description You are given an integer n, the number of teams in a tournament that has strange rules: If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance...
""" Problem Description You are given an integer n, the number of teams in a tournament that has strange rules: If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance to the next round. If the current number of teams is odd, one te...
subdomain = 'srcc' api_version = 'v1' callback_url = 'http://localhost:4567/'
subdomain = 'srcc' api_version = 'v1' callback_url = 'http://localhost:4567/'
# Take the values C = int(input()) A = int(input()) # calculate student trips quociente = A // (C - 1) # how many students are letf resto = A % (C - 1) # if there is a student left, you have +1 trip if resto > 0: quociente += 1 # Shows the value print(quociente)
c = int(input()) a = int(input()) quociente = A // (C - 1) resto = A % (C - 1) if resto > 0: quociente += 1 print(quociente)
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2016 OSGeo # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 ...
class Basecataloguebackend(object): """Catalogue abstract base class""" def remove_record(self, uuid): """Remove record from the catalogue""" raise not_implemented_error() def create_record(self, item): """Create record in the catalogue""" raise not_implemented_error() ...
class BaseCreation(object): """ This class encapsulates all backend-specific differences that pertain to database *creation*, such as the column types to use for particular Django Fields. """ pass
class Basecreation(object): """ This class encapsulates all backend-specific differences that pertain to database *creation*, such as the column types to use for particular Django Fields. """ pass
class TechnicalSpecs(object): def __init__(self): self.__negative_format = None self.__cinematographic_process = None self.__link = None @property def negative_format(self): return self.__negative_format @negative_format.setter def negative_format(self, negative_for...
class Technicalspecs(object): def __init__(self): self.__negative_format = None self.__cinematographic_process = None self.__link = None @property def negative_format(self): return self.__negative_format @negative_format.setter def negative_format(self, negative_fo...
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 load("//bazel_tools:versions.bzl", "version_to_name") def _build_dar( name, package_name, srcs, data_dependencies, sdk_version): daml = "@...
load('//bazel_tools:versions.bzl', 'version_to_name') def _build_dar(name, package_name, srcs, data_dependencies, sdk_version): daml = '@daml-sdk-{sdk_version}//:daml'.format(sdk_version=sdk_version) native.genrule(name=name, srcs=srcs + data_dependencies, outs=['%s.dar' % name], tools=[daml], cmd='set -euo pi...
# package marker. __version__ = "1.1b3" __date__ = "Nov 23, 2017"
__version__ = '1.1b3' __date__ = 'Nov 23, 2017'
S=list(input()) S.reverse() N=len(S) R=[0]*N R10=[0]*N m=2019 K=0 R10[0]=1 R[0]=int(S[0])%m for i in range(1,N): R10[i]=(R10[i-1]*10)%m R[i]=(R[i-1]+int(S[i])*R10[i])%m d={} for i in range(2019): d[i]=0 for i in range(N): d[R[i]]+=1 ans=0 for i in range(2019): if i == 0: ans += d[i] ...
s = list(input()) S.reverse() n = len(S) r = [0] * N r10 = [0] * N m = 2019 k = 0 R10[0] = 1 R[0] = int(S[0]) % m for i in range(1, N): R10[i] = R10[i - 1] * 10 % m R[i] = (R[i - 1] + int(S[i]) * R10[i]) % m d = {} for i in range(2019): d[i] = 0 for i in range(N): d[R[i]] += 1 ans = 0 for i in range(201...
# -*- coding: utf-8 -*- # Scrapy settings for dingdian project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/lates...
bot_name = 'dingdian' spider_modules = ['dingdian.spiders'] newspider_module = 'dingdian.spiders' robotstxt_obey = True item_pipelines = {'dingdian.mysqlpipelines.pipelines.DingdianPipeline': 1} httpcache_enabled = True httpcache_expiration_secs = 0 httpcache_dir = 'httpcache' httpcache_ignore_http_codes = [] httpcache...
class Solution(object): def maxProduct(self, nums): """ :type nums: List[int] :rtype: int """ # Runtime: 40 ms # Memory: 13.5 MB max_ = -1 second_max = -1 for num in nums: if num > max_: max_, second_max = num, max_ ...
class Solution(object): def max_product(self, nums): """ :type nums: List[int] :rtype: int """ max_ = -1 second_max = -1 for num in nums: if num > max_: (max_, second_max) = (num, max_) elif num > second_max: ...
# coding=utf-8 config_templates = { 'main': '', 'jails': 'enable = true\n', 'actions': """ # Fail2Ban configuration file # # Author: # # [Definition] # Option: actionstart # Notes.: command executed once at the start of Fail2Ban. # Values: CMD # actionstart = # Option: actionstop # Notes.: command...
config_templates = {'main': '', 'jails': 'enable = true\n', 'actions': '\n# Fail2Ban configuration file\n#\n# Author:\n#\n#\n\n[Definition]\n\n# Option: actionstart\n# Notes.: command executed once at the start of Fail2Ban.\n# Values: CMD\n#\nactionstart =\n\n\n# Option: actionstop\n# Notes.: command executed once...
""" Copyright (c) 2022 Adam Lisichin, Hubert Decyusz, Wojciech Nowicki, Gustaw Daczkowski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the righ...
""" Copyright (c) 2022 Adam Lisichin, Hubert Decyusz, Wojciech Nowicki, Gustaw Daczkowski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the righ...
# this works, but has the argument order dependency problem class Rectangle: def __init__(self, width, height): self.height = height self.width = width def area(self): return self.height * self.width def perimeter(self): return (2 * self.height) + (2 * self.width) x = Rectangle(4, 4) print(x.wi...
class Rectangle: def __init__(self, width, height): self.height = height self.width = width def area(self): return self.height * self.width def perimeter(self): return 2 * self.height + 2 * self.width x = rectangle(4, 4) print(x.width) print(x.area()) print(x.perimeter())
""" Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only 1 right child. Example 1: Input: [5,3,6,2,4,null,8,1,null,null,null,7,9] 5 / \ 3 6 / \ \ 2 4 8 / / \ 1 7 9 Ou...
""" Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only 1 right child. Example 1: Input: [5,3,6,2,4,null,8,1,null,null,null,7,9] 5 / 3 6 / \\ 2 4 8 / / 1 7 9 Output:...
# -*- coding: utf-8 -*- # -------------------------------------- # tree_from_shot.py # # MDSplus Python project # for CTH data access # # tree_from_shot --- returns the CTH MDSplus tree associated with the # given shot number # # Parameters: # shotnum - integer - the shotnumber to open # Returns: #...
def tree_from_shot(shotnum): shot_string = str(shotnum) tree = 't' + shotString[0:6] return tree
k,n=map(int,input().split());a=[int(i+1) for i in range(k)] for _ in range(n): s,e,m=map(int,input().split()) b0=a[:s-1];b1=a[s-1:e];b2=a[e:];a=[] l=b1[:m-s];r=b1[m-s:];b1=r+l a=b0+b1+b2 r="" for i in a: r+=str(i)+' ' print(r)
(k, n) = map(int, input().split()) a = [int(i + 1) for i in range(k)] for _ in range(n): (s, e, m) = map(int, input().split()) b0 = a[:s - 1] b1 = a[s - 1:e] b2 = a[e:] a = [] l = b1[:m - s] r = b1[m - s:] b1 = r + l a = b0 + b1 + b2 r = '' for i in a: r += str(i) + ' ' print(r)
__author__ = 'Masataka' class IFileParser: def __init__(self): pass def getparam(self): pass def getJob(self): pass
__author__ = 'Masataka' class Ifileparser: def __init__(self): pass def getparam(self): pass def get_job(self): pass
# -*- encoding: utf-8 def func(x, y): return x + y def test_example(): assert func(1, 2) == 3
def func(x, y): return x + y def test_example(): assert func(1, 2) == 3
#!/usr/bin/env python class EnogList(): """ Object that stores the orthologous groups and their weights (if applicable) """ def __init__(self, enog_list, enog_dict): """ at initialization, the "EnogList" sorts the information that is required later. i.e. the dictionary of weights ...
class Enoglist: """ Object that stores the orthologous groups and their weights (if applicable) """ def __init__(self, enog_list, enog_dict): """ at initialization, the "EnogList" sorts the information that is required later. i.e. the dictionary of weights as used in completenes...
#!/usr/bin/python # -*- coding: utf-8 -*- ### # MIT License # # Copyright (c) 2021 Yi-Sheng, Kang (Eason Kang) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
service = data.get('service') [service_domain, service_name] = service.split('.') service_data_decrease = data.get('service_data_decrease') service_data_increase = data.get('service_data_increase') speed_percentage = data.get('percentage') speed_count = data.get('speed_count') fan_speed_entity_id = data.get('speed_enti...
# -*- coding=utf-8 -*- class MessageInfo: def __init__(self, msgFlag, msgBody): self.msgFlag = msgFlag self.msgReServe = 0 msgBody = msgBody.encode(encoding='utf-8') # msgBody = bytes(msgBody, encoding='utf-8') self.msgBodySize = msgBody.__len__() self.msgBo...
class Messageinfo: def __init__(self, msgFlag, msgBody): self.msgFlag = msgFlag self.msgReServe = 0 msg_body = msgBody.encode(encoding='utf-8') self.msgBodySize = msgBody.__len__() self.msgBody = msgBody def get_msg(arg): pass def create_msg(msgFlag=1001, msgBo...
"""Role testing files using testinfra""" def test_login_user(host): """Check login user""" g = host.group("berry") assert g.exists u = host.user("rasp") assert u.exists assert u.group == "berry" f = host.file("/home/rasp/.ssh/authorized_keys") assert f.is_file public_key = "ssh-...
"""Role testing files using testinfra""" def test_login_user(host): """Check login user""" g = host.group('berry') assert g.exists u = host.user('rasp') assert u.exists assert u.group == 'berry' f = host.file('/home/rasp/.ssh/authorized_keys') assert f.is_file public_key = 'ssh-ed25...
guest_list = ["Shantopriyo Bhowmick", "Jordan B Peterson", "Mayuri B Upadhaya", "Deblina Bhowmick", "Sandeep Goswami", "Soumen Goswami"] print(f"Hi my dear brother{guest_list[0].title()}, Hope your killing it wherever you are. Come join me for a dinner. Meet people i like the most") print(f"Hi professor {guest_list[1...
guest_list = ['Shantopriyo Bhowmick', 'Jordan B Peterson', 'Mayuri B Upadhaya', 'Deblina Bhowmick', 'Sandeep Goswami', 'Soumen Goswami'] print(f'Hi my dear brother{guest_list[0].title()}, Hope your killing it wherever you are. Come join me for a dinner. Meet people i like the most') print(f"Hi professor {guest_list[1]....
class Participation: def __init__(self, id, tournament_id, player_id): self.id = id self.tournament_id = tournament_id self.player_id = player_id @staticmethod def build(attributes): return Participation( id=attributes['id'], tournament_id=attributes[...
class Participation: def __init__(self, id, tournament_id, player_id): self.id = id self.tournament_id = tournament_id self.player_id = player_id @staticmethod def build(attributes): return participation(id=attributes['id'], tournament_id=attributes['tournament_id'], player...
class NoisePageMetadata(object): """ This class is the model of the NoisePage metadata as it is represented by the HTTP API """ def __init__(self, db_version): self.db_version = db_version
class Noisepagemetadata(object): """ This class is the model of the NoisePage metadata as it is represented by the HTTP API """ def __init__(self, db_version): self.db_version = db_version
""" pbs package """ __all__ = ["main", "build", "lookup"]
""" pbs package """ __all__ = ['main', 'build', 'lookup']
## ## Some global settings constants ## # The amount of inactivity (in milliseconds) that must elapse # before the badge will consider going into standby. If set to # zero then the badge will never attempt to sleep. sleeptimeout = 900000 # The default banner message to print in the scroll.py animation. banner = "DEFC...
sleeptimeout = 900000 banner = 'DEFCON Furs' debug = False bootanim = 'scroll' mazesolver = True blecooldown = 60 boopselect = 0 color = 16777215
class IncentivizeLearningRate: """ Environment which incentivizes the agent to act as if learning_rate=1. Whenever the agent takes an action, the environment determines: would the agent take the same action if the agent had been identically trained except with learning_rate=1? If so, give the agent ...
class Incentivizelearningrate: """ Environment which incentivizes the agent to act as if learning_rate=1. Whenever the agent takes an action, the environment determines: would the agent take the same action if the agent had been identically trained except with learning_rate=1? If so, give the agent ...
# Set collector mode `raw` or `unpack` mode = 'raw' # LIsten IP address. ip_address = '127.0.0.1' # Listen port (UDP). port = 2055 # Template size in bytes. Template size configured on exporter. template_size_in_bytes = 50 # Capture duration in seconds caption_duration = 300
mode = 'raw' ip_address = '127.0.0.1' port = 2055 template_size_in_bytes = 50 caption_duration = 300
example_readings = [3,4,3,1,2] readings = [2,1,1,4,4,1,3,4,2,4,2,1,1,4,3,5,1,1,5,1,1,5,4,5,4,1,5,1,3,1,4,2,3,2,1,2,5,5,2,3,1,2,3,3,1,4,3,1,1,1,1,5,2,1,1,1,5,3,3,2,1,4,1,1,1,3,1,1,5,5,1,4,4,4,4,5,1,5,1,1,5,5,2,2,5,4,1,5,4,1,4,1,1,1,1,5,3,2,4,1,1,1,4,4,1,2,1,1,5,2,1,1,1,4,4,4,4,3,3,1,1,5,1,5,2,1,4,1,2,4,4,4,4,2,2,2,4,4,4...
example_readings = [3, 4, 3, 1, 2] readings = [2, 1, 1, 4, 4, 1, 3, 4, 2, 4, 2, 1, 1, 4, 3, 5, 1, 1, 5, 1, 1, 5, 4, 5, 4, 1, 5, 1, 3, 1, 4, 2, 3, 2, 1, 2, 5, 5, 2, 3, 1, 2, 3, 3, 1, 4, 3, 1, 1, 1, 1, 5, 2, 1, 1, 1, 5, 3, 3, 2, 1, 4, 1, 1, 1, 3, 1, 1, 5, 5, 1, 4, 4, 4, 4, 5, 1, 5, 1, 1, 5, 5, 2, 2, 5, 4, 1, 5, 4, 1, 4, ...
class Events: TRAINING_START = "TRAINING_START" EPOCH_START = "EPOCH_START" BATCH_START = "BATCH_START" FORWARD = "FORWARD" BACKWARD = "BACKWARD" BATCH_END = "BATCH_END" VALIDATE = "VALIDATE" EPOCH_END = "EPOCH_END" TRAINING_END = "TRAINING_END" ERROR = "ERROR"
class Events: training_start = 'TRAINING_START' epoch_start = 'EPOCH_START' batch_start = 'BATCH_START' forward = 'FORWARD' backward = 'BACKWARD' batch_end = 'BATCH_END' validate = 'VALIDATE' epoch_end = 'EPOCH_END' training_end = 'TRAINING_END' error = 'ERROR'
# 1.07 # Slicing and dicing #Selecting single values from a list is just one part of the story. It's also possible to slice your list, which means selecting multiple elements from your list. Use the following syntax: #my_list[start:end] #The start index will be included, while the end index is not. #The code sample b...
areas = ['hallway', 11.25, 'kitchen', 18.0, 'living room', 20.0, 'bedroom', 10.75, 'bathroom', 9.5] downstairs = areas[0:6] upstairs = areas[6:10] print(downstairs) print(upstairs)
class Node: def __init__(self, val, parent, level=0): self.val = val self.parent = None self.level = level class Tree: def __init__(self, root): self.root = Node(root, None) self.root.level = 0 def find_hits(self, dist, clubs): c = self.root q = [...
class Node: def __init__(self, val, parent, level=0): self.val = val self.parent = None self.level = level class Tree: def __init__(self, root): self.root = node(root, None) self.root.level = 0 def find_hits(self, dist, clubs): c = self.root q = [c...
# Source : https://leetcode.com/problems/merge-sorted-array/ # Author : foxfromworld # Date : 12/10/2021 # Second attempt class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ Do not return anything, modify nums1 in-place instead. """ p1, ...
class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ Do not return anything, modify nums1 in-place instead. """ (p1, p2) = (m - 1, n - 1) for p in range(m + n - 1, -1, -1): if p2 < 0: break i...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Margins in Sales Orders', 'version':'1.0', 'category': 'Sales/Sales', 'description': """ This module adds the 'Margin' on sales order. ============================================= This gives ...
{'name': 'Margins in Sales Orders', 'version': '1.0', 'category': 'Sales/Sales', 'description': "\nThis module adds the 'Margin' on sales order.\n=============================================\n\nThis gives the profitability by calculating the difference between the Unit\nPrice and Cost Price.\n ", 'depends': ['sale_...
a = int(input()) s = [x for x in input().split()] output = [] for i in range(a-1): if i == 0: if s[0] == '1': output.append('x^%d' % (a-i)) elif s[0] == '-1': output.append('-x^%d' % (a-i)) else: output.append(s[0]+'x^%d' % (a-i)) else: if int(...
a = int(input()) s = [x for x in input().split()] output = [] for i in range(a - 1): if i == 0: if s[0] == '1': output.append('x^%d' % (a - i)) elif s[0] == '-1': output.append('-x^%d' % (a - i)) else: output.append(s[0] + 'x^%d' % (a - i)) elif int(s[...
def collatzChain(n): lengthChain=0 while n!=1: if n%2==0: n=int(n/2) else: n=int((3*n)+1) print(n) def collatzChainLength(n): lengthChain=0 while n!=1: if n%2==0: n=int(n/2) else: n=int((3*n)+1) ...
def collatz_chain(n): length_chain = 0 while n != 1: if n % 2 == 0: n = int(n / 2) else: n = int(3 * n + 1) print(n) def collatz_chain_length(n): length_chain = 0 while n != 1: if n % 2 == 0: n = int(n / 2) else: n ...
vowels = "aeiouAEIOU" consonants = "bcdfghjklmnpqrstvwxyz"; consonants+=consonants.upper() #The f means final, I thought acually writing final would take to long fvowels = "" fcon="" fother="" userInput = input("Please input sentance to split: ") print ("Splitting sentance: " + userInput) #Iterates through inputed char...
vowels = 'aeiouAEIOU' consonants = 'bcdfghjklmnpqrstvwxyz' consonants += consonants.upper() fvowels = '' fcon = '' fother = '' user_input = input('Please input sentance to split: ') print('Splitting sentance: ' + userInput) for char in userInput: if char in vowels: fvowels += char elif char in consonant...
#!/usr/bin/env python3 # Replace by your own program print("hello world")
print('hello world')
#! /usr/bin/env python # -*- coding: utf-8 -*- """ @Author:lichunhui @Time: 2018/7/12 10:12 @Description: """
""" @Author:lichunhui @Time: 2018/7/12 10:12 @Description: """
""" Module: 'flowlib.faces._encode' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 class Encode: '' def _available(): pass def _update(): pass d...
""" Module: 'flowlib.faces._encode' on M5 FlowUI v1.4.0-beta """ class Encode: """""" def _available(): pass def _update(): pass def clear_value(): pass def deinit(): pass def get_dir(): pass def get_press(): pass def get_value(): ...
""" Database module """ class Database(object): """ Defines data structures and methods to store article content. """ def save(self, article): """ Saves an article. Args: article: article metadata and text content """ def complete(self): """ ...
""" Database module """ class Database(object): """ Defines data structures and methods to store article content. """ def save(self, article): """ Saves an article. Args: article: article metadata and text content """ def complete(self): """ ...
def is_mechanic(user): return user.groups.filter(name='mechanic') # return user.is_superuser def is_mechanic_above(user): return user.groups.filter(name='mechanic') or user.is_superuser # return user.is_superuser
def is_mechanic(user): return user.groups.filter(name='mechanic') def is_mechanic_above(user): return user.groups.filter(name='mechanic') or user.is_superuser
# -*- coding: utf-8 -*- """ Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license. """ class ClassTools(object): def copyattrs(self, source, names): for name in names: setattr(self, name, getattr(source, name)) def copyvalues(self, *a...
""" Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license. """ class Classtools(object): def copyattrs(self, source, names): for name in names: setattr(self, name, getattr(source, name)) def copyvalues(self, *args, **kwargs): s...
less = "Nimis"; more = "Non satis"; requiredGold = 104; def sumCoinValues(coins): totalValue = 0; for coin in coins: totalValue += coin.value return totalValue def collectAllCoins(): item = hero.findNearest(hero.findItems()) while item: hero.moveXY(item.pos.x, item.pos.y) ...
less = 'Nimis' more = 'Non satis' required_gold = 104 def sum_coin_values(coins): total_value = 0 for coin in coins: total_value += coin.value return totalValue def collect_all_coins(): item = hero.findNearest(hero.findItems()) while item: hero.moveXY(item.pos.x, item.pos.y) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 02/12/2017 8:57 PM # @Project : BioQueue # @Author : Li Yao # @File : svn.py def get_sub_protocol(db_obj, protocol_parent, step_order_start=1): steps = list() steps.append(db_obj(software='svn', parameter='checkout {{InputF...
def get_sub_protocol(db_obj, protocol_parent, step_order_start=1): steps = list() steps.append(db_obj(software='svn', parameter='checkout {{InputFile}}', parent=protocol_parent, user_id=0, hash='c025d53644388a50fb3704b4a81d5a93', step_order=step_order_start)) return (step_order_start + len(steps), steps)
n = int(input("> ")) suma = 0 while n > 0: suma += n % 10 n //= 10 print(suma)
n = int(input('> ')) suma = 0 while n > 0: suma += n % 10 n //= 10 print(suma)
# Author: Ashish Jangra from Teenage Coder var_int = 3 var_float = -3.14 var_boolean = False var_string = "True" print(type(var_int)) print(type(var_boolean)) print(type(var_string)) print(type(var_float))
var_int = 3 var_float = -3.14 var_boolean = False var_string = 'True' print(type(var_int)) print(type(var_boolean)) print(type(var_string)) print(type(var_float))
class Saml: def __init__(self, britive): self.britive = britive self.base_url = f'{self.britive.base_url}/saml' def settings(self, as_list: bool = False) -> any: """ Retrieve the SAML settings for the tenant. For historical reasons there was a time in which multiple SA...
class Saml: def __init__(self, britive): self.britive = britive self.base_url = f'{self.britive.base_url}/saml' def settings(self, as_list: bool=False) -> any: """ Retrieve the SAML settings for the tenant. For historical reasons there was a time in which multiple SAML...
# version code d345910f07ae coursera = 1 # Please fill out this stencil and submit using the provided submission script. ## 1: (Task 1) Movie Review ## Task 1 def movie_review(name): """ Input: the name of a movie Output: a string (one of the review options), selected at random using randint """ ...
coursera = 1 def movie_review(name): """ Input: the name of a movie Output: a string (one of the review options), selected at random using randint """ return ... def make_inverse_index(strlist): """ Input: a list of documents as strings Output: a dictionary that maps each word in any d...
a, b, c, x, y = map(int, input().split()) ans = 5000*(10**5)*2 for i in range(max(x, y)+1): tmp_ans = i*2*c if x > i: tmp_ans += (x-i)*a if y > i: tmp_ans += (y-i)*b ans = min(ans, tmp_ans) print(ans)
(a, b, c, x, y) = map(int, input().split()) ans = 5000 * 10 ** 5 * 2 for i in range(max(x, y) + 1): tmp_ans = i * 2 * c if x > i: tmp_ans += (x - i) * a if y > i: tmp_ans += (y - i) * b ans = min(ans, tmp_ans) print(ans)
# Python - 2.7.6 def AddExtra(listOfNumbers): return listOfNumbers + ['']
def add_extra(listOfNumbers): return listOfNumbers + ['']
@dataclass class Position: x: int = 0 y: int = 0 def __matmul__(self, other: tuple[int, int]) -> None: self.x = other[0] self.y = other[1]
@dataclass class Position: x: int = 0 y: int = 0 def __matmul__(self, other: tuple[int, int]) -> None: self.x = other[0] self.y = other[1]
# testlist_comp # : (test | star_expr) (comp_for | (COMMA (test | star_expr))* COMMA?) # ; # test [x] # star_expr comp_for [z for z in a] # test COMMA star_expr COMMA [x, *a,] # star_expr COMMA test COMMA star_expr [*u, a, *i]
[x] [z for z in a] [x, *a] [*u, a, *i]
"""Errors not related to the Telegram API itself""" class ReadCancelledError(Exception): """Occurs when a read operation was cancelled.""" def __init__(self): super().__init__(self, 'The read operation was cancelled.') class TypeNotFoundError(Exception): """ Occurs when a type is not found, ...
"""Errors not related to the Telegram API itself""" class Readcancellederror(Exception): """Occurs when a read operation was cancelled.""" def __init__(self): super().__init__(self, 'The read operation was cancelled.') class Typenotfounderror(Exception): """ Occurs when a type is not found, f...
def foo(x): return 1/x def zoo(x): res = foo(x) return res print(zoo(0))
def foo(x): return 1 / x def zoo(x): res = foo(x) return res print(zoo(0))
# Email Configuration EMAIL_PORT = 587 EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'bob@bobmail.com' EMAIL_HOST_PASSWORD = 'bob' EMAIL_USE_TLS = True
email_port = 587 email_host = 'smtp.gmail.com' email_host_user = 'bob@bobmail.com' email_host_password = 'bob' email_use_tls = True
self.description = "dir->symlink change during package upgrade (conflict)" p1 = pmpkg("pkg1", "1.0-1") p1.files = ["test/", "test/file1", "test/dir/file1", "test/dir/file2"] self.addpkg2db("local", p1) p2 = pmpkg("pkg2") p2.files = ["test/dir/file3"] self.addpkg2db("local", p2) p3...
self.description = 'dir->symlink change during package upgrade (conflict)' p1 = pmpkg('pkg1', '1.0-1') p1.files = ['test/', 'test/file1', 'test/dir/file1', 'test/dir/file2'] self.addpkg2db('local', p1) p2 = pmpkg('pkg2') p2.files = ['test/dir/file3'] self.addpkg2db('local', p2) p3 = pmpkg('pkg1', '2.0-1') p3.files = ['...
# __about__.py # # Copyright (C) 2006-2020 wolfSSL Inc. # # This file is part of wolfSSL. # # wolfSSL is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any ...
metadata = dict(__name__='wolfcrypt', __version__='0.1.9', __license__='GPLv2 or Commercial License', __author__='wolfSSL Inc.', __author_email__='info@wolfssl.com', __url__='https://wolfssl.github.io/wolfcrypt-py', __description__=u"A Python library that encapsulates wolfSSL's wolfCrypt API.", __keywords__='security, ...
class Notifier: def __init__(self, transporter): self.transporter = transporter def log(self, s): self.transporter.send('logs', s) def error(self, message, stack): self.transporter.send('process:exception', { 'message': message, 'stack': stack })
class Notifier: def __init__(self, transporter): self.transporter = transporter def log(self, s): self.transporter.send('logs', s) def error(self, message, stack): self.transporter.send('process:exception', {'message': message, 'stack': stack})
# sub_tasks_no_name.py data_sets = ['Tmean', 'Sunshine'] def task_reformat_data(): """Reformats all raw files for easier analysis""" for data_type in data_sets: yield { 'actions': ['python reformat_weather_data.py %(dependencies)s > %(targets)s'], 'file_dep': ['UK_...
data_sets = ['Tmean', 'Sunshine'] def task_reformat_data(): """Reformats all raw files for easier analysis""" for data_type in data_sets: yield {'actions': ['python reformat_weather_data.py %(dependencies)s > %(targets)s'], 'file_dep': ['UK_{}_data.txt'.format(data_type)], 'targets': ['UK_{}_data.refor...
def isPalindrome(s): """ :type s: str :rtype: bool """ s = "".join([i.lower() for i in s if i.isalnum()]) if len(s) == 0: return True count = -1 for i in range(len(s)): if s[i] == s[count]: count -= 1 else: return False re...
def is_palindrome(s): """ :type s: str :rtype: bool """ s = ''.join([i.lower() for i in s if i.isalnum()]) if len(s) == 0: return True count = -1 for i in range(len(s)): if s[i] == s[count]: count -= 1 else: return False return True inp...
class Registry: def __init__(self): self._registered_methods = {} def namespaces(self): return list(self._registered_methods) def methods(self, *namespace_path): return self._registered_methods[namespace_path] def clear(self): self._registered_methods = {} def reg...
class Registry: def __init__(self): self._registered_methods = {} def namespaces(self): return list(self._registered_methods) def methods(self, *namespace_path): return self._registered_methods[namespace_path] def clear(self): self._registered_methods = {} def re...
class AppRoutes: def __init__(self) -> None: self.prefix = "/api" self.users_sign_ups = "/api/users/sign-ups" self.auth_token = "/api/auth/token" self.auth_token_long = "/api/auth/token/long" self.auth_refresh = "/api/auth/refresh" self.users = "/api/users" s...
class Approutes: def __init__(self) -> None: self.prefix = '/api' self.users_sign_ups = '/api/users/sign-ups' self.auth_token = '/api/auth/token' self.auth_token_long = '/api/auth/token/long' self.auth_refresh = '/api/auth/refresh' self.users = '/api/users' s...
release_major = 2 release_minor = 3 release_patch = 0 release_so_abi_rev = 2 # These are set by the distribution script release_vc_rev = None release_datestamp = 0 release_type = 'unreleased'
release_major = 2 release_minor = 3 release_patch = 0 release_so_abi_rev = 2 release_vc_rev = None release_datestamp = 0 release_type = 'unreleased'
# -*- coding: utf-8 -*- def two_sum(nums, target): if ((nums is None) or not isinstance(nums, list) or len(nums) == 0): return False nums.sort() low, high = 0, len(nums) - 1 while low < high: total = nums[low] + nums[high] if total < target: ...
def two_sum(nums, target): if nums is None or not isinstance(nums, list) or len(nums) == 0: return False nums.sort() (low, high) = (0, len(nums) - 1) while low < high: total = nums[low] + nums[high] if total < target: while low + 1 < high and nums[low] == nums[low + 1...
"""Top-level package for Nexia.""" __version__ = "0.1.0" ROOT_URL = "https://www.mynexia.com" MOBILE_URL = f"{ROOT_URL}/mobile" DEFAULT_DEVICE_NAME = "Home Automation" PUT_UPDATE_DELAY = 0.5 HOLD_PERMANENT = "permanent_hold" HOLD_RESUME_SCHEDULE = "run_schedule" OPERATION_MODE_AUTO = "AUTO" OPERATION_MODE_COOL = ...
"""Top-level package for Nexia.""" __version__ = '0.1.0' root_url = 'https://www.mynexia.com' mobile_url = f'{ROOT_URL}/mobile' default_device_name = 'Home Automation' put_update_delay = 0.5 hold_permanent = 'permanent_hold' hold_resume_schedule = 'run_schedule' operation_mode_auto = 'AUTO' operation_mode_cool = 'COOL'...
''' Python program which adds up columns and rows of given table as shown in the specified figure Input number of rows/columns (0 to exit) 4 Input cell value: 25 69 51 26 68 35 29 54 54 57 45 63 61 68 47 59 Result: 25 69 51 26 171 68 35 29 54 186 54 57 45 63 219 61 68 47 59 235 208 229 172 202 811 Input number of rows/...
""" Python program which adds up columns and rows of given table as shown in the specified figure Input number of rows/columns (0 to exit) 4 Input cell value: 25 69 51 26 68 35 29 54 54 57 45 63 61 68 47 59 Result: 25 69 51 26 171 68 35 29 54 186 54 57 45 63 219 61 68 47 59 235 208 229 172 202 811 Input number of rows/...
# -*- coding: utf-8 -*- """ Created on Tue May 28 19:29:10 2019 @author: ASUS """ #import numpy as np #def factorial(): # my_array = [] # for i in range(5): # my_array.append(int(input("Enter number: "))) # my_array = np.array(my_array) # print(np.floor(my_array)) # #factorial() def factorial...
""" Created on Tue May 28 19:29:10 2019 @author: ASUS """ def factorial(n): if n <= 1: return 1 else: return n * factorial(n - 1) n = int(input('Enter number: ')) print(factorial(n))
# Set up the winner variable to hold None winner = None print('winner:', winner) print('winner is None:', winner is None) print('winner is not None:', winner is not None) print(type(winner)) # Now set winner to be True print('Set winner to True') winner = True print('winner:', winner) print('winner is None:', winner i...
winner = None print('winner:', winner) print('winner is None:', winner is None) print('winner is not None:', winner is not None) print(type(winner)) print('Set winner to True') winner = True print('winner:', winner) print('winner is None:', winner is None) print('winner is not None:', winner is not None) print(type(win...
# This should cover all the syntactical constructs that we hope to support # Intended sources should be the variable `SOURCE` and intended sinks should be # arguments to the function `SINK` (see python/ql/test/experimental/dataflow/testConfig.qll). # # Functions whose name ends with "_with_local_flow" will also be test...
source = 'source' def sink(x): print(x) def test_tuple_with_local_flow(): x = (3, SOURCE) y = x[1] sink(y) def test_names(): x = SOURCE sink(x) def test_string_literal(): x = 'source' sink(x) def test_bytes_literal(): x = b'source' sink(x) def test_integer_literal(): x ...
n = int(input()) prime=0 for i in range(n-1,0,-1): if i==2: prime = i elif(i>2): st=True for j in range(2,int(n**0.5)+1): if(i%j==0): st=False break if(st): prime = i break s_prime=0 for i in range(n+1,n+(n...
n = int(input()) prime = 0 for i in range(n - 1, 0, -1): if i == 2: prime = i elif i > 2: st = True for j in range(2, int(n ** 0.5) + 1): if i % j == 0: st = False break if st: prime = i break s_prime = 0 for i i...
cars = { 'Ford': ['Falcon', 'Focus', 'Festiva', 'Fairlane'], 'Holden': ['Commodore', 'Captiva', 'Barina', 'Trailblazer'], 'Nissan': ['Maxima', 'Pulsar', '350Z', 'Navara'], 'Honda': ['Civic', 'Accord', 'Odyssey', 'Jazz'], 'Jeep': ['Grand Cherokee', 'Cherokee', 'Trailhawk', 'Trackhawk'] } def get_al...
cars = {'Ford': ['Falcon', 'Focus', 'Festiva', 'Fairlane'], 'Holden': ['Commodore', 'Captiva', 'Barina', 'Trailblazer'], 'Nissan': ['Maxima', 'Pulsar', '350Z', 'Navara'], 'Honda': ['Civic', 'Accord', 'Odyssey', 'Jazz'], 'Jeep': ['Grand Cherokee', 'Cherokee', 'Trailhawk', 'Trackhawk']} def get_all_jeeps(cars=cars): ...
""" Entradas Salario-->float-->s Ventas_1-->float-->v1 Ventas_2-->float-->v2 Ventas_3-->float-->v3 Salidas Total_1-->float-->t1 Total_2-->float-->t2 Total_3-->float-->t3 """ s=float(input("Ingrese su salario bruto: ")) v1=float(input("Ingrese las ventas del departamento 1: ")) v2=float(input("Ingrese las ventas del dep...
""" Entradas Salario-->float-->s Ventas_1-->float-->v1 Ventas_2-->float-->v2 Ventas_3-->float-->v3 Salidas Total_1-->float-->t1 Total_2-->float-->t2 Total_3-->float-->t3 """ s = float(input('Ingrese su salario bruto: ')) v1 = float(input('Ingrese las ventas del departamento 1: ')) v2 = float(input('Ingrese las ventas d...
version_defaults = { 'param_keys': { 'grid5': ['accrate', 'x', 'z', 'qb', 'mass'], 'synth5': ['accrate', 'x', 'z', 'qb', 'mass'], 'grid6': ['accrate', 'x', 'z', 'qb', 'mass'], 'he1': ['accrate', 'x', 'z', 'qb', 'mass'], 'he2': ['accrate', 'qb'], }, 'bprops': { ...
version_defaults = {'param_keys': {'grid5': ['accrate', 'x', 'z', 'qb', 'mass'], 'synth5': ['accrate', 'x', 'z', 'qb', 'mass'], 'grid6': ['accrate', 'x', 'z', 'qb', 'mass'], 'he1': ['accrate', 'x', 'z', 'qb', 'mass'], 'he2': ['accrate', 'qb']}, 'bprops': {'grid5': ('rate', 'u_rate', 'fluence', 'u_fluence', 'peak', 'u_p...
fname = input("Enter file name: ") try: fhand = open(fname) except: print('Something wrong with the file') for line in fhand: print((line.upper()).rstrip())
fname = input('Enter file name: ') try: fhand = open(fname) except: print('Something wrong with the file') for line in fhand: print(line.upper().rstrip())
# -*- coding: utf-8 -*- def ULongToHexHash(long: int): buffer = [None] * 8 buffer[0] = (long >> 56).to_bytes(28,byteorder='little').hex()[:2] buffer[1] = (long >> 48).to_bytes(28,byteorder='little').hex()[:2] buffer[2] = (long >> 40).to_bytes(28,byteorder='little').hex()[:2] buffer[3] = (long >> 32)...
def u_long_to_hex_hash(long: int): buffer = [None] * 8 buffer[0] = (long >> 56).to_bytes(28, byteorder='little').hex()[:2] buffer[1] = (long >> 48).to_bytes(28, byteorder='little').hex()[:2] buffer[2] = (long >> 40).to_bytes(28, byteorder='little').hex()[:2] buffer[3] = (long >> 32).to_bytes(28, byt...
def hide_spines(ax, positions=["top", "right"]): """ Pass a matplotlib axis and list of positions with spines to be removed args: ax: Matplotlib axis object positions: Python list e.g. ['top', 'bottom'] """ assert isinstance(positions, list), "Position must be passed ...
def hide_spines(ax, positions=['top', 'right']): """ Pass a matplotlib axis and list of positions with spines to be removed args: ax: Matplotlib axis object positions: Python list e.g. ['top', 'bottom'] """ assert isinstance(positions, list), 'Position must be passed ...
class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ result_len = 0 result_str = '' if len(strs) == 1: return strs[0] # get the smallest str min_len = None smalles...
class Solution(object): def longest_common_prefix(self, strs): """ :type strs: List[str] :rtype: str """ result_len = 0 result_str = '' if len(strs) == 1: return strs[0] min_len = None smallest_str = None for item in strs: ...
"""Top-level package for Freud API Crawler.""" __author__ = """Peter Andorfer""" __email__ = 'peter.andorfer@oeaw.ac.at' __version__ = '0.19.0'
"""Top-level package for Freud API Crawler.""" __author__ = 'Peter Andorfer' __email__ = 'peter.andorfer@oeaw.ac.at' __version__ = '0.19.0'
expected_output = { "peer_type": { "vbond": { "downtime": { "2021-12-15T04:19:41+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DCONFAIL", "peer_organization": "", ...
expected_output = {'peer_type': {'vbond': {'downtime': {'2021-12-15T04:19:41+0000': {'domain_id': '0', 'local_color': 'gold', 'local_error': 'DCONFAIL', 'peer_organization': '', 'peer_private_ip': '184.118.1.19', 'peer_private_port': '12346', 'peer_protocol': 'dtls', 'peer_public_ip': '184.118.1.19', 'peer_public_port'...
map = {'corridor':['room1','','','room2'],'room1':['','','corridor',''],'room2':['','corridor','','']} commands = {'room1':room1,'room2':room2,'corridor':corridor} def Moving(location): rooms = map[location] directions = ['North','East','South','West'] availableDirections = [directions[i] for i,j in enume...
map = {'corridor': ['room1', '', '', 'room2'], 'room1': ['', '', 'corridor', ''], 'room2': ['', 'corridor', '', '']} commands = {'room1': room1, 'room2': room2, 'corridor': corridor} def moving(location): rooms = map[location] directions = ['North', 'East', 'South', 'West'] available_directions = [directio...
# -*- coding:utf-8 -*- """ OOP: Object-Oriented Programming/Paradigm 3 main characteristics: * Encapsulation: Scope of data is limited to the Object * Inheritance: Object fields can be implicitly used in extended classes * Polymorphism: Same name can have different signatures """ # ###########################...
""" OOP: Object-Oriented Programming/Paradigm 3 main characteristics: * Encapsulation: Scope of data is limited to the Object * Inheritance: Object fields can be implicitly used in extended classes * Polymorphism: Same name can have different signatures """ def increment(n): return lambda x: x + n def coun...
def fence_pattern(rails, message_size): pass def encode(rails, message): pass def decode(rails, encoded_message): pass
def fence_pattern(rails, message_size): pass def encode(rails, message): pass def decode(rails, encoded_message): pass
# python3 def last_digit_of_fibonacci_number_naive(n): assert 0 <= n <= 10 ** 7 if n <= 1: return n return (last_digit_of_fibonacci_number_naive(n - 1) + last_digit_of_fibonacci_number_naive(n - 2)) % 10 def last_digit_of_fibonacci_number(n): assert 0 <= n <= 10 ** 7 if (n < 2): ...
def last_digit_of_fibonacci_number_naive(n): assert 0 <= n <= 10 ** 7 if n <= 1: return n return (last_digit_of_fibonacci_number_naive(n - 1) + last_digit_of_fibonacci_number_naive(n - 2)) % 10 def last_digit_of_fibonacci_number(n): assert 0 <= n <= 10 ** 7 if n < 2: return n el...
""" A python program for Dijkstra's single source shortest path algorithm. The program is for adjacency list representation of the graph """ # Function that implements Dijkstra's single source shortest path algorithm # for a graph represented using adjacency list representation def dijkstra(N, graph, src): S = lis...
""" A python program for Dijkstra's single source shortest path algorithm. The program is for adjacency list representation of the graph """ def dijkstra(N, graph, src): s = list() S.append(src) dist = {x: 99 for x in range(1, N + 1)} dist[src] = 0 min_cost = 999 selected_u = 0 selected_v =...
# From pep-0318 examples: # https://www.python.org/dev/peps/pep-0318/#examples def accepts(*types): def check_accepts(f): assert len(types) == f.func_code.co_argcount def new_f(*args, **kwds): for (a, t) in zip(args, types): assert isinstance(a, t), "arg %r does not ma...
def accepts(*types): def check_accepts(f): assert len(types) == f.func_code.co_argcount def new_f(*args, **kwds): for (a, t) in zip(args, types): assert isinstance(a, t), 'arg %r does not match %s' % (a, t) return f(*args, **kwds) new_f.func_name = f...
# -*- coding: utf-8 -*- """ 669. Trim a Binary Search Tree Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in [low, high]. Trimming the tree should not change the relative structure of the elements that will remain in the tree (i...
""" 669. Trim a Binary Search Tree Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in [low, high]. Trimming the tree should not change the relative structure of the elements that will remain in the tree (i.e., any node's descenda...
historical_yrs = [i + 14 for i in range(6)] future_yrs = [5*i + 20 for i in range(7)] cities = { 'NR': { 'Delhi': (28.620198, 77.207953), 'Jaipur': (26.913310, 75.800162), 'Lucknow': (26.850000, 80.949997), 'Kanpur': (26.460681, 80.313318), 'Ghaz...
historical_yrs = [i + 14 for i in range(6)] future_yrs = [5 * i + 20 for i in range(7)] cities = {'NR': {'Delhi': (28.620198, 77.207953), 'Jaipur': (26.91331, 75.800162), 'Lucknow': (26.85, 80.949997), 'Kanpur': (26.460681, 80.313318), 'Ghaziabad': (28.673733, 77.437598), 'Ludhiana': (30.903434, 75.854784), 'Agra': (27...
port="COM3" # if ('virtual' in globals() and virtual): virtualArduino = Runtime.start("virtualArduino", "VirtualArduino") virtualArduino.connect(port) ard = Runtime.createAndStart("Arduino","Arduino") ard.connect(port) # i2cmux = Runtime.createAndStart("i2cMux","I2cMux") # From version 1.0.2316 use attach inste...
port = 'COM3' if 'virtual' in globals() and virtual: virtual_arduino = Runtime.start('virtualArduino', 'VirtualArduino') virtualArduino.connect(port) ard = Runtime.createAndStart('Arduino', 'Arduino') ard.connect(port) i2cmux = Runtime.createAndStart('i2cMux', 'I2cMux') i2cmux.attach(ard, '1', '0x70') mpu6050_0...
""" looks for parameter values that are reflected in the response. Author: maradrianbelen.com The scan function will be called for request/response made via ZAP, excluding some of the automated tools Passive scan rules should not make any requests Note that new passive scripts will initially be disabled Right click th...
""" looks for parameter values that are reflected in the response. Author: maradrianbelen.com The scan function will be called for request/response made via ZAP, excluding some of the automated tools Passive scan rules should not make any requests Note that new passive scripts will initially be disabled Right click th...
# # PySNMP MIB module NBS-CMMCENUM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBS-CMMCENUM-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:17:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
#! /usr/bin/env python3 '''A library of functions for our cool app''' def add(a, b): return a + b def add1(a): return a - 1 def sub1(a): pass
"""A library of functions for our cool app""" def add(a, b): return a + b def add1(a): return a - 1 def sub1(a): pass
def test_ports(api, utils): """Demonstrates adding ports to a configuration and setting the configuration on the traffic generator. The traffic generator should have no items configured other than the ports in this test. """ tx_port = utils.settings.ports[0] rx_port = utils.settings.ports[1...
def test_ports(api, utils): """Demonstrates adding ports to a configuration and setting the configuration on the traffic generator. The traffic generator should have no items configured other than the ports in this test. """ tx_port = utils.settings.ports[0] rx_port = utils.settings.ports[1...
""" 39 / 39 test cases passed. Runtime: 340 ms Memory Usage: 34.7 MB """ class Solution: def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int: graph = [[] for _ in range(n)] for i in range(n): id = manager[i] if id != -1: ...
""" 39 / 39 test cases passed. Runtime: 340 ms Memory Usage: 34.7 MB """ class Solution: def num_of_minutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int: graph = [[] for _ in range(n)] for i in range(n): id = manager[i] if id != -1: ...
# V0 # IDEA : DP class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ dp = [False] * (len(s) + 1) dp[0] = True for i in range(1, len(s) + 1): for k in range(i): ...
class Solution(object): def word_break(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ dp = [False] * (len(s) + 1) dp[0] = True for i in range(1, len(s) + 1): for k in range(i): if dp[k] and ...
# # PySNMP MIB module LANART-AGENT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LANART-AGENT # Produced by pysmi-0.3.4 at Mon Apr 29 19:54:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, constraints_union, value_size_constraint, single_value_constraint) ...