content
stringlengths
7
1.05M
def cgi_content(type="text/html"): return('Content type: ' + type + '\n\n') def webpage_start(): return('<html>') def web_title(title): return('<head><title>' + title + '</title></head>') def body_start(h1_message): return('<h1 align="center">' + h1_message + '</h1><p align="center">') def body_end(): return("...
class GTDException(Exception): '''single parameter indicates exit code for the interpreter, because this exception typically results in a return of control to the terminal''' def __init__(self, errno): self.errno = errno
class ExcalValueError(ValueError): pass class ExcalFileExistsError(FileExistsError): pass
my_family = { 'wife': { 'name': 'Julia', 'age': 32 }, 'daughter': { 'name': 'Aurelia', 'age': 2 }, 'son': { 'name': 'Lazarus', 'age': .5 }, 'father': { 'name': 'Rodney', 'age': 62 } } # use a dictionary comprehension to produce output that looks like this: # Krista is my siste...
fieldname_list = [ "file_name", "file_path", "v_format", "v_info", "v_profile", "v_settings", "v_settings_cabac", "v_settings_reframes", "v_format_settings_gop", "v_codec_id", "v_codec_id_info", "v_duration", "v_bit_rate_mode", "v_bit_rate", "v_max_bit_rate", ...
#binary search class BinarySearch: def __init__(self): self.elements = [10,12,15,18,19,22,27,32,38] def SearchElm(self,elem): start = 0 stop = len(self.elements)-1 while start <= stop: mid_point = start + (stop - start) if self.elements[mid_point] == ...
''' This problem was asked by Facebook. Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed). For example, given the string "([])[]({})", you should return true. Given the string "([)]" or "((()", you should return false. ''' bracket_vocab = {...
# -*- encoding: utf-8 -*- # Copyright (c) 2021 Stephen Bunn <stephen@bunn.io> # ISC License <https://choosealicense.com/licenses/isc> """Contains module-wide constants.""" APP_NAME = "brut" APP_VERSION = "0.1.0"
# Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. # Once 'done' is entered, print out the largest and smallest of the numbers. # If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. ...
tipo = int ( input ('Qual tipo de polpança ? ')) valor = float ( input ('Quanto quer reservar R$')) if ( tipo == 1 ): valor1 = (valor * 0.03) print ('Redimento mensal é R${}'.format(valor1)) elif ( tipo == 2 ): valor1 = (valor * 0.04) print ('Rendimento mensal é R${}'.format(valor1))
"""The K factor of a string is defined as the number of times 'abba' appears as a substring. Given two numbers N and k,​ find the number of strings of length N with 'K factor' = k. The algorithms is as follows: dp[n][k] will be a 4 element array, wherein each element can be the number of strings of length n and 'K fa...
# Can you find the needle in the haystack? # Write a function findNeedle() that takes an array full of junk but containing one "needle" # After your function finds the needle it should return a message (as a string) that says: # "found the needle at position " plus the index it found the needle, so: # Python, Ruby ...
class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ dict1, dict2 = {}, {} for item in s: dict1[item] = dict1.get(item, 0) + 1 for item in t: dict2[item] = dict2.get(item, 0) + 1 ...
velocidade = float(input('Qual é a velocidade atual do carro? ')) velocidadeLimite = 80.0 if velocidade > velocidadeLimite: print('MULTADO! Você excedeu o limite permitido de {:.1f} Km/h!'.format(velocidadeLimite)) print('Você deve pagar uma multa de R$ {:.2f}.'.format((velocidade - velocidadeLimite) * 7)) pr...
# # @lc app=leetcode id=859 lang=python3 # # [859] Buddy Strings # # @lc code=start class Solution: def buddyStrings(self, A: str, B: str) -> bool: if len(A) <= 1 or len(B) <= 1 or len(A) != len(B): return False if A == B: return len(set(A)) < len(A) i = 0 wh...
# # @lc app=leetcode.cn id=114 lang=python3 # # [114] flatten-binary-tree-to-linked-list # None # @lc code=end
def get_counter_and_increment(filename="counter.dat"): with open(filename, "a+") as f: f.seek(0) val = int(f.read() or 0) + 1 f.seek(0) f.truncate() f.write(str(val)) return val def get_counter(filename="counter.dat"): with open(filename, "a+") as f: f....
# # Keys under which options are stored. OPTIONS_UNKNOWN = 0 OPTIONS_FILE_OUTPUT = 1 OPTIONS_CPU = 2 OPTIONS_STANDARD = 3 # General options that belong to no specific collection. OPTION_UNKNOWN = 0 OPTION_DISABLE_OPTIMISATIONS = 1 OPTION_DEFAULT_FILE_NAME = 2 # CPU optons. CPU_UNKNOWN = 0 CPU_MC60000 = 1 CPU_MC60010...
class seq: def __init__(self, strbases): self.strbases = strbases def len(self): return len(self.strbases) def complement(self): comp = '' for e in self.strbases: if e == 'A': comp += 'T' elif e == 'C': comp += 'G' ...
"""Change the config values.""" branches = ('master', 'dev') # Note: Single element requires a comma at end. add_codeowners_file = True signed_commit = False branch_rules = {"required_approving_review_count": 1, "require_code_owner_reviews": True, "contexts": ["CodeQL"], ...
# Total em segundos # Escreva um programa que pergunte, em sequência, uma quantidade de dias, horas, minutos e segundos para o usuário. Depois calcule o total em segundos e imprima. input_days = int(input('Quantos dias?')) input_hours = int(input('Quantas horas?')) input_minutes = int(input('Quantos minutos?')) input_...
""" LC322 -- Coin Change time complexity -- O(N*M) space complexiy -- O(M) M is len(coins), N is amount Runtime: 1080 ms, faster than 85.13% of Python3 online submissions for Coin Change. Memory Usage: 13.8 MB, less than 30.56% of Python3 online submissions for Coin Change. normal dp small trick is to build a n+1 leng...
""" @Author: huuuuusy @GitHub: https://github.com/huuuuusy 系统: Ubuntu 18.04 IDE: VS Code 1.36 工具: python == 3.7.3 """ """ 思路: 使用filter + lambda对数组进行筛选 结果: 本地运行可以,但是无法通过测试,猜测网站测试不允许对nums进行filter操作 本思路可以作为日常使用的参考 """ class Solution: def removeElement(self, nums, val): nums = filter(lambda num ...
class TimeSlot: """A class to store time slot""" minutes_in_hour = 60 def __init__(self, name='name'): # initialize an empty slot self._h = 0 self._m = 0 self.name = name # timeslot is an instance attribute # (attribute of the object) @property def m(self):...
class Solution: def dominantIndex(self, nums: List[int]) -> int: max_num = max(nums) for i in nums: if i != max_num and max_num < 2*i: return -1 return nums.index(max_num)
# Program to print first n tribonacci # numbers Matrix Multiplication # function for 3*3 matrix def multiply(T, M): a = (T[0][0] * M[0][0] + T[0][1] * M[1][0] + T[0][2] * M[2][0]) b = (T[0][0] * M[0][1] + T[0][1] * M[1][1] + T[0][2] * M[2][1]) c = (T[0][0] * M[0][2] + T[0...
# -*- coding: utf-8 -*-# # ----------------------- # Name: Rooms # Description: 信令服务器room机制 # Author: mao # Date: 2020/6/15 # ----------------------- class Room: def __init__(self, roomid): self.roomid = roomid self.members = set() def __iter__(self): """ ...
''' Problem 5. Write a program that finds out whether a given name is present in a list or not.''' # Name search genrator using the Python names = ["Vasudev","Ridhi","hritik","Hanuman", "Gaurav"] name = input("Enter the Name : ") if name in names: print("Your name is in the list") else: print("Your name is ...
class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ max_sum = (10 ** 4) * -1 restart = True tmp_sum = (10 ** 4) * -1 for n in nums: if restart: tmp_sum = n resta...
FLAG_OK = 0 FLAG_WARNING = 1 FLAG_ERROR = 2 FLAG_UNKNOWN = 3 FLAG_OK_STR = "OK" FLAG_WARNING_STR = "WARNING" FLAG_ERROR_STR = "ERROR" FLAG_UNKNOWN_STR = "UNKNOWN" FLAG_MAP = { FLAG_OK_STR: FLAG_OK, FLAG_WARNING_STR: FLAG_WARNING, FLAG_ERROR_STR: FLAG_ERROR, FLAG_UNKNOWN_STR: FLAG_UNKNOWN, }
kernel_weight = 0.03 bias_weight = 0.03 model_iris_l1 = models.Sequential([ layers.Input(shape = (4,)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kernel_weight), bias_regularizer=regularizers.l2(bias_weight)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kern...
DEBUG = False # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{{ secret_key }}' ALLOWED_HOSTS = ['{{ host }}'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': '{{ database_name }}', 'USER': '{{ database_user }}', 'PASS...
"""Constants used in the openapi_builder package.""" EXTENSION_NAME = "__open_api_doc__" # Name of the extension in the Flask application. HIDDEN_ATTR_NAME = "__option_api_attr" # Attribute name for adding options. DOCUMENTATION_URL = "https://flyingbird95.github.io/openapi-builder"
class ParkingSystem: def __init__(self, big: int, medium: int, small: int): self.bigSize, self.bigCount, self.mediumSize, self.mediumCount, self.smallSize, self.smallCount = big, 0, medium, 0, small, 0 def addCar(self, carType: int) -> bool: if carType == 1: if self.bigCount < self...
# # PySNMP MIB module CISCO-IMAGE-TC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IMAGE-TC # Produced by pysmi-0.3.4 at Mon Apr 29 17:39:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
# Addresses LOAD_R3_ADDR = 0x0C00C650 OSFATAL_ADDR = 0x01031618 class PayloadAddress: pass CHAIN_END = "#Execute ROP chain\nexit\n\n#Dunno why but I figured I might as well put it here, should never hit this though\nend" def write_rop_chain(rop_chain, path): with open('rop_setup.s', 'r') as f: setup ...
""" Wriggler crawler module. """ class Error(Exception): """ All exceptions returned are subclass of this one. """
class DisjointSet: def __init__(self, n, data): self.graph = data self.n = n self.parent = [i for i in range(self.n)] self.rank = [1] * self.n def find_parent(self, x): if self.parent[x] != x: self.parent[x] = self.find_parent(self.parent[x]) return s...
# island count problem big hint (use a Stack) # data structures (stack queue etc) class OLDStack: def __init__(self): self.storage = [] """ Push method ----------- takes in a value and appends it to the storage """ def push(self, value): self.storage.append(v...
# coding: utf-8 DEFAULT_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) ' \ 'Chrome/55.0.2883.95 Safari/537.36 ' DATA_FOLDER = "data"
def my_decorator(func): def wrapper(): print("before the function is called.") func() print("after the function is called.") return wrapper @my_decorator def say_hi_HTA_with_syntax(): print("Hi! HTA with_syntax") def say_hi_HTA_without_syntax(): print('Hi! HTA without_syntax') ...
N = int(input()) XL = [list(map(int, input().split())) for _ in range(N)] t = [(x + l, x - l) for x, l in XL] t.sort() max_r = -float('inf') result = 0 for i in range(N): r, l = t[i] if max_r <= l: result += 1 max_r = r print(result)
def solution(xs): maxp = 1 negs = [] for i in xs: if i < 0: negs.append(i) elif i > 1: maxp *= i if len(negs) < 2 and max(xs) < 2: return str(max(xs)) negs.sort() while len(negs) > 1: maxp *= negs.pop(0) * negs.pop(0) return str(maxp)
#dicionario alunos = {} for i in range(1,4): nome = input('Digite seu nome: ') nota = float(input('Digite sua nota: ')) alunos[nome] = nota print(alunos) soma = 0 for nota in alunos.values(): soma += nota print('A média é', soma / 3)
# -*- coding: utf-8 -*- # Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. # The same repeated number may be chosen from C unlimited number of times. # Note: # All numbers (including target) will be positive integers. # El...
# Stairs # https://www.interviewbit.com/problems/stairs/ # # You are climbing a stair case. It takes n steps to reach to the top. # # Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? # # Example : # # Input : 3 # Return : 3 # # Steps : [1 1 1], [1 2], [2 1] # # # # # # # ...
''' A Python program to add two objects if both objects are an integer type. ''' def areObjectsInteger (inputNum01, inputNum02): if not (isinstance(inputNum01, int) and isinstance(inputNum02, int)): return False return inputNum01 + inputNum02 def main (): a,b = [float(x) for x in input("Enter ...
def next_line(line): res = [] prev = 0 nb = 0 for i in range(len(line)): if prev == 0: prev = line[i] nb = 1 else: if prev == line[i]: nb += 1 else: res.append(nb) res.append(prev) ...
""" See statsmodels.tsa.arima.model.ARIMA and statsmodels.tsa.SARIMAX. """ ARIMA_DEPRECATION_ERROR = """ statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have been removed in favor of statsmodels.tsa.arima.model.ARIMA (note the . between arima and model) and statsmodels.tsa.SARIMAX. statsmodels....
class UserPoolDeleteError(Exception): """ User pool delete error handler """ pass
class Carro(): """Uma tentativa simples de representar um carro.""" def __init__(self, fabricante, modelo, ano): """Inicializa os atributos que descrevem um carro.""" self.fabricante = fabricante self.modelo = modelo self.ano = ano self.leitura_hodometro = 0 def...
# versão 01 do código da aplicação class Filme: def __init__(self, nome, ano, duracao): self.__nome = nome self.__ano = ano self.__duracao = duracao self.__likes = 0 # O número de likes inicia com 0 def adiciona_like(self): self.__likes += 1 @property def nome(self): return self.__nome.tit...
#!/usr/bin/env python name = 'Bob' age = 2002 if name == 'Alice': print('Hi, Alice!') elif age < 12: print('You are not Alice, kiddo!') elif age > 2000: print('Unlike you, Alice is not undead, immortal vampire.') elif age > 100: print('You are not Alice, grannie.')
# 1. CREATE A DICTIONARY # Remember, dictionaries are essentially objects. # Make a dictionary with five different keys relating to your favorite celebrity. You must include at least four different data types as values for those keys. # ================ CODE HERE ================ # ================ END CODE ========...
#!/usr/bin/python with open('README.md', 'w') as README: with open('docs/list_of__modules.rst', 'r') as index: README.write(''' # Cisco ACI modules for Ansible This project is working on upstreaming Cisco ACI support within the Ansible project. We currently have 30+ modules available, and many more are b...
# Generated from 'Events.h' nullEvent = 0 mouseDown = 1 mouseUp = 2 keyDown = 3 keyUp = 4 autoKey = 5 updateEvt = 6 diskEvt = 7 activateEvt = 8 osEvt = 15 kHighLevelEvent = 23 mDownMask = 1 << mouseDown mUpMask = 1 << mouseUp keyDownMask = 1 << keyDown keyUpMask = 1 << keyUp autoKeyMask = 1 << autoKey updateMask = 1 <...
SOLUTIONS = '/view' STATUS = '/status' DOWNLOADS = '/download' SHARED = '/shared' GIT = '/git/<int:course_id>/<int:exercise_number>.git'
# GATES OGORK # SPRING 2021 FINAL PROJECT # IS 3220 # PASSWORD GENERATOR # MAY 2, 2021 def reverse(app_name): # this function reverses whatever word the user inputs app_name = app_name.lower() return app_name[::-1] def a_replace(name): # this function replaces every "a" with "@" ret...
#!/usr/bin/python def read_file(file, delimiter): """Reads data from a file, separated via delimiter Args: file: Path to file. delimiter: Data value separator, similar to using CSV. Returns: An array of dict records. """ f = open(file, 'r') lines = f.readlines() records = [] f...
# Copyright (c) 2017-present, Facebook, Inc. # # 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 o...
__author__ = 'roland' NORMAL = "/_/_/_/normal" IDMAP = { # Webfinger "rp-discovery-webfinger-url": NORMAL, "rp-discovery-webfinger-acct": NORMAL, 'rp-discovery-webfinger-http-href': '/_/_/httphref/normal', 'rp-discovery-webfinger-unknown-member': '/_/_/wfunknown/normal', # Discovery "rp-di...
lista = ['A', 'B', 'C'] for i, itens in enumerate(lista): print (i + 1, ' = ', itens) lista[-1] = 'D' lista[-2] = 'F' lista[-3] = 'M' for e, itens in enumerate(lista): print (e + 1, ' -> ', itens) lista.remove('F') for d, itens in enumerate(lista): print(d + 1, ' == ', itens) lista.extend(['B', 'C', 'A']) l...
"""Error classes for Pydactyl.""" class PydactylError(Exception): """Base error class.""" pass class BadRequestError(PydactylError): """Raised when a request is passed invalid parameters.""" pass class ClientConfigError(PydactylError): """Raised when a client configuration error exists.""" ...
class Register: def __init__(self, id): self.id = id regs = [Register(i) for i in range(16)] RG0, RG1, RG2, RG3, RG4, RG5, RG6, RG7, RG8, RG9, RG10, RG11, RG12, RG13, RIP, RBANK = regs
oscar_number = int(input()) message = '' if oscar_number == 88: message = 'Leo finally won the Oscar! Leo is happy' elif oscar_number == 86: message = 'Not even for Wolf of Wall Street?!' elif oscar_number < 88 and oscar_number != 86: message = 'When will you give Leo an Oscar?' elif oscar_number ...
test_cases = int(input().strip()) for t in range(1, test_cases + 1): N, M = map(int, input().strip().split()) binary = bin(M)[2:].zfill(N)[-N:] result = 'ON' if '0' in binary: result = 'OFF' print('#{} {}'.format(t, result))
# # Project Euler Math Functions # Soren Rasmussen 5/14/2015 # #!/usr/bin/python def sieveOfEratosthenes(n): primes = [0]*n output = [] for i in range(2,n): if primes[i] == 0: output.append(i) j=2*i while j < n: primes[j] = 1 ...
a=int(input()) b=int(input()) c=int(input()) d=int(input()) print((a^b)&(c|d)^((b&c)|(a^d)))
def map(nums_list, operation): ''' Return a sequence of values obtained by applying the operation function to each number in nums_list. ''' return [operation(num) for num in nums_list] def double(num): return num * 2 def triple(num): return num * 3 nums_list = (1, 3, -10) for operation in (doubl...
# -*- coding: utf-8 -*- if __name__ == '__main__': crawl_name = 'maomi_china_selfie' cmd = 'scrapy crawl {0}'.format(crawl_name) # cmdline.execute(['scrapy','crawl','csgbidding']) cmdline.execute(cmd.split())
# -*- coding: utf-8 -*- """Model config in json format""" kaggle_config = { "dataset": { "download": False, "data_dir": "~/tensorflow_datasets", }, "data": { "class_names": ["PNEUMONIA"], "image_dimension": (224, 224, 3), "image_height": 224, "image_width": 2...
# oop/mro.simple.py class A: label = 'a' class B(A): label = 'b' class C(A): label = 'c' class D(B, C): pass d = D() print(d.label) # Hypothetically this could be either 'b' or 'c' print(d.__class__.mro()) # notice another way to get the MRO # prints: # [<class '__main__.D'>, <class '__main__....
""" Constants for websites """ CONTENT_TYPE_PAGE = "page" CONTENT_TYPE_RESOURCE = "resource" CONTENT_TYPE_INSTRUCTOR = "instructor" CONTENT_TYPE_METADATA = "sitemetadata" CONTENT_TYPE_NAVMENU = "navmenu" COURSE_PAGE_LAYOUTS = ["instructor_insights"] COURSE_RESOURCE_LAYOUTS = ["pdf", "video"] CONTENT_FILENAME_MAX_LEN...
class TestApplication: # Will the application start? def test_start(self, application): application.start()
class Error(Exception): """Base class for other exceptions""" pass class ConfigNotFound(Error): """Raise when config file is required but not present""" print(f"ERROR:FileNotFound: Please provide configuration file using '-c' argument or check file path") exit(1)
class ProviderException(Exception): pass class NoProviderException(ProviderException): def __init__(self, hostname) -> None: self.hostname = hostname def __str__(self) -> str: return "No provider for {0}".format(self.hostname)
#!/usr/bin/env python NAME = 'Alert Logic (Alert Logic)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return _, page = r if all(i in page for i in (b'<title>Requested URL cannot be found</title>', b'Proceed to homepage', ...
# Ex102 def fatorial(numero, show=False): """ => CALCULA O FATORIAL DE UM NÚMERO. :param numero: O valor inteiro que o usuário deseja saber o fatorial. :param show: (Opcional) Mostrar o cálculo inteiro/Mostrar apenas o resultado. :return: O resultado fatorial do valor 'numero'. """ cont = 0 ...
load( ":common.bzl", "dart_filetypes", "filter_files", "has_dart_sources", "make_dart_context", "make_package_uri", "api_summary_extension", ) def ddc_action(ctx, dart_ctx, ddc_output, source_map_output): """ddc compile action.""" flags = [] if ctx.attr.force_ddc_compile: print("...
str = "This is string example" print("Reversed string is: "+str[::-1]) ss = str.split(" ") print("Reversed words are: "+ss[0][::-1]+" "+ss[1][::-1]+" "+ss[2][::-1]+" "+ss[3][::-1]) print("Reversed letters are: "+ss[0][0:2][::-1]) print("*".join(ss)) print("Replaced by was is: "+ss[0]+" "+ss[1].replace("is","was")+...
# -*- coding: utf-8 -*- """ Statistics collector helper class for pdf2xlsx """ class StatLogger(): """ Collect statistic about the zip to xlsx process. Assembles a list containin invoice number of items. Every item is the number of entries found during the invoice parsing. It implements a simple API: ne...
# -*- coding: utf-8 -*- """ Written by Daniel M. Aukes Email: danaukes<at>gmail.com Please see LICENSE for full license. """ class NameGenerator(object): @classmethod def generate_name(cls): try: name = cls._generate_name() except AttributeError: cls._ii = 0 ...
#!/usr/bin/env python """ Expression Add Operators Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so they evaluate to the target value. Examples: "123", 6 -> ["1+2+3", "1*2*3"] "232", 8 -> ["2*3+2"...
""" LER DOIS NUMERO E MOSTRAR A SOMA ENTRE ELES """ num1 = int(input('Digite o primeiro valor a ser somado .: ')) num2 = int(input('Digite o segundo valor a ser somado .: ')) soma = num1 + num2 # print(f'A soma é {num1 + num2}') #utilizando o .format print('A soma entre {} e {} é {}'.format(num1, num2, soma))
class Solution: def lengthOfLastWord(self, s): s=s.split() if len(s)==0: return 0 return len(s[-1])
schema = { 'user': [ { 'mail_id': 'string', 'patient': [ { 'name': 'string', 'mob': 9929929922, 'address': 'string', 'stats': {...}, }, {...} ], 're...
buildcode=""" function Get-SystemTime(){ $time_mask = @() $the_time = Get-Date $time_mask += [string]$the_time.Year + "0000" $time_mask += [string]$the_time.Year + [string]$the_time.Month + "00" $time_mask += [string]$the_time.Year + [string]$the_time.Month + [string]$the_time.Day return $time_mask } """ callco...
def nlr_gen(left, right, parent): """ left и right являются zero-based индексами. https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR) """ # Количество элементов от left до right включительно: cnt_from_left_to_right_inclusive = right - left + 1 # Если элементов всего два: if cn...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\xcc\xb5(e\x9f\xabO\r,\xe6J\x922\x85M\xb7' _lr_action_items = {'LOGOR':([6,11,12,17,20,21,22,28,32,33,35,47,48,49,50,51,80,81,88,89,92,100,101,102,103,104,105,106,107,108,109,110,111,112,1...
class JobResultExample(object): IN_PROGRESS = { "status": { "state": "IN PROGRESS" }, "configuration": { "copy": { "sourceTable": { "projectId": "source_project_id", "tableId": "source_table_id$123", ...
mongo = { 'server': '127.0.0.1', 'database': 'geodigger', 'collection': 'data', } email = { 'server': '', 'username': '', 'address': '', 'password': '', } ui = { 'tmp': '/tmp/geodiggerui', }
#Conditions sur les nombres pairs et impairs a = int(input("saisir nombre : ")) if a%2 == 0: print("le nombre est pair") else: print("le nombre est impair")
myBag = 'shiny gold' rules = [] midBags = set() midBags.add(myBag) #i've the feeling that never attended an algo class is making this too much fucking difficult #pradella i'm ready def part2(string): numberTemp = 1 if string == myBag: numberTemp = 0 for line in rules: outerBag, innerBags = line.spl...
s = input() a = 2 b = a + a x = 1 y = x print(y) if not ((s)): print('bar')
# coding:utf-8 ''' @Copyright:LintCode @Author: lilsweetcaligula @Problem: http://www.lintcode.com/problem/reverse-words-in-a-string @Language: Python @Datetime: 17-02-15 15:03 ''' class Solution: # @param s : A string # @return : A string def reverseWords(self, s): return ' '.join(reversed(s.sp...
class DBRouter(object): """ A router to control all database operations on models in the auth application. """ radiusmodels = ( 'freeradius' ) def db_for_read(self, model, **hints): """ Attempts to read radius models go to radius """ if model._meta.app_...
# -*- coding: utf-8 -*- """ Created on Tue Feb 15 22:58:31 2022 @author: ACER """ class clientes: def __init__(self,nombre): self.nombre=nombre def showCliente(self): print("show el clientes ", self.nombre)
dict={11:"th",12:"th",13:"th",1:"st",2:"nd",3:"rd"} def number_to_ordinal(n): if n>10: check=int(str(n)[-2:]) temp=dict.get(check%10, "th") return f"{n}{dict[check]}" if check in dict else f"{n}{temp}" else: temp=dict.get(n%10, "th") return f"{n}{temp}" if n else "0"
#quiz game def check_guess(guess, answer): global score still_guessing = True attempt = 0 while still_guessing and attempt < 3: if guess.lower() == answer.lower(): print("Correct Answer") score = score + 1 still_guessing = False else: if a...
# # PySNMP MIB module HIPATH-WIRELESS-HWC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIPATH-WIRELESS-HWC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:30:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...