content
stringlengths
7
1.05M
""" Copyright (c) 2021 Cisco and/or its affiliates. This software is licensed to you under the terms of the Cisco Sample Code License, Version 1.1 (the "License"). You may obtain a copy of the License at https://developer.cisco.com/docs/licenses All use of the material herein must be in accordance wit...
def dight(n): sum=0 while n>0: sum=sum+n%10 n=n//10 return sum k=0 l=[] for i in range(2,100): for j in range(2,100): t=i**j d=dight(t) if d==i: k+=1 l.append(t) l=sorted(l) print(l[29])
load("//cuda:providers.bzl", "CudaInfo") def is_dynamic_input(src): return src.extension in ["so", "dll", "dylib"] def is_object_file(src): return src.extension in ["obj", "o"] def is_static_input(src): return src.extension in ["a", "lib", "lo"] def is_source_file(src): return src.extens...
def custMin(paramList): n = len(paramList)-1 for pos in range(n): if paramList[pos] < paramList[pos+1]: paramList[pos], paramList[pos+1] = paramList[pos+1], paramList[pos] return paramList[n] print(custMin([5, 2, 9, 10, -2, 90]))
# -*- coding: utf-8 -*- # # Copyright (c) 2013 Clione Software # Copyright (c) 2010-2013 Cidadania S. Coop. Galega # # 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.or...
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) All Rights Reserved. # # 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 ap...
def get_digit(num): root = num ** 0.5 if root % 1 == 0: return counting = [] b = (root // 1) c = 1 while True: d = (c / (root - b)) // 1 e = num - b ** 2 if e % c == 0: c = e / c else: c = e b = (c * d - b) ...
""" Generate a JSON file for pre-configuration .. only:: development_administrator Created on Jul. 6, 2020 @author: jgossage """ def genpre(file: str = 'preconfig.json'): pass
# https://youtu.be/wNVCJj642n4?list=PLAB1DA9F452D9466C def binary_search(items, target): low = 0 high = len(items) while (high - low) > 1: middle = (low + high) // 2 if target < items[middle]: high = middle if target >= items[middle]: low = mi...
# https://www.hackerrank.com/challenges/count-luck/problem def findMove(matrix,now,gone): x,y = now moves = list() moves.append((x+1,y)) if(x!=len(matrix)-1 and matrix[x+1][y]!='X' ) else None moves.append((x,y+1)) if(y!=len(matrix[0])-1 and matrix[x][y+1]!='X') else None moves.append((x-1,y)) if(x...
""" future: clean single-source support for Python 3 and 2 ====================================================== The ``future`` module helps run Python 3.x-compatible code under Python 2 with minimal code cruft. The goal is to allow you to write clean, modern, forward-compatible Python 3 code today and to run it wit...
# # PySNMP MIB module CISCO-LWAPP-DOT11-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-DOT11-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:47: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 __version__ = (0, 5, 2) __version_info__ = ".".join(map(str, __version__)) APP_NAME = 'pseudo-interpreter' APP_AUTHOR = 'bell345' APP_VERSION = __version_info__
class DiagonalDisproportion: def getDisproportion(self, matrix): r = 0 for i, s in enumerate(matrix): r += int(s[i]) - int(s[-i-1]) return r
for num in range(101): div = 0 for x in range(1, num+1): resto = num % x if resto == 0: div += 1 if div == 2: print(num)
#weight = 50 State.PS_veliki=_State(False,name='PS_veliki',shared=True) State.PS_mali=_State(False,name='PS_mali',shared=True) def run(): r.setpos(-1500+155+125+10,-1000+600+220,90) #bocno absrot90 r.conf_set('send_status_interval', 10) State.color = 'ljubicasta' # init servos llift(0) rlift(0) rfliper(0) lflip...
def join_dictionaries( dictionaries: list) -> dict: joined_dictionary = \ dict() for dictionary in dictionaries: joined_dictionary.update( dictionary) return \ joined_dictionary
"""Version file.""" # __ __ # ______ _/ /_ / / # /_ __/__ /_ __/_________ / /______,- ___ __ _____ __ # / / / _ \/ / / ___/ /_/_/ // / __ // _ '_ \/ ___/ _ \ # __/ /_/ / / / /_/ ___/ _ \/ _' / /_/ // // // / ___/ / / / # /_____/_/ /_/\__/____/_/ /_/_/ \_\___...
APIAE_PARAMS = dict( n_x=90, # dimension of x; observation n_z=3, # dimension of z; latent space n_u=1, # dimension of u; control K=10, # the number of time steps R=1, # the number of adaptations L=32, # the number of trajectory sampled dt=.1, # time interval ur=.1, # update r...
class Computer: def __init__(self): self.__maxprice = 900 def sell(self): print("Selling Price: {}".format(self.__maxprice)) def setMaxPrice(self, price): self.__maxprice = price c = Computer() c.sell() # change the price c.__maxprice = 1000 c.sell() # using setter function c.se...
if __name__ == "__main__": ant_map = """ ------a------------------------------------ ------------------o---------------------- -----------------o----------------------- ------------------------------------------ ------------------------------------------ -------------------------------------...
# 15 - Faça um Programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês. # Calcule e mostre o total do seu salário no referido mês, sabendo-se que são descontados 11% para o Imposto de Renda, # 8% para o INSS e 5% para o sindicato, faça um programa que nos dê: # A. salário bruto. # B. qua...
COMPANY_PRESENTATION = "company_presentation" LUNCH_PRESENTATION = "lunch_presentation" ALTERNATIVE_PRESENTATION = "alternative_presentation" COURSE = "course" KID_EVENT = "kid_event" PARTY = "party" SOCIAL = "social" OTHER = "other" EVENT = "event" EVENT_TYPES = ( (COMPANY_PRESENTATION, COMPANY_PRESENTATION), ...
class FilteredElementIdIterator(object,IEnumerator[ElementId],IDisposable,IEnumerator): """ An iterator to a set of element ids filtered by the settings of a FilteredElementCollector. """ def Dispose(self): """ Dispose(self: FilteredElementIdIterator) """ pass def GetCurrent(self): """ GetCurrent(self...
# -*- coding: utf-8 -*- """ Created on Thu Aug 6 10:26:35 2020 @author: ruy Automation of German Lloyd 2012 High Speed Craft strucutural rules calculation """
n,m = input().split(' ') my_array = list(input().split(' ')) A = set(input().split(' ')) B = set(input().split(' ')) happiness = 0 for i in my_array: happiness += (i in A) - (i in B) print(happiness)
buf = "" buf += "\xdb\xdd\xd9\x74\x24\xf4\x58\xbf\x63\x6e\x69\x90\x33" buf += "\xc9\xb1\x52\x83\xe8\xfc\x31\x78\x13\x03\x1b\x7d\x8b" buf += "\x65\x27\x69\xc9\x86\xd7\x6a\xae\x0f\x32\x5b\xee\x74" buf += "\x37\xcc\xde\xff\x15\xe1\x95\x52\x8d\x72\xdb\x7a\xa2" buf += "\x33\x56\x5d\x8d\xc4\xcb\x9d\x8c\x46\x16\xf2\x6e\x76" ...
print(" "*7 + "A") print(" "*6 + "B B") print(" "*5 + "C C") print(" "*4 + "D" + " "*5 + "D") print(" "*3 + "E" + " "*7 + "E") print(" "*4 + "D" + " "*5 + "D") print(" "*5 + "C C") print(" "*6 + "B B") print(" "*7 + "A")
subscription_service = paymill_context.get_subscription_service() subscription_with_offer_and_different_values = subscription_service.create_with_offer_id( payment_id='pay_5e078197cde8a39e4908f8aa', offer_id='offer_b33253c73ae0dae84ff4', name='Example Subscription', period_of_validity='2 YEAR', star...
""" Primim numere și ponderile lor asociate. Practic, acestea definesc o histogramă. Fiecare pondere este în intervalul [0, 1] Suma ponderilor este 1. Pe exemplul: v = 5 1 3 2 9 6 11 w = 0.1 0.12 0.05 0.1 0.2 0.13 0.3 Avem 6 ca mediană ponderată. Putem rezolva în O(n log n): sortăm vectorul, și apoi facem sumele...
class Monkey(object): '''Store data of placed monkey''' def __init__(self, position=None, name=None, mtype=None) -> None: ''' :arg position: position, list :arg name: name :arg mtype: type of monkey (get from action.action) ''' self.position = position se...
print('Diamante Negro Viagens! Consulte preços abaixo: ') distancia = float(input('Quantos quilômetros de distância tem seu destino? ')) if distancia <= 200: print('Você pagará R${:.2f} reais por {} Km!'.format(distancia * 0.50, distancia)) else: print('Você pagará R${:.2f} reais por {} Km!'.format(distancia ...
labelClassification = """ border-style: none; font-weight: bold; font-size: 40px; color: white; """ mainWindowFrame = """ border: 2px solid rgb(40, 40, 40); border-radius: 4px; background-color: rgb(70,70,73); background: qlineargradient(x1: 0, y1: 0, x2: 0, y...
''' Created on 2015年12月15日 @author: Darren ''' def inOrder(root): res=[] stack=[] while root or stack: if root: stack.append(root) root=root.left else: root=stack.pop() res.append(root.val) root=root.right return res def preO...
# Desenvolva um programa que leia a média dos 4 bimestres de um aluno e diga se ele já passou de ano ou não. média_1s = 0 média_2s = 0 for n in range (1,5): nota_ = input(f'Digite a nota de sua média no {n}° bimestre (caso ainda não saiba a nota, digite "0"): ').strip() nota = float(nota_) if n == 1 or n ...
matched = [[0, 450], [1, 466], [2, 566], [3, 974], [4, 1000], [5, 1222], [6, 1298], [7, 1322], [8, 1340], [9, 1704], [10, 1752], [11, 2022], [12, 2114], [13, 2332], [14, 2360], [15, 2380], [16, 2388], [17, 2596], [18, 2662], [19, 2706], [20, 2842], [21, 2914], [22, 3132], [23, 3148], [24, 3158], [...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def levelOrder(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if root == None:...
#============================================================================== ## ## Copyright Jim Carty © 2020 ## ## This file is subject to the terms and conditions defined in file ## 'LICENSE.txt', which is part of this source code package. ## #=======================================================================...
#!/usr/bin/env python # Mainly for use in stubconnections/kubectl.yml print('PID: 1')
# START LAB EXERCISE 03 print('Lab Exercise 03 \n') # PROBLEM 1 (5 Points) inventors = None # PROBLEM 2 (4 Points) #SETUP invention = 'Heating, ventilation, and air conditioning' #END SETUP # PROBLEM 3 (4 Points) # SETUP new_inventor = {'Alexander Miles': 'Automatic electric elevator doors'} # END SETUP # PRO...
class handshake: def clientside(Socket_Object): """This must be called with the main object from the socket""" pass#Socket_Object.
#!/usr/bin/python3 # Can user retrieve reward after a time cycle? def test_get_reward(multi, base_token, reward_token, alice, issue, chain): amount = 10 ** 10 init_reward_balance = reward_token.balanceOf(alice) base_token.approve(multi, amount, {"from": alice}) multi.stake(amount, {"from": alice}) ...
data = ( 'ddwim', # 0x00 'ddwib', # 0x01 'ddwibs', # 0x02 'ddwis', # 0x03 'ddwiss', # 0x04 'ddwing', # 0x05 'ddwij', # 0x06 'ddwic', # 0x07 'ddwik', # 0x08 'ddwit', # 0x09 'ddwip', # 0x0a 'ddwih', # 0x0b 'ddyu', # 0x0c 'ddyug', # 0x0d 'ddyugg', # 0x0e 'ddyugs', # 0x0f 'dd...
"""Static key/seed for keystream generation""" ACP_STATIC_KEY = "5b6faf5d9d5b0e1351f2da1de7e8d673".decode("hex") def generate_acp_keystream(length): """Get key used to encrypt the header key (and some message data?) Args: length (int): length of keystream to generate Returns: String of requested length N...
# Este es un módulo con funciones que saludan def despedir(): print("Adiós, me estoy despidiendo desde la función despedir() del módulo despedidas") class Despedida(): def __init__(self): print("Adiós, me estoy despidiendo desde el __init__ de la clase Despedida")
"""RCON exceptions.""" __all__ = ['InvalidPacketStructure', 'RequestIdMismatch', 'InvalidCredentials'] class InvalidPacketStructure(Exception): """Indicates an invalid packet structure.""" class RequestIdMismatch(Exception): """Indicates that the sent and received request IDs do not match.""" def __i...
def build_mx(n, m): grid = [] for i in range(n): grid.append([' '] * m) return grid def EMPTY_SHAPE(): return [[]] class Shape(object): _name = None grid = EMPTY_SHAPE() rotate_grid = [] def __init__(self, grid): # align each row and column is same n = len(gri...
def test(): assert ( "from spacy.tokens import Doc" in __solution__ ), "Importierst du die Klasse Doc?" assert ( len(words) == 5 ), "Es sieht so aus, als ob du eine falsche Anzahl an Wörtern hast." assert ( len(spaces) == 5 ), "Es sieht so aus, als ob du eine falsche Anza...
def cal_average(num): i = 0 for x in num: i += x avg = i / len(num) return avg cal_average([1,2,3,4])
preciocompu= float(input("Ingrese el valor del computador pago de contado:")) valorcuotas= float (input("Ingrese el valor de las cuotas en caso de pagarlo a 12 cuotas:")) pagofinalintereses=(valorcuotas*12) print("Se pagaría:", str(pagofinalintereses), "por el computador") cuotasininteres=(preciocompu/12) print("El val...
#!/use/bin/python3 __author__ = 'yangdd' ''' example 024 ''' a = 2 b =1 total = 0.0 for i in range(1,21): total += a/b a,b=a+b,a print(total)
# # PySNMP MIB module RFC1285-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1285-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:48:17 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, 0...
grey_image = np.mean(image, axis=-1) print("Shape: {}".format(grey_image.shape)) print("Type: {}".format(grey_image.dtype)) print("image size: {:0.3} MB".format(grey_image.nbytes / 1e6)) print("Min: {}; Max: {}".format(grey_image.min(), grey_image.max())) plt.imshow(grey_image, cmap=plt.cm.Greys_r)
def start_HotSpot(ssid="Hovercraft",encrypted=False,passd="1234",iface="wlan0"): print("HotSpot %s encrypt %s with Pass %s on Interface %s",ssid,encrypted,passd,iface) def stop_HotSpot(): print("HotSpot stopped")
''' Autor: Pedro Augusto Objetivo: implemente um programa em Python que recebe um número real e informe se é igual a zero, número positivo ou negativo. Nível Básico ''' def propsNum(var1): if var1 == 0: return "O valor dado é igual a 0!" elif var1 > 0: return str(var1)+" é positivo!" else: return str(...
n = int(input()) left_side = 0 right_side = 0 for i in range(n): num = int(input()) left_side += num for i in range(n): num = int(input()) right_side += num if left_side == right_side: print(f"Yes, sum = {left_side}") else: print(f"No, diff = {abs(left_side - right_side)}")
# # PySNMP MIB module CTRON-PRIORITY-CLASSIFY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-PRIORITY-CLASSIFY-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:30:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
DESCRIPTION = "switch to a different module" def autocomplete(shell, line, text, state): # todo: make this show shorter paths at a time # should never go this big... if len(line.split()) > 2 and line.split()[0] != "set": return None options = [x + " " for x in shell.plugins if x.startswith(tex...
# test builtin issubclass class A: pass print(issubclass(A, A)) print(issubclass(A, (A,))) try: issubclass(A, 1) except TypeError: print('TypeError') try: issubclass('a', 1) except TypeError: print('TypeError')
def install(job): prefab = job.service.executor.prefab # For now we download FS from there. when we have proper VM image it will be installed already if not prefab.core.command_check('fs'): prefab.core.dir_ensure('$BINDIR') prefab.core.file_download('https://stor.jumpscale.org/public/fs', '...
# Gianna-Carina Gruen # 05/23/2016 # Homework 1 # 1. Prompt the user for their year of birth, and tell them (approximately): year_of_birth = input ("Hello! I'm not interested in your name, but I would like to know your age. In what year were you born?") # Additionally, if someone gives you a year in the futu...
# https://contest.yandex.ru/contest/24735/run-report/53783569/ def broken_search(nums, target) -> int: """Бинарный поиск в 'сломанном' списке. Args: nums (List): массив, бывший отсортированным в кольцевой структуре target ([type]): искомый эл-т Returns: int: индекс искомого эл-та, и...
'''078 - Faça um programa que leia 5 valores numéricos e guarde-os em uma lista. No final, mostre qual foi o maior e o menor valor digitado e as suas respectivas posições na lista. ''' lista = [] posicao_maior = [] posicao_menor = [] for p in range(0, 5): val = int(input(f'Digite um valor na posição {p}: ')) l...
# Copyright (c) 2020-2021 Matematyka dla Ciekawych Świata (http://ciekawi.icm.edu.pl/) # Copyright (c) 2020-2021 Robert Ryszard Paciorek <rrp@opcode.eu.org> # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Soft...
class Solution: def removePalindromeSub(self, s: str) -> int: # exception if s == '': return 0 elif s == s[::-1]: return 1 else: return 2
#!/usr/bin/env python # coding=utf-8 class startURL: xinfangURL = [ 'http://cs.ganji.com/fang12/o1/', 'http://cs.ganji.com/fang12/o2/', 'http://cs.ganji.com/fang12/o3/', 'http://cs.ganji.com/fang12/o4/', 'http://cs.ganji.com/fang12/o5/', 'http://cs.ganji.com/fang12/o...
# File: hackerone_consts.py # Copyright (c) 2020-2021 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # # Constants for actions ACTION_ID_GET_ALL = 'get_reports' ACTION_ID_GET_UPDATED = 'get_updated_reports' ACTION_ID_GET_ONE = 'get_report' ACTION_ID_UPDATE = 'update_id' ACTI...
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def removeNthFromEnd(self, head, n): """ :type head: ListNode :type n: int :rtype: ListNode """ pre_n_th = n...
# -*- coding: utf-8 -*- # Author: Daniel Yang <daniel.yj.yang@gmail.com> # # License: BSD-3-Clause __version__ = "0.0.6" __license__ = "BSD-3-Clause License"
##n=int(input("enter a number:")) ##i=1 ## ##count=0 ##while(i<n): ## if(n%i==0): ## count=count+1 ## ## i=i+1 ##if(count<=2): ## print("prime") ##else: ## print("not") i=2 j=2 while(i<=10): while(j<i): if(i%j==0): break; else: print(i) ...
for m in range(1,1000): for n in range(m+1,1000): c=1000-m-n if c**2==(m**2+n**2): print('The individual numbers a,b,c respectively are',m,n,c,'the product of abc is',m*n*c)
{ 'target_defaults': { 'includes': ['../common-mk/common.gypi'], 'variables': { 'deps': [ 'protobuf', ], }, }, 'targets': [ { 'target_name': 'media_perception_protos', 'type': 'static_library', 'variables': { 'proto_in_dir': 'proto/', 'proto_ou...
class Solution: def canReach(self, arr: List[int], start: int) -> bool: # bastardized version of DFS # if we are out of bounds return false # else check to left and right # same idea as sinking islands where we remove visited for current recurse left, right ...
# Escreva um programa em Python que leia um número inteiro qualquer e peça para o usuário escolher qual será a base de conversão: 1 para binário, 2 para octal e 3 para hexadecimal. numero = int(input('Digite um número: ')) print('''[1] para binário [2] para octal [3] para hexadecimal''') escolha = int(input('Escolha e...
class Queue: def __init__(self, maxsize): self.__max_size = maxsize self.__elements = [None] * self.__max_size self.__rear = -1 self.__front = 0 def getMaxSize(self): return self.__max_size def isFull(self): return self.__rear == self.__max_size def isE...
def HammingDistance(p, q): mm = [p[i] != q[i] for i in range(len(p))] return sum(mm) # def ImmediateNeighbors(Pattern): # Neighborhood = [Pattern] # for i in range(len(Pattern)): # nuc = Pattern[i] # for nuc2 in ['A', 'C', 'G', 'T']: # if nuc != nuc2: # pat =...
''' Description: Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to have unique values. Example 1: Input: root = [10,5,15,3,7,null,18], L = 7, R = 15 Output: 32 Example 2: Input: root = [10,5,15,3,7,...
""" This is a modelmanager settings file. Import or define your settings variables, functions or classes below. For example: ``` # will only be available here import pandas as example_module from pandas.some_module import some_function as _pandas_function # will be available as project.example_variable example_varia...
""" Given array of integers lengths, create an array of arrays output such that output[i] consists of lengths[i] elements and output[i][j] = j. Example For lengths = [1, 2, 0, 4], the output should be create2DArray(lengths) = [[0], [0, 1], [], ...
# Exercício 086 numeros = [[], [], []] for c in range(0, 3): for d in range(0, 3): n = int(input(f'Digite o valor {c},{d}: ')) numeros[c].append(n) print('=-' * 10) print('NÚMEROS EM MATRIZ:') for c in range(0, 3): for d in range(0, 3): print(f'{numeros[c][d]:^5}', end='') print()
# model settings model = dict( type='Classification', pretrained=None, backbone=dict( type='MobileNetV3', arch='large', out_indices=(16,), # x-1: stage-x norm_cfg=dict(type='BN', eps=0.001, momentum=0.01), ), head=dict( type='ClsHead', loss=dict(type=...
#coding=utf-8 ''' Created on 2015-11-11 @author: zhangtiande ''' class Project(object): project_save_filed="项目保存失败,请联系管理员" project_member_save_fail="添加成员失败,请重试" project_member_remove_fail="删除成员失败,请重试" project_member_update_role_fail="更新成员角色失败,请重试" project_webhook_save_fail="添加webhook失败,请重试" ...
""" API for yt.frontends.gamer """
# Generate permutations with a space def permutation_with_space_helper(input_val, output_val): if len(input_val) == 0: # Base condition to get a final output once the input string is empty final.append(output_val) return # Store the first element of the string and make decisions on it ...
"""Skeleton for 'itertools' stdlib module.""" class islice(object): def __init__(self, iterable, start, stop=None, step=None): """ :type iterable: collections.Iterable[T] :type start: numbers.Integral :type stop: numbers.Integral | None :type step: numbers.Integral | None ...
EXAMPLE_DOCS = [ # Collection stored as "docs" { '_data': 'one two', '_type': 'http://sharejs.org/types/textv1', '_v': 8, '_m': { 'mtime': 1415654366808, 'ctime': 1415654358668 }, '_id': '26aabd89-541b-5c02-9e6a-ad332ba43118' }, { ...
dia = input("Digite o dia de nascimento: ") mes = input("Digite o mês de nascimento: ") ano = input("Digite o ano de nascimento: ") print("A data de nascimento é: {}/{}/{} ." .format(dia, mes, ano))
""" Ranges - Precisamos conhecer o loop for para usar o ranges. - Precisamos conhecer o range para trabalhar melhor com loops for. Ranges são utilizados para gerar sequências numéricas, não de forma aleatória, mas sim de maneira especificada. Formas gerais: # Forma 01 range(valor_de_parada) for num in range(11)...
def insert_line(file, text, after=None, before=None, past=None, once=True): with open(file) as f: lines = iter(f.readlines()) with open(file, 'w') as f: if past: for line in lines: f.write(line) if re.match(past, line): break ...
count = int(input()) tux = [" _~_ ", " (o o) ", " / V \ ", "/( _ )\\ ", " ^^ ^^ "] for i in tux: print(i * count)
class Node(): ''' The DiNode class is specifically designed for altering path search. - Active and passive out nodes, for easily iteratively find new nodes in path. - Marks for easy look up edges already visited (earlier Schlaufen) / nodes in path-creation already visited - The edge-marks have t...
## 函数 抽象 #斐波那契数列 ##函数体要写在调用之前 nums=int(input("enter a num")) def fibs(nums): ##为函数编写文档 'a fibs function' list = []; for i in range(nums): if i==0 or i==1: list.append(1) else: list.append(list[i-2]+list[i-1]); print(list) fibs(nums); ##打印函数文档 d...
class Point2D: def __init__(self,x,y): self.x = x self.y = y def __eq__(self, value): return self.x == value.x and self.y == value.y def __hash__(self): return hash((self.x,self.y))
bind = "localhost:10050" # 绑定的ip与端口 backlog = 512 # 监听队列数量,64-2048 worker_class = 'sync' # 使用gevent模式,还可以使用sync 模式,默认的是sync模式 workers = 2 # multiprocessing.cpu_count() #进程数 threads = 8 # multiprocessing.cpu_count()*4 #指定每个进程开启的线程数 loglevel = 'info' # 日志级别,这个日志级别指的是错误日志的级别,而访问日志的级别无法设置 access_log_format = '%(t)...
""" This is pure Python implementation of linear search algorithm For doctests run following command: python3 -m doctest -v linear_search.py For manual testing run: python3 linear_search.py """ def linear_search(sequence: list, target: int) -> int: """A pure Python implementation of a linear search ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, a, b): if a is None: return b if b is None: return a if a.val > b.va...
""" package information : Core package Author: Shanmugathas Vigneswaran email: shanmugathas.vigneswaran@outlook.fr Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) Licence: https://creativecommons.org/licenses/by-nc/4.0/ UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WO...
# DEFAULT_ASSET_URL="https://totogoto.com/assets/python_project/images/" DEFAULT_ASSET_URL="https://cdn.jsdelivr.net/gh/totogoto/assets/" DEFAULT_OBJECTS = [ "1", "2", "3", "4", "5", "apple_goal", "apple", "around3_sol", "banana_goal", "banana", "beeper_goal", "box_goal",...
def main(): with open('test.txt','rt') as infile: test2 = infile.read() test1 ='This is a test of the emergency text system' print(test1 == test2) if __name__ == '__main__': main()
# Enter your code here. Read input from STDIN. Print output to STDOUT testCases = int(input()) for i in range(testCases): word = input() for j in range(len(word)): if j%2 == 0: print(word[j], end='') print(" ", end="") for j in range(len(word)): if j%2 !=...