content
stringlengths
7
1.05M
extensions = ["sphinx-favicon"] master_doc = "index" exclude_patterns = ["_build"] html_theme = "basic" html_static_path = ["gfx"] favicons = [ { "sizes": "32x32", "static-file": "square.svg", }, { "sizes": "128x128", "static-file": "nested/triangle.svg", }, ]
lista = [] nome = str(input('Qual é o seu nome? ')) print(f'Olá, {nome} vamos começar...\n') while True: valor = int(input('Digite um valor: ')) if valor not in lista: print('Valor adicionado a lista') lista.append(valor) else: print('Esse valor já está na lista, não podemos adicion...
acceptall = [ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n", "Accept-Encoding: gzip, deflate\r\n", "Accept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n", "Accept: text/html, application...
# -*- coding: utf-8 -*- """Top-level package for Make Notebooks.""" __author__ = """Martin Skarzynski""" __version__ = '0.0.1'
# region headers # escript-template v20190605 / stephane.bourdeaud@nutanix.com # * author: Geluykens, Andy <Andy.Geluykens@pfizer.com> # * version: 2019/06/05 # task_name: RubrikGetSlaDomainId # description: This script gets the id of the specified Rubrik SLA domain. # endregion # region capture Cal...
class Animal: def __init__(self, name): # Constructor of the class self.name = name def speak(self): # Abstract method, defined by convention only raise NotImplementedError("Subclass must implement abstract method") class Dog(Animal): def speak(self): return self.n...
''' You are given a spreadsheet that contains a list of N athletes and their details (such as age, height, weight and so on). You are required to sort the data based on the Kth attribute and print the final resulting table. Follow the example given below for better understanding. image Note that K is indexed fro...
print('====== DESAFIO 78 ======') lista = list() cont = 0 for c in range(1,3): lista.append(int(input('Digite um número: '))) print(f'O maior número digitado foi: {max(lista)} na posição {lista.index(max(lista))}') print(f'O menor número digitado foi: {min(lista)} na posição {lista.index(min(lista))}')
# Copyright 2019 BlueCat Networks. All rights reserved. # -*- coding: utf-8 -*- type = 'ui' sub_pages = [ { 'name' : 'cmdb_routers_page', 'title' : u'CMDB Routers', 'endpoint' : 'cmdb_routers/cmdb_routers_endpoint', 'description' : u'cmdb_routers' }, ]
input = """ #maxint=100. g(1,X):- #int(X). s(1). f(X) :- s(Y), g(Y,X), T=1+2. """ output = """ {f(0), f(1), f(10), f(100), f(11), f(12), f(13), f(14), f(15), f(16), f(17), f(18), f(19), f(2), f(20), f(21), f(22), f(23), f(24), f(25), f(26), f(27), f(28), f(29), f(3), f(30), f(31), f(32), f(33), f(34), f(35), f(36), f...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
__title__ = "mathy_core" __version__ = "0.8.4" __summary__ = "Computer Algebra System for working with math expressions" __uri__ = "https://mathy.ai" __author__ = "Justin DuJardin" __email__ = "justin@dujardinconsulting.com" __license__ = "All rights reserved"
#!/usr/bin/env python3 theInput = """785 516 744 272 511 358 801 791 693 572 150 74 644 534 138 191 396 196 860 92 399 233 321 823 720 333 570 308 427 572 246 206 66 156 261 595 336 810 505 810 210 938 615 987 820 117 22 519 412 990 256 405 996 423 55 366 418 290 402 810 31...
# -*- coding: utf-8 -*- """Holder for shared Configuration""" def init(): """Holder for shared Configuration""" global config try: config except NameError: config = {}
#!/usr/bin/env python3 def validate_script(script): """ Validate compiled script """ assert type(script) == bytes # TODO - more validation
class ContactHelper: def __init__(self, app): self.app = app def open_contacts_page(self): wd = self.app.wd if not (wd.current_url.endswith("/group.php") and len (wd.find_elements_by_name("new"))) > 0: wd.find_element_by_link_text("home").click() def create(self, conta...
lista = [] for c in range(0, 5): n = ' ' while n.isnumeric() == False: n = input('digite um número: ') if n.isnumeric() == False: print('o valor digitado não e um número') n = int(n) if c == 0 or n > lista[-1]: lista.append(n) print('adicionado para o final da...
''' 使用多继承中,我们基本不会使用super()来调用 父类中的任何内容.除非每个父类中的变量和方法 都是独特的 ''' class Point(object): x = 0.0 y = 0.0 def __init__(self, x, y): self.x = x self.y = y print("Point constructor") def ToString(self): return "{X:" + str(self.x) + ",Y:" + str(self.y) + "}" class Size(object):...
# some sample PROJECT_NAME = "My Application" APPLICATION_SENTENCE = "Hello Django" # add apps into project read after settings.py # append application into lists # INSTALLED_APPS.append('my_application') # MIDDLEWARE.append('my_application.middleware.MyApplicationMiddleware') # add an application INSTALLED_APPS.appe...
""" AAn isogram is a word that has no repeating letters, consecutive or non-consecutive. For example "something" and "brother" are isograms, where as "nothing" and "sister" are not. Below method compares the length of the string with the length (or size) of the set of the same string. The set of the string removes...
__source__ = 'https://leetcode.com/problems/next-greater-element-i/' # Time: O(m + n) # Space: O(m + n) # # Description: 496. Next Greater Element I # # You are given two arrays (without duplicates) nums1 and nums2 where nums1's elements are subset of nums2. # Find all the next greater numbers for nums1's elements in ...
__all__=["declare_reproducible"] def declare_reproducible(SEED = 123): ''' https://github.com/NVIDIA/framework-determinism/blob/master/pytorch.md ''' # or whatever you choose try : random.seed(SEED) # if you're using random except : pass try : np.random.seed(SEED)...
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } } SECRET_KEY = 'supersecret' INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'nonr...
class Solution: def buildTree(self, preorder, inorder): if not inorder: return None root_val = preorder[0] index = inorder.index(root_val) left_tree = self.buildTree(preorder[1:index + 1], inorder[:index]) right_tree = self.buildTree(preorder[index + 1:...
num1 = int(input()) num2 = int(input()) print(f'X = {num1 + num2}')
def PeptideMasses(PeptideMassesSummaryFileName, PeptidesListFileLocation): # 'amino acid', monoisotopic residue mass, average residue mass AAResidueMassData = {'A':('Ala', 71.037114, 71.0779), 'C':('Cys', 103.009185, 103.1429), 'D':('Asp', 115.026943, 115.0874), '...
""" Given a sequence of n integers a1, a2, ..., an, a 132 pattern is a subsequence ai, aj, ak such that i < j < k and ai < ak < aj. Design an algorithm that takes a list of n numbers as input and checks whether there is a 132 pattern in the list. Note: n will be less than 15,000. Example 1: Input: [1, 2, 3, 4] Outpu...
# Multiplying strings and accessing characters within them # You can print a string multiple times by... multiplying it! print("-" * 10) # Since strings are basically a list, you can also access characters # or ranges of characters by indexing into them name = "Phil Hinton" print(f"Name: {name}") # First characte...
# TWITTER ACCESS_KEY = (" ") ACCESS_SECRET = (" ") CONSUMER_KEY = (" ") CONSUMER_SECRET = (" ") BEARER_TOKEN = (" ") # TELEGRAM API_KEY = (" ") BOT_CHAT_ID = (" ") # DISCORD APPLICATION_ID = (" ") PUBLIC_KEY = (" ") CLIENT_ID = (" ") CLIENT_SECRET = (" ") TOKEN = (" ") invite_url = (" ") # tweets baixados tweets = [...
SESSION_EXPIRED = "Session expired. Please log in again." NETWORK_ERROR_MESSAGE = ( "Network error. Please check your connection and try again." ) AUTH_SERVER_ERROR = ( "A problem occured while trying to authenticate with divio.com. " "Please try again later" ) SERVER_ERROR = ( "A problem occured while ...
class FileType: CSV = 'csv' XLSX = 'xlsx' JSON = 'json' XML = 'xml'
# -*- coding: utf-8 -*- countries_data = [ { 'name': u'Afghanistan', 'alpha2': u'AF', 'alpha3': u'AFG', 'numeric': 4, 'independent': True, }, { 'name': u'Åland Islands', 'alpha2': u'AX', 'alpha3': u'ALA', 'numeric': 248, 'indep...
def test_eval_mode(wdriver): assert wdriver.execute_script("return window.rp.pyEval('1+1')") == 2 def test_exec_mode(wdriver): assert wdriver.execute_script("return window.rp.pyExec('1+1')") is None def test_exec_single_mode(wdriver): assert wdriver.execute_script("return window.rp.pyExecSingle('1+1')")...
# encoding: UTF-8 def remove_chinese(str): s = "" for w in str: if w >= u'\u4e00' and w <= u'\u9fa5': continue s += w return s def remove_non_numerical(s): f = '' for i in range(len(s)): try: f = float(s[:i+1]) except: return f ...
# Link: https://leetcode.com/problems/search-in-rotated-sorted-array/ # Time: O(LogN) # Space: O(1) # As the given array is rotated sorted, binary search cannot be applied directly. def search(nums, target): start, end = 0, len(nums) - 1 while start <= end: mid = (start + end) // 2 if targ...
class Sequence: transcription_table = {'A':'U', 'T':'A', 'C':'G' , 'G':'C'} enz_dict = {'EcoRI':'GAATTC', 'EcoRV':'GATATC'} def __init__(self, seqstring): self.seqstring = seqstring.upper() def restriction(self, enz): try: enz_target = Sequence.enz_dict[enz] retur...
''' URL: https://leetcode.com/problems/delete-node-in-a-linked-list/ Difficulty: Easy Description: Delete Node in a Linked List Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly. It is ...
class Messages: USERS_1 = 'Username already exists.' USERS_2 = 'Email already exists.' USERS_3 = 'Password and Confirm Password must be same.' USERS_4 = 'Username or Password is incorrect.' USERS_5 = 'Your email address is not verified.' TOKENS_1 = 'Token does not exist.' TOKENS_2 = 'User d...
class PageEffectiveImageMixin(object): def get_effective_image(self): if self.image: return self.image page = self.get_main_language_page() if page.specific.image: return page.specific.get_effective_image() return ''
#!/usr/bin/env python3 """Reads gamebits.txt and produces: - one list per table, in gamebitsN.txt - GameBit.h for import into Ghidra - a list of all known bits, in stdout """ tables = [ {'id':0, 'bits':[]}, {'id':1, 'bits':[]}, {'id':2, 'bits':[]}, {'id':3, 'bits':[]}, ] allBits = [] longestName = 4 # ...
# /home/bruce/python/workareas/pyke-hg/r1_working/pyke/krb_compiler/krbparser_tables.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '`\xa3O\x17\xd6C\xd4E2\xb5\xf60wIM\xd9' _lr_action_items = {'TAKING_TOK':([142,161,187,216,],[-66,188,-66,240,]),'L...
def code_function(): #function begin############################################ global code code=""" `include "{0}_env.sv" class {0}_model_base_test extends uvm_test; `uvm_component_utils({0}_model_base_test) //--------------------------------------- // env instance //------------...
# The next lines will make the Pixel Turtle and its heading invisible # and will clear the screen for light show hidePixel() hideHeading() clear() # Those are the colors for the light show colors = [white, red, yellow, green, cyan, blue, purple, white] # First we move to the top left corner moveTo(0, 0) # For each c...
# Write a Python program to multiply two numbers entered by the user and display their product # for more info on this quiz, go to this url: http://www.programmr.com/multiply-two-numbers-1 def multiply_number(): print("Please enter two numbers") user_inputs = [] result = 1 for i in range(2): ...
class Singleton(object): def __init__(self): self.x = 0 def foo(self): pass singleton = Singleton() ''' Python 的模块就是天然的单例模式,因为模块在第一次导入时,会生成 .pyc 文件, 当第二次导入时,就会直接加载 .pyc 文件,而不会再次执行模块代码。 因此,我们只需把相关的函数和数据定义在一个模块中,就可以获得一个单例对象了。 '''
personal_details = ('Sanjar', 22, 'India') print(personal_details) name, _, country = personal_details print(name, country)
print ("how old are you?.",) age=raw_input() print("How tall are you?.",) height=raw_input() print("How much do you weight?.",) weight=raw_input() print("So you're %r old,%r tall and %r heavy."%(age,height,weight))
""" Define directories and options, here as an example for modeling crime offences. Input file requirements: Input csv file must include one column labeled "region_id" which holds the ID number for each location and two columns "centroid_x" and "centroid_y" which hold the x and y coordinate for each location, respectiv...
x = list(input().lower()) y = list(input().lower()) for i,j in zip(x,y): if i>j: print("1") break elif i<j: print("-1") break else: print("0")
# def soma (a, b): # print(f'A = {a} e B = {b}') # s = a + b # print(f'A soma de A + B = {s}') # # # soma(4, 5) # def contador(* num): # tam = len(num) # print(f'Recebi os valores {num} e são ao todo {tam} números') # # # contador(1, 2, 3) # contador(4, 5, 1, 4, 5) # contador(9, 1, 8, 8, 7, 5, 6) de...
fashion_mnist = tf.keras.datasets.fashion_mnist (train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data() class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot'] (train_images, train_labels), (test_images, test_la...
marksheet = [] scores = [] n = int(input()) for i in range(n): name = input() score = float(input()) marksheet += [[name, score]] scores += [score] li = sorted(set(scores))[1] for n, s in marksheet: if s == li: print(n)
def import_and_create_dictionary(filename): """This function is used to create an expense dictionary from a file Every line in the file should be in the format: key , value the key is a user's name and the value is an expense to update the user's total expense with. the value shld be a number, however...
# -*- coding: utf-8 -*- def main(): n = int(input()) ans = set() for i in range(n): ai, bi = map(int, input().split()) if ai > bi: ans.add((bi, ai)) else: ans.add((ai, bi)) print(len(ans)) if __name__ == '__main__': main()
# vim: set ts=4 sw=4 et fileencoding=utf-8: '''Vim encoding mappings to Sublime Text''' ENCODING_MAP = { 'latin1': 'Western (Windows 1252)', 'koi8-r': 'Cyrillic (KOI8-R)', 'koi8-u': 'Cyrillic (KOI8-U)', 'macroman': 'Western (Mac Roman)', 'iso-8859-1': 'Western (ISO 8859-1)', ...
""" Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = [1,1,1], k = 2 Output: 2 Solution: 1. Brute Force Enumerate all subarray 2. Accumulative Sum """ # Brute Force # Time: O(n^2) # Space: O(1) class Solution: d...
# # PySNMP MIB module NNCEXTPVC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NNCEXTPVC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:13:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
# The isBadVersion API is already defined for you. # def isBadVersion(version: int) -> int: class Solution: def firstBadVersion(self, n: int) -> int: start, end = 1, n while start < end: mid = start + (end - start) // 2 check = isBadVersion(mid) if check...
""" Pseudocode: exercises 23, 24, 25 Post-solution REVIEW: Too much detail, to be honest especially for someone who understands the fundamentals Ex 23: Exercise 23 – Your first loops Generate a list that contains at least 20 random integers. Write one loop that sums up all entries of the list. ...
load("@bazel_skylib//lib:shell.bzl", "shell") _CONTENT_PREFIX = """#!/usr/bin/env bash set -euo pipefail """ def _multirun_impl(ctx): transitive_depsets = [] content = [_CONTENT_PREFIX] for command in ctx.attr.commands: defaultInfo = command[DefaultInfo] if defaultInfo.files_to_run == N...
current_petrol = 0 current_position = 0 n = int(input().strip()) for i in range(n): petrol, distance = map(int, input().strip().split(' ')) current_petrol += petrol if (current_petrol > distance): current_petrol -= distance else: current_petrol = 0 current_position = i print(curr...
APPNAME = 'assembly' APPAUTHOR = 'kbase' URL = 'http://kbase.us/services/assembly' AUTH_SERVICE = 'KBase' OAUTH_EXP_DAYS = 14 OAUTH_FILENAME = 'globus_oauth.prop'
PACKAGE = "python-ptrace" VERSION = "0.9" WEBSITE = "http://python-ptrace.readthedocs.org/" LICENSE = "GNU GPL v2"
def findmax(items): if len(items) == 0: return None m = items[0] i = 1 while i < len(items): if m < items[i]: m = items[i] i = i + 1 return m
# -*- coding: utf-8 -*- """ Model Map refurbishment_level table :author: Sergio Aparicio Vegas :version: 0.2 :date: 29 Nov 2017 """ __docformat__ = "restructuredtext" class RefurbishmentLevel(): """ Refurbishment level options """ def __init__(self): self.__id = 0 self._...
#!/usr/bin/python patch_size = [25, 31, 35] scale_factor = [1.15, 1.2, 1.3] num_levels = [4, 8, 10] max_dist = [35, 40, 45, 50] fp_runscript = open("/home/kivan/source/cv-stereo/scripts/egomotion_kitti_eval/run_validation_orb2.sh", 'w') fp_runscript.write("#!/bin/bash\n\n") cnt = 0 for i in range(len(patch_size)): ...
''' Com base na tabela abaixo, escreva um programa que leia o código de um item e a quantidade deste item. A seguir, calcule e mostre o valor da conta a pagar. <img src="https://resources.urionlinejudge.com.br/gallery/images/problems/UOJ_1038_en.png" alt="Price Table"> Entrada O arquivo de entrada contém dois valores ...
# This program has been developed by students from the bachelor Computer Science at Utrecht University within the # Software and Game project course # ©Copyright Utrecht University Department of Information and Computing Sciences. """Contains test data.""" test_get_assignments_data = \ { "courses": [ ...
"""Automatically generated by oppfest. To update, run python3 -m script.oppfest """ # fmt: off MQTT = { "tasmota": [ "tasmota/discovery/#" ] }
class Queue: def __init__(self, size): if size <= 0: raise "Size must be 1 or greater." self.start = 0 self.end = 0 self.count = 0 self.size = size self.items = [None] * size def enqueue(self, data): if self.count >= self.size: r...
""" Zachary Cook Class representing a lab user. """ """ Class for a user. """ class User(): """ Constructor for the user. """ def __init__(self,id,maxSessionTime,accessType="UNAUTHORIZED"): self.id = id self.accessType = accessType self.maxSessionTime = maxSessionTime """ Returns the user's id. """ de...
def dist_whittaker(datamtx, strict=True): """ returns whittaker distance (manhattan distance with sample normalization) btw rows. This script interfaces with Cogent for adding the extra metric in QIIME in beta_diversity.py dist(a,b) = 0.5*manhattan distance(ai/A, bi/B) where ai is each element of a, and A...
# ----------------------------------------------------------------------------- # Staff Assistance Flow # ----------------------------------------------------------------------------- staff_assistance_customer_email_inputtext = "xpath=//*[@id='emailInput']" staff_assistance_company_input ...
# ------------------------------ # 187. Repeated DNA Sequences # # Description: # You are given two non-empty linked lists representing two non-negative integers. The most significant digit # comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. # # You may a...
# Python Program To Copy An Image Into Another Files ''' Function Name : Copy An Image Into Another Files Function Date : 24 Sep 2020 Function Author : Prasad Dangare Input : -- Output : -- ''' # Open The File In Binary Modes f1 = open('new.jpg.png', 'rb') f2 = open('new...
# Oefening: Vraag de geboortedatum van de gebruiker en zeg de leeftijd. huidig_jaar = 2017 huidige_maand = 10 huidige_dag = 24 jaar = int(input("In welk jaar ben je geboren? ")) maand = int(input("En in welke maand? (getal) ")) # De dag moeten we pas weten als de geboortemaand deze maand is! # Je kan het hier nat...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # dist...
# Problem for Prof Charnesky's mid term review sheet at: # https://canvas.umd.umich.edu/courses/522665/pages/midterm-practice?module_item_id=9243802 # 1 Classes and Unit Test question # Given the following UML, write the class # Pizza # toppings : [] # slices : int # base_cost : float # price_per_topping : int # get_to...
class Node: def __init__(self, value): self.value = value self.left = None self.right = None def insert(self, value): if self.value: if value < self.value: if self.left: self.left.insert(value) else: ...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
class Settings: """ All Game Settings """ def __init__(self): self.screen_width = 1000 self.screen_height = 600 self.bg_color = (180, 255, 255) self.ship_speed = 1.25 self.ship_limit = 3 self.bullet_speed = 1 self.bullet_width = 3 self....
total = 0 for num in range(101): total = total + num print (total)
''' script de aprovação de financiamento de casa ''' valor_casa = float(input('Qual o Valor da casa? R$')) salario = float(input('Qual o Seu salario mensal? R$')) tempo = int(input('Em Quantos Anos você vai pagar? ')) parcela_salario = ((salario/100) * 30) parcela_casa = valor_casa / (tempo * 12) if parcela_casa <= ...
# 抓捕异常 def try_except(): try: 3 / 0 except ZeroDivisionError as err: print("zero error: {0}".format(err)) finally: print("this is finally") print("try_except") # 抛出异常 def raise_study(): x = 10 if x > 5: raise Exception('x 不能大于 5。x 的值为: {}'.format(x)) # 如果你只想...
def totalFruit(self, tree): count = {} i = res = 0 for j, v in enumerate(tree): count[v] = count.get(v, 0) + 1 while len(count) > 2: count[tree[i]] -= 1 if count[tree[i]] == 0: del count[tree[i]] i += 1 res = max(res, j - i + 1) return res
a, b = input().split() st = '' num_a = int(a) num_b = int(b) if num_a % 2 == 0 : answer = -num_a st += str(-num_a) else : answer = num_a st += str(num_a) if a == b : if int(a) % 2 == 0 : print("-", a, "=-", a, sep='') else : print(a, "=+", a, sep='') exit() while ...
result =1 i=1 while i<=100: result=result*i i=i+1 pass print("the factorial is {}".format(result))
class TOS(QTextEdit): tos_signal = pyqtSignal() error_signal = pyqtSignal(object) class Plugin(TrustedCoinPlugin): def __init__(self, parent, config, name): super().__init__(parent, config, name) @hook def on_new_window(self, window): wallet = window.wallet if not isinstance(wallet, self.wallet_class): re...
# ! Desafio 56 # ! Crie um programa que leia o nome, idade e sexo de 4 pessoas. No final do programa, mostre: # ! A media de idade do grupo # ! Qual é o nome do homem mais velho # ! Quantas mulheres tem menos de 20 anos. SomaIdade = 0 MediaIdade = 0 MaiorIdade = 0 NomeVelho = '' totmulher20 = 0 for p in range(1, 5): ...
# # PySNMP MIB module ZHONE-PHY-SONET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-PHY-SONET-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:47:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
### SATISFACTORY RESPONSE ## Not found code OK = 200 OK_NOCONTENT = 204 ### CLIENT ERROR ## Not found code NOT_FOUND = 404 UNAUTHORIZED = 401 ### SERVER ERROR ## Internal server error INTERNAL_ERROR = 500
""" Time complexity O(n) """ # Search for maximum number l = [2, 4, 5, 1, 80, 5, 99] maximum = l[0] for item in l: if item > maximum: maximum = item print(maximum)
# DESCRIPTION # Return the root node of a binary search tree that matches the given preorder traversal. # It's guaranteed that for the given test cases there is always possible to find a # binary search tree with the given requirements. # EXAMPLE # Input: [8,5,1,7,10,12] # Output: [8,5,10,1,7,null,12] # Definition f...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None ## mergesort class Solution(object): def sortList(self, head): """ :type head: ListNode :rtype: ListNode """ if not head or not head....
def find_floor(brackets: str) -> int: return sum(1 if c == '(' else -1 for c in brackets) def find_basement_entry(brackets: str) -> int: return [n + 1 for n in range(len(brackets)) if find_floor(brackets[:n + 1]) == -1][0] if __name__ == '__main__': with open('input') as f: bracket_text = f.read...
result = [ None, 6, ['a', 'b', 'c', {'uu': 5.6, 'oo': [Ellipsis], 'ii': {Ellipsis}}], {'uu': 5.6, 'oo': [Ellipsis], 'ii': {Ellipsis}}, {'uu': 5.6, 'oo': [Ellipsis], 'ii': {Ellipsis}}, ['a', 'b', 'c', {'uu': 5.6, 'oo': [Ellipsis], 'ii': {Ellipsis}}], None, 6 ] def is_equal(a, b, message...
p1, p2 = map(int, input().split()) m = (p1 + p2) / 2 if m >= 7: print(f'{m} - Aprovado', end='') elif m < 5: print(f'{m} - Reprovado', end='') else: print(f'{m} - De Recuperacao', end='')
"""680. Valid Palindrome II https://leetcode.com/problems/valid-palindrome-ii/ """ class Solution: def validPalindrome(self, s: str) -> bool: def helper(i: int, j: int, flag: bool) -> bool: while i < j: if s[i] == s[j]: i += 1 j -= 1 ...
# # PySNMP MIB module RADIUS-ACCOUNTING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADIUS-ACCOUNTING-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:44:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
#!/usr/bin/env python3 # # --- Day 19: Beacon Scanner --- # # As your probe drifted down through this area, it released an assortment # of beacons and scanners into the water. It's difficult to navigate in the # pitch black open waters of the ocean trench, but if you can build a map # of the trench using data from the ...